blob: 67fa74cf04bda897b2264a05ffe8ae5b19fba03e [file] [log] [blame]
Mahir Gunyel03de0d32020-06-03 01:36:59 -07001/*
2 * Copyright 2018-present Open Networking Foundation
3
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7
8 * http://www.apache.org/licenses/LICENSE-2.0
9
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package device
18
19import (
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070020 "context"
Maninder9a1bc0d2020-10-26 11:34:02 +053021 "fmt"
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070022 "strconv"
23
24 "github.com/gogo/protobuf/proto"
25 coreutils "github.com/opencord/voltha-go/rw_core/utils"
Maninderdfadc982020-10-28 14:04:33 +053026 "github.com/opencord/voltha-lib-go/v4/pkg/log"
Maninder9a1bc0d2020-10-26 11:34:02 +053027 "github.com/opencord/voltha-protos/v4/go/common"
Maninderdfadc982020-10-28 14:04:33 +053028 ofp "github.com/opencord/voltha-protos/v4/go/openflow_13"
29 "github.com/opencord/voltha-protos/v4/go/voltha"
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070030 "google.golang.org/grpc/codes"
31 "google.golang.org/grpc/status"
Mahir Gunyel03de0d32020-06-03 01:36:59 -070032)
33
34// listDeviceGroups returns logical device flow groups
35func (agent *Agent) listDeviceGroups() map[uint32]*ofp.OfpGroupEntry {
khenaidoo7585a962021-06-10 16:15:38 -040036 groupIDs := agent.groupCache.ListIDs()
Mahir Gunyel03de0d32020-06-03 01:36:59 -070037 groups := make(map[uint32]*ofp.OfpGroupEntry, len(groupIDs))
38 for groupID := range groupIDs {
khenaidoo7585a962021-06-10 16:15:38 -040039 if groupHandle, have := agent.groupCache.Lock(groupID); have {
Mahir Gunyel03de0d32020-06-03 01:36:59 -070040 groups[groupID] = groupHandle.GetReadOnly()
41 groupHandle.Unlock()
42 }
43 }
44 return groups
45}
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070046
47func (agent *Agent) addGroupsToAdapter(ctx context.Context, newGroups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
Rohan Agrawal31f21802020-06-12 05:38:46 +000048 logger.Debugw(ctx, "add-groups-to-adapters", log.Fields{"device-id": agent.deviceID, "groups": newGroups, "flow-metadata": flowMetadata})
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070049
Maninder9a1bc0d2020-10-26 11:34:02 +053050 var desc string
51 operStatus := &common.OperationResp{Code: common.OperationResp_OPERATION_FAILURE}
52
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070053 if (len(newGroups)) == 0 {
Rohan Agrawal31f21802020-06-12 05:38:46 +000054 logger.Debugw(ctx, "nothing-to-update", log.Fields{"device-id": agent.deviceID, "groups": newGroups})
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070055 return coreutils.DoneResponse(), nil
56 }
57
Kent Hagermancba2f302020-07-28 13:37:36 -040058 device, err := agent.getDeviceReadOnly(ctx)
59 if err != nil {
Maninder9a1bc0d2020-10-26 11:34:02 +053060 desc = err.Error()
61 agent.logDeviceUpdate(ctx, "addGroupsToAdapter", nil, nil, operStatus, &desc)
Kent Hagermancba2f302020-07-28 13:37:36 -040062 return coreutils.DoneResponse(), status.Errorf(codes.Aborted, "%s", err)
63 }
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070064 dType, err := agent.adapterMgr.GetDeviceType(ctx, &voltha.ID{Id: device.Type})
65 if err != nil {
Maninder9a1bc0d2020-10-26 11:34:02 +053066 desc = fmt.Sprintf("non-existent-device-type-%s", device.Type)
67 agent.logDeviceUpdate(ctx, "addGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070068 return coreutils.DoneResponse(), status.Errorf(codes.FailedPrecondition, "non-existent-device-type-%s", device.Type)
69 }
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070070
71 groupsToAdd := make([]*ofp.OfpGroupEntry, 0)
72 groupsToDelete := make([]*ofp.OfpGroupEntry, 0)
73 for _, group := range newGroups {
khenaidoo7585a962021-06-10 16:15:38 -040074 groupHandle, created, err := agent.groupCache.LockOrCreate(ctx, group)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070075 if err != nil {
Maninder9a1bc0d2020-10-26 11:34:02 +053076 desc = err.Error()
77 agent.logDeviceUpdate(ctx, "addGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070078 return coreutils.DoneResponse(), err
79 }
80
81 if created {
82 groupsToAdd = append(groupsToAdd, group)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070083 } else {
84 groupToChange := groupHandle.GetReadOnly()
85 if !proto.Equal(groupToChange, group) {
86 //Group needs to be updated.
87 if err := groupHandle.Update(ctx, group); err != nil {
88 groupHandle.Unlock()
Maninder9a1bc0d2020-10-26 11:34:02 +053089 desc = fmt.Sprintf("failure-updating-group-%s-to-device-%s", strconv.Itoa(int(group.Desc.GroupId)), agent.deviceID)
90 agent.logDeviceUpdate(ctx, "addGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070091 return coreutils.DoneResponse(), status.Errorf(codes.Internal, "failure-updating-group-%s-to-device-%s", strconv.Itoa(int(group.Desc.GroupId)), agent.deviceID)
92 }
93 groupsToDelete = append(groupsToDelete, groupToChange)
94 groupsToAdd = append(groupsToAdd, group)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070095 } else {
96 //No need to change the group. It is already exist.
Himani Chawlab4c25912020-11-12 17:16:38 +053097 logger.Debugw(ctx, "no-need-to-change-already-existing-group", log.Fields{"device-id": agent.deviceID, "group": newGroups, "flow-metadata": flowMetadata})
Mahir Gunyelfa6ea272020-06-10 17:03:51 -070098 }
99 }
100
101 groupHandle.Unlock()
102 }
103 // Sanity check
104 if (len(groupsToAdd)) == 0 {
Rohan Agrawal31f21802020-06-12 05:38:46 +0000105 logger.Debugw(ctx, "no-groups-to-update", log.Fields{"device-id": agent.deviceID, "groups": newGroups})
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700106 return coreutils.DoneResponse(), nil
107 }
108
109 // Send update to adapters
Rohan Agrawalcf12f202020-08-03 04:42:01 +0000110 subCtx, cancel := context.WithTimeout(log.WithSpanFromContext(context.Background(), ctx), agent.defaultTimeout)
Himani Chawlab4c25912020-11-12 17:16:38 +0530111 subCtx = coreutils.WithRPCMetadataFromContext(subCtx, ctx)
112
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700113 response := coreutils.NewResponse()
114 if !dType.AcceptsAddRemoveFlowUpdates {
Kent Hagermana7c9d792020-07-16 17:39:01 -0400115 updatedAllGroups := agent.listDeviceGroups()
116 rpcResponse, err := agent.adapterProxy.UpdateFlowsBulk(subCtx, device, nil, updatedAllGroups, flowMetadata)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700117 if err != nil {
118 cancel()
Maninder9a1bc0d2020-10-26 11:34:02 +0530119 desc = err.Error()
120 agent.logDeviceUpdate(ctx, "addGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700121 return coreutils.DoneResponse(), err
122 }
Maninder9a1bc0d2020-10-26 11:34:02 +0530123 go agent.waitForAdapterFlowResponse(subCtx, cancel, "addGroupsToAdapter", rpcResponse, response)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700124 } else {
125 flowChanges := &ofp.FlowChanges{
126 ToAdd: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
127 ToRemove: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
128 }
129 groupChanges := &ofp.FlowGroupChanges{
130 ToAdd: &voltha.FlowGroups{Items: groupsToAdd},
131 ToRemove: &voltha.FlowGroups{Items: groupsToDelete},
132 ToUpdate: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
133 }
134 rpcResponse, err := agent.adapterProxy.UpdateFlowsIncremental(subCtx, device, flowChanges, groupChanges, flowMetadata)
135 if err != nil {
136 cancel()
Maninder9a1bc0d2020-10-26 11:34:02 +0530137 desc = err.Error()
138 agent.logDeviceUpdate(ctx, "addGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700139 return coreutils.DoneResponse(), err
140 }
Maninder9a1bc0d2020-10-26 11:34:02 +0530141 go agent.waitForAdapterFlowResponse(subCtx, cancel, "addGroupsToAdapter", rpcResponse, response)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700142 }
Maninder9a1bc0d2020-10-26 11:34:02 +0530143 operStatus.Code = common.OperationResp_OPERATION_IN_PROGRESS
144 agent.logDeviceUpdate(ctx, "addGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700145 return response, nil
146}
147
148func (agent *Agent) deleteGroupsFromAdapter(ctx context.Context, groupsToDel []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
Rohan Agrawal31f21802020-06-12 05:38:46 +0000149 logger.Debugw(ctx, "delete-groups-from-adapter", log.Fields{"device-id": agent.deviceID, "groups": groupsToDel})
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700150
151 if (len(groupsToDel)) == 0 {
Rohan Agrawal31f21802020-06-12 05:38:46 +0000152 logger.Debugw(ctx, "nothing-to-delete", log.Fields{"device-id": agent.deviceID})
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700153 return coreutils.DoneResponse(), nil
154 }
Maninder9a1bc0d2020-10-26 11:34:02 +0530155
156 var desc string
157 operStatus := &common.OperationResp{Code: common.OperationResp_OPERATION_FAILURE}
158
159 defer agent.logDeviceUpdate(ctx, "deleteGroupsFromAdapter", nil, nil, operStatus, &desc)
160
Kent Hagermancba2f302020-07-28 13:37:36 -0400161 device, err := agent.getDeviceReadOnly(ctx)
162 if err != nil {
Maninder9a1bc0d2020-10-26 11:34:02 +0530163 desc = err.Error()
Kent Hagermancba2f302020-07-28 13:37:36 -0400164 return coreutils.DoneResponse(), status.Errorf(codes.Aborted, "%s", err)
165 }
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700166 dType, err := agent.adapterMgr.GetDeviceType(ctx, &voltha.ID{Id: device.Type})
167 if err != nil {
Maninder9a1bc0d2020-10-26 11:34:02 +0530168 desc = fmt.Sprintf("non-existent-device-type-%s", device.Type)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700169 return coreutils.DoneResponse(), status.Errorf(codes.FailedPrecondition, "non-existent-device-type-%s", device.Type)
170 }
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700171
172 for _, group := range groupsToDel {
khenaidoo7585a962021-06-10 16:15:38 -0400173 if groupHandle, have := agent.groupCache.Lock(group.Desc.GroupId); have {
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700174 // Update the store and cache
175 if err := groupHandle.Delete(ctx); err != nil {
176 groupHandle.Unlock()
Maninder9a1bc0d2020-10-26 11:34:02 +0530177 desc = err.Error()
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700178 return coreutils.DoneResponse(), err
179 }
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700180 groupHandle.Unlock()
181 }
182 }
183
184 // Send update to adapters
Rohan Agrawalcf12f202020-08-03 04:42:01 +0000185 subCtx, cancel := context.WithTimeout(log.WithSpanFromContext(context.Background(), ctx), agent.defaultTimeout)
Himani Chawlab4c25912020-11-12 17:16:38 +0530186 subCtx = coreutils.WithRPCMetadataFromContext(subCtx, ctx)
187
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700188 response := coreutils.NewResponse()
189 if !dType.AcceptsAddRemoveFlowUpdates {
Kent Hagermana7c9d792020-07-16 17:39:01 -0400190 updatedAllGroups := agent.listDeviceGroups()
191 rpcResponse, err := agent.adapterProxy.UpdateFlowsBulk(subCtx, device, nil, updatedAllGroups, flowMetadata)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700192 if err != nil {
193 cancel()
Maninder9a1bc0d2020-10-26 11:34:02 +0530194 desc = err.Error()
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700195 return coreutils.DoneResponse(), err
196 }
Maninder9a1bc0d2020-10-26 11:34:02 +0530197 go agent.waitForAdapterFlowResponse(subCtx, cancel, "deleteGroupsFromAdapter", rpcResponse, response)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700198 } else {
199 flowChanges := &ofp.FlowChanges{
200 ToAdd: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
201 ToRemove: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
202 }
203 groupChanges := &ofp.FlowGroupChanges{
204 ToAdd: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
205 ToRemove: &voltha.FlowGroups{Items: groupsToDel},
206 ToUpdate: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
207 }
208 rpcResponse, err := agent.adapterProxy.UpdateFlowsIncremental(subCtx, device, flowChanges, groupChanges, flowMetadata)
209 if err != nil {
210 cancel()
Maninder9a1bc0d2020-10-26 11:34:02 +0530211 desc = err.Error()
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700212 return coreutils.DoneResponse(), err
213 }
Maninder9a1bc0d2020-10-26 11:34:02 +0530214 go agent.waitForAdapterFlowResponse(subCtx, cancel, "deleteGroupsFromAdapter", rpcResponse, response)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700215 }
Maninder9a1bc0d2020-10-26 11:34:02 +0530216 operStatus.Code = common.OperationResp_OPERATION_IN_PROGRESS
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700217 return response, nil
218}
219
220func (agent *Agent) updateGroupsToAdapter(ctx context.Context, updatedGroups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) (coreutils.Response, error) {
Himani Chawlab4c25912020-11-12 17:16:38 +0530221 logger.Debugw(ctx, "update-groups-to-adapter", log.Fields{"device-id": agent.deviceID, "groups": updatedGroups})
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700222
Maninder9a1bc0d2020-10-26 11:34:02 +0530223 var desc string
224 operStatus := &common.OperationResp{Code: common.OperationResp_OPERATION_FAILURE}
225
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700226 if (len(updatedGroups)) == 0 {
Rohan Agrawal31f21802020-06-12 05:38:46 +0000227 logger.Debugw(ctx, "nothing-to-update", log.Fields{"device-id": agent.deviceID, "groups": updatedGroups})
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700228 return coreutils.DoneResponse(), nil
229 }
230
Kent Hagermancba2f302020-07-28 13:37:36 -0400231 device, err := agent.getDeviceReadOnly(ctx)
232 if err != nil {
Maninder9a1bc0d2020-10-26 11:34:02 +0530233 desc = err.Error()
234 agent.logDeviceUpdate(ctx, "updateGroupsToAdapter", nil, nil, operStatus, &desc)
Kent Hagermancba2f302020-07-28 13:37:36 -0400235 return coreutils.DoneResponse(), status.Errorf(codes.Aborted, "%s", err)
236 }
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700237 if device.OperStatus != voltha.OperStatus_ACTIVE || device.ConnectStatus != voltha.ConnectStatus_REACHABLE || device.AdminState != voltha.AdminState_ENABLED {
Maninder9a1bc0d2020-10-26 11:34:02 +0530238 desc = fmt.Sprintf("invalid device states-oper-%s-connect-%s-admin-%s", device.OperStatus, device.ConnectStatus, device.AdminState)
239 agent.logDeviceUpdate(ctx, "updateGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700240 return coreutils.DoneResponse(), status.Errorf(codes.FailedPrecondition, "invalid device states-oper-%s-connect-%s-admin-%s", device.OperStatus, device.ConnectStatus, device.AdminState)
241 }
242 dType, err := agent.adapterMgr.GetDeviceType(ctx, &voltha.ID{Id: device.Type})
243 if err != nil {
Maninder9a1bc0d2020-10-26 11:34:02 +0530244 desc = fmt.Sprintf("non-existent-device-type-%s", device.Type)
245 agent.logDeviceUpdate(ctx, "updateGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700246 return coreutils.DoneResponse(), status.Errorf(codes.FailedPrecondition, "non-existent-device-type-%s", device.Type)
247 }
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700248
Kent Hagermana7c9d792020-07-16 17:39:01 -0400249 groupsToUpdate := make([]*ofp.OfpGroupEntry, 0)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700250 for _, group := range updatedGroups {
khenaidoo7585a962021-06-10 16:15:38 -0400251 if groupHandle, have := agent.groupCache.Lock(group.Desc.GroupId); have {
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700252 // Update the store and cache
253 if err := groupHandle.Update(ctx, group); err != nil {
254 groupHandle.Unlock()
Maninder9a1bc0d2020-10-26 11:34:02 +0530255 desc = err.Error()
256 agent.logDeviceUpdate(ctx, "updateGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700257 return coreutils.DoneResponse(), err
258 }
259 groupsToUpdate = append(groupsToUpdate, group)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700260 groupHandle.Unlock()
261 }
262 }
263
Rohan Agrawalcf12f202020-08-03 04:42:01 +0000264 subCtx, cancel := context.WithTimeout(log.WithSpanFromContext(context.Background(), ctx), agent.defaultTimeout)
Himani Chawlab4c25912020-11-12 17:16:38 +0530265 subCtx = coreutils.WithRPCMetadataFromContext(subCtx, ctx)
266
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700267 response := coreutils.NewResponse()
268 // Process bulk flow update differently than incremental update
269 if !dType.AcceptsAddRemoveFlowUpdates {
Kent Hagermana7c9d792020-07-16 17:39:01 -0400270 updatedAllGroups := agent.listDeviceGroups()
271 rpcResponse, err := agent.adapterProxy.UpdateFlowsBulk(subCtx, device, nil, updatedAllGroups, nil)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700272 if err != nil {
273 cancel()
Maninder9a1bc0d2020-10-26 11:34:02 +0530274 desc = err.Error()
275 agent.logDeviceUpdate(ctx, "updateGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700276 return coreutils.DoneResponse(), err
277 }
Maninder9a1bc0d2020-10-26 11:34:02 +0530278 go agent.waitForAdapterFlowResponse(subCtx, cancel, "updateGroupsToAdapter", rpcResponse, response)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700279 } else {
Rohan Agrawal31f21802020-06-12 05:38:46 +0000280 logger.Debugw(ctx, "updating-groups",
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700281 log.Fields{
282 "device-id": agent.deviceID,
283 "groups-to-update": groupsToUpdate,
284 })
285
286 // Sanity check
287 if (len(groupsToUpdate)) == 0 {
Rohan Agrawal31f21802020-06-12 05:38:46 +0000288 logger.Debugw(ctx, "nothing-to-update", log.Fields{"device-id": agent.deviceID, "groups": groupsToUpdate})
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700289 cancel()
290 return coreutils.DoneResponse(), nil
291 }
292
293 flowChanges := &ofp.FlowChanges{
294 ToAdd: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
295 ToRemove: &voltha.Flows{Items: []*ofp.OfpFlowStats{}},
296 }
297 groupChanges := &ofp.FlowGroupChanges{
298 ToAdd: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
299 ToRemove: &voltha.FlowGroups{Items: []*ofp.OfpGroupEntry{}},
300 ToUpdate: &voltha.FlowGroups{Items: groupsToUpdate},
301 }
302 rpcResponse, err := agent.adapterProxy.UpdateFlowsIncremental(subCtx, device, flowChanges, groupChanges, flowMetadata)
303 if err != nil {
304 cancel()
Maninder9a1bc0d2020-10-26 11:34:02 +0530305 desc = err.Error()
306 agent.logDeviceUpdate(ctx, "updateGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700307 return coreutils.DoneResponse(), err
308 }
Maninder9a1bc0d2020-10-26 11:34:02 +0530309 go agent.waitForAdapterFlowResponse(subCtx, cancel, "updateGroupsToAdapter", rpcResponse, response)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700310 }
311
Maninder9a1bc0d2020-10-26 11:34:02 +0530312 operStatus.Code = common.OperationResp_OPERATION_IN_PROGRESS
313 agent.logDeviceUpdate(ctx, "updateGroupsToAdapter", nil, nil, operStatus, &desc)
Mahir Gunyelfa6ea272020-06-10 17:03:51 -0700314 return response, nil
315}