[VOL-3187]Pass Context down the execution call hierarchy across ofagent codebase

Change-Id: Ia5f2fa1509beefe0ddc427b83e39d2702782db8f
diff --git a/internal/pkg/ofagent/refresh.go b/internal/pkg/ofagent/refresh.go
index 1744578..43cbb86 100644
--- a/internal/pkg/ofagent/refresh.go
+++ b/internal/pkg/ofagent/refresh.go
@@ -27,7 +27,7 @@
 
 func (ofa *OFAgent) synchronizeDeviceList(ctx context.Context) {
 	// Refresh once to get everything started
-	ofa.refreshDeviceList()
+	ofa.refreshDeviceList(ctx)
 
 	tick := time.NewTicker(ofa.DeviceListRefreshInterval)
 loop:
@@ -36,22 +36,22 @@
 		case <-ctx.Done():
 			break loop
 		case <-tick.C:
-			ofa.refreshDeviceList()
+			ofa.refreshDeviceList(ctx)
 		}
 	}
 	tick.Stop()
 }
 
-func (ofa *OFAgent) refreshDeviceList() {
+func (ofa *OFAgent) refreshDeviceList(ctx context.Context) {
 	// If we exit, assume disconnected
 	if ofa.volthaClient == nil {
-		logger.Error("no-voltha-connection")
+		logger.Error(ctx, "no-voltha-connection")
 		ofa.events <- ofaEventVolthaDisconnected
 		return
 	}
 	deviceList, err := ofa.volthaClient.Get().ListLogicalDevices(context.Background(), &empty.Empty{})
 	if err != nil {
-		logger.Errorw("ofagent failed to query device list from voltha",
+		logger.Errorw(ctx, "ofagent failed to query device list from voltha",
 			log.Fields{"error": err})
 		ofa.events <- ofaEventVolthaDisconnected
 		return
@@ -73,9 +73,9 @@
 			toDel = append(toDel, key)
 		}
 	}
-	logger.Debugw("GrpcClient refreshDeviceList", log.Fields{"ToAdd": toAdd, "ToDel": toDel})
+	logger.Debugw(ctx, "GrpcClient refreshDeviceList", log.Fields{"ToAdd": toAdd, "ToDel": toDel})
 	for i := 0; i < len(toAdd); i++ {
-		ofa.addOFClient(toAdd[i]) // client is started in addOFClient
+		ofa.addOFClient(ctx, toAdd[i]) // client is started in addOFClient
 	}
 	for i := 0; i < len(toDel); i++ {
 		ofa.clientMap[toDel[i]].Stop()
@@ -85,12 +85,12 @@
 	}
 }
 
-func (ofa *OFAgent) addOFClient(deviceID string) *openflow.OFClient {
-	logger.Debugw("GrpcClient addClient called ", log.Fields{"device-id": deviceID})
+func (ofa *OFAgent) addOFClient(ctx context.Context, deviceID string) *openflow.OFClient {
+	logger.Debugw(ctx, "GrpcClient addClient called ", log.Fields{"device-id": deviceID})
 	ofa.mapLock.Lock()
 	ofc := ofa.clientMap[deviceID]
 	if ofc == nil {
-		ofc = openflow.NewOFClient(&openflow.OFClient{
+		ofc = openflow.NewOFClient(ctx, &openflow.OFClient{
 			DeviceID:              deviceID,
 			OFControllerEndPoints: ofa.OFControllerEndPoints,
 			VolthaClient:          ofa.volthaClient,
@@ -102,14 +102,14 @@
 		ofa.clientMap[deviceID] = ofc
 	}
 	ofa.mapLock.Unlock()
-	logger.Debugw("Finished with addClient", log.Fields{"deviceID": deviceID})
+	logger.Debugw(ctx, "Finished with addClient", log.Fields{"deviceID": deviceID})
 	return ofc
 }
 
-func (ofa *OFAgent) getOFClient(deviceID string) *openflow.OFClient {
+func (ofa *OFAgent) getOFClient(ctx context.Context, deviceID string) *openflow.OFClient {
 	ofc := ofa.clientMap[deviceID]
 	if ofc == nil {
-		ofc = ofa.addOFClient(deviceID)
+		ofc = ofa.addOFClient(ctx, deviceID)
 	}
 	return ofc
 }