[VOL-3069]Pass Context in methods which are performing logging and need the context

Change-Id: Ie84f9e240aa4f47d0046acaac0d82d21b17252e5
diff --git a/pkg/mocks/common.go b/pkg/mocks/common.go
index 3b2df29..836770c 100644
--- a/pkg/mocks/common.go
+++ b/pkg/mocks/common.go
@@ -21,12 +21,12 @@
 	"github.com/opencord/voltha-lib-go/v3/pkg/log"
 )
 
-var logger log.Logger
+var logger log.CLogger
 
 func init() {
 	// Setup this package so that it's log level can be modified at run time
 	var err error
-	logger, err = log.AddPackage(log.JSON, log.ErrorLevel, log.Fields{"pkg": "mocks"})
+	logger, err = log.RegisterPackage(log.JSON, log.ErrorLevel, log.Fields{"pkg": "mocks"})
 	if err != nil {
 		panic(err)
 	}
diff --git a/pkg/mocks/mockEventproxy.go b/pkg/mocks/mockEventproxy.go
index d2621ab..2abddf2 100644
--- a/pkg/mocks/mockEventproxy.go
+++ b/pkg/mocks/mockEventproxy.go
@@ -18,8 +18,8 @@
 package mocks
 
 import (
+	"context"
 	"errors"
-
 	"github.com/opencord/voltha-protos/v3/go/voltha"
 )
 
@@ -28,7 +28,7 @@
 }
 
 // SendDeviceEvent mocks the SendDeviceEvent function
