[VOL-3069]Pass Context down the execution call hierarchy across voltha codebase

Change-Id: I97a2630d9a4fe5dc3161113539edda476534f186
diff --git a/rw_core/mocks/adapter_olt.go b/rw_core/mocks/adapter_olt.go
index 61f431a..fc284ab 100644
--- a/rw_core/mocks/adapter_olt.go
+++ b/rw_core/mocks/adapter_olt.go
@@ -41,14 +41,14 @@
 }
 
 // NewOLTAdapter - creates OLT adapter instance
-func NewOLTAdapter(cp adapterif.CoreProxy) *OLTAdapter {
+func NewOLTAdapter(ctx context.Context, cp adapterif.CoreProxy) *OLTAdapter {
 	return &OLTAdapter{
-		Adapter: NewAdapter(cp),
+		Adapter: NewAdapter(ctx, cp),
 	}
 }
 
 // Adopt_device creates new handler for added device
-func (oltA *OLTAdapter) Adopt_device(device *voltha.Device) error { // nolint
+func (oltA *OLTAdapter) Adopt_device(ctx context.Context, device *voltha.Device) error { // nolint
 	go func() {
 		d := proto.Clone(device).(*voltha.Device)
 		d.Root = true
@@ -56,8 +56,8 @@
 		d.Model = "go-mock"
 		d.SerialNumber = com.GetRandomSerialNumber()
 		d.MacAddress = strings.ToUpper(com.GetRandomMacAddress())
-		oltA.storeDevice(d)
-		if res := oltA.coreProxy.DeviceUpdate(context.TODO(), d); res != nil {
+		oltA.storeDevice(ctx, d)
+		if res := oltA.coreProxy.DeviceUpdate(ctx, d); res != nil {
 			logger.Fatalf("deviceUpdate-failed-%s", res)
 		}
 		nniPort := &voltha.Port{
@@ -67,7 +67,7 @@
 			OperStatus: voltha.OperStatus_ACTIVE,
 		}
 		var err error
-		if err = oltA.coreProxy.PortCreated(context.TODO(), d.Id, nniPort); err != nil {
+		if err = oltA.coreProxy.PortCreated(ctx, d.Id, nniPort); err != nil {
 			logger.Fatalf("PortCreated-failed-%s", err)
 		}
 
@@ -77,30 +77,30 @@
 			Type:       voltha.Port_PON_OLT,
 			OperStatus: voltha.OperStatus_ACTIVE,
 		}
-		if err = oltA.coreProxy.PortCreated(context.TODO(), d.Id, ponPort); err != nil {
+		if err = oltA.coreProxy.PortCreated(ctx, d.Id, ponPort); err != nil {
 			logger.Fatalf("PortCreated-failed-%s", err)
 		}
 
 		d.ConnectStatus = voltha.ConnectStatus_REACHABLE
 		d.OperStatus = voltha.OperStatus_ACTIVE
 
-		if err = oltA.coreProxy.DeviceStateUpdate(context.TODO(), d.Id, d.ConnectStatus, d.OperStatus); err != nil {
+		if err = oltA.coreProxy.DeviceStateUpdate(ctx, d.Id, d.ConnectStatus, d.OperStatus); err != nil {
 			logger.Fatalf("Device-state-update-failed-%s", err)
 		}
 
 		//Get the latest device data from the Core
-		if d, err = oltA.coreProxy.GetDevice(context.TODO(), d.Id, d.Id); err != nil {
+		if d, err = oltA.coreProxy.GetDevice(ctx, d.Id, d.Id); err != nil {
 			logger.Fatalf("getting-device-failed-%s", err)
 		}
 
-		oltA.updateDevice(d)
+		oltA.updateDevice(ctx, d)
 
 		// Register Child devices
 		initialUniPortNo := startingUNIPortNo
 		for i := 0; i < numONUPerOLT; i++ {
 			go func(seqNo int) {
 				if _, err := oltA.coreProxy.ChildDeviceDetected(
-					context.TODO(),
+					ctx,
 					d.Id,
 					1,
 					"onu_adapter_mock",
@@ -117,8 +117,8 @@
 }
 
 // Get_ofp_device_info returns ofp device info
-func (oltA *OLTAdapter) Get_ofp_device_info(device *voltha.Device) (*ic.SwitchCapability, error) { // nolint
-	if d := oltA.getDevice(device.Id); d == nil {
+func (oltA *OLTAdapter) Get_ofp_device_info(ctx context.Context, device *voltha.Device) (*ic.SwitchCapability, error) { // nolint
+	if d := oltA.getDevice(ctx, device.Id); d == nil {
 		logger.Fatalf("device-not-found-%s", device.Id)
 	}
 	return &ic.SwitchCapability{
@@ -139,15 +139,15 @@
 }
 
 // Get_ofp_port_info returns ofp port info
-func (oltA *OLTAdapter) Get_ofp_port_info(device *voltha.Device, portNo int64) (*ic.PortCapability, error) { // nolint
-	if d := oltA.getDevice(device.Id); d == nil {
+func (oltA *OLTAdapter) Get_ofp_port_info(ctx context.Context, device *voltha.Device, portNo int64) (*ic.PortCapability, error) { // nolint
+	if d := oltA.getDevice(ctx, device.Id); d == nil {
 		logger.Fatalf("device-not-found-%s", device.Id)
 	}
 	capability := uint32(of.OfpPortFeatures_OFPPF_1GB_FD | of.OfpPortFeatures_OFPPF_FIBER)
 	return &ic.PortCapability{
 		Port: &voltha.LogicalPort{
 			OfpPort: &of.OfpPort{
-				HwAddr:     macAddressToUint32Array("11:22:33:44:55:66"),
+				HwAddr:     macAddressToUint32Array(ctx, "11:22:33:44:55:66"),
 				Config:     0,
 				State:      uint32(of.OfpPortState_OFPPS_LIVE),
 				Curr:       capability,
@@ -163,19 +163,19 @@
 }
 
 // GetNumONUPerOLT returns number of ONUs per OLT
-func (oltA *OLTAdapter) GetNumONUPerOLT() int {
+func (oltA *OLTAdapter) GetNumONUPerOLT(ctx context.Context) int {
 	return numONUPerOLT
 }
 
 // Returns the starting UNI port number
-func (oltA *OLTAdapter) GetStartingUNIPortNo() int {
+func (oltA *OLTAdapter) GetStartingUNIPortNo(ctx context.Context) int {
 	return startingUNIPortNo
 }
 
 // Disable_device disables device
-func (oltA *OLTAdapter) Disable_device(device *voltha.Device) error { // nolint
+func (oltA *OLTAdapter) Disable_device(ctx context.Context, device *voltha.Device) error { // nolint
 	go func() {
-		if d := oltA.getDevice(device.Id); d == nil {
+		if d := oltA.getDevice(ctx, device.Id); d == nil {
 			logger.Fatalf("device-not-found-%s", device.Id)
 		}
 
@@ -195,7 +195,7 @@
 			return
 		}
 
-		oltA.updateDevice(cloned)
+		oltA.updateDevice(ctx, cloned)
 
 		// Tell the Core that all child devices have been disabled (by default it's an action already taken by the Core
 		if err := oltA.coreProxy.ChildDevicesLost(context.TODO(), cloned.Id); err != nil {
@@ -207,9 +207,9 @@
 }
 
 // Reenable_device reenables device
-func (oltA *OLTAdapter) Reenable_device(device *voltha.Device) error { // nolint
+func (oltA *OLTAdapter) Reenable_device(ctx context.Context, device *voltha.Device) error { // nolint
 	go func() {
-		if d := oltA.getDevice(device.Id); d == nil {
+		if d := oltA.getDevice(ctx, device.Id); d == nil {
 			logger.Fatalf("device-not-found-%s", device.Id)
 		}
 
@@ -235,7 +235,7 @@
 }
 
 // Enable_port -
-func (oltA *OLTAdapter) Enable_port(deviceId string, Port *voltha.Port) error { //nolint
+func (oltA *OLTAdapter) Enable_port(ctx context.Context, deviceId string, Port *voltha.Port) error { //nolint
 	go func() {
 
 		if Port.Type == voltha.Port_PON_OLT {
@@ -249,7 +249,7 @@
 }
 
 // Disable_port -
-func (oltA *OLTAdapter) Disable_port(deviceId string, Port *voltha.Port) error { //nolint
+func (oltA *OLTAdapter) Disable_port(ctx context.Context, deviceId string, Port *voltha.Port) error { //nolint
 	go func() {
 
 		if Port.Type == voltha.Port_PON_OLT {
@@ -263,12 +263,12 @@
 }
 
 // Child_device_lost deletes ONU and its references
-func (oltA *OLTAdapter) Child_device_lost(deviceID string, pPortNo uint32, onuID uint32) error { // nolint
+func (oltA *OLTAdapter) Child_device_lost(ctx context.Context, deviceID string, pPortNo uint32, onuID uint32) error { // nolint
 	return nil
 }
 
 // Reboot_device -
-func (oltA *OLTAdapter) Reboot_device(device *voltha.Device) error { // nolint
+func (oltA *OLTAdapter) Reboot_device(ctx context.Context, device *voltha.Device) error { // nolint
 	logger.Infow("reboot-device", log.Fields{"deviceId": device.Id})
 
 	go func() {
@@ -284,12 +284,12 @@
 }
 
 // TODO: REMOVE Start_omci_test begins an omci self-test
-func (oltA *OLTAdapter) Start_omci_test(device *voltha.Device, request *voltha.OmciTestRequest) (*ic.TestResponse, error) { // nolint
+func (oltA *OLTAdapter) Start_omci_test(ctx context.Context, device *voltha.Device, request *voltha.OmciTestRequest) (*ic.TestResponse, error) { // nolint
 	_ = device
 	return nil, errors.New("start-omci-test-not-implemented")
 }
 
-func (oltA *OLTAdapter) Get_ext_value(deviceId string, device *voltha.Device, valueflag voltha.ValueType_Type) (*voltha.ReturnValues, error) { // nolint
+func (oltA *OLTAdapter) Get_ext_value(ctx context.Context, deviceId string, device *voltha.Device, valueflag voltha.ValueType_Type) (*voltha.ReturnValues, error) { // nolint
 	_ = deviceId
 	_ = device
 	_ = valueflag