[VOL-4756] Cleanup TODO context

Change-Id: I21d5ec8cc015154bc893e54c652d31562d8da5d9
diff --git a/internal/pkg/controller/addflows.go b/internal/pkg/controller/addflows.go
index 0d6c27a..a4bf35c 100644
--- a/internal/pkg/controller/addflows.go
+++ b/internal/pkg/controller/addflows.go
@@ -84,7 +84,7 @@
 		logger.Infow(ctx, "Flow Mod Request", log.Fields{"Cookie": flow.Cookie, "Oper": aft.flow.Command, "Port": aft.flow.PortID})
 		if aft.flow.Command == of.CommandAdd {
 			flow.State = of.FlowAddPending
-			if err := aft.device.AddFlow(flow); err != nil {
+			if err := aft.device.AddFlow(ctx, flow); err != nil {
 				logger.Warnw(ctx, "Add Flow Error", log.Fields{"Cookie": flow.Cookie, "Reason": err.Error()})
 
 				// If flow already exists in cache, check for flow state
@@ -93,7 +93,7 @@
 				if err.Error() == ErrDuplicateFlow {
 					dbFlow, _ := aft.device.GetFlow(flow.Cookie)
 					if dbFlow.State == of.FlowAddSuccess {
-						aft.device.triggerFlowNotification(flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
+						aft.device.triggerFlowNotification(ctx, flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
 						flowsPresent++
 					}
 				}
@@ -108,7 +108,7 @@
 				// aft.device.AddFlowToDb(dbFlow)
 				flowsToProcess[flow.Cookie] = dbFlow
 			}
-			aft.device.triggerFlowNotification(flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
+			aft.device.triggerFlowNotification(ctx, flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
 		}
 	}
 
@@ -124,7 +124,7 @@
 			for _, flow := range aft.flow.SubFlows {
 				logger.Errorw(ctx, "Skip Flow Update", log.Fields{"Reason": "Port Deleted", "PortName": aft.flow.PortName, "PortNo": aft.flow.PortID, "Cookie": flow.Cookie, "Operation": aft.flow.Command})
 				if aft.flow.Command == of.CommandDel {
-					aft.device.triggerFlowNotification(flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
+					aft.device.triggerFlowNotification(ctx, flow.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
 				}
 			}
 			return nil
@@ -160,7 +160,7 @@
 				}
 				break
 			}
-			aft.device.triggerFlowNotification(flow.FlowMod.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
+			aft.device.triggerFlowNotification(ctx, flow.FlowMod.Cookie, aft.flow.Command, of.BwAvailDetails{}, nil)
 
 		} else {
 			logger.Errorw(ctx, "Update Flow Table Failed: Voltha Client Unavailable", log.Fields{"Flow": flow})
diff --git a/internal/pkg/controller/auditdevice.go b/internal/pkg/controller/auditdevice.go
index 2cabffc..33be2e5 100644
--- a/internal/pkg/controller/auditdevice.go
+++ b/internal/pkg/controller/auditdevice.go
@@ -119,12 +119,12 @@
 				// This port exists in the received list and the map at
 				// VGC. This is common so delete it
 				logger.Infow(ctx, "Port State Mismatch", log.Fields{"Port": vgcPort.ID, "OfpPort": ofpPort.PortNo, "ReceivedState": ofpPort.State, "CurrentState": vgcPort.State})
-				ad.device.ProcessPortState(ofpPort.PortNo, ofpPort.State)
+				ad.device.ProcessPortState(ctx, ofpPort.PortNo, ofpPort.State)
 			} else {
 				//To ensure the flows are in sync with port status and no mismatch due to reboot,
 				// repush/delete flows based on current port status
 				logger.Infow(ctx, "Port State Processing", log.Fields{"Port": vgcPort.ID, "OfpPort": ofpPort.PortNo, "ReceivedState": ofpPort.State, "CurrentState": vgcPort.State})
-				ad.device.ProcessPortStateAfterReboot(ofpPort.PortNo, ofpPort.State)
+				ad.device.ProcessPortStateAfterReboot(ctx, ofpPort.PortNo, ofpPort.State)
 			}
 			delete(missingPorts, id)
 		} else {
@@ -158,15 +158,15 @@
 		logger.Errorw(ctx, "Audit Device Task Cancelled", log.Fields{"Context": ad.ctx, "Task": ad.taskID})
 		return tasks.ErrTaskCancelError
 	}
-	ad.AddMissingPorts(missingPorts)
-	ad.DelExcessPorts(excessPorts)
+	ad.AddMissingPorts(ctx, missingPorts)
+	ad.DelExcessPorts(ctx, excessPorts)
 	ad.device.deviceAuditInProgress = false
 	logger.Warnw(ctx, "Audit Device Task Completed", log.Fields{"Context": ctx, "taskId": taskID, "Device": ad.device.ID})
 	return nil
 }
 
 // AddMissingPorts to add the missing ports
-func (ad *AuditDevice) AddMissingPorts(mps map[uint32]*ofp.OfpPort) {
+func (ad *AuditDevice) AddMissingPorts(cntx context.Context, mps map[uint32]*ofp.OfpPort) {
 	logger.Debugw(ctx, "Device Audit - Add Missing Ports", log.Fields{"NumPorts": len(mps)})
 
 	addMissingPort := func(mp *ofp.OfpPort) {
@@ -174,11 +174,11 @@
 
 		// Error is ignored as it only drops duplicate ports
 		logger.Infow(ctx, "Calling AddPort", log.Fields{"No": mp.PortNo, "Name": mp.Name})
-		if err := ad.device.AddPort(mp.PortNo, mp.Name); err != nil {
+		if err := ad.device.AddPort(cntx, mp.PortNo, mp.Name); err != nil {
 			logger.Warnw(ctx, "AddPort Failed", log.Fields{"No": mp.PortNo, "Name": mp.Name, "Reason": err})
 		}
 		if mp.State == uint32(ofp.OfpPortState_OFPPS_LIVE) {
-			ad.device.ProcessPortState(mp.PortNo, mp.State)
+			ad.device.ProcessPortState(cntx, mp.PortNo, mp.State)
 		}
 		logger.Debugw(ctx, "Processed Port Add Ind", log.Fields{"Port No": mp.PortNo, "Port Name": mp.Name})
 
@@ -198,12 +198,12 @@
 }
 
 // DelExcessPorts to delete the excess ports
-func (ad *AuditDevice) DelExcessPorts(eps []uint32) {
+func (ad *AuditDevice) DelExcessPorts(cntx context.Context, eps []uint32) {
 	logger.Debugw(ctx, "Device Audit - Delete Excess Ports", log.Fields{"NumPorts": len(eps)})
 	for _, id := range eps {
 		// Now delete the port from the device @ VGC
 		logger.Infow(ctx, "Device Audit - Deleting Port", log.Fields{"PortId": id})
-		if err := ad.device.DelPort(id); err != nil {
+		if err := ad.device.DelPort(cntx, id); err != nil {
 			logger.Warnw(ctx, "DelPort Failed", log.Fields{"PortId": id, "Reason": err})
 		}
 	}
diff --git a/internal/pkg/controller/audittables.go b/internal/pkg/controller/audittables.go
index 1afad05..079ff2f 100644
--- a/internal/pkg/controller/audittables.go
+++ b/internal/pkg/controller/audittables.go
@@ -97,7 +97,7 @@
 	}
 
 	// Audit the flows
-	if err = att.AuditFlows(); err != nil {
+	if err = att.AuditFlows(ctx); err != nil {
 		logger.Errorw(ctx, "Audit Flows Failed", log.Fields{"Reason": err.Error()})
 		errInfo = err
 	}
@@ -211,7 +211,7 @@
 // voltha and identifying the delta between the ones held here and the
 // ones held at VOLTHA. The delta must be cleaned up to keep both the
 // components in sync
-func (att *AuditTablesTask) AuditFlows() error {
+func (att *AuditTablesTask) AuditFlows(cntx context.Context) error {
 
 	if att.stop {
 		return tasks.ErrTaskCancelError
@@ -267,7 +267,7 @@
 			defaultSuccessFlowStatus.Cookie = strconv.FormatUint(flow.Cookie, 10)
 
 			logger.Infow(ctx, "Triggering Internal Flow Notification", log.Fields{"Flow Status": defaultSuccessFlowStatus})
-			GetController().ProcessFlowModResultIndication(defaultSuccessFlowStatus)
+			GetController().ProcessFlowModResultIndication(cntx, defaultSuccessFlowStatus)
 		} else {
 			// The flow exists at the controller but not at the device
 			// Push the flow to the device
@@ -280,9 +280,9 @@
 	if !att.stop {
 		//  The flows remaining in the received flows are the excess flows at
 		// the device. Delete those flows
-		att.DelExcessFlows(rcvdFlows)
+		att.DelExcessFlows(cntx, rcvdFlows)
 		// Add the flows missing at the device
-		att.AddMissingFlows(flowsToAdd)
+		att.AddMissingFlows(cntx, flowsToAdd)
 	} else {
 		err = tasks.ErrTaskCancelError
 	}
@@ -291,7 +291,7 @@
 
 // AddMissingFlows : The flows missing from the device are reinstalled att the audit
 // The flows are added into a VoltFlow structure.
-func (att *AuditTablesTask) AddMissingFlows(mflow *of.VoltFlow) {
+func (att *AuditTablesTask) AddMissingFlows(cntx context.Context, mflow *of.VoltFlow) {
 	logger.Debugw(ctx, "Add Missing Flows", log.Fields{"Number": len(mflow.SubFlows)})
 	mflow.Command = of.CommandAdd
 	ofFlows := of.ProcessVoltFlow(att.device.ID, mflow.Command, mflow.SubFlows)
@@ -314,12 +314,12 @@
 		if _, err = vc.UpdateLogicalDeviceFlowTable(att.ctx, flow); err != nil {
 			logger.Errorw(ctx, "Update Flow Table Failed", log.Fields{"Reason": err.Error()})
 		}
-		att.device.triggerFlowResultNotification(flow.FlowMod.Cookie, dbFlow, of.CommandAdd, bwConsumedInfo, err)
+		att.device.triggerFlowResultNotification(cntx, flow.FlowMod.Cookie, dbFlow, of.CommandAdd, bwConsumedInfo, err)
 	}
 }
 
 // DelExcessFlows delete the excess flows held at the VOLTHA
-func (att *AuditTablesTask) DelExcessFlows(flows map[uint64]*ofp.OfpFlowStats) {
+func (att *AuditTablesTask) DelExcessFlows(cntx context.Context, flows map[uint64]*ofp.OfpFlowStats) {
 	logger.Debugw(ctx, "Deleting Excess Flows", log.Fields{"Number of Flows": len(flows)})
 
 	var vc voltha.VolthaServiceClient
@@ -362,7 +362,7 @@
 		if _, err = vc.UpdateLogicalDeviceFlowTable(att.ctx, flowUpdate); err != nil {
 			logger.Errorw(ctx, "Flow Audit Delete Failed", log.Fields{"Reason": err.Error()})
 		}
-		att.device.triggerFlowResultNotification(flow.Cookie, nil, of.CommandDel, of.BwAvailDetails{}, err)
+		att.device.triggerFlowResultNotification(cntx, flow.Cookie, nil, of.CommandDel, of.BwAvailDetails{}, err)
 	}
 }
 
diff --git a/internal/pkg/controller/changeevent.go b/internal/pkg/controller/changeevent.go
index 21ed05d..46b1be5 100644
--- a/internal/pkg/controller/changeevent.go
+++ b/internal/pkg/controller/changeevent.go
@@ -74,16 +74,16 @@
 		state := status.PortStatus.Desc.State
 		logger.Infow(ctx, "Process Port Change Event", log.Fields{"Port No": portNo, "Port Name": portName, "State": state, "Reason": status.PortStatus.Reason})
 		if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_ADD {
-			_ = cet.device.AddPort(portNo, portName)
+			_ = cet.device.AddPort(ctx, portNo, portName)
 			if state == uint32(ofp.OfpPortState_OFPPS_LIVE) {
-				cet.device.ProcessPortState(portNo, state)
+				cet.device.ProcessPortState(ctx, portNo, state)
 			}
 		} else if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_DELETE {
-			if err := cet.device.DelPort(portNo); err != nil {
+			if err := cet.device.DelPort(ctx, portNo); err != nil {
 				logger.Warnw(ctx, "DelPort Failed", log.Fields{"Port No": portNo, "Error": err})
 			}
 		} else if status.PortStatus.Reason == ofp.OfpPortReason_OFPPR_MODIFY {
-			cet.device.ProcessPortUpdate(portName, portNo, state)
+			cet.device.ProcessPortUpdate(ctx, portName, portNo, state)
 		}
 		logger.Infow(ctx, "Processed Port Change Event", log.Fields{"Port No": portNo, "Port Name": portName, "State": state, "Reason": status.PortStatus.Reason})
 		return nil
diff --git a/internal/pkg/controller/controller.go b/internal/pkg/controller/controller.go
index 9abbd42..f08f7e1 100644
--- a/internal/pkg/controller/controller.go
+++ b/internal/pkg/controller/controller.go
@@ -89,16 +89,16 @@
 }
 
 // AddDevice to add device
-func (v *VoltController) AddDevice(config *intf.VPClientCfg) intf.IVPClient {
+func (v *VoltController) AddDevice(cntx context.Context, config *intf.VPClientCfg) intf.IVPClient {
 
-	d := NewDevice(config.DeviceID, config.SerialNum, config.VolthaClient, config.SouthBoundID)
+	d := NewDevice(cntx, config.DeviceID, config.SerialNum, config.VolthaClient, config.SouthBoundID)
 	v.devices[config.DeviceID] = d
-	v.app.AddDevice(d.ID, d.SerialNum, config.SouthBoundID)
+	v.app.AddDevice(cntx, d.ID, d.SerialNum, config.SouthBoundID)
 
-	d.RestoreMetersFromDb()
-	d.RestoreGroupsFromDb()
-	d.RestoreFlowsFromDb()
-	d.RestorePortsFromDb()
+	d.RestoreMetersFromDb(cntx)
+	d.RestoreGroupsFromDb(cntx)
+	d.RestoreFlowsFromDb(cntx)
+	d.RestorePortsFromDb(cntx)
 	d.ConnectInd(context.TODO(), intf.DeviceDisc)
 	d.packetOutChannel = config.PacketOutChannel
 
@@ -108,13 +108,13 @@
 }
 
 // DelDevice to delete device
-func (v *VoltController) DelDevice(id string) {
+func (v *VoltController) DelDevice(cntx context.Context, id string) {
 	d, ok := v.devices[id]
 	if ok {
 		delete(v.devices, id)
 		d.Delete()
 	}
-	v.app.DelDevice(id)
+	v.app.DelDevice(cntx, id)
 	d.cancel() // To stop the device tables sync routine
 	logger.Warnw(ctx, "Deleted device", log.Fields{"Device": id})
 }
@@ -193,27 +193,27 @@
 }
 
 // DeviceRebootInd is device reboot indication
-func (v *VoltController) DeviceRebootInd(dID string, srNo string, sbID string) {
-	v.app.DeviceRebootInd(dID, srNo, sbID)
-	_ = db.DelAllRoutesForDevice(dID)
-	_ = db.DelAllGroup(dID)
-	_ = db.DelAllMeter(dID)
-	_ = db.DelAllPONCounters(dID)
+func (v *VoltController) DeviceRebootInd(cntx context.Context, dID string, srNo string, sbID string) {
+	v.app.DeviceRebootInd(cntx, dID, srNo, sbID)
+	_ = db.DelAllRoutesForDevice(cntx, dID)
+	_ = db.DelAllGroup(cntx, dID)
+	_ = db.DelAllMeter(cntx, dID)
+	_ = db.DelAllPONCounters(cntx, dID)
 }
 
 // DeviceDisableInd is device deactivation indication
-func (v *VoltController) DeviceDisableInd(dID string) {
-	v.app.DeviceDisableInd(dID)
+func (v *VoltController) DeviceDisableInd(cntx context.Context, dID string) {
+	v.app.DeviceDisableInd(cntx, dID)
 }
 
 //TriggerPendingProfileDeleteReq - trigger pending profile delete requests
-func (v *VoltController) TriggerPendingProfileDeleteReq(device string) {
-	v.app.TriggerPendingProfileDeleteReq(device)
+func (v *VoltController) TriggerPendingProfileDeleteReq(cntx context.Context, device string) {
+	v.app.TriggerPendingProfileDeleteReq(cntx, device)
 }
 
 //TriggerPendingMigrateServicesReq - trigger pending services migration requests
-func (v *VoltController) TriggerPendingMigrateServicesReq(device string) {
-	v.app.TriggerPendingMigrateServicesReq(device)
+func (v *VoltController) TriggerPendingMigrateServicesReq(cntx context.Context, device string) {
+	v.app.TriggerPendingMigrateServicesReq(cntx, device)
 }
 
 // SetAuditFlags to set the audit flags
@@ -229,8 +229,8 @@
 }
 
 //ProcessFlowModResultIndication - send flow mod result notification
-func (v *VoltController) ProcessFlowModResultIndication(flowStatus intf.FlowStatus) {
-	v.app.ProcessFlowModResultIndication(flowStatus)
+func (v *VoltController) ProcessFlowModResultIndication(cntx context.Context, flowStatus intf.FlowStatus) {
+	v.app.ProcessFlowModResultIndication(cntx, flowStatus)
 }
 
 // AddVPAgent to add the vpagent
@@ -259,7 +259,7 @@
 }
 
 // AddFlows to add flows
-func (v *VoltController) AddFlows(port string, device string, flow *of.VoltFlow) error {
+func (v *VoltController) AddFlows(cntx context.Context, port string, device string, flow *of.VoltFlow) error {
 	d, err := v.GetDevice(device)
 	if err != nil {
 		logger.Errorw(ctx, "Device Not Found", log.Fields{"Device": device})
@@ -292,10 +292,10 @@
 		// Actual flow deletion and addition at voltha will happen during flow tables audit.
 		for _, subFlow := range flow.SubFlows {
 			logger.Debugw(ctx, "Cookie Migration Required", log.Fields{"OldCookie": subFlow.OldCookie, "NewCookie": subFlow.Cookie})
-			if err := d.DelFlowWithOldCookie(subFlow); err != nil {
+			if err := d.DelFlowWithOldCookie(cntx, subFlow); err != nil {
 				logger.Errorw(ctx, "Delete flow with old cookie failed", log.Fields{"Error": err, "OldCookie": subFlow.OldCookie})
 			}
-			if err := d.AddFlow(subFlow); err != nil {
+			if err := d.AddFlow(cntx, subFlow); err != nil {
 				logger.Errorw(ctx, "Flow Add Failed", log.Fields{"Error": err, "Cookie": subFlow.Cookie})
 			}
 		}
@@ -310,7 +310,7 @@
 }
 
 // DelFlows to delete flows
-func (v *VoltController) DelFlows(port string, device string, flow *of.VoltFlow) error {
+func (v *VoltController) DelFlows(cntx context.Context, port string, device string, flow *of.VoltFlow) error {
 	d, err := v.GetDevice(device)
 	if err != nil {
 		logger.Errorw(ctx, "Device Not Found", log.Fields{"Device": device})
@@ -343,7 +343,7 @@
 		// Actual flow deletion at voltha will happen during flow tables audit.
 		for _, subFlow := range flow.SubFlows {
 			logger.Debugw(ctx, "Old Cookie delete Required", log.Fields{"OldCookie": subFlow.OldCookie})
-			if err := d.DelFlowWithOldCookie(subFlow); err != nil {
+			if err := d.DelFlowWithOldCookie(cntx, subFlow); err != nil {
 				logger.Errorw(ctx, "DelFlowWithOldCookie failed", log.Fields{"OldCookie": subFlow.OldCookie, "Error": err})
 			}
 		}
@@ -400,13 +400,13 @@
 }
 
 // PortAddInd for port add indication
-func (v *VoltController) PortAddInd(device string, id uint32, name string) {
-	v.app.PortAddInd(device, id, name)
+func (v *VoltController) PortAddInd(cntx context.Context, device string, id uint32, name string) {
+	v.app.PortAddInd(cntx, device, id, name)
 }
 
 // PortDelInd for port delete indication
-func (v *VoltController) PortDelInd(device string, port string) {
-	v.app.PortDelInd(device, port)
+func (v *VoltController) PortDelInd(cntx context.Context, device string, port string) {
+	v.app.PortDelInd(cntx, device, port)
 }
 
 // PortUpdateInd for port update indication
@@ -415,13 +415,13 @@
 }
 
 // PortUpInd for port up indication
-func (v *VoltController) PortUpInd(device string, port string) {
-	v.app.PortUpInd(device, port)
+func (v *VoltController) PortUpInd(cntx context.Context, device string, port string) {
+	v.app.PortUpInd(cntx, device, port)
 }
 
 // PortDownInd for port down indication
-func (v *VoltController) PortDownInd(device string, port string) {
-	v.app.PortDownInd(device, port)
+func (v *VoltController) PortDownInd(cntx context.Context, device string, port string) {
+	v.app.PortDownInd(cntx, device, port)
 }
 
 // DeviceUpInd for device up indication
@@ -435,8 +435,8 @@
 }
 
 // PacketInInd for packet in indication
-func (v *VoltController) PacketInInd(device string, port string, data []byte) {
-	v.app.PacketInInd(device, port, data)
+func (v *VoltController) PacketInInd(cntx context.Context, device string, port string, data []byte) {
+	v.app.PacketInInd(cntx, device, port, data)
 }
 
 // GetPortState to get port status
@@ -450,8 +450,8 @@
 }
 
 // UpdateMvlanProfiles for update mvlan profiles
-func (v *VoltController) UpdateMvlanProfiles(device string) {
-	v.app.UpdateMvlanProfilesForDevice(device)
+func (v *VoltController) UpdateMvlanProfiles(cntx context.Context, device string) {
+	v.app.UpdateMvlanProfilesForDevice(cntx, device)
 }
 
 // GetController to get controller
diff --git a/internal/pkg/controller/controllertasks.go b/internal/pkg/controller/controllertasks.go
index 50a51ee..586999c 100644
--- a/internal/pkg/controller/controllertasks.go
+++ b/internal/pkg/controller/controllertasks.go
@@ -68,7 +68,7 @@
 
 	logger.Infow(ctx, "Add Device Task Triggered", log.Fields{"Device": adt.config.DeviceID, "SerialNum": adt.config.SerialNum})
 
-	device := GetController().AddDevice(adt.config)
+	device := GetController().AddDevice(ctx, adt.config)
 	vpagent.GetVPAgent().AddClientToClientMap(adt.config.DeviceID, device)
 	logger.Infow(ctx, "Add Device Task Completed", log.Fields{"Device": adt.config.DeviceID, "SerialNum": adt.config.SerialNum})
 
diff --git a/internal/pkg/controller/device.go b/internal/pkg/controller/device.go
index cea6960..b410490 100644
--- a/internal/pkg/controller/device.go
+++ b/internal/pkg/controller/device.go
@@ -130,7 +130,7 @@
 }
 
 // NewDevice is the constructor for Device
-func NewDevice(id string, slno string, vclientHldr *holder.VolthaServiceClientHolder, southBoundID string) *Device {
+func NewDevice(cntx context.Context, id string, slno string, vclientHldr *holder.VolthaServiceClientHolder, southBoundID string) *Device {
 	var device Device
 	device.ID = id
 	device.SerialNum = slno
@@ -143,7 +143,7 @@
 	device.flowQueue = make(map[uint32]*UniIDFlowQueue)
 	//Get the flowhash from db and update the flowhash variable in the device.
 	device.SouthBoundID = southBoundID
-	flowHash, err := db.GetFlowHash(id)
+	flowHash, err := db.GetFlowHash(cntx, id)
 	if err != nil {
 		device.flowHash = DefaultMaxFlowQueues
 	} else {
@@ -177,7 +177,7 @@
 }
 
 // AddFlow - Adds the flow to the device and also to the database
-func (d *Device) AddFlow(flow *of.VoltSubFlow) error {
+func (d *Device) AddFlow(cntx context.Context, flow *of.VoltSubFlow) error {
 	d.flowLock.Lock()
 	defer d.flowLock.Unlock()
 	logger.Infow(ctx, "AddFlow to device", log.Fields{"Cookie": flow.Cookie})
@@ -185,34 +185,34 @@
 		return errors.New(ErrDuplicateFlow)
 	}
 	d.flows[flow.Cookie] = flow
-	d.AddFlowToDb(flow)
+	d.AddFlowToDb(cntx, flow)
 	return nil
 }
 
 // AddFlowToDb is the utility to add the flow to the device
-func (d *Device) AddFlowToDb(flow *of.VoltSubFlow) {
+func (d *Device) AddFlowToDb(cntx context.Context, flow *of.VoltSubFlow) {
 	if b, err := json.Marshal(flow); err == nil {
-		if err = db.PutFlow(d.ID, flow.Cookie, string(b)); err != nil {
+		if err = db.PutFlow(cntx, d.ID, flow.Cookie, string(b)); err != nil {
 			logger.Errorw(ctx, "Write Flow to DB failed", log.Fields{"device": d.ID, "cookie": flow.Cookie, "Reason": err})
 		}
 	}
 }
 
 // DelFlow - Deletes the flow from the device and the database
-func (d *Device) DelFlow(flow *of.VoltSubFlow) error {
+func (d *Device) DelFlow(cntx context.Context, flow *of.VoltSubFlow) error {
 	d.flowLock.Lock()
 	defer d.flowLock.Unlock()
 	if _, ok := d.flows[flow.Cookie]; ok {
 		delete(d.flows, flow.Cookie)
-		d.DelFlowFromDb(flow.Cookie)
+		d.DelFlowFromDb(cntx, flow.Cookie)
 		return nil
 	}
 	return errors.New("Flow does not Exist")
 }
 
 // DelFlowFromDb is utility to delete the flow from the device
-func (d *Device) DelFlowFromDb(flowID uint64) {
-	_ = db.DelFlow(d.ID, flowID)
+func (d *Device) DelFlowFromDb(cntx context.Context, flowID uint64) {
+	_ = db.DelFlow(cntx, d.ID, flowID)
 }
 
 // IsFlowPresentWithOldCookie is to check whether there is any flow with old cookie.
@@ -231,22 +231,22 @@
 }
 
 // DelFlowWithOldCookie is to delete flow with old cookie.
-func (d *Device) DelFlowWithOldCookie(flow *of.VoltSubFlow) error {
+func (d *Device) DelFlowWithOldCookie(cntx context.Context, flow *of.VoltSubFlow) error {
 	d.flowLock.Lock()
 	defer d.flowLock.Unlock()
 	if _, ok := d.flows[flow.OldCookie]; ok {
 		logger.Infow(ctx, "Flow was added before vgc upgrade. Trying to delete with old cookie",
 			log.Fields{"OldCookie": flow.OldCookie})
 		delete(d.flows, flow.OldCookie)
-		d.DelFlowFromDb(flow.OldCookie)
+		d.DelFlowFromDb(cntx, flow.OldCookie)
 		return nil
 	}
 	return errors.New("Flow does not Exist")
 }
 
 // RestoreFlowsFromDb to restore flows from database
-func (d *Device) RestoreFlowsFromDb() {
-	flows, _ := db.GetFlows(d.ID)
+func (d *Device) RestoreFlowsFromDb(cntx context.Context) {
+	flows, _ := db.GetFlows(cntx, d.ID)
 	for _, flow := range flows {
 		b, ok := flow.Value.([]byte)
 		if !ok {
@@ -277,41 +277,41 @@
 // Group operations at the device which include update and delete
 
 // UpdateGroupEntry - Adds/Updates the group to the device and also to the database
-func (d *Device) UpdateGroupEntry(group *of.Group) {
+func (d *Device) UpdateGroupEntry(cntx context.Context, group *of.Group) {
 
 	logger.Infow(ctx, "Update Group to device", log.Fields{"ID": group.GroupID})
 	d.groups.Store(group.GroupID, group)
-	d.AddGroupToDb(group)
+	d.AddGroupToDb(cntx, group)
 }
 
 // AddGroupToDb - Utility to add the group to the device DB
-func (d *Device) AddGroupToDb(group *of.Group) {
+func (d *Device) AddGroupToDb(cntx context.Context, group *of.Group) {
 	if b, err := json.Marshal(group); err == nil {
 		logger.Infow(ctx, "Adding Group to DB", log.Fields{"grp": group, "Json": string(b)})
-		if err = db.PutGroup(d.ID, group.GroupID, string(b)); err != nil {
+		if err = db.PutGroup(cntx, d.ID, group.GroupID, string(b)); err != nil {
 			logger.Errorw(ctx, "Write Group to DB failed", log.Fields{"device": d.ID, "groupID": group.GroupID, "Reason": err})
 		}
 	}
 }
 
 // DelGroupEntry - Deletes the group from the device and the database
-func (d *Device) DelGroupEntry(group *of.Group) {
+func (d *Device) DelGroupEntry(cntx context.Context, group *of.Group) {
 
 	if _, ok := d.groups.Load(group.GroupID); ok {
 		d.groups.Delete(group.GroupID)
-		d.DelGroupFromDb(group.GroupID)
+		d.DelGroupFromDb(cntx, group.GroupID)
 	}
 }
 
 // DelGroupFromDb - Utility to delete the Group from the device
-func (d *Device) DelGroupFromDb(groupID uint32) {
-	_ = db.DelGroup(d.ID, groupID)
+func (d *Device) DelGroupFromDb(cntx context.Context, groupID uint32) {
+	_ = db.DelGroup(cntx, d.ID, groupID)
 }
 
 //RestoreGroupsFromDb - restores all groups from DB
-func (d *Device) RestoreGroupsFromDb() {
+func (d *Device) RestoreGroupsFromDb(cntx context.Context) {
 	logger.Info(ctx, "Restoring Groups")
-	groups, _ := db.GetGroups(d.ID)
+	groups, _ := db.GetGroups(cntx, d.ID)
 	for _, group := range groups {
 		b, ok := group.Value.([]byte)
 		if !ok {
@@ -338,14 +338,14 @@
 }
 
 // AddMeter to add meter
-func (d *Device) AddMeter(meter *of.Meter) error {
+func (d *Device) AddMeter(cntx context.Context, meter *of.Meter) error {
 	d.meterLock.Lock()
 	defer d.meterLock.Unlock()
 	if _, ok := d.meters[meter.ID]; ok {
 		return errors.New("Duplicate Meter")
 	}
 	d.meters[meter.ID] = meter
-	go d.AddMeterToDb(meter)
+	go d.AddMeterToDb(cntx, meter)
 	return nil
 }
 
@@ -360,34 +360,34 @@
 }
 
 // DelMeter to delete meter
-func (d *Device) DelMeter(meter *of.Meter) bool {
+func (d *Device) DelMeter(cntx context.Context, meter *of.Meter) bool {
 	d.meterLock.Lock()
 	defer d.meterLock.Unlock()
 	if _, ok := d.meters[meter.ID]; ok {
 		delete(d.meters, meter.ID)
-		go d.DelMeterFromDb(meter.ID)
+		go d.DelMeterFromDb(cntx, meter.ID)
 		return true
 	}
 	return false
 }
 
 // AddMeterToDb is utility to add the Group to the device
-func (d *Device) AddMeterToDb(meter *of.Meter) {
+func (d *Device) AddMeterToDb(cntx context.Context, meter *of.Meter) {
 	if b, err := json.Marshal(meter); err == nil {
-		if err = db.PutDeviceMeter(d.ID, meter.ID, string(b)); err != nil {
+		if err = db.PutDeviceMeter(cntx, d.ID, meter.ID, string(b)); err != nil {
 			logger.Errorw(ctx, "Write Meter to DB failed", log.Fields{"device": d.ID, "meterID": meter.ID, "Reason": err})
 		}
 	}
 }
 
 // DelMeterFromDb to delete meter from db
-func (d *Device) DelMeterFromDb(id uint32) {
-	_ = db.DelDeviceMeter(d.ID, id)
+func (d *Device) DelMeterFromDb(cntx context.Context, id uint32) {
+	_ = db.DelDeviceMeter(cntx, d.ID, id)
 }
 
 // RestoreMetersFromDb to restore meters from db
-func (d *Device) RestoreMetersFromDb() {
-	meters, _ := db.GetDeviceMeters(d.ID)
+func (d *Device) RestoreMetersFromDb(cntx context.Context) {
+	meters, _ := db.GetDeviceMeters(cntx, d.ID)
 	for _, meter := range meters {
 		b, ok := meter.Value.([]byte)
 		if !ok {
@@ -420,7 +420,7 @@
 
 // AddPort to add the port as requested by the device/VOLTHA
 // Inform the application if the port is successfully added
-func (d *Device) AddPort(id uint32, name string) error {
+func (d *Device) AddPort(cntx context.Context, id uint32, name string) error {
 	d.portLock.Lock()
 	defer d.portLock.Unlock()
 
@@ -434,36 +434,36 @@
 	p := NewDevicePort(id, name)
 	d.PortsByID[id] = p
 	d.PortsByName[name] = p
-	d.WritePortToDb(p)
-	GetController().PortAddInd(d.ID, p.ID, p.Name)
+	d.WritePortToDb(cntx, p)
+	GetController().PortAddInd(cntx, d.ID, p.ID, p.Name)
 	logger.Infow(ctx, "Added Port", log.Fields{"Device": d.ID, "Port": id})
 	return nil
 }
 
 // DelPort to delete the port as requested by the device/VOLTHA
 // Inform the application if the port is successfully deleted
-func (d *Device) DelPort(id uint32) error {
+func (d *Device) DelPort(cntx context.Context, id uint32) error {
 
 	p := d.GetPortByID(id)
 	if p == nil {
 		return errors.New("Unknown Port")
 	}
 	if p.State == PortStateUp {
-		GetController().PortDownInd(d.ID, p.Name)
+		GetController().PortDownInd(cntx, d.ID, p.Name)
 	}
 	d.portLock.Lock()
 	defer d.portLock.Unlock()
 
-	GetController().PortDelInd(d.ID, p.Name)
+	GetController().PortDelInd(cntx, d.ID, p.Name)
 	delete(d.PortsByID, p.ID)
 	delete(d.PortsByName, p.Name)
-	d.DelPortFromDb(p.ID)
+	d.DelPortFromDb(cntx, p.ID)
 	logger.Infow(ctx, "Deleted Port", log.Fields{"Device": d.ID, "Port": id})
 	return nil
 }
 
 // UpdatePortByName is utility to update the port by Name
-func (d *Device) UpdatePortByName(name string, port uint32) {
+func (d *Device) UpdatePortByName(cntx context.Context, name string, port uint32) {
 	d.portLock.Lock()
 	defer d.portLock.Unlock()
 
@@ -474,7 +474,7 @@
 	delete(d.PortsByID, p.ID)
 	p.ID = port
 	d.PortsByID[port] = p
-	d.WritePortToDb(p)
+	d.WritePortToDb(cntx, p)
 	GetController().PortUpdateInd(d.ID, p.Name, p.ID)
 	logger.Infow(ctx, "Updated Port", log.Fields{"Device": d.ID, "Port": p.ID, "PortName": name})
 }
@@ -539,42 +539,42 @@
 }
 
 // WritePortToDb to add the port to the database
-func (d *Device) WritePortToDb(port *DevicePort) {
+func (d *Device) WritePortToDb(ctx context.Context, port *DevicePort) {
 	port.Version = database.PresentVersionMap[database.DevicePortPath]
 	if b, err := json.Marshal(port); err == nil {
-		if err = db.PutPort(d.ID, port.ID, string(b)); err != nil {
+		if err = db.PutPort(ctx, d.ID, port.ID, string(b)); err != nil {
 			logger.Errorw(ctx, "Write port to DB failed", log.Fields{"device": d.ID, "port": port.ID, "Reason": err})
 		}
 	}
 }
 
 // DelPortFromDb to delete port from database
-func (d *Device) DelPortFromDb(id uint32) {
-	_ = db.DelPort(d.ID, id)
+func (d *Device) DelPortFromDb(cntx context.Context, id uint32) {
+	_ = db.DelPort(cntx, d.ID, id)
 }
 
 // RestorePortsFromDb to restore ports from database
-func (d *Device) RestorePortsFromDb() {
-	ports, _ := db.GetPorts(d.ID)
+func (d *Device) RestorePortsFromDb(cntx context.Context) {
+	ports, _ := db.GetPorts(cntx, d.ID)
 	for _, port := range ports {
 		b, ok := port.Value.([]byte)
 		if !ok {
 			logger.Warn(ctx, "The value type is not []byte")
 			continue
 		}
-		d.CreatePortFromString(b)
+		d.CreatePortFromString(cntx, b)
 	}
 }
 
 // CreatePortFromString to create port from string
-func (d *Device) CreatePortFromString(b []byte) {
+func (d *Device) CreatePortFromString(cntx context.Context, b []byte) {
 	var port DevicePort
 	if err := json.Unmarshal(b, &port); err == nil {
 		if _, ok := d.PortsByID[port.ID]; !ok {
 			logger.Debugw(ctx, "Adding Port From Db", log.Fields{"ID": port.ID})
 			d.PortsByID[port.ID] = &port
 			d.PortsByName[port.Name] = &port
-			GetController().PortAddInd(d.ID, port.ID, port.Name)
+			GetController().PortAddInd(cntx, d.ID, port.ID, port.Name)
 		} else {
 			logger.Warnw(ctx, "Duplicate Port", log.Fields{"ID": port.ID})
 		}
@@ -662,7 +662,7 @@
 }
 
 // DeviceRebootInd is called when the logical device is rebooted.
-func (d *Device) DeviceRebootInd() {
+func (d *Device) DeviceRebootInd(cntx context.Context) {
 	logger.Warnw(ctx, "Device State change Ind: Rebooted", log.Fields{"Device": d.ID})
 
 	if d.State == DeviceStateREBOOTED {
@@ -673,19 +673,19 @@
 
 	d.State = DeviceStateREBOOTED
 	GetController().SetRebootInProgressForDevice(d.ID)
-	GetController().DeviceRebootInd(d.ID, d.SerialNum, d.SouthBoundID)
-	d.ReSetAllPortStates()
+	GetController().DeviceRebootInd(cntx, d.ID, d.SerialNum, d.SouthBoundID)
+	d.ReSetAllPortStates(cntx)
 }
 
 // DeviceDisabledInd is called when the logical device is disabled
-func (d *Device) DeviceDisabledInd() {
+func (d *Device) DeviceDisabledInd(cntx context.Context) {
 	logger.Warnw(ctx, "Device State change Ind: Disabled", log.Fields{"Device": d.ID})
 	d.State = DeviceStateDISABLED
-	GetController().DeviceDisableInd(d.ID)
+	GetController().DeviceDisableInd(cntx, d.ID)
 }
 
 //ReSetAllPortStates - Set all logical device port status to DOWN
-func (d *Device) ReSetAllPortStates() {
+func (d *Device) ReSetAllPortStates(cntx context.Context) {
 	logger.Warnw(ctx, "Resetting all Ports State to DOWN", log.Fields{"Device": d.ID, "State": d.State})
 
 	d.portLock.Lock()
@@ -694,15 +694,15 @@
 	for _, port := range d.PortsByID {
 		if port.State != PortStateDown {
 			logger.Infow(ctx, "Resetting Port State to DOWN", log.Fields{"Device": d.ID, "Port": port})
-			GetController().PortDownInd(d.ID, port.Name)
+			GetController().PortDownInd(cntx, d.ID, port.Name)
 			port.State = PortStateDown
-			d.WritePortToDb(port)
+			d.WritePortToDb(cntx, port)
 		}
 	}
 }
 
 //ReSetAllPortStatesInDb - Set all logical device port status to DOWN in DB and skip indication to application
-func (d *Device) ReSetAllPortStatesInDb() {
+func (d *Device) ReSetAllPortStatesInDb(cntx context.Context) {
 	logger.Warnw(ctx, "Resetting all Ports State to DOWN In DB", log.Fields{"Device": d.ID, "State": d.State})
 
 	d.portLock.Lock()
@@ -712,14 +712,14 @@
 		if port.State != PortStateDown {
 			logger.Infow(ctx, "Resetting Port State to DOWN and Write to DB", log.Fields{"Device": d.ID, "Port": port})
 			port.State = PortStateDown
-			d.WritePortToDb(port)
+			d.WritePortToDb(cntx, port)
 		}
 	}
 }
 
 // ProcessPortUpdate deals with the change in port id (ONU movement) and taking action
 // to update only when the port state is DOWN
-func (d *Device) ProcessPortUpdate(portName string, port uint32, state uint32) {
+func (d *Device) ProcessPortUpdate(cntx context.Context, portName string, port uint32, state uint32) {
 	if p := d.GetPortByName(portName); p != nil {
 		if p.ID != port {
 			logger.Infow(ctx, "Port ID update indication", log.Fields{"Port": p.Name, "Old PortID": p.ID, "New Port ID": port})
@@ -727,10 +727,10 @@
 				logger.Errorw(ctx, "Port ID update failed. Port State UP", log.Fields{"Port": p})
 				return
 			}
-			d.UpdatePortByName(portName, port)
+			d.UpdatePortByName(cntx, portName, port)
 			logger.Errorw(ctx, "Port ID Updated", log.Fields{"Port": p})
 		}
-		d.ProcessPortState(port, state)
+		d.ProcessPortState(cntx, port, state)
 	}
 }
 
@@ -750,7 +750,7 @@
 
 // ProcessPortState deals with the change in port status and taking action
 // based on the new state and the old state
-func (d *Device) ProcessPortState(port uint32, state uint32) {
+func (d *Device) ProcessPortState(cntx context.Context, port uint32, state uint32) {
 	if d.State != DeviceStateUP && !util.IsNniPort(port) {
 		logger.Warnw(ctx, "Ignore Port State Processing - Device not UP", log.Fields{"Device": d.ID, "Port": port, "DeviceState": d.State})
 		return
@@ -765,15 +765,15 @@
 		if state == uint32(ofp.OfpPortState_OFPPS_LIVE) && p.State == PortStateDown {
 			// Transition from DOWN to UP
 			logger.Infow(ctx, "Port State Change to UP", log.Fields{"Device": d.ID, "Port": port})
-			GetController().PortUpInd(d.ID, p.Name)
+			GetController().PortUpInd(cntx, d.ID, p.Name)
 			p.State = PortStateUp
-			d.WritePortToDb(p)
+			d.WritePortToDb(cntx, p)
 		} else if (state != uint32(ofp.OfpPortState_OFPPS_LIVE)) && (p.State != PortStateDown) {
 			// Transition from UP to Down
 			logger.Infow(ctx, "Port State Change to Down", log.Fields{"Device": d.ID, "Port": port})
-			GetController().PortDownInd(d.ID, p.Name)
+			GetController().PortDownInd(cntx, d.ID, p.Name)
 			p.State = PortStateDown
-			d.WritePortToDb(p)
+			d.WritePortToDb(cntx, p)
 		} else {
 			logger.Warnw(ctx, "Dropping Port Ind: No Change in Port State", log.Fields{"PortName": p.Name, "ID": port, "Device": d.ID, "PortState": p.State, "IncomingState": state})
 		}
@@ -781,7 +781,7 @@
 }
 
 // ProcessPortStateAfterReboot - triggers the port state indication to sort out configu mismatch due to reboot
-func (d *Device) ProcessPortStateAfterReboot(port uint32, state uint32) {
+func (d *Device) ProcessPortStateAfterReboot(cntx context.Context, port uint32, state uint32) {
 	if d.State != DeviceStateUP && !util.IsNniPort(port) {
 		logger.Warnw(ctx, "Ignore Port State Processing - Device not UP", log.Fields{"Device": d.ID, "Port": port, "DeviceState": d.State})
 		return
@@ -791,10 +791,10 @@
 		p.Tasks.Initialize(d.ctx)
 		if p.State == PortStateUp {
 			logger.Infow(ctx, "Port State: UP", log.Fields{"Device": d.ID, "Port": port})
-			GetController().PortUpInd(d.ID, p.Name)
+			GetController().PortUpInd(cntx, d.ID, p.Name)
 		} else if p.State == PortStateDown {
 			logger.Infow(ctx, "Port State: Down", log.Fields{"Device": d.ID, "Port": port})
-			GetController().PortDownInd(d.ID, p.Name)
+			GetController().PortDownInd(cntx, d.ID, p.Name)
 		}
 	}
 }
@@ -810,7 +810,7 @@
 
 // PacketIn handle the incoming packet-in and deliver to the application for the
 // actual processing
-func (d *Device) PacketIn(pkt *ofp.PacketIn) {
+func (d *Device) PacketIn(cntx context.Context, pkt *ofp.PacketIn) {
 	logger.Debugw(ctx, "Received a Packet-In", log.Fields{"Device": d.ID})
 	if pkt.PacketIn.Reason != ofp.OfpPacketInReason_OFPR_ACTION {
 		logger.Warnw(ctx, "Unsupported PacketIn Reason", log.Fields{"Reason": pkt.PacketIn.Reason})
@@ -819,7 +819,7 @@
 	data := pkt.PacketIn.Data
 	port := PacketInGetPort(pkt.PacketIn)
 	if pName, err := d.GetPortName(port); err == nil {
-		GetController().PacketInInd(d.ID, pName, data)
+		GetController().PacketInInd(cntx, d.ID, pName, data)
 	} else {
 		logger.Warnw(ctx, "Unknown Port", log.Fields{"Reason": err.Error()})
 	}
@@ -954,21 +954,21 @@
 }
 
 // SetFlowHash sets the device flow hash and writes to the DB.
-func (d *Device) SetFlowHash(hash uint32) {
+func (d *Device) SetFlowHash(cntx context.Context, hash uint32) {
 	d.flowQueueLock.Lock()
 	defer d.flowQueueLock.Unlock()
 
 	d.flowHash = hash
-	d.writeFlowHashToDB()
+	d.writeFlowHashToDB(cntx)
 }
 
-func (d *Device) writeFlowHashToDB() {
+func (d *Device) writeFlowHashToDB(cntx context.Context) {
 	hash, err := json.Marshal(d.flowHash)
 	if err != nil {
 		logger.Errorw(ctx, "failed to marshal flow hash", log.Fields{"hash": d.flowHash})
 		return
 	}
-	if err := db.PutFlowHash(d.ID, string(hash)); err != nil {
+	if err := db.PutFlowHash(cntx, d.ID, string(hash)); err != nil {
 		logger.Errorw(ctx, "Failed to add flow hash to DB", log.Fields{"device": d.ID, "hash": d.flowHash})
 	}
 }
@@ -987,12 +987,12 @@
 	return false
 }
 
-func (d *Device) triggerFlowNotification(cookie uint64, oper of.Command, bwDetails of.BwAvailDetails, err error) {
+func (d *Device) triggerFlowNotification(cntx context.Context, cookie uint64, oper of.Command, bwDetails of.BwAvailDetails, err error) {
 	flow, _ := d.GetFlow(cookie)
-	d.triggerFlowResultNotification(cookie, flow, oper, bwDetails, err)
+	d.triggerFlowResultNotification(cntx, cookie, flow, oper, bwDetails, err)
 }
 
-func (d *Device) triggerFlowResultNotification(cookie uint64, flow *of.VoltSubFlow, oper of.Command, bwDetails of.BwAvailDetails, err error) {
+func (d *Device) triggerFlowResultNotification(cntx context.Context, cookie uint64, flow *of.VoltSubFlow, oper of.Command, bwDetails of.BwAvailDetails, err error) {
 
 	statusCode, statusMsg := infraerror.GetErrorInfo(err)
 	success := isFlowOperSuccess(statusCode, oper)
@@ -1001,7 +1001,7 @@
 		if dbFlow, ok := d.GetFlow(cookie); ok {
 			dbFlow.State = uint8(state)
 			dbFlow.ErrorReason = reason
-			d.AddFlowToDb(dbFlow)
+			d.AddFlowToDb(cntx, dbFlow)
 		}
 	}
 
@@ -1019,7 +1019,7 @@
 		logger.Debugw(ctx, "Updated Flow to DB", log.Fields{"Cookie": cookie, "State": state})
 	} else {
 		if success && flow != nil {
-			if err := d.DelFlow(flow); err != nil {
+			if err := d.DelFlow(cntx, flow); err != nil {
 				logger.Warnw(ctx, "Delete Flow Error", log.Fields{"Cookie": flow.Cookie, "Reason": err.Error()})
 			}
 		} else if !success {
@@ -1038,5 +1038,5 @@
 	}
 
 	logger.Infow(ctx, "Sending Flow Notification", log.Fields{"Cookie": cookie, "Error Code": statusCode, "FlowOp": oper})
-	GetController().ProcessFlowModResultIndication(flowResult)
+	GetController().ProcessFlowModResultIndication(cntx, flowResult)
 }
diff --git a/internal/pkg/controller/modgroup.go b/internal/pkg/controller/modgroup.go
index e51a347..065c161 100644
--- a/internal/pkg/controller/modgroup.go
+++ b/internal/pkg/controller/modgroup.go
@@ -95,9 +95,9 @@
 
 	if grp.group.Command != of.GroupCommandDel {
 		grp.group.State = of.GroupOperPending
-		grp.device.UpdateGroupEntry(grp.group)
+		grp.device.UpdateGroupEntry(ctx, grp.group)
 	} else {
-		grp.device.DelGroupEntry(grp.group)
+		grp.device.DelGroupEntry(ctx, grp.group)
 	}
 
 	if !grp.device.isSBOperAllowed(grp.group.ForceAction) {
diff --git a/internal/pkg/controller/modmeter.go b/internal/pkg/controller/modmeter.go
index b5ce86c..62d2f40 100644
--- a/internal/pkg/controller/modmeter.go
+++ b/internal/pkg/controller/modmeter.go
@@ -89,12 +89,12 @@
 	// First add/delete the flows first locally before passing them to actual device
 	if mmt.command == of.MeterCommandAdd {
 		mmt.meter.State = of.MeterOperPending
-		if err := mmt.device.AddMeter(mmt.meter); err != nil {
+		if err := mmt.device.AddMeter(ctx, mmt.meter); err != nil {
 			// Meter already exists so we dont have to do anything here
 			return nil
 		}
 	} else {
-		if !mmt.device.DelMeter(mmt.meter) {
+		if !mmt.device.DelMeter(ctx, mmt.meter) {
 			// Meter doesn't exist so we dont have to do anything here
 			return nil
 		}
diff --git a/internal/pkg/controller/pendingprofiles.go b/internal/pkg/controller/pendingprofiles.go
index a97cdfa..97bb238 100644
--- a/internal/pkg/controller/pendingprofiles.go
+++ b/internal/pkg/controller/pendingprofiles.go
@@ -69,19 +69,19 @@
 
 	//Trigger Pending Service Delete Tasks
 	logger.Warnw(ctx, "Pending Service Delete Task Triggered", log.Fields{"Device": ppt.device.ID})
-	GetController().TriggerPendingProfileDeleteReq(ppt.device.ID)
+	GetController().TriggerPendingProfileDeleteReq(ctx, ppt.device.ID)
 	logger.Warnw(ctx, "Pending Service Delete Task Completed", log.Fields{"Device": ppt.device.ID})
 
 	//Trigger Pending Migrate Services Tasks
 	logger.Warnw(ctx, "Pending Migrate Services Task Triggered", log.Fields{"Device": ppt.device.ID})
-	GetController().TriggerPendingMigrateServicesReq(ppt.device.ID)
+	GetController().TriggerPendingMigrateServicesReq(ctx, ppt.device.ID)
 	logger.Warnw(ctx, "Pending Migrate Services Task Completed", log.Fields{"Device": ppt.device.ID})
 
 	GetController().ResetAuditFlags(ppt.device)
 
 	// Updating Mvlan Profile
 	logger.Warnw(ctx, "Pending Update Mvlan Task Triggered", log.Fields{"Device": ppt.device.ID})
-	if err := ppt.UpdateMvlanProfiles(); err != nil {
+	if err := ppt.UpdateMvlanProfiles(ctx); err != nil {
 		logger.Errorw(ctx, "Update Mvlan Profile Failed", log.Fields{"Reason": err.Error()})
 		errInfo = err
 	}
@@ -92,7 +92,7 @@
 }
 
 // UpdateMvlanProfiles to update the mvlan profiles
-func (ppt *PendingProfilesTask) UpdateMvlanProfiles() error {
-	GetController().UpdateMvlanProfiles(ppt.device.ID)
+func (ppt *PendingProfilesTask) UpdateMvlanProfiles(cntx context.Context) error {
+	GetController().UpdateMvlanProfiles(cntx, ppt.device.ID)
 	return nil
 }