-func (me *MockEventProxy) SendDeviceEvent(deviceEvent *voltha.DeviceEvent, category voltha.EventCategory_Types,
+func (me *MockEventProxy) SendDeviceEvent(ctx context.Context, deviceEvent *voltha.DeviceEvent, category voltha.EventCategory_Types,
 	subCategory voltha.EventSubCategory_Types, raisedTs int64) error {
 	if raisedTs == 0 {
 		return errors.New("raisedTS cannot be zero")
@@ -37,7 +37,7 @@
 }
 
 // SendKpiEvent mocks the SendKpiEvent function
-func (me *MockEventProxy) SendKpiEvent(id string, deviceEvent *voltha.KpiEvent2, category voltha.EventCategory_Types,
+func (me *MockEventProxy) SendKpiEvent(ctx context.Context, id string, deviceEvent *voltha.KpiEvent2, category voltha.EventCategory_Types,
 	subCategory voltha.EventSubCategory_Types, raisedTs int64) error {
 	if raisedTs == 0 {
 		return errors.New("raisedTS cannot be zero")
diff --git a/pkg/mocks/mockKVClient.go b/pkg/mocks/mockKVClient.go
index d4527ad..5e13d1d 100644
--- a/pkg/mocks/mockKVClient.go
+++ b/pkg/mocks/mockKVClient.go
@@ -70,9 +70,9 @@
 
 // Get mock function implementation for KVClient
 func (kvclient *MockKVClient) Get(ctx context.Context, key string) (*kvstore.KVPair, error) {
-	logger.Debugw("Warning Warning Warning: Get of MockKVClient called", log.Fields{"key": key})
+	logger.Debugw(ctx, "Warning Warning Warning: Get of MockKVClient called", log.Fields{"key": key})
 	if key != "" {
-		logger.Debug("Warning Key Not Blank")
+		logger.Debug(ctx, "Warning Key Not Blank")
 		if strings.Contains(key, "meter_id/{0,62,8}/{upstream}") {
 			meterConfig := ofp.OfpMeterConfig{
 				Flags:   0,
@@ -117,7 +117,7 @@
 			return kvstore.NewKVPair(key, str, "mock", 3000, 1), nil
 		}
 		if strings.Contains(key, FlowIDpool) {
-			logger.Debug("Error Error Error Key:", FlowIDpool)
+			logger.Debug(ctx, "Error Error Error Key:", FlowIDpool)
 			data := make(map[string]interface{})
 			data["pool"] = "1024"
 			data["start_idx"] = 1
@@ -127,7 +127,7 @@
 		}
 		if strings.Contains(key, FlowIDs) {
 			data := []uint32{1, 2}
-			logger.Debug("Error Error Error Key:", FlowIDs)
+			logger.Debug(ctx, "Error Error Error Key:", FlowIDs)
 			str, _ := json.Marshal(data)
 			return kvstore.NewKVPair(key, str, "mock", 3000, 1), nil
 		}
@@ -140,22 +140,22 @@
 					LogicalFlowID:   1,
 				},
 			}
-			logger.Debug("Error Error Error Key:", FlowIDs)
+			logger.Debug(ctx, "Error Error Error Key:", FlowIDs)
 			str, _ := json.Marshal(data)
 			return kvstore.NewKVPair(key, str, "mock", 3000, 1), nil
 		}
 		if strings.Contains(key, GemportIDs) {
-			logger.Debug("Error Error Error Key:", GemportIDs)
+			logger.Debug(ctx, "Error Error Error Key:", GemportIDs)
 			str, _ := json.Marshal(1)
 			return kvstore.NewKVPair(key, str, "mock", 3000, 1), nil
 		}
 		if strings.Contains(key, AllocIDs) {
-			logger.Debug("Error Error Error Key:", AllocIDs)
+			logger.Debug(ctx, "Error Error Error Key:", AllocIDs)
 			str, _ := json.Marshal(1)
 			return kvstore.NewKVPair(key, str, "mock", 3000, 1), nil
 		}
 		if strings.Contains(key, FlowGroup) || strings.Contains(key, FlowGroupCached) {
-			logger.Debug("Error Error Error Key:", FlowGroup)
+			logger.Debug(ctx, "Error Error Error Key:", FlowGroup)
 			groupInfo := resourcemanager.GroupInfo{
 				GroupID:  2,
 				OutPorts: []uint32{1},
@@ -251,9 +251,9 @@
 }
 
 // CloseWatch mock function implementation for KVClient
-func (kvclient *MockKVClient) CloseWatch(key string, ch chan *kvstore.Event) {
+func (kvclient *MockKVClient) CloseWatch(ctx context.Context, key string, ch chan *kvstore.Event) {
 }
 
 // Close mock function implementation for KVClient
-func (kvclient *MockKVClient) Close() {
+func (kvclient *MockKVClient) Close(ctx context.Context) {
 }
diff --git a/pkg/mocks/mockTechprofile.go b/pkg/mocks/mockTechprofile.go
index d47864c..4a71661 100644
--- a/pkg/mocks/mockTechprofile.go
+++ b/pkg/mocks/mockTechprofile.go
@@ -31,19 +31,19 @@
 }
 
 // SetKVClient to mock techprofile SetKVClient method
-func (m MockTechProfile) SetKVClient() *db.Backend {
+func (m MockTechProfile) SetKVClient(ctx context.Context) *db.Backend {
 	return &db.Backend{Client: &MockKVClient{}}
 }
 
 // GetTechProfileInstanceKVPath to mock techprofile GetTechProfileInstanceKVPath method
-func (m MockTechProfile) GetTechProfileInstanceKVPath(techProfiletblID uint32, uniPortName string) string {
+func (m MockTechProfile) GetTechProfileInstanceKVPath(ctx context.Context, techProfiletblID uint32, uniPortName string) string {
 	return ""
 
 }
 
 // GetTPInstanceFromKVStore to mock techprofile GetTPInstanceFromKVStore method
 func (m MockTechProfile) GetTPInstanceFromKVStore(ctx context.Context, techProfiletblID uint32, path string) (interface{}, error) {
-	logger.Debug("Warning Warning Warning: GetTPInstanceFromKVStore")
+	logger.Debug(ctx, "Warning Warning Warning: GetTPInstanceFromKVStore")
 	return nil, nil
 
 }
@@ -83,19 +83,19 @@
 }
 
 // GetprotoBufParamValue to mock techprofile GetprotoBufParamValue method
-func (m MockTechProfile) GetprotoBufParamValue(paramType string, paramKey string) int32 {
+func (m MockTechProfile) GetprotoBufParamValue(ctx context.Context, paramType string, paramKey string) int32 {
 	return 0
 
 }
 
 // GetUsScheduler to mock techprofile GetUsScheduler method
-func (m MockTechProfile) GetUsScheduler(tpInstance *tp.TechProfile) (*tp_pb.SchedulerConfig, error) {
+func (m MockTechProfile) GetUsScheduler(ctx context.Context, tpInstance *tp.TechProfile) (*tp_pb.SchedulerConfig, error) {
 	return &tp_pb.SchedulerConfig{}, nil
 
 }
 
 // GetDsScheduler to mock techprofile GetDsScheduler method
-func (m MockTechProfile) GetDsScheduler(tpInstance *tp.TechProfile) (*tp_pb.SchedulerConfig, error) {
+func (m MockTechProfile) GetDsScheduler(ctx context.Context, tpInstance *tp.TechProfile) (*tp_pb.SchedulerConfig, error) {
 	return &tp_pb.SchedulerConfig{}, nil
 }
 
@@ -107,17 +107,17 @@
 }
 
 // GetTrafficQueues to mock techprofile GetTrafficQueues method
-func (m MockTechProfile) GetTrafficQueues(tp *tp.TechProfile, Dir tp_pb.Direction) ([]*tp_pb.TrafficQueue, error) {
+func (m MockTechProfile) GetTrafficQueues(ctx context.Context, tp *tp.TechProfile, Dir tp_pb.Direction) ([]*tp_pb.TrafficQueue, error) {
 	return []*tp_pb.TrafficQueue{{}}, nil
 }
 
 // GetMulticastTrafficQueues to mock techprofile GetMulticastTrafficQueues method
-func (m MockTechProfile) GetMulticastTrafficQueues(tp *tp.TechProfile) []*tp_pb.TrafficQueue {
+func (m MockTechProfile) GetMulticastTrafficQueues(ctx context.Context, tp *tp.TechProfile) []*tp_pb.TrafficQueue {
 	return []*tp_pb.TrafficQueue{{}}
 }
 
 // GetGemportIDForPbit to mock techprofile GetGemportIDForPbit method
-func (m MockTechProfile) GetGemportIDForPbit(tp interface{}, Dir tp_pb.Direction, pbit uint32) uint32 {
+func (m MockTechProfile) GetGemportIDForPbit(ctx context.Context, tp interface{}, Dir tp_pb.Direction, pbit uint32) uint32 {
 	return 0
 }