VOL-1900 lint warning fixes rw_core

Change-Id: Icaa84d7ce24163da90c91ff2babcbb78ff4e9141
diff --git a/Makefile b/Makefile
index f41d7ae..206becd 100644
--- a/Makefile
+++ b/Makefile
@@ -237,7 +237,7 @@
 sca: golangci_lint_tool_install
 	rm -rf ./sca-report
 	@mkdir -p ./sca-report
-	$(GOLANGCI_LINT_TOOL) run -E golint --out-format junit-xml ./cli/... 2>&1 | tee ./sca-report/sca-report.xml
+	$(GOLANGCI_LINT_TOOL) run -E golint -D structcheck --out-format junit-xml ./cli/... ./rw_core/...  2>&1 | tee ./sca-report/sca-report.xml
 
 test: go_junit_install gocover_cobertura_install local-lib-go
 	@mkdir -p ./tests/results
diff --git a/rw_core/config/config.go b/rw_core/config/config.go
index 68dca2c..5ba2f3c 100644
--- a/rw_core/config/config.go
+++ b/rw_core/config/config.go
@@ -13,52 +13,55 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package config
 
 import (
 	"flag"
 	"fmt"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
+
 	"time"
+
+	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 )
 
 // RW Core service default constants
 const (
-	ConsulStoreName                   = "consul"
-	EtcdStoreName                     = "etcd"
-	default_GrpcPort                  = 50057
-	default_GrpcHost                  = ""
-	default_KafkaAdapterHost          = "127.0.0.1"
-	default_KafkaAdapterPort          = 9092
-	default_KafkaClusterHost          = "127.0.0.1"
-	default_KafkaClusterPort          = 9094
-	default_KVStoreType               = EtcdStoreName
-	default_KVStoreTimeout            = 5 //in seconds
-	default_KVStoreHost               = "127.0.0.1"
-	default_KVStorePort               = 2379 // Consul = 8500; Etcd = 2379
-	default_KVTxnKeyDelTime           = 60
-	default_KVStoreDataPrefix         = "service/voltha"
-	default_LogLevel                  = 0
-	default_Banner                    = false
-	default_DisplayVersionOnly        = false
-	default_CoreTopic                 = "rwcore"
-	default_RWCoreEndpoint            = "rwcore"
-	default_RWCoreKey                 = "pki/voltha.key"
-	default_RWCoreCert                = "pki/voltha.crt"
-	default_RWCoreCA                  = "pki/voltha-CA.pem"
-	default_AffinityRouterTopic       = "affinityRouter"
-	default_InCompetingMode           = true
-	default_LongRunningRequestTimeout = int64(2000)
-	default_DefaultRequestTimeout     = int64(500)
-	default_CoreTimeout               = int64(500)
-	default_CoreBindingKey            = "voltha_backend_name"
-	default_CorePairTopic             = "rwcore_1"
-	default_MaxConnectionRetries      = -1 // retries forever
-	default_ConnectionRetryInterval   = 2 * time.Second
-	default_LiveProbeInterval         = 60 * time.Second
-	default_NotLiveProbeInterval      = 5 * time.Second // Probe more frequently when not alive
-	default_ProbeHost                 = ""
-	default_ProbePort                 = 8080
+	ConsulStoreName                  = "consul"
+	EtcdStoreName                    = "etcd"
+	defaultGrpcPort                  = 50057
+	defaultGrpcHost                  = ""
+	defaultKafkaAdapterHost          = "127.0.0.1"
+	defaultKafkaAdapterPort          = 9092
+	defaultKafkaClusterHost          = "127.0.0.1"
+	defaultKafkaClusterPort          = 9094
+	defaultKVStoreType               = EtcdStoreName
+	defaultKVStoreTimeout            = 5 //in seconds
+	defaultKVStoreHost               = "127.0.0.1"
+	defaultKVStorePort               = 2379 // Consul = 8500; Etcd = 2379
+	defaultKVTxnKeyDelTime           = 60
+	defaultKVStoreDataPrefix         = "service/voltha"
+	defaultLogLevel                  = 0
+	defaultBanner                    = false
+	defaultDisplayVersionOnly        = false
+	defaultCoreTopic                 = "rwcore"
+	defaultRWCoreEndpoint            = "rwcore"
+	defaultRWCoreKey                 = "pki/voltha.key"
+	defaultRWCoreCert                = "pki/voltha.crt"
+	defaultRWCoreCA                  = "pki/voltha-CA.pem"
+	defaultAffinityRouterTopic       = "affinityRouter"
+	defaultInCompetingMode           = true
+	defaultLongRunningRequestTimeout = int64(2000)
+	defaultDefaultRequestTimeout     = int64(500)
+	defaultCoreTimeout               = int64(500)
+	defaultCoreBindingKey            = "voltha_backend_name"
+	defaultCorePairTopic             = "rwcore_1"
+	defaultMaxConnectionRetries      = -1 // retries forever
+	defaultConnectionRetryInterval   = 2 * time.Second
+	defaultLiveProbeInterval         = 60 * time.Second
+	defaultNotLiveProbeInterval      = 5 * time.Second // Probe more frequently when not alive
+	defaultProbeHost                 = ""
+	defaultProbePort                 = 8080
 )
 
 // RWCoreFlags represents the set of configurations used by the read-write core service
@@ -100,45 +103,48 @@
 }
 
 func init() {
-	log.AddPackage(log.JSON, log.WarnLevel, nil)
+	_, err := log.AddPackage(log.JSON, log.WarnLevel, nil)
+	if err != nil {
+		log.Errorw("unable-to-register-a-package-to-the-log-map", log.Fields{"error": err})
+	}
 }
 
 // NewRWCoreFlags returns a new RWCore config
 func NewRWCoreFlags() *RWCoreFlags {
 	var rwCoreFlag = RWCoreFlags{ // Default values
-		RWCoreEndpoint:            default_RWCoreEndpoint,
-		GrpcHost:                  default_GrpcHost,
-		GrpcPort:                  default_GrpcPort,
-		KafkaAdapterHost:          default_KafkaAdapterHost,
-		KafkaAdapterPort:          default_KafkaAdapterPort,
-		KafkaClusterHost:          default_KafkaClusterHost,
-		KafkaClusterPort:          default_KafkaClusterPort,
-		KVStoreType:               default_KVStoreType,
-		KVStoreTimeout:            default_KVStoreTimeout,
-		KVStoreHost:               default_KVStoreHost,
-		KVStorePort:               default_KVStorePort,
-		KVStoreDataPrefix:         default_KVStoreDataPrefix,
-		KVTxnKeyDelTime:           default_KVTxnKeyDelTime,
-		CoreTopic:                 default_CoreTopic,
-		LogLevel:                  default_LogLevel,
-		Banner:                    default_Banner,
-		DisplayVersionOnly:        default_DisplayVersionOnly,
-		RWCoreKey:                 default_RWCoreKey,
-		RWCoreCert:                default_RWCoreCert,
-		RWCoreCA:                  default_RWCoreCA,
-		AffinityRouterTopic:       default_AffinityRouterTopic,
-		InCompetingMode:           default_InCompetingMode,
-		DefaultRequestTimeout:     default_DefaultRequestTimeout,
-		LongRunningRequestTimeout: default_LongRunningRequestTimeout,
-		DefaultCoreTimeout:        default_CoreTimeout,
-		CoreBindingKey:            default_CoreBindingKey,
-		CorePairTopic:             default_CorePairTopic,
-		MaxConnectionRetries:      default_MaxConnectionRetries,
-		ConnectionRetryInterval:   default_ConnectionRetryInterval,
-		LiveProbeInterval:         default_LiveProbeInterval,
-		NotLiveProbeInterval:      default_NotLiveProbeInterval,
-		ProbeHost:                 default_ProbeHost,
-		ProbePort:                 default_ProbePort,
+		RWCoreEndpoint:            defaultRWCoreEndpoint,
+		GrpcHost:                  defaultGrpcHost,
+		GrpcPort:                  defaultGrpcPort,
+		KafkaAdapterHost:          defaultKafkaAdapterHost,
+		KafkaAdapterPort:          defaultKafkaAdapterPort,
+		KafkaClusterHost:          defaultKafkaClusterHost,
+		KafkaClusterPort:          defaultKafkaClusterPort,
+		KVStoreType:               defaultKVStoreType,
+		KVStoreTimeout:            defaultKVStoreTimeout,
+		KVStoreHost:               defaultKVStoreHost,
+		KVStorePort:               defaultKVStorePort,
+		KVStoreDataPrefix:         defaultKVStoreDataPrefix,
+		KVTxnKeyDelTime:           defaultKVTxnKeyDelTime,
+		CoreTopic:                 defaultCoreTopic,
+		LogLevel:                  defaultLogLevel,
+		Banner:                    defaultBanner,
+		DisplayVersionOnly:        defaultDisplayVersionOnly,
+		RWCoreKey:                 defaultRWCoreKey,
+		RWCoreCert:                defaultRWCoreCert,
+		RWCoreCA:                  defaultRWCoreCA,
+		AffinityRouterTopic:       defaultAffinityRouterTopic,
+		InCompetingMode:           defaultInCompetingMode,
+		DefaultRequestTimeout:     defaultDefaultRequestTimeout,
+		LongRunningRequestTimeout: defaultLongRunningRequestTimeout,
+		DefaultCoreTimeout:        defaultCoreTimeout,
+		CoreBindingKey:            defaultCoreBindingKey,
+		CorePairTopic:             defaultCorePairTopic,
+		MaxConnectionRetries:      defaultMaxConnectionRetries,
+		ConnectionRetryInterval:   defaultConnectionRetryInterval,
+		LiveProbeInterval:         defaultLiveProbeInterval,
+		NotLiveProbeInterval:      defaultNotLiveProbeInterval,
+		ProbeHost:                 defaultProbeHost,
+		ProbePort:                 defaultProbePort,
 	}
 	return &rwCoreFlag
 }
@@ -146,97 +152,95 @@
 // ParseCommandArguments parses the arguments when running read-write core service
 func (cf *RWCoreFlags) ParseCommandArguments() {
 
-	var help string
-
-	help = fmt.Sprintf("RW core endpoint address")
-	flag.StringVar(&(cf.RWCoreEndpoint), "vcore-endpoint", default_RWCoreEndpoint, help)
+	help := fmt.Sprintf("RW core endpoint address")
+	flag.StringVar(&(cf.RWCoreEndpoint), "vcore-endpoint", defaultRWCoreEndpoint, help)
 
 	help = fmt.Sprintf("GRPC server - host")
-	flag.StringVar(&(cf.GrpcHost), "grpc_host", default_GrpcHost, help)
+	flag.StringVar(&(cf.GrpcHost), "grpc_host", defaultGrpcHost, help)
 
 	help = fmt.Sprintf("GRPC server - port")
-	flag.IntVar(&(cf.GrpcPort), "grpc_port", default_GrpcPort, help)
+	flag.IntVar(&(cf.GrpcPort), "grpc_port", defaultGrpcPort, help)
 
 	help = fmt.Sprintf("Kafka - Adapter messaging host")
-	flag.StringVar(&(cf.KafkaAdapterHost), "kafka_adapter_host", default_KafkaAdapterHost, help)
+	flag.StringVar(&(cf.KafkaAdapterHost), "kafka_adapter_host", defaultKafkaAdapterHost, help)
 
 	help = fmt.Sprintf("Kafka - Adapter messaging port")
-	flag.IntVar(&(cf.KafkaAdapterPort), "kafka_adapter_port", default_KafkaAdapterPort, help)
+	flag.IntVar(&(cf.KafkaAdapterPort), "kafka_adapter_port", defaultKafkaAdapterPort, help)
 
 	help = fmt.Sprintf("Kafka - Cluster messaging host")
-	flag.StringVar(&(cf.KafkaClusterHost), "kafka_cluster_host", default_KafkaClusterHost, help)
+	flag.StringVar(&(cf.KafkaClusterHost), "kafka_cluster_host", defaultKafkaClusterHost, help)
 
 	help = fmt.Sprintf("Kafka - Cluster messaging port")
-	flag.IntVar(&(cf.KafkaClusterPort), "kafka_cluster_port", default_KafkaClusterPort, help)
+	flag.IntVar(&(cf.KafkaClusterPort), "kafka_cluster_port", defaultKafkaClusterPort, help)
 
 	help = fmt.Sprintf("RW Core topic")
-	flag.StringVar(&(cf.CoreTopic), "rw_core_topic", default_CoreTopic, help)
+	flag.StringVar(&(cf.CoreTopic), "rw_core_topic", defaultCoreTopic, help)
 
 	help = fmt.Sprintf("Affinity Router topic")
-	flag.StringVar(&(cf.AffinityRouterTopic), "affinity_router_topic", default_AffinityRouterTopic, help)
+	flag.StringVar(&(cf.AffinityRouterTopic), "affinity_router_topic", defaultAffinityRouterTopic, help)
 
 	help = fmt.Sprintf("In competing Mode - two cores competing to handle a transaction ")
-	flag.BoolVar(&cf.InCompetingMode, "in_competing_mode", default_InCompetingMode, help)
+	flag.BoolVar(&cf.InCompetingMode, "in_competing_mode", defaultInCompetingMode, help)
 
 	help = fmt.Sprintf("KV store type")
-	flag.StringVar(&(cf.KVStoreType), "kv_store_type", default_KVStoreType, help)
+	flag.StringVar(&(cf.KVStoreType), "kv_store_type", defaultKVStoreType, help)
 
 	help = fmt.Sprintf("The default timeout when making a kv store request")
-	flag.IntVar(&(cf.KVStoreTimeout), "kv_store_request_timeout", default_KVStoreTimeout, help)
+	flag.IntVar(&(cf.KVStoreTimeout), "kv_store_request_timeout", defaultKVStoreTimeout, help)
 
 	help = fmt.Sprintf("KV store host")
-	flag.StringVar(&(cf.KVStoreHost), "kv_store_host", default_KVStoreHost, help)
+	flag.StringVar(&(cf.KVStoreHost), "kv_store_host", defaultKVStoreHost, help)
 
 	help = fmt.Sprintf("KV store port")
-	flag.IntVar(&(cf.KVStorePort), "kv_store_port", default_KVStorePort, help)
+	flag.IntVar(&(cf.KVStorePort), "kv_store_port", defaultKVStorePort, help)
 
 	help = fmt.Sprintf("The time to wait before deleting a completed transaction key")
-	flag.IntVar(&(cf.KVTxnKeyDelTime), "kv_txn_delete_time", default_KVTxnKeyDelTime, help)
+	flag.IntVar(&(cf.KVTxnKeyDelTime), "kv_txn_delete_time", defaultKVTxnKeyDelTime, help)
 
 	help = fmt.Sprintf("KV store data prefix")
-	flag.StringVar(&(cf.KVStoreDataPrefix), "kv_store_data_prefix", default_KVStoreDataPrefix, help)
+	flag.StringVar(&(cf.KVStoreDataPrefix), "kv_store_data_prefix", defaultKVStoreDataPrefix, help)
 
 	help = fmt.Sprintf("Log level")
-	flag.IntVar(&(cf.LogLevel), "log_level", default_LogLevel, help)
+	flag.IntVar(&(cf.LogLevel), "log_level", defaultLogLevel, help)
 
 	help = fmt.Sprintf("Timeout for long running request")
-	flag.Int64Var(&(cf.LongRunningRequestTimeout), "timeout_long_request", default_LongRunningRequestTimeout, help)
+	flag.Int64Var(&(cf.LongRunningRequestTimeout), "timeout_long_request", defaultLongRunningRequestTimeout, help)
 
 	help = fmt.Sprintf("Default timeout for regular request")
-	flag.Int64Var(&(cf.DefaultRequestTimeout), "timeout_request", default_DefaultRequestTimeout, help)
+	flag.Int64Var(&(cf.DefaultRequestTimeout), "timeout_request", defaultDefaultRequestTimeout, help)
 
 	help = fmt.Sprintf("Default Core timeout")
-	flag.Int64Var(&(cf.DefaultCoreTimeout), "core_timeout", default_CoreTimeout, help)
+	flag.Int64Var(&(cf.DefaultCoreTimeout), "core_timeout", defaultCoreTimeout, help)
 
 	help = fmt.Sprintf("Show startup banner log lines")
-	flag.BoolVar(&cf.Banner, "banner", default_Banner, help)
+	flag.BoolVar(&cf.Banner, "banner", defaultBanner, help)
 
 	help = fmt.Sprintf("Show version information and exit")
-	flag.BoolVar(&cf.DisplayVersionOnly, "version", default_DisplayVersionOnly, help)
+	flag.BoolVar(&cf.DisplayVersionOnly, "version", defaultDisplayVersionOnly, help)
 
 	help = fmt.Sprintf("The name of the meta-key whose value is the rw-core group to which the ofagent is bound")
-	flag.StringVar(&(cf.CoreBindingKey), "core_binding_key", default_CoreBindingKey, help)
+	flag.StringVar(&(cf.CoreBindingKey), "core_binding_key", defaultCoreBindingKey, help)
 
 	help = fmt.Sprintf("Core pairing group topic")
-	flag.StringVar(&cf.CorePairTopic, "core_pair_topic", default_CorePairTopic, help)
+	flag.StringVar(&cf.CorePairTopic, "core_pair_topic", defaultCorePairTopic, help)
 
 	help = fmt.Sprintf("The number of retries to connect to a dependent component")
-	flag.IntVar(&(cf.MaxConnectionRetries), "max_connection_retries", default_MaxConnectionRetries, help)
+	flag.IntVar(&(cf.MaxConnectionRetries), "max_connection_retries", defaultMaxConnectionRetries, help)
 
 	help = fmt.Sprintf("The number of seconds between each connection retry attempt")
-	flag.DurationVar(&(cf.ConnectionRetryInterval), "connection_retry_interval", default_ConnectionRetryInterval, help)
+	flag.DurationVar(&(cf.ConnectionRetryInterval), "connection_retry_interval", defaultConnectionRetryInterval, help)
 
 	help = fmt.Sprintf("The number of seconds between liveness probes while in a live state")
-	flag.DurationVar(&(cf.LiveProbeInterval), "live_probe_interval", default_LiveProbeInterval, help)
+	flag.DurationVar(&(cf.LiveProbeInterval), "live_probe_interval", defaultLiveProbeInterval, help)
 
 	help = fmt.Sprintf("The number of seconds between liveness probes while in a not live state")
-	flag.DurationVar(&(cf.NotLiveProbeInterval), "not_live_probe_interval", default_NotLiveProbeInterval, help)
+	flag.DurationVar(&(cf.NotLiveProbeInterval), "not_live_probe_interval", defaultNotLiveProbeInterval, help)
 
 	help = fmt.Sprintf("The host on which to listen to answer liveness and readiness probe queries over HTTP.")
-	flag.StringVar(&(cf.ProbeHost), "probe_host", default_ProbeHost, help)
+	flag.StringVar(&(cf.ProbeHost), "probe_host", defaultProbeHost, help)
 
 	help = fmt.Sprintf("The port on which to listen to answer liveness and readiness probe queries over HTTP.")
-	flag.IntVar(&(cf.ProbePort), "probe_port", default_ProbePort, help)
+	flag.IntVar(&(cf.ProbePort), "probe_port", defaultProbePort, help)
 
 	flag.Parse()
 }
diff --git a/rw_core/core/adapter_manager.go b/rw_core/core/adapter_manager.go
index aa83b53..493b391 100644
--- a/rw_core/core/adapter_manager.go
+++ b/rw_core/core/adapter_manager.go
@@ -13,26 +13,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
 	"context"
-	"errors"
 	"fmt"
+	"reflect"
+	"sync"
+
 	"github.com/gogo/protobuf/proto"
 	"github.com/opencord/voltha-go/db/model"
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 	"github.com/opencord/voltha-lib-go/v2/pkg/probe"
 	"github.com/opencord/voltha-protos/v2/go/voltha"
-	"reflect"
-	"sync"
 )
 
+// sentinel constants
 const (
-	SENTINEL_ADAPTER_ID    = "adapter_sentinel"
-	SENTINEL_DEVICETYPE_ID = "device_type_sentinel"
+	SentinelAdapterID    = "adapter_sentinel"
+	SentinelDevicetypeID = "device_type_sentinel"
 )
 
+// AdapterAgent represents adapter agent
 type AdapterAgent struct {
 	adapter     *voltha.Adapter
 	deviceTypes map[string]*voltha.DeviceType
@@ -52,14 +55,6 @@
 	return &adapterAgent
 }
 
-// Returns true if this device agent can handle this device Type
-func (aa *AdapterAgent) handlesDeviceType(deviceType string) bool {
-	aa.lock.RLock()
-	defer aa.lock.RUnlock()
-	_, exist := aa.deviceTypes[deviceType]
-	return exist
-}
-
 func (aa *AdapterAgent) getDeviceType(deviceType string) *voltha.DeviceType {
 	aa.lock.RLock()
 	defer aa.lock.RUnlock()
@@ -88,6 +83,7 @@
 	aa.deviceTypes[deviceType.Id] = deviceType
 }
 
+// AdapterManager represents adapter manager attributes
 type AdapterManager struct {
 	adapterAgents               map[string]*AdapterAgent
 	deviceTypeToAdapterMap      map[string]string
@@ -95,16 +91,16 @@
 	adapterProxy                *model.Proxy
 	deviceTypeProxy             *model.Proxy
 	deviceMgr                   *DeviceManager
-	coreInstanceId              string
+	coreInstanceID              string
 	exitChannel                 chan int
 	lockAdaptersMap             sync.RWMutex
 	lockdDeviceTypeToAdapterMap sync.RWMutex
 }
 
-func newAdapterManager(cdProxy *model.Proxy, coreInstanceId string, deviceMgr *DeviceManager) *AdapterManager {
+func newAdapterManager(cdProxy *model.Proxy, coreInstanceID string, deviceMgr *DeviceManager) *AdapterManager {
 	var adapterMgr AdapterManager
 	adapterMgr.exitChannel = make(chan int, 1)
-	adapterMgr.coreInstanceId = coreInstanceId
+	adapterMgr.coreInstanceID = coreInstanceID
 	adapterMgr.clusterDataProxy = cdProxy
 	adapterMgr.adapterAgents = make(map[string]*AdapterAgent)
 	adapterMgr.deviceTypeToAdapterMap = make(map[string]string)
@@ -132,13 +128,6 @@
 	log.Info("adapter-manager-started")
 }
 
-func (aMgr *AdapterManager) stop(ctx context.Context) {
-	log.Info("stopping-device-manager")
-	aMgr.exitChannel <- 1
-	probe.UpdateStatusFromContext(ctx, "adapter-manager", probe.ServiceStatusStopped)
-	log.Info("device-manager-stopped")
-}
-
 //loadAdaptersAndDevicetypesInMemory loads the existing set of adapters and device types in memory
 func (aMgr *AdapterManager) loadAdaptersAndDevicetypesInMemory() {
 	// Load the adapters
@@ -152,7 +141,7 @@
 	} else {
 		log.Debug("no-existing-adapter-found")
 		//	No adapter data.   In order to have a proxy setup for that path let's create a fake adapter
-		aMgr.addAdapter(&voltha.Adapter{Id: SENTINEL_ADAPTER_ID}, true)
+		aMgr.addAdapter(&voltha.Adapter{Id: SentinelAdapterID}, true)
 	}
 
 	// Load the device types
@@ -168,7 +157,7 @@
 	} else {
 		log.Debug("no-existing-device-type-found")
 		//	No device types data.   In order to have a proxy setup for that path let's create a fake device type
-		aMgr.addDeviceTypes(&voltha.DeviceTypes{Items: []*voltha.DeviceType{{Id: SENTINEL_DEVICETYPE_ID, Adapter: SENTINEL_ADAPTER_ID}}}, true)
+		aMgr.addDeviceTypes(&voltha.DeviceTypes{Items: []*voltha.DeviceType{{Id: SentinelDevicetypeID, Adapter: SentinelAdapterID}}}, true)
 	}
 }
 
@@ -180,7 +169,12 @@
 	if adapterAgent, ok := aMgr.adapterAgents[adapter.Id]; ok {
 		if adapterAgent.getAdapter() != nil {
 			// Already registered - Adapter may have restarted.  Trigger the reconcile process for that adapter
-			go aMgr.deviceMgr.adapterRestarted(adapter)
+			go func() {
+				err := aMgr.deviceMgr.adapterRestarted(adapter)
+				if err != nil {
+					log.Errorw("unable-to-restart-adapter", log.Fields{"error": err})
+				}
+			}()
 			return
 		}
 	}
@@ -270,7 +264,7 @@
 	defer aMgr.lockAdaptersMap.RUnlock()
 	for _, adapterAgent := range aMgr.adapterAgents {
 		if a := adapterAgent.getAdapter(); a != nil {
-			if a.Id != SENTINEL_ADAPTER_ID { // don't report the sentinel
+			if a.Id != SentinelAdapterID { // don't report the sentinel
 				result.Items = append(result.Items, (proto.Clone(a)).(*voltha.Adapter))
 			}
 		}
@@ -278,16 +272,10 @@
 	return result, nil
 }
 
-func (aMgr *AdapterManager) deleteAdapter(adapterId string) {
-	aMgr.lockAdaptersMap.Lock()
-	defer aMgr.lockAdaptersMap.Unlock()
-	delete(aMgr.adapterAgents, adapterId)
-}
-
-func (aMgr *AdapterManager) getAdapter(adapterId string) *voltha.Adapter {
+func (aMgr *AdapterManager) getAdapter(adapterID string) *voltha.Adapter {
 	aMgr.lockAdaptersMap.RLock()
 	defer aMgr.lockAdaptersMap.RUnlock()
-	if adapterAgent, ok := aMgr.adapterAgents[adapterId]; ok {
+	if adapterAgent, ok := aMgr.adapterAgents[adapterID]; ok {
 		return adapterAgent.getAdapter()
 	}
 	return nil
@@ -332,8 +320,13 @@
 
 	if aMgr.getAdapter(adapter.Id) != nil {
 		//	Already registered - Adapter may have restarted.  Trigger the reconcile process for that adapter
-		go aMgr.deviceMgr.adapterRestarted(adapter)
-		return &voltha.CoreInstance{InstanceId: aMgr.coreInstanceId}
+		go func() {
+			err := aMgr.deviceMgr.adapterRestarted(adapter)
+			if err != nil {
+				log.Errorw("unable-to-restart-adapter", log.Fields{"error": err})
+			}
+		}()
+		return &voltha.CoreInstance{InstanceId: aMgr.coreInstanceID}
 	}
 	// Save the adapter and the device types
 	aMgr.addAdapter(adapter, true)
@@ -341,17 +334,17 @@
 
 	log.Debugw("adapter-registered", log.Fields{"adapter": adapter.Id})
 
-	return &voltha.CoreInstance{InstanceId: aMgr.coreInstanceId}
+	return &voltha.CoreInstance{InstanceId: aMgr.coreInstanceID}
 }
 
 //getAdapterName returns the name of the device adapter that service this device type
 func (aMgr *AdapterManager) getAdapterName(deviceType string) (string, error) {
 	aMgr.lockdDeviceTypeToAdapterMap.Lock()
 	defer aMgr.lockdDeviceTypeToAdapterMap.Unlock()
-	if adapterId, exist := aMgr.deviceTypeToAdapterMap[deviceType]; exist {
-		return adapterId, nil
+	if adapterID, exist := aMgr.deviceTypeToAdapterMap[deviceType]; exist {
+		return adapterID, nil
 	}
-	return "", errors.New(fmt.Sprintf("Adapter-not-registered-for-device-type %s", deviceType))
+	return "", fmt.Errorf("Adapter-not-registered-for-device-type %s", deviceType)
 }
 
 func (aMgr *AdapterManager) listDeviceTypes() []*voltha.DeviceType {
@@ -359,9 +352,9 @@
 	defer aMgr.lockdDeviceTypeToAdapterMap.Unlock()
 
 	deviceTypes := make([]*voltha.DeviceType, 0, len(aMgr.deviceTypeToAdapterMap))
-	for deviceTypeId, adapterId := range aMgr.deviceTypeToAdapterMap {
-		if adapterAgent, have := aMgr.adapterAgents[adapterId]; have {
-			if deviceType := adapterAgent.getDeviceType(deviceTypeId); deviceType != nil {
+	for deviceTypeID, adapterID := range aMgr.deviceTypeToAdapterMap {
+		if adapterAgent, have := aMgr.adapterAgents[adapterID]; have {
+			if deviceType := adapterAgent.getDeviceType(deviceTypeID); deviceType != nil {
 				deviceTypes = append(deviceTypes, deviceType)
 			}
 		}
@@ -374,8 +367,8 @@
 	aMgr.lockdDeviceTypeToAdapterMap.Lock()
 	defer aMgr.lockdDeviceTypeToAdapterMap.Unlock()
 
-	if adapterId, exist := aMgr.deviceTypeToAdapterMap[deviceType]; exist {
-		if adapterAgent, _ := aMgr.adapterAgents[adapterId]; adapterAgent != nil {
+	if adapterID, exist := aMgr.deviceTypeToAdapterMap[deviceType]; exist {
+		if adapterAgent := aMgr.adapterAgents[adapterID]; adapterAgent != nil {
 			return adapterAgent.getDeviceType(deviceType)
 		}
 	}
diff --git a/rw_core/core/adapter_proxy.go b/rw_core/core/adapter_proxy.go
index b986a0e..c8b28aa 100755
--- a/rw_core/core/adapter_proxy.go
+++ b/rw_core/core/adapter_proxy.go
@@ -13,10 +13,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
 	"context"
+
 	"github.com/golang/protobuf/ptypes"
 	a "github.com/golang/protobuf/ptypes/any"
 	"github.com/opencord/voltha-lib-go/v2/pkg/kafka"
@@ -28,6 +30,7 @@
 	"google.golang.org/grpc/status"
 )
 
+// AdapterProxy represents adapter proxy attributes
 type AdapterProxy struct {
 	TestMode              bool
 	deviceTopicRegistered bool
@@ -35,6 +38,7 @@
 	kafkaICProxy          *kafka.InterContainerProxy
 }
 
+// NewAdapterProxy will return adapter proxy instance
 func NewAdapterProxy(kafkaProxy *kafka.InterContainerProxy, corePairTopic string) *AdapterProxy {
 	return &AdapterProxy{
 		kafkaICProxy:          kafkaProxy,
@@ -43,20 +47,19 @@
 	}
 }
 
-func unPackResponse(rpc string, deviceId string, success bool, response *a.Any) error {
+func unPackResponse(rpc string, deviceID string, success bool, response *a.Any) error {
 	if success {
 		return nil
-	} else {
-		unpackResult := &ic.Error{}
-		var err error
-		if err = ptypes.UnmarshalAny(response, unpackResult); err != nil {
-			log.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
-			return err
-		}
-		log.Debugw("response", log.Fields{"rpc": rpc, "deviceId": deviceId, "success": success, "error": err})
-		// TODO:  Need to get the real error code
-		return status.Errorf(codes.Canceled, "%s", unpackResult.Reason)
 	}
+	unpackResult := &ic.Error{}
+	var err error
+	if err = ptypes.UnmarshalAny(response, unpackResult); err != nil {
+		log.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
+		return err
+	}
+	log.Debugw("response", log.Fields{"rpc": rpc, "deviceId": deviceID, "success": success, "error": err})
+	// TODO:  Need to get the real error code
+	return status.Errorf(codes.Canceled, "%s", unpackResult.Reason)
 }
 
 func (ap *AdapterProxy) getCoreTopic() kafka.Topic {
@@ -67,6 +70,7 @@
 	return kafka.Topic{Name: adapterName}
 }
 
+// AdoptDevice invokes adopt device rpc
 func (ap *AdapterProxy) AdoptDevice(ctx context.Context, device *voltha.Device) error {
 	log.Debugw("AdoptDevice", log.Fields{"device": device})
 	rpc := "adopt_device"
@@ -85,6 +89,7 @@
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// DisableDevice invokes disable device rpc
 func (ap *AdapterProxy) DisableDevice(ctx context.Context, device *voltha.Device) error {
 	log.Debugw("DisableDevice", log.Fields{"deviceId": device.Id})
 	rpc := "disable_device"
@@ -106,6 +111,7 @@
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// ReEnableDevice invokes reenable device rpc
 func (ap *AdapterProxy) ReEnableDevice(ctx context.Context, device *voltha.Device) error {
 	log.Debugw("ReEnableDevice", log.Fields{"deviceId": device.Id})
 	rpc := "reenable_device"
@@ -122,6 +128,7 @@
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// RebootDevice invokes reboot device rpc
 func (ap *AdapterProxy) RebootDevice(ctx context.Context, device *voltha.Device) error {
 	log.Debugw("RebootDevice", log.Fields{"deviceId": device.Id})
 	rpc := "reboot_device"
@@ -138,6 +145,7 @@
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// DeleteDevice invokes delete device rpc
 func (ap *AdapterProxy) DeleteDevice(ctx context.Context, device *voltha.Device) error {
 	log.Debugw("DeleteDevice", log.Fields{"deviceId": device.Id})
 	rpc := "delete_device"
@@ -155,6 +163,7 @@
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// GetOfpDeviceInfo invokes get ofp device info rpc
 func (ap *AdapterProxy) GetOfpDeviceInfo(ctx context.Context, device *voltha.Device) (*ic.SwitchCapability, error) {
 	log.Debugw("GetOfpDeviceInfo", log.Fields{"deviceId": device.Id})
 	toTopic := ap.getAdapterTopic(device.Adapter)
@@ -174,18 +183,18 @@
 			return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error())
 		}
 		return unpackResult, nil
-	} else {
-		unpackResult := &ic.Error{}
-		var err error
-		if err = ptypes.UnmarshalAny(result, unpackResult); err != nil {
-			log.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
-		}
-		log.Debugw("GetOfpDeviceInfo-return", log.Fields{"deviceid": device.Id, "success": success, "error": err})
-		// TODO:  Need to get the real error code
-		return nil, status.Errorf(codes.Internal, "%s", unpackResult.Reason)
 	}
+	unpackResult := &ic.Error{}
+	var err error
+	if err = ptypes.UnmarshalAny(result, unpackResult); err != nil {
+		log.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
+	}
+	log.Debugw("GetOfpDeviceInfo-return", log.Fields{"deviceid": device.Id, "success": success, "error": err})
+	// TODO:  Need to get the real error code
+	return nil, status.Errorf(codes.Internal, "%s", unpackResult.Reason)
 }
 
+// GetOfpPortInfo invokes get ofp port info rpc
 func (ap *AdapterProxy) GetOfpPortInfo(ctx context.Context, device *voltha.Device, portNo uint32) (*ic.PortCapability, error) {
 	log.Debugw("GetOfpPortInfo", log.Fields{"deviceId": device.Id})
 	toTopic := ap.getAdapterTopic(device.Adapter)
@@ -210,35 +219,38 @@
 			return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error())
 		}
 		return unpackResult, nil
-	} else {
-		unpackResult := &ic.Error{}
-		var err error
-		if err = ptypes.UnmarshalAny(result, unpackResult); err != nil {
-			log.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
-		}
-		log.Debugw("GetOfpPortInfo-return", log.Fields{"deviceid": device.Id, "success": success, "error": err})
-		// TODO:  Need to get the real error code
-		return nil, status.Errorf(codes.Internal, "%s", unpackResult.Reason)
 	}
+	unpackResult := &ic.Error{}
+	var err error
+	if err = ptypes.UnmarshalAny(result, unpackResult); err != nil {
+		log.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
+	}
+	log.Debugw("GetOfpPortInfo-return", log.Fields{"deviceid": device.Id, "success": success, "error": err})
+	// TODO:  Need to get the real error code
+	return nil, status.Errorf(codes.Internal, "%s", unpackResult.Reason)
 }
 
 //TODO: Implement the functions below
 
+// AdapterDescriptor - TODO
 func (ap *AdapterProxy) AdapterDescriptor() (*voltha.Adapter, error) {
 	log.Debug("AdapterDescriptor")
 	return nil, nil
 }
 
+// DeviceTypes - TODO
 func (ap *AdapterProxy) DeviceTypes() (*voltha.DeviceType, error) {
 	log.Debug("DeviceTypes")
 	return nil, nil
 }
 
+// Health - TODO
 func (ap *AdapterProxy) Health() (*voltha.HealthStatus, error) {
 	log.Debug("Health")
 	return nil, nil
 }
 
+// ReconcileDevice invokes reconcile device rpc
 func (ap *AdapterProxy) ReconcileDevice(ctx context.Context, device *voltha.Device) error {
 	log.Debugw("ReconcileDevice", log.Fields{"deviceId": device.Id})
 	rpc := "Reconcile_device"
@@ -254,16 +266,19 @@
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// AbandonDevice - TODO
 func (ap *AdapterProxy) AbandonDevice(device voltha.Device) error {
 	log.Debug("AbandonDevice")
 	return nil
 }
 
+// GetDeviceDetails - TODO
 func (ap *AdapterProxy) GetDeviceDetails(device voltha.Device) (*voltha.Device, error) {
 	log.Debug("GetDeviceDetails")
 	return nil, nil
 }
 
+// DownloadImage invokes download image rpc
 func (ap *AdapterProxy) DownloadImage(ctx context.Context, device *voltha.Device, download *voltha.ImageDownload) error {
 	log.Debugw("DownloadImage", log.Fields{"deviceId": device.Id, "image": download.Name})
 	rpc := "download_image"
@@ -285,6 +300,7 @@
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// GetImageDownloadStatus invokes get image download status rpc
 func (ap *AdapterProxy) GetImageDownloadStatus(ctx context.Context, device *voltha.Device, download *voltha.ImageDownload) (*voltha.ImageDownload, error) {
 	log.Debugw("GetImageDownloadStatus", log.Fields{"deviceId": device.Id, "image": download.Name})
 	rpc := "get_image_download_status"
@@ -310,18 +326,18 @@
 			return nil, status.Errorf(codes.InvalidArgument, "%s", err.Error())
 		}
 		return unpackResult, nil
-	} else {
-		unpackResult := &ic.Error{}
-		var err error
-		if err = ptypes.UnmarshalAny(result, unpackResult); err != nil {
-			log.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
-			return nil, err
-		}
-		log.Debugw("GetImageDownloadStatus-return", log.Fields{"deviceid": device.Id, "success": success, "error": err})
-		return nil, status.Errorf(codes.Internal, "%s", unpackResult.Reason)
 	}
+	unpackResult := &ic.Error{}
+	var err error
+	if err = ptypes.UnmarshalAny(result, unpackResult); err != nil {
+		log.Warnw("cannot-unmarshal-response", log.Fields{"error": err})
+		return nil, err
+	}
+	log.Debugw("GetImageDownloadStatus-return", log.Fields{"deviceid": device.Id, "success": success, "error": err})
+	return nil, status.Errorf(codes.Internal, "%s", unpackResult.Reason)
 }
 
+// CancelImageDownload invokes cancel image download rpc
 func (ap *AdapterProxy) CancelImageDownload(ctx context.Context, device *voltha.Device, download *voltha.ImageDownload) error {
 	log.Debugw("CancelImageDownload", log.Fields{"deviceId": device.Id, "image": download.Name})
 	rpc := "cancel_image_download"
@@ -343,6 +359,7 @@
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// ActivateImageUpdate invokes activate image update rpc
 func (ap *AdapterProxy) ActivateImageUpdate(ctx context.Context, device *voltha.Device, download *voltha.ImageDownload) error {
 	log.Debugw("ActivateImageUpdate", log.Fields{"deviceId": device.Id, "image": download.Name})
 	rpc := "activate_image_update"
@@ -364,6 +381,7 @@
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// RevertImageUpdate invokes revert image update rpc
 func (ap *AdapterProxy) RevertImageUpdate(ctx context.Context, device *voltha.Device, download *voltha.ImageDownload) error {
 	log.Debugw("RevertImageUpdate", log.Fields{"deviceId": device.Id, "image": download.Name})
 	rpc := "revert_image_update"
@@ -385,20 +403,21 @@
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// SelfTestDevice - TODO
 func (ap *AdapterProxy) SelfTestDevice(device voltha.Device) (*voltha.SelfTestResponse, error) {
 	log.Debug("SelfTestDevice")
 	return nil, nil
 }
 
-func (ap *AdapterProxy) packetOut(deviceType string, deviceId string, outPort uint32, packet *openflow_13.OfpPacketOut) error {
-	log.Debugw("packetOut", log.Fields{"deviceId": deviceId})
+func (ap *AdapterProxy) packetOut(deviceType string, deviceID string, outPort uint32, packet *openflow_13.OfpPacketOut) error {
+	log.Debugw("packetOut", log.Fields{"deviceId": deviceID})
 	toTopic := ap.getAdapterTopic(deviceType)
 	rpc := "receive_packet_out"
-	dId := &ic.StrType{Val: deviceId}
+	dID := &ic.StrType{Val: deviceID}
 	args := make([]*kafka.KVArg, 3)
 	args[0] = &kafka.KVArg{
 		Key:   "deviceId",
-		Value: dId,
+		Value: dID,
 	}
 	op := &ic.IntType{Val: int64(outPort)}
 	args[1] = &kafka.KVArg{
@@ -413,11 +432,12 @@
 	// TODO:  Do we need to wait for an ACK on a packet Out?
 	// Use a device specific topic as we are the only core handling requests for this device
 	replyToTopic := ap.getCoreTopic()
-	success, result := ap.kafkaICProxy.InvokeRPC(nil, rpc, &toTopic, &replyToTopic, true, deviceId, args...)
-	log.Debugw("packetOut", log.Fields{"deviceid": deviceId, "success": success})
-	return unPackResponse(rpc, deviceId, success, result)
+	success, result := ap.kafkaICProxy.InvokeRPC(context.TODO(), rpc, &toTopic, &replyToTopic, true, deviceID, args...)
+	log.Debugw("packetOut", log.Fields{"deviceid": deviceID, "success": success})
+	return unPackResponse(rpc, deviceID, success, result)
 }
 
+// UpdateFlowsBulk invokes update flows bulk rpc
 func (ap *AdapterProxy) UpdateFlowsBulk(device *voltha.Device, flows *voltha.Flows, groups *voltha.FlowGroups, flowMetadata *voltha.FlowMetadata) error {
 	log.Debugw("UpdateFlowsBulk", log.Fields{"deviceId": device.Id, "flowsInUpdate": len(flows.Items), "groupsToUpdate": len(groups.Items)})
 	toTopic := ap.getAdapterTopic(device.Adapter)
@@ -442,11 +462,12 @@
 
 	// Use a device specific topic as we are the only core handling requests for this device
 	replyToTopic := ap.getCoreTopic()
-	success, result := ap.kafkaICProxy.InvokeRPC(nil, rpc, &toTopic, &replyToTopic, true, device.Id, args...)
+	success, result := ap.kafkaICProxy.InvokeRPC(context.TODO(), rpc, &toTopic, &replyToTopic, true, device.Id, args...)
 	log.Debugw("UpdateFlowsBulk-response", log.Fields{"deviceid": device.Id, "success": success})
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// UpdateFlowsIncremental invokes update flows incremental rpc
 func (ap *AdapterProxy) UpdateFlowsIncremental(device *voltha.Device, flowChanges *openflow_13.FlowChanges, groupChanges *openflow_13.FlowGroupChanges, flowMetadata *voltha.FlowMetadata) error {
 	log.Debugw("UpdateFlowsIncremental",
 		log.Fields{
@@ -479,11 +500,12 @@
 	}
 	// Use a device specific topic as we are the only core handling requests for this device
 	replyToTopic := ap.getCoreTopic()
-	success, result := ap.kafkaICProxy.InvokeRPC(nil, rpc, &toTopic, &replyToTopic, true, device.Id, args...)
+	success, result := ap.kafkaICProxy.InvokeRPC(context.TODO(), rpc, &toTopic, &replyToTopic, true, device.Id, args...)
 	log.Debugw("UpdateFlowsIncremental-response", log.Fields{"deviceid": device.Id, "success": success})
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
+// UpdatePmConfigs invokes update pm configs rpc
 func (ap *AdapterProxy) UpdatePmConfigs(ctx context.Context, device *voltha.Device, pmConfigs *voltha.PmConfigs) error {
 	log.Debugw("UpdatePmConfigs", log.Fields{"deviceId": device.Id})
 	toTopic := ap.getAdapterTopic(device.Adapter)
@@ -499,26 +521,30 @@
 	}
 
 	replyToTopic := ap.getCoreTopic()
-	success, result := ap.kafkaICProxy.InvokeRPC(nil, rpc, &toTopic, &replyToTopic, true, device.Id, args...)
+	success, result := ap.kafkaICProxy.InvokeRPC(context.TODO(), rpc, &toTopic, &replyToTopic, true, device.Id, args...)
 	log.Debugw("UpdatePmConfigs-response", log.Fields{"deviceid": device.Id, "success": success})
 	return unPackResponse(rpc, device.Id, success, result)
 }
 
-func (ap *AdapterProxy) ReceivePacketOut(deviceId voltha.ID, egressPortNo int, msg interface{}) error {
+// ReceivePacketOut - TODO
+func (ap *AdapterProxy) ReceivePacketOut(deviceID voltha.ID, egressPortNo int, msg interface{}) error {
 	log.Debug("ReceivePacketOut")
 	return nil
 }
 
+// SuppressAlarm - TODO
 func (ap *AdapterProxy) SuppressAlarm(filter voltha.AlarmFilter) error {
 	log.Debug("SuppressAlarm")
 	return nil
 }
 
+// UnSuppressAlarm - TODO
 func (ap *AdapterProxy) UnSuppressAlarm(filter voltha.AlarmFilter) error {
 	log.Debug("UnSuppressAlarm")
 	return nil
 }
 
+// SimulateAlarm invokes simulate alarm rpc
 func (ap *AdapterProxy) SimulateAlarm(ctx context.Context, device *voltha.Device, simulatereq *voltha.SimulateAlarmRequest) error {
 	log.Debugw("SimulateAlarm", log.Fields{"id": simulatereq.Id})
 	rpc := "simulate_alarm"
diff --git a/rw_core/core/adapter_proxy_test.go b/rw_core/core/adapter_proxy_test.go
index e6e0ecb..c281f03 100755
--- a/rw_core/core/adapter_proxy_test.go
+++ b/rw_core/core/adapter_proxy_test.go
@@ -18,6 +18,9 @@
 import (
 	"context"
 	"crypto/rand"
+	"testing"
+	"time"
+
 	cm "github.com/opencord/voltha-go/rw_core/mocks"
 	com "github.com/opencord/voltha-lib-go/v2/pkg/adapters/common"
 	"github.com/opencord/voltha-lib-go/v2/pkg/kafka"
@@ -28,14 +31,12 @@
 	"github.com/stretchr/testify/assert"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
-	"testing"
-	"time"
 )
 
 const (
 	coreName       = "rw_core"
 	adapterName    = "adapter_mock"
-	coreInstanceId = "1000"
+	coreInstanceID = "1000"
 )
 
 var (
@@ -47,7 +48,7 @@
 )
 
 func init() {
-	if _, err := log.SetDefaultLogger(log.JSON, 0, log.Fields{"instanceId": coreInstanceId}); err != nil {
+	if _, err := log.SetDefaultLogger(log.JSON, 0, log.Fields{"instanceId": coreInstanceID}); err != nil {
 		log.With(log.Fields{"error": err}).Fatal("Cannot setup logging")
 	}
 	// Set the log level to Warning
@@ -65,17 +66,17 @@
 		log.Fatalw("Failure-creating-core-intercontainerProxy", log.Fields{"error": err})
 
 	}
-	if err := coreKafkaICProxy.Start(); err != nil {
+	if err = coreKafkaICProxy.Start(); err != nil {
 		log.Fatalw("Failure-starting-core-kafka-intercontainerProxy", log.Fields{"error": err})
 	}
-	if err := coreKafkaICProxy.SubscribeWithDefaultRequestHandler(kafka.Topic{Name: coreName}, 0); err != nil {
+	if err = coreKafkaICProxy.SubscribeWithDefaultRequestHandler(kafka.Topic{Name: coreName}, 0); err != nil {
 		log.Fatalw("Failure-subscribing-core-request-handler", log.Fields{"error": err})
 	}
 
 	// Setup adapter inter-container proxy and adapter request handler
 	adapterCoreProxy := com.NewCoreProxy(nil, adapterName, coreName)
 	adapter = cm.NewAdapter(adapterCoreProxy)
-	adapterReqHandler = com.NewRequestHandlerProxy(coreInstanceId, adapter, adapterCoreProxy)
+	adapterReqHandler = com.NewRequestHandlerProxy(coreInstanceID, adapter, adapterCoreProxy)
 	if adapterKafkaICProxy, err = kafka.NewInterContainerProxy(
 		kafka.MsgClient(kc),
 		kafka.DefaultTopic(&kafka.Topic{Name: adapterName}),
diff --git a/rw_core/core/adapter_request_handler.go b/rw_core/core/adapter_request_handler.go
index f1f17c8..8f43643 100644
--- a/rw_core/core/adapter_request_handler.go
+++ b/rw_core/core/adapter_request_handler.go
@@ -13,10 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
+	"context"
 	"errors"
+
 	"github.com/golang/protobuf/ptypes"
 	"github.com/golang/protobuf/ptypes/empty"
 	"github.com/opencord/voltha-go/db/model"
@@ -29,9 +32,10 @@
 	"google.golang.org/grpc/status"
 )
 
+// AdapterRequestHandlerProxy represent adapter request handler proxy attributes
 type AdapterRequestHandlerProxy struct {
 	TestMode                  bool
-	coreInstanceId            string
+	coreInstanceID            string
 	deviceMgr                 *DeviceManager
 	lDeviceMgr                *LogicalDeviceManager
 	adapterMgr                *AdapterManager
@@ -43,12 +47,13 @@
 	core                      *Core
 }
 
-func NewAdapterRequestHandlerProxy(core *Core, coreInstanceId string, dMgr *DeviceManager, ldMgr *LogicalDeviceManager,
+// NewAdapterRequestHandlerProxy assigns values for adapter request handler proxy attributes and returns the new instance
+func NewAdapterRequestHandlerProxy(core *Core, coreInstanceID string, dMgr *DeviceManager, ldMgr *LogicalDeviceManager,
 	aMgr *AdapterManager, cdProxy *model.Proxy, ldProxy *model.Proxy, incompetingMode bool, longRunningRequestTimeout int64,
 	defaultRequestTimeout int64) *AdapterRequestHandlerProxy {
 	var proxy AdapterRequestHandlerProxy
 	proxy.core = core
-	proxy.coreInstanceId = coreInstanceId
+	proxy.coreInstanceID = coreInstanceID
 	proxy.deviceMgr = dMgr
 	proxy.lDeviceMgr = ldMgr
 	proxy.clusterDataProxy = cdProxy
@@ -61,22 +66,22 @@
 }
 
 // This is a helper function that attempts to acquire the request by using the device ownership model
-func (rhp *AdapterRequestHandlerProxy) takeRequestOwnership(transactionId string, devId string, maxTimeout ...int64) (*KVTransaction, error) {
+func (rhp *AdapterRequestHandlerProxy) takeRequestOwnership(transactionID string, devID string, maxTimeout ...int64) (*KVTransaction, error) {
 	timeout := rhp.defaultRequestTimeout
 	if len(maxTimeout) > 0 {
 		timeout = maxTimeout[0]
 	}
-	txn := NewKVTransaction(transactionId)
+	txn := NewKVTransaction(transactionID)
 	if txn == nil {
 		return nil, errors.New("fail-to-create-transaction")
 	}
 
 	var acquired bool
 	var err error
-	if devId != "" {
+	if devID != "" {
 		var ownedByMe bool
-		if ownedByMe, err = rhp.core.deviceOwnership.OwnedByMe(&utils.DeviceID{Id: devId}); err != nil {
-			log.Warnw("getting-ownership-failed", log.Fields{"deviceId": devId, "error": err})
+		if ownedByMe, err = rhp.core.deviceOwnership.OwnedByMe(&utils.DeviceID{ID: devID}); err != nil {
+			log.Warnw("getting-ownership-failed", log.Fields{"deviceId": devID, "error": err})
 			return nil, kafka.ErrorTransactionInvalidId
 		}
 		acquired, err = txn.Acquired(timeout, ownedByMe)
@@ -84,12 +89,11 @@
 		acquired, err = txn.Acquired(timeout)
 	}
 	if err == nil && acquired {
-		log.Debugw("transaction-acquired", log.Fields{"transactionId": txn.txnId})
+		log.Debugw("transaction-acquired", log.Fields{"transactionId": txn.txnID})
 		return txn, nil
-	} else {
-		log.Debugw("transaction-not-acquired", log.Fields{"transactionId": txn.txnId, "error": err})
-		return nil, kafka.ErrorTransactionNotAcquired
 	}
+	log.Debugw("transaction-not-acquired", log.Fields{"transactionId": txn.txnID, "error": err})
+	return nil, kafka.ErrorTransactionNotAcquired
 }
 
 // competeForTransaction is a helper function to determine whether every request needs to compete with another
@@ -98,6 +102,7 @@
 	return rhp.coreInCompetingMode
 }
 
+// Register registers the adapter
 func (rhp *AdapterRequestHandlerProxy) Register(args []*ic.Argument) (*voltha.CoreInstance, error) {
 	if len(args) < 3 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
@@ -106,7 +111,7 @@
 	}
 	adapter := &voltha.Adapter{}
 	deviceTypes := &voltha.DeviceTypes{}
-	transactionId := &ic.StrType{}
+	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "adapter":
@@ -120,26 +125,26 @@
 				return nil, err
 			}
 		case kafka.TransactionKey:
-			if err := ptypes.UnmarshalAny(arg.Value, transactionId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, transactionID); err != nil {
 				log.Warnw("cannot-unmarshal-transaction-ID", log.Fields{"error": err})
 				return nil, err
 			}
 		}
 	}
-	log.Debugw("Register", log.Fields{"Adapter": *adapter, "DeviceTypes": deviceTypes, "transactionId": transactionId.Val, "coreId": rhp.coreInstanceId})
+	log.Debugw("Register", log.Fields{"Adapter": *adapter, "DeviceTypes": deviceTypes, "transactionID": transactionID.Val, "coreID": rhp.coreInstanceID})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionId.Val, ""); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, "")
+		if err != nil {
 			if err.Error() == kafka.ErrorTransactionNotAcquired.Error() {
-				log.Debugw("Another core handled the request", log.Fields{"transactionId": transactionId})
+				log.Debugw("Another core handled the request", log.Fields{"transactionId": transactionID})
 				// Update our adapters in memory
 				go rhp.adapterMgr.updateAdaptersAndDevicetypesInMemory(adapter)
 			}
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
@@ -148,6 +153,7 @@
 	return rhp.adapterMgr.registerAdapter(adapter, deviceTypes), nil
 }
 
+// GetDevice returns device info
 func (rhp *AdapterRequestHandlerProxy) GetDevice(args []*ic.Argument) (*voltha.Device, error) {
 	if len(args) < 2 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
@@ -171,16 +177,16 @@
 			}
 		}
 	}
-	log.Debugw("GetDevice", log.Fields{"deviceId": pID.Id, "transactionID": transactionID.Val})
+	log.Debugw("GetDevice", log.Fields{"deviceID": pID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, pID.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, pID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
@@ -188,14 +194,15 @@
 	}
 
 	// Get the device via the device manager
-	if device, err := rhp.deviceMgr.GetDevice(pID.Id); err != nil {
+	device, err := rhp.deviceMgr.GetDevice(pID.Id)
+	if err != nil {
 		return nil, status.Errorf(codes.NotFound, "%s", err.Error())
-	} else {
-		log.Debugw("GetDevice-response", log.Fields{"deviceId": pID.Id})
-		return device, nil
 	}
+	log.Debugw("GetDevice-response", log.Fields{"deviceID": pID.Id})
+	return device, nil
 }
 
+// DeviceUpdate updates device using adapter data
 func (rhp *AdapterRequestHandlerProxy) DeviceUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
@@ -219,26 +226,32 @@
 			}
 		}
 	}
-	log.Debugw("DeviceUpdate", log.Fields{"deviceId": device.Id, "transactionID": transactionID.Val})
+	log.Debugw("DeviceUpdate", log.Fields{"deviceID": device.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, device.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, device.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
-	log.Debugw("DeviceUpdate got txn", log.Fields{"deviceId": device.Id, "transactionID": transactionID.Val})
+	log.Debugw("DeviceUpdate got txn", log.Fields{"deviceID": device.Id, "transactionID": transactionID.Val})
 	if rhp.TestMode { // Execute only for test cases
 		return new(empty.Empty), nil
 	}
-	go rhp.deviceMgr.updateDeviceUsingAdapterData(device)
+	go func() {
+		err := rhp.deviceMgr.updateDeviceUsingAdapterData(device)
+		if err != nil {
+			log.Errorw("unable-to-update-device-using-adapter-data", log.Fields{"error": err})
+		}
+	}()
 	return new(empty.Empty), nil
 }
 
+// GetChildDevice returns details of child device
 func (rhp *AdapterRequestHandlerProxy) GetChildDevice(args []*ic.Argument) (*voltha.Device, error) {
 	if len(args) < 3 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
@@ -249,7 +262,7 @@
 	pID := &voltha.ID{}
 	transactionID := &ic.StrType{}
 	serialNumber := &ic.StrType{}
-	onuId := &ic.IntType{}
+	onuID := &ic.IntType{}
 	parentPortNo := &ic.IntType{}
 	for _, arg := range args {
 		switch arg.Key {
@@ -264,7 +277,7 @@
 				return nil, err
 			}
 		case "onu_id":
-			if err := ptypes.UnmarshalAny(arg.Value, onuId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, onuID); err != nil {
 				log.Warnw("cannot-unmarshal-ID", log.Fields{"error": err})
 				return nil, err
 			}
@@ -280,24 +293,25 @@
 			}
 		}
 	}
-	log.Debugw("GetChildDevice", log.Fields{"parentDeviceId": pID.Id, "args": args, "transactionID": transactionID.Val})
+	log.Debugw("GetChildDevice", log.Fields{"parentDeviceID": pID.Id, "args": args, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, pID.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, pID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
 		return &voltha.Device{Id: pID.Id}, nil
 	}
-	return rhp.deviceMgr.GetChildDevice(pID.Id, serialNumber.Val, onuId.Val, parentPortNo.Val)
+	return rhp.deviceMgr.GetChildDevice(pID.Id, serialNumber.Val, onuID.Val, parentPortNo.Val)
 }
 
+// GetChildDeviceWithProxyAddress returns details of child device with proxy address
 func (rhp *AdapterRequestHandlerProxy) GetChildDeviceWithProxyAddress(args []*ic.Argument) (*voltha.Device, error) {
 	if len(args) < 2 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
@@ -325,12 +339,12 @@
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, proxyAddress.DeviceId); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, proxyAddress.DeviceId)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
@@ -339,19 +353,20 @@
 	return rhp.deviceMgr.GetChildDeviceWithProxyAddress(proxyAddress)
 }
 
+// GetPorts returns the ports information of the device based on the port type.
 func (rhp *AdapterRequestHandlerProxy) GetPorts(args []*ic.Argument) (*voltha.Ports, error) {
 	if len(args) < 3 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	deviceId := &voltha.ID{}
+	deviceID := &voltha.ID{}
 	pt := &ic.IntType{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, deviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -367,7 +382,7 @@
 			}
 		}
 	}
-	log.Debugw("GetPorts", log.Fields{"deviceID": deviceId.Id, "portype": pt.Val, "transactionID": transactionID.Val})
+	log.Debugw("GetPorts", log.Fields{"deviceID": deviceID.Id, "portype": pt.Val, "transactionID": transactionID.Val})
 	if rhp.TestMode { // Execute only for test cases
 		aPort := &voltha.Port{Label: "test_port"}
 		allPorts := &voltha.Ports{}
@@ -376,17 +391,18 @@
 	}
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
-	return rhp.deviceMgr.getPorts(nil, deviceId.Id, voltha.Port_PortType(pt.Val))
+	return rhp.deviceMgr.getPorts(context.TODO(), deviceID.Id, voltha.Port_PortType(pt.Val))
 }
 
+// GetChildDevices gets all the child device IDs from the device passed as parameter
 func (rhp *AdapterRequestHandlerProxy) GetChildDevices(args []*ic.Argument) (*voltha.Devices, error) {
 	if len(args) < 2 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
@@ -410,16 +426,16 @@
 			}
 		}
 	}
-	log.Debugw("GetChildDevices", log.Fields{"deviceId": pID.Id, "transactionID": transactionID.Val})
+	log.Debugw("GetChildDevices", log.Fields{"deviceID": pID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, pID.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, pID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
@@ -442,11 +458,11 @@
 	pID := &voltha.ID{}
 	portNo := &ic.IntType{}
 	dt := &ic.StrType{}
-	chnlId := &ic.IntType{}
+	chnlID := &ic.IntType{}
 	transactionID := &ic.StrType{}
 	serialNumber := &ic.StrType{}
-	vendorId := &ic.StrType{}
-	onuId := &ic.IntType{}
+	vendorID := &ic.StrType{}
+	onuID := &ic.IntType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "parent_device_id":
@@ -465,12 +481,12 @@
 				return nil, err
 			}
 		case "channel_id":
-			if err := ptypes.UnmarshalAny(arg.Value, chnlId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, chnlID); err != nil {
 				log.Warnw("cannot-unmarshal-channel-id", log.Fields{"error": err})
 				return nil, err
 			}
 		case "vendor_id":
-			if err := ptypes.UnmarshalAny(arg.Value, vendorId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, vendorID); err != nil {
 				log.Warnw("cannot-unmarshal-vendor-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -480,7 +496,7 @@
 				return nil, err
 			}
 		case "onu_id":
-			if err := ptypes.UnmarshalAny(arg.Value, onuId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, onuID); err != nil {
 				log.Warnw("cannot-unmarshal-onu-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -491,46 +507,47 @@
 			}
 		}
 	}
-	log.Debugw("ChildDeviceDetected", log.Fields{"parentDeviceId": pID.Id, "parentPortNo": portNo.Val,
-		"deviceType": dt.Val, "channelId": chnlId.Val, "serialNumber": serialNumber.Val,
-		"vendorId": vendorId.Val, "onuId": onuId.Val, "transactionID": transactionID.Val})
+	log.Debugw("ChildDeviceDetected", log.Fields{"parentDeviceID": pID.Id, "parentPortNo": portNo.Val,
+		"deviceType": dt.Val, "channelID": chnlID.Val, "serialNumber": serialNumber.Val,
+		"vendorID": vendorID.Val, "onuID": onuID.Val, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, pID.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, pID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
 		return nil, nil
 	}
-	device, err := rhp.deviceMgr.childDeviceDetected(pID.Id, portNo.Val, dt.Val, chnlId.Val, vendorId.Val, serialNumber.Val, onuId.Val)
+	device, err := rhp.deviceMgr.childDeviceDetected(pID.Id, portNo.Val, dt.Val, chnlID.Val, vendorID.Val, serialNumber.Val, onuID.Val)
 	if err != nil {
-		log.Errorw("child-detection-failed", log.Fields{"parentId": pID.Id, "onuId": onuId.Val, "error": err})
+		log.Errorw("child-detection-failed", log.Fields{"parentID": pID.Id, "onuID": onuID.Val, "error": err})
 		return nil, err
 	}
 
 	return device, nil
 }
 
+// DeviceStateUpdate updates device status
 func (rhp *AdapterRequestHandlerProxy) DeviceStateUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 3 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	deviceId := &voltha.ID{}
+	deviceID := &voltha.ID{}
 	operStatus := &ic.IntType{}
 	connStatus := &ic.IntType{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, deviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -551,43 +568,49 @@
 			}
 		}
 	}
-	log.Debugw("DeviceStateUpdate", log.Fields{"deviceId": deviceId.Id, "oper-status": operStatus,
+	log.Debugw("DeviceStateUpdate", log.Fields{"deviceID": deviceID.Id, "oper-status": operStatus,
 		"conn-status": connStatus, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
 		return nil, nil
 	}
 	// When the enum is not set (i.e. -1), Go still convert to the Enum type with the value being -1
-	go rhp.deviceMgr.updateDeviceStatus(deviceId.Id, voltha.OperStatus_OperStatus(operStatus.Val),
-		voltha.ConnectStatus_ConnectStatus(connStatus.Val))
+	go func() {
+		err := rhp.deviceMgr.updateDeviceStatus(deviceID.Id, voltha.OperStatus_OperStatus(operStatus.Val),
+			voltha.ConnectStatus_ConnectStatus(connStatus.Val))
+		if err != nil {
+			log.Errorw("unable-to-update-device-status", log.Fields{"error": err})
+		}
+	}()
 
 	return new(empty.Empty), nil
 }
 
+// ChildrenStateUpdate updates child device status
 func (rhp *AdapterRequestHandlerProxy) ChildrenStateUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 3 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	deviceId := &voltha.ID{}
+	deviceID := &voltha.ID{}
 	operStatus := &ic.IntType{}
 	connStatus := &ic.IntType{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, deviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -608,17 +631,17 @@
 			}
 		}
 	}
-	log.Debugw("ChildrenStateUpdate", log.Fields{"deviceId": deviceId.Id, "oper-status": operStatus,
+	log.Debugw("ChildrenStateUpdate", log.Fields{"deviceID": deviceID.Id, "oper-status": operStatus,
 		"conn-status": connStatus, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
@@ -626,29 +649,35 @@
 	}
 
 	// When the enum is not set (i.e. -1), Go still convert to the Enum type with the value being -1
-	go rhp.deviceMgr.updateChildrenStatus(deviceId.Id, voltha.OperStatus_OperStatus(operStatus.Val),
-		voltha.ConnectStatus_ConnectStatus(connStatus.Val))
+	go func() {
+		err := rhp.deviceMgr.updateChildrenStatus(deviceID.Id, voltha.OperStatus_OperStatus(operStatus.Val),
+			voltha.ConnectStatus_ConnectStatus(connStatus.Val))
+		if err != nil {
+			log.Errorw("unable-to-update-children-status", log.Fields{"error": err})
+		}
+	}()
 
-	//if err := rhp.deviceMgr.updateChildrenStatus(deviceId.Id, voltha.OperStatus_OperStatus(operStatus.Val),
+	//if err := rhp.deviceMgr.updateChildrenStatus(deviceID.ID, voltha.OperStatus_OperStatus(operStatus.Val),
 	//	voltha.ConnectStatus_ConnectStatus(connStatus.Val)); err != nil {
 	//	return nil, err
 	//}
 	return new(empty.Empty), nil
 }
 
+// PortsStateUpdate updates the ports state related to the device
 func (rhp *AdapterRequestHandlerProxy) PortsStateUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	deviceId := &voltha.ID{}
+	deviceID := &voltha.ID{}
 	operStatus := &ic.IntType{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, deviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -664,34 +693,40 @@
 			}
 		}
 	}
-	log.Debugw("PortsStateUpdate", log.Fields{"deviceId": deviceId.Id, "operStatus": operStatus, "transactionID": transactionID.Val})
+	log.Debugw("PortsStateUpdate", log.Fields{"deviceID": deviceID.Id, "operStatus": operStatus, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
 		return nil, nil
 	}
 
-	go rhp.deviceMgr.updatePortsState(deviceId.Id, voltha.OperStatus_OperStatus(operStatus.Val))
+	go func() {
+		err := rhp.deviceMgr.updatePortsState(deviceID.Id, voltha.OperStatus_OperStatus(operStatus.Val))
+		if err != nil {
+			log.Errorw("unable-to-update-ports-state", log.Fields{"error": err})
+		}
+	}()
 
 	return new(empty.Empty), nil
 }
 
+// PortStateUpdate updates the port state of the device
 func (rhp *AdapterRequestHandlerProxy) PortStateUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 3 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	deviceId := &voltha.ID{}
+	deviceID := &voltha.ID{}
 	portType := &ic.IntType{}
 	portNo := &ic.IntType{}
 	operStatus := &ic.IntType{}
@@ -699,7 +734,7 @@
 	for _, arg := range args {
 		switch arg.Key {
 		case "device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, deviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -725,45 +760,51 @@
 			}
 		}
 	}
-	log.Debugw("PortStateUpdate", log.Fields{"deviceId": deviceId.Id, "operStatus": operStatus,
+	log.Debugw("PortStateUpdate", log.Fields{"deviceID": deviceID.Id, "operStatus": operStatus,
 		"portType": portType, "portNo": portNo, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
 		return nil, nil
 	}
 
-	go rhp.deviceMgr.updatePortState(deviceId.Id, voltha.Port_PortType(portType.Val), uint32(portNo.Val),
-		voltha.OperStatus_OperStatus(operStatus.Val))
+	go func() {
+		err := rhp.deviceMgr.updatePortState(deviceID.Id, voltha.Port_PortType(portType.Val), uint32(portNo.Val),
+			voltha.OperStatus_OperStatus(operStatus.Val))
+		if err != nil {
+			log.Errorw("unable-to-update-port-state", log.Fields{"error": err})
+		}
+	}()
 
-	//if err := rhp.deviceMgr.updatePortState(deviceId.Id, voltha.Port_PortType(portType.Val), uint32(portNo.Val),
+	//if err := rhp.deviceMgr.updatePortState(deviceID.ID, voltha.Port_PortType(portType.Val), uint32(portNo.Val),
 	//	voltha.OperStatus_OperStatus(operStatus.Val)); err != nil {
 	//	return nil, err
 	//}
 	return new(empty.Empty), nil
 }
 
+// DeleteAllPorts deletes all ports of device
 func (rhp *AdapterRequestHandlerProxy) DeleteAllPorts(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 3 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	deviceId := &voltha.ID{}
+	deviceID := &voltha.ID{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, deviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -774,39 +815,46 @@
 			}
 		}
 	}
-	log.Debugw("DeleteAllPorts", log.Fields{"deviceId": deviceId.Id, "transactionID": transactionID.Val})
+	log.Debugw("DeleteAllPorts", log.Fields{"deviceID": deviceID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
 		return nil, nil
 	}
 
-	go rhp.deviceMgr.deleteAllPorts(deviceId.Id)
+	go func() {
+		err := rhp.deviceMgr.deleteAllPorts(deviceID.Id)
+		if err != nil {
+			log.Errorw("unable-to-delete-ports", log.Fields{"error": err})
+		}
+	}()
 
 	return new(empty.Empty), nil
 }
 
+// ChildDevicesLost indicates that a parent device is in a state (Disabled) where it cannot manage the child devices.
+// This will trigger the Core to disable all the child devices.
 func (rhp *AdapterRequestHandlerProxy) ChildDevicesLost(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	parentDeviceId := &voltha.ID{}
+	parentDeviceID := &voltha.ID{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "parent_device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, parentDeviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, parentDeviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -817,39 +865,46 @@
 			}
 		}
 	}
-	log.Debugw("ChildDevicesLost", log.Fields{"deviceId": parentDeviceId.Id, "transactionID": transactionID.Val})
+	log.Debugw("ChildDevicesLost", log.Fields{"deviceID": parentDeviceID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, parentDeviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, parentDeviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
 		return nil, nil
 	}
 
-	go rhp.deviceMgr.childDevicesLost(parentDeviceId.Id)
+	go func() {
+		err := rhp.deviceMgr.childDevicesLost(parentDeviceID.Id)
+		if err != nil {
+			log.Errorw("unable-to-disable-child-devices", log.Fields{"error": err})
+		}
+	}()
 
 	return new(empty.Empty), nil
 }
 
+// ChildDevicesDetected invoked by an adapter when child devices are found, typically after after a disable/enable sequence.
+// This will trigger the Core to Enable all the child devices of that parent.
 func (rhp *AdapterRequestHandlerProxy) ChildDevicesDetected(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	parentDeviceId := &voltha.ID{}
+	parentDeviceID := &voltha.ID{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "parent_device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, parentDeviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, parentDeviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -860,43 +915,44 @@
 			}
 		}
 	}
-	log.Debugw("ChildDevicesDetected", log.Fields{"deviceId": parentDeviceId.Id, "transactionID": transactionID.Val})
+	log.Debugw("ChildDevicesDetected", log.Fields{"deviceID": parentDeviceID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, parentDeviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, parentDeviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
 		return nil, nil
 	}
 
-	if err := rhp.deviceMgr.childDevicesDetected(parentDeviceId.Id); err != nil {
-		log.Errorw("child-devices-dection-failed", log.Fields{"parentId": parentDeviceId.Id, "error": err})
+	if err := rhp.deviceMgr.childDevicesDetected(parentDeviceID.Id); err != nil {
+		log.Errorw("child-devices-dection-failed", log.Fields{"parentID": parentDeviceID.Id, "error": err})
 		return nil, err
 	}
 
 	return new(empty.Empty), nil
 }
 
+// PortCreated adds port to device
 func (rhp *AdapterRequestHandlerProxy) PortCreated(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 3 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	deviceId := &voltha.ID{}
+	deviceID := &voltha.ID{}
 	port := &voltha.Port{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, deviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -912,26 +968,32 @@
 			}
 		}
 	}
-	log.Debugw("PortCreated", log.Fields{"deviceId": deviceId.Id, "port": port, "transactionID": transactionID.Val})
+	log.Debugw("PortCreated", log.Fields{"deviceID": deviceID.Id, "port": port, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
 		return nil, nil
 	}
-	go rhp.deviceMgr.addPort(deviceId.Id, port)
+	go func() {
+		err := rhp.deviceMgr.addPort(deviceID.Id, port)
+		if err != nil {
+			log.Errorw("unable-to-add-port", log.Fields{"error": err})
+		}
+	}()
 
 	return new(empty.Empty), nil
 }
 
+// DevicePMConfigUpdate initializes the pm configs as defined by the adapter.
 func (rhp *AdapterRequestHandlerProxy) DevicePMConfigUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
@@ -954,42 +1016,48 @@
 			}
 		}
 	}
-	log.Debugw("DevicePMConfigUpdate", log.Fields{"deviceId": pmConfigs.Id, "configs": pmConfigs,
+	log.Debugw("DevicePMConfigUpdate", log.Fields{"deviceID": pmConfigs.Id, "configs": pmConfigs,
 		"transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, pmConfigs.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, pmConfigs.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
 		return nil, nil
 	}
 
-	go rhp.deviceMgr.initPmConfigs(pmConfigs.Id, pmConfigs)
+	go func() {
+		err := rhp.deviceMgr.initPmConfigs(pmConfigs.Id, pmConfigs)
+		if err != nil {
+			log.Errorw("unable-to-initialize-pm-configs", log.Fields{"error": err})
+		}
+	}()
 
 	return new(empty.Empty), nil
 }
 
+// PacketIn sends the incoming packet of device
 func (rhp *AdapterRequestHandlerProxy) PacketIn(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 4 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	deviceId := &voltha.ID{}
+	deviceID := &voltha.ID{}
 	portNo := &ic.IntType{}
 	packet := &ic.Packet{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, deviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -1010,41 +1078,47 @@
 			}
 		}
 	}
-	log.Debugw("PacketIn", log.Fields{"deviceId": deviceId.Id, "port": portNo.Val, "packet": packet,
+	log.Debugw("PacketIn", log.Fields{"deviceID": deviceID.Id, "port": portNo.Val, "packet": packet,
 		"transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	// TODO: If this adds too much latencies then needs to remove transaction and let OFAgent filter out
 	// duplicates.
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 	if rhp.TestMode { // Execute only for test cases
 		return nil, nil
 	}
-	go rhp.deviceMgr.PacketIn(deviceId.Id, uint32(portNo.Val), transactionID.Val, packet.Payload)
+	go func() {
+		err := rhp.deviceMgr.PacketIn(deviceID.Id, uint32(portNo.Val), transactionID.Val, packet.Payload)
+		if err != nil {
+			log.Errorw("unable-to-receive-packet-from-adapter", log.Fields{"error": err})
+		}
+	}()
 
 	return new(empty.Empty), nil
 }
 
+// UpdateImageDownload updates image download
 func (rhp *AdapterRequestHandlerProxy) UpdateImageDownload(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	deviceId := &voltha.ID{}
+	deviceID := &voltha.ID{}
 	img := &voltha.ImageDownload{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, deviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -1060,41 +1134,47 @@
 			}
 		}
 	}
-	log.Debugw("UpdateImageDownload", log.Fields{"deviceId": deviceId.Id, "image-download": img,
+	log.Debugw("UpdateImageDownload", log.Fields{"deviceID": deviceID.Id, "image-download": img,
 		"transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
 		return nil, nil
 	}
-	go rhp.deviceMgr.updateImageDownload(deviceId.Id, img)
-	//if err := rhp.deviceMgr.updateImageDownload(deviceId.Id, img); err != nil {
+	go func() {
+		err := rhp.deviceMgr.updateImageDownload(deviceID.Id, img)
+		if err != nil {
+			log.Errorw("unable-to-update-image-download", log.Fields{"error": err})
+		}
+	}()
+	//if err := rhp.deviceMgr.updateImageDownload(deviceID.ID, img); err != nil {
 	//	return nil, err
 	//}
 	return new(empty.Empty), nil
 }
 
+// ReconcileChildDevices reconciles child devices
 func (rhp *AdapterRequestHandlerProxy) ReconcileChildDevices(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
 		log.Warn("invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("invalid-number-of-args")
 		return nil, err
 	}
-	parentDeviceId := &voltha.ID{}
+	parentDeviceID := &voltha.ID{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "parent_device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, parentDeviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, parentDeviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -1105,16 +1185,16 @@
 			}
 		}
 	}
-	log.Debugw("ReconcileChildDevices", log.Fields{"deviceId": parentDeviceId.Id, "transactionID": transactionID.Val})
+	log.Debugw("ReconcileChildDevices", log.Fields{"deviceID": parentDeviceID.Id, "transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, parentDeviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, parentDeviceID.Id)
+		if err != nil {
 			log.Debugw("Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
@@ -1122,24 +1202,30 @@
 	}
 
 	// Run it in its own routine
-	go rhp.deviceMgr.reconcileChildDevices(parentDeviceId.Id)
+	go func() {
+		err := rhp.deviceMgr.reconcileChildDevices(parentDeviceID.Id)
+		if err != nil {
+			log.Errorw("unable-to-reconcile-child-devices", log.Fields{"error": err})
+		}
+	}()
 
 	return new(empty.Empty), nil
 }
 
+// DeviceReasonUpdate updates device reason
 func (rhp *AdapterRequestHandlerProxy) DeviceReasonUpdate(args []*ic.Argument) (*empty.Empty, error) {
 	if len(args) < 2 {
 		log.Warn("DeviceReasonUpdate: invalid-number-of-args", log.Fields{"args": args})
 		err := errors.New("DeviceReasonUpdate: invalid-number-of-args")
 		return nil, err
 	}
-	deviceId := &voltha.ID{}
+	deviceID := &voltha.ID{}
 	reason := &ic.StrType{}
 	transactionID := &ic.StrType{}
 	for _, arg := range args {
 		switch arg.Key {
 		case "device_id":
-			if err := ptypes.UnmarshalAny(arg.Value, deviceId); err != nil {
+			if err := ptypes.UnmarshalAny(arg.Value, deviceID); err != nil {
 				log.Warnw("cannot-unmarshal-device-id", log.Fields{"error": err})
 				return nil, err
 			}
@@ -1155,17 +1241,17 @@
 			}
 		}
 	}
-	log.Debugw("DeviceReasonUpdate", log.Fields{"deviceId": deviceId.Id, "reason": reason.Val,
+	log.Debugw("DeviceReasonUpdate", log.Fields{"deviceId": deviceID.Id, "reason": reason.Val,
 		"transactionID": transactionID.Val})
 
 	// Try to grab the transaction as this core may be competing with another Core
 	if rhp.competeForTransaction() {
-		if txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceId.Id); err != nil {
+		txn, err := rhp.takeRequestOwnership(transactionID.Val, deviceID.Id)
+		if err != nil {
 			log.Debugw("DeviceReasonUpdate: Core did not process request", log.Fields{"transactionID": transactionID, "error": err})
 			return nil, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	if rhp.TestMode { // Execute only for test cases
@@ -1173,7 +1259,12 @@
 	}
 
 	// Run it in its own routine
-	go rhp.deviceMgr.updateDeviceReason(deviceId.Id, reason.Val)
+	go func() {
+		err := rhp.deviceMgr.updateDeviceReason(deviceID.Id, reason.Val)
+		if err != nil {
+			log.Errorw("unable-to-update-device-reason", log.Fields{"error": err})
+		}
+	}()
 
 	return new(empty.Empty), nil
 }
diff --git a/rw_core/core/core.go b/rw_core/core/core.go
index 047ef4a..ef08402 100644
--- a/rw_core/core/core.go
+++ b/rw_core/core/core.go
@@ -13,10 +13,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
 	"context"
+	"time"
+
 	"github.com/opencord/voltha-go/db/model"
 	"github.com/opencord/voltha-go/rw_core/config"
 	"github.com/opencord/voltha-lib-go/v2/pkg/db"
@@ -29,11 +32,11 @@
 	"google.golang.org/grpc"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
-	"time"
 )
 
+// Core represent read,write core attributes
 type Core struct {
-	instanceId        string
+	instanceID        string
 	deviceMgr         *DeviceManager
 	logicalDeviceMgr  *LogicalDeviceManager
 	grpcServer        *grpcserver.GrpcServer
@@ -53,12 +56,16 @@
 }
 
 func init() {
-	log.AddPackage(log.JSON, log.WarnLevel, nil)
+	_, err := log.AddPackage(log.JSON, log.WarnLevel, nil)
+	if err != nil {
+		log.Errorw("unable-to-register-package-to-the-log-map", log.Fields{"error": err})
+	}
 }
 
+// NewCore creates instance of rw core
 func NewCore(id string, cf *config.RWCoreFlags, kvClient kvstore.Client, kafkaClient kafka.Client) *Core {
 	var core Core
-	core.instanceId = id
+	core.instanceID = id
 	core.exitChannel = make(chan int, 1)
 	core.config = cf
 	core.kvClient = kvClient
@@ -84,6 +91,7 @@
 	return &core
 }
 
+// Start brings up core services
 func (core *Core) Start(ctx context.Context) {
 
 	// If the context has a probe then fetch it and register our services
@@ -102,7 +110,7 @@
 		}
 	}
 
-	log.Info("starting-core-services", log.Fields{"coreId": core.instanceId})
+	log.Info("starting-core-services", log.Fields{"coreId": core.instanceID})
 
 	// Wait until connection to KV Store is up
 	if err := core.waitUntilKVStoreReachableOrMaxTries(ctx, core.config.MaxConnectionRetries, core.config.ConnectionRetryInterval); err != nil {
@@ -120,7 +128,7 @@
 
 	log.Debugw("values", log.Fields{"kmp": core.kmp})
 	core.deviceMgr = newDeviceManager(core)
-	core.adapterMgr = newAdapterManager(core.clusterDataProxy, core.instanceId, core.deviceMgr)
+	core.adapterMgr = newAdapterManager(core.clusterDataProxy, core.instanceID, core.deviceMgr)
 	core.deviceMgr.adapterMgr = core.adapterMgr
 	core.logicalDeviceMgr = newLogicalDeviceManager(core, core.deviceMgr, core.kmp, core.clusterDataProxy, core.config.DefaultCoreTimeout)
 
@@ -140,12 +148,13 @@
 	go core.monitorKvstoreLiveness(ctx)
 
 	// Setup device ownership context
-	core.deviceOwnership = NewDeviceOwnership(core.instanceId, core.kvClient, core.deviceMgr, core.logicalDeviceMgr,
+	core.deviceOwnership = NewDeviceOwnership(core.instanceID, core.kvClient, core.deviceMgr, core.logicalDeviceMgr,
 		"service/voltha/owns_device", 10)
 
 	log.Info("core-services-started")
 }
 
+// Stop brings down core services
 func (core *Core) Stop(ctx context.Context) {
 	log.Info("stopping-adaptercore")
 	if core.exitChannel != nil {
@@ -231,13 +240,13 @@
 /*
  * KafkaMonitorThread
  *
- * Repsonsible for starting the Kafka Interadapter Proxy and monitoring its liveness
+ * Responsible for starting the Kafka Interadapter Proxy and monitoring its liveness
  * state.
  *
  * Any producer that fails to send will cause KafkaInterContainerProxy to
  * post a false event on its liveness channel. Any producer that succeeds in sending
  * will cause KafkaInterContainerProxy to post a true event on its liveness
- * channel. Group recievers also update liveness state, and a receiver will typically
+ * channel. Group receivers also update liveness state, and a receiver will typically
  * indicate a loss of liveness within 3-5 seconds of Kafka going down. Receivers
  * only indicate restoration of liveness if a message is received. During normal
  * operation, messages will be routinely produced and received, automatically
@@ -281,7 +290,7 @@
 			log.Infow("started-kafka-proxy", log.Fields{})
 
 			// cannot do this until after the kmp is started
-			if err := core.registerAdapterRequestHandlers(ctx, core.instanceId, core.deviceMgr, core.logicalDeviceMgr, core.adapterMgr, core.clusterDataProxy, core.localDataProxy); err != nil {
+			if err := core.registerAdapterRequestHandlers(ctx, core.instanceID, core.deviceMgr, core.logicalDeviceMgr, core.adapterMgr, core.clusterDataProxy, core.localDataProxy); err != nil {
 				log.Fatal("Failure-registering-adapterRequestHandler")
 			}
 
@@ -357,7 +366,7 @@
 					return status.Error(codes.Unavailable, "kv store unreachable")
 				}
 			}
-			count += 1
+			count++
 			//	Take a nap before retrying
 			time.Sleep(retryInterval)
 			log.Infow("retry-KV-store-connectivity", log.Fields{"retryCount": count, "maxRetries": maxRetries, "retryInterval": retryInterval})
@@ -370,10 +379,10 @@
 	return nil
 }
 
-func (core *Core) registerAdapterRequestHandlers(ctx context.Context, coreInstanceId string, dMgr *DeviceManager,
+func (core *Core) registerAdapterRequestHandlers(ctx context.Context, coreInstanceID string, dMgr *DeviceManager,
 	ldMgr *LogicalDeviceManager, aMgr *AdapterManager, cdProxy *model.Proxy, ldProxy *model.Proxy,
 ) error {
-	requestProxy := NewAdapterRequestHandlerProxy(core, coreInstanceId, dMgr, ldMgr, aMgr, cdProxy, ldProxy,
+	requestProxy := NewAdapterRequestHandlerProxy(core, coreInstanceID, dMgr, ldMgr, aMgr, cdProxy, ldProxy,
 		core.config.InCompetingMode, core.config.LongRunningRequestTimeout, core.config.DefaultRequestTimeout)
 
 	// Register the broadcast topic to handle any core-bound broadcast requests
diff --git a/rw_core/core/device_agent.go b/rw_core/core/device_agent.go
index 9dd41fb..0f4c177 100755
--- a/rw_core/core/device_agent.go
+++ b/rw_core/core/device_agent.go
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
@@ -35,9 +36,10 @@
 	"google.golang.org/grpc/status"
 )
 
+// DeviceAgent represents device agent attributes
 type DeviceAgent struct {
-	deviceId         string
-	parentId         string
+	deviceID         string
+	parentID         string
 	deviceType       string
 	isRootdevice     bool
 	adapterProxy     *AdapterProxy
@@ -55,13 +57,13 @@
 	var agent DeviceAgent
 	agent.adapterProxy = ap
 	if device.Id == "" {
-		agent.deviceId = CreateDeviceId()
+		agent.deviceID = CreateDeviceID()
 	} else {
-		agent.deviceId = device.Id
+		agent.deviceID = device.Id
 	}
 
 	agent.isRootdevice = device.Root
-	agent.parentId = device.ParentId
+	agent.parentID = device.ParentId
 	agent.deviceType = device.Type
 	agent.deviceMgr = deviceMgr
 	agent.adapterMgr = deviceMgr.adapterMgr
@@ -74,36 +76,36 @@
 
 // start()
 // save the device to the data model and registers for callbacks on that device if deviceToCreate!=nil.  Otherwise,
-// it will load the data from the dB and setup teh necessary callbacks and proxies. Returns the device that
+// it will load the data from the dB and setup the necessary callbacks and proxies. Returns the device that
 // was started.
 func (agent *DeviceAgent) start(ctx context.Context, deviceToCreate *voltha.Device) (*voltha.Device, error) {
 	var device *voltha.Device
 
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("starting-device-agent", log.Fields{"deviceId": agent.deviceId})
+	log.Debugw("starting-device-agent", log.Fields{"deviceId": agent.deviceID})
 	if deviceToCreate == nil {
 		// Load the existing device
-		if loadedDevice := agent.clusterDataProxy.Get(ctx, "/devices/"+agent.deviceId, 1, true, ""); loadedDevice != nil {
+		if loadedDevice := agent.clusterDataProxy.Get(ctx, "/devices/"+agent.deviceID, 1, true, ""); loadedDevice != nil {
 			var ok bool
 			if device, ok = loadedDevice.(*voltha.Device); ok {
 				agent.deviceType = device.Adapter
 			} else {
-				log.Errorw("failed-to-convert-device", log.Fields{"deviceId": agent.deviceId})
-				return nil, status.Errorf(codes.NotFound, "device-%s", agent.deviceId)
+				log.Errorw("failed-to-convert-device", log.Fields{"deviceId": agent.deviceID})
+				return nil, status.Errorf(codes.NotFound, "device-%s", agent.deviceID)
 			}
 		} else {
-			log.Errorw("failed-to-load-device", log.Fields{"deviceId": agent.deviceId})
-			return nil, status.Errorf(codes.NotFound, "device-%s", agent.deviceId)
+			log.Errorw("failed-to-load-device", log.Fields{"deviceId": agent.deviceID})
+			return nil, status.Errorf(codes.NotFound, "device-%s", agent.deviceID)
 		}
-		log.Debugw("device-loaded-from-dB", log.Fields{"deviceId": agent.deviceId})
+		log.Debugw("device-loaded-from-dB", log.Fields{"deviceId": agent.deviceID})
 	} else {
 		// Create a new device
 		// Assumption is that AdminState, FlowGroups, and Flows are unitialized since this
 		// is a new device, so populate them here before passing the device to clusterDataProxy.AddWithId.
 		// agent.deviceId will also have been set during newDeviceAgent().
 		device = (proto.Clone(deviceToCreate)).(*voltha.Device)
-		device.Id = agent.deviceId
+		device.Id = agent.deviceID
 		device.AdminState = voltha.AdminState_PREPROVISIONED
 		device.FlowGroups = &ofp.FlowGroups{Items: nil}
 		device.Flows = &ofp.Flows{Items: nil}
@@ -114,16 +116,16 @@
 		}
 
 		// Add the initial device to the local model
-		if added := agent.clusterDataProxy.AddWithID(ctx, "/devices", agent.deviceId, device, ""); added == nil {
-			log.Errorw("failed-to-add-device", log.Fields{"deviceId": agent.deviceId})
-			return nil, status.Errorf(codes.Aborted, "failed-adding-device-%s", agent.deviceId)
+		if added := agent.clusterDataProxy.AddWithID(ctx, "/devices", agent.deviceID, device, ""); added == nil {
+			log.Errorw("failed-to-add-device", log.Fields{"deviceId": agent.deviceID})
+			return nil, status.Errorf(codes.Aborted, "failed-adding-device-%s", agent.deviceID)
 		}
 	}
 
-	agent.deviceProxy = agent.clusterDataProxy.CreateProxy(ctx, "/devices/"+agent.deviceId, false)
+	agent.deviceProxy = agent.clusterDataProxy.CreateProxy(ctx, "/devices/"+agent.deviceID, false)
 	agent.deviceProxy.RegisterCallback(model.POST_UPDATE, agent.processUpdate)
 
-	log.Debugw("device-agent-started", log.Fields{"deviceId": agent.deviceId})
+	log.Debugw("device-agent-started", log.Fields{"deviceId": agent.deviceID})
 	return device, nil
 }
 
@@ -133,8 +135,8 @@
 	defer agent.lockDevice.Unlock()
 	log.Debug("stopping-device-agent")
 	//	Remove the device from the KV store
-	if removed := agent.clusterDataProxy.Remove(ctx, "/devices/"+agent.deviceId, ""); removed == nil {
-		log.Debugw("device-already-removed", log.Fields{"id": agent.deviceId})
+	if removed := agent.clusterDataProxy.Remove(ctx, "/devices/"+agent.deviceID, ""); removed == nil {
+		log.Debugw("device-already-removed", log.Fields{"id": agent.deviceID})
 	}
 	agent.exitChannel <- 1
 	log.Debug("device-agent-stopped")
@@ -147,10 +149,10 @@
 	defer agent.lockDevice.Unlock()
 	log.Debug("reconciling-device-agent-devicetype")
 	// TODO: context timeout
-	if device := agent.clusterDataProxy.Get(context.Background(), "/devices/"+agent.deviceId, 1, true, ""); device != nil {
+	if device := agent.clusterDataProxy.Get(context.Background(), "/devices/"+agent.deviceID, 1, true, ""); device != nil {
 		if d, ok := device.(*voltha.Device); ok {
 			agent.deviceType = d.Adapter
-			log.Debugw("reconciled-device-agent-devicetype", log.Fields{"Id": agent.deviceId, "type": agent.deviceType})
+			log.Debugw("reconciled-device-agent-devicetype", log.Fields{"Id": agent.deviceID, "type": agent.deviceType})
 		}
 	}
 }
@@ -159,81 +161,81 @@
 func (agent *DeviceAgent) getDevice() (*voltha.Device, error) {
 	agent.lockDevice.RLock()
 	defer agent.lockDevice.RUnlock()
-	if device := agent.clusterDataProxy.Get(context.Background(), "/devices/"+agent.deviceId, 0, false, ""); device != nil {
+	if device := agent.clusterDataProxy.Get(context.Background(), "/devices/"+agent.deviceID, 0, false, ""); device != nil {
 		if d, ok := device.(*voltha.Device); ok {
 			cloned := proto.Clone(d).(*voltha.Device)
 			return cloned, nil
 		}
 	}
-	return nil, status.Errorf(codes.NotFound, "device-%s", agent.deviceId)
+	return nil, status.Errorf(codes.NotFound, "device-%s", agent.deviceID)
 }
 
 // getDeviceWithoutLock is a helper function to be used ONLY by any device agent function AFTER it has acquired the device lock.
 // This function is meant so that we do not have duplicate code all over the device agent functions
 func (agent *DeviceAgent) getDeviceWithoutLock() (*voltha.Device, error) {
-	if device := agent.clusterDataProxy.Get(context.Background(), "/devices/"+agent.deviceId, 0, false, ""); device != nil {
+	if device := agent.clusterDataProxy.Get(context.Background(), "/devices/"+agent.deviceID, 0, false, ""); device != nil {
 		if d, ok := device.(*voltha.Device); ok {
 			cloned := proto.Clone(d).(*voltha.Device)
 			return cloned, nil
 		}
 	}
-	return nil, status.Errorf(codes.NotFound, "device-%s", agent.deviceId)
+	return nil, status.Errorf(codes.NotFound, "device-%s", agent.deviceID)
 }
 
 // enableDevice activates a preprovisioned or a disable device
 func (agent *DeviceAgent) enableDevice(ctx context.Context) error {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("enableDevice", log.Fields{"id": agent.deviceId})
+	log.Debugw("enableDevice", log.Fields{"id": agent.deviceID})
 
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
+	}
+	// First figure out which adapter will handle this device type.  We do it at this stage as allow devices to be
+	// pre-provisionned with the required adapter not registered.   At this stage, since we need to communicate
+	// with the adapter then we need to know the adapter that will handle this request
+	adapterName, err := agent.adapterMgr.getAdapterName(device.Type)
+	if err != nil {
+		log.Warnw("no-adapter-registered-for-device-type", log.Fields{"deviceType": device.Type, "deviceAdapter": device.Adapter})
+		return err
+	}
+	device.Adapter = adapterName
+
+	if device.AdminState == voltha.AdminState_ENABLED {
+		log.Debugw("device-already-enabled", log.Fields{"id": agent.deviceID})
+		return nil
+	}
+
+	if device.AdminState == voltha.AdminState_DELETED {
+		// This is a temporary state when a device is deleted before it gets removed from the model.
+		err = status.Error(codes.FailedPrecondition, fmt.Sprintf("cannot-enable-a-deleted-device: %s ", device.Id))
+		log.Warnw("invalid-state", log.Fields{"id": agent.deviceID, "state": device.AdminState, "error": err})
+		return err
+	}
+
+	previousAdminState := device.AdminState
+
+	// Update the Admin State and set the operational state to activating before sending the request to the
+	// Adapters
+	cloned := proto.Clone(device).(*voltha.Device)
+	cloned.AdminState = voltha.AdminState_ENABLED
+	cloned.OperStatus = voltha.OperStatus_ACTIVATING
+
+	if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
+		return err
+	}
+
+	// Adopt the device if it was in preprovision state.  In all other cases, try to reenable it.
+	if previousAdminState == voltha.AdminState_PREPROVISIONED {
+		if err := agent.adapterProxy.AdoptDevice(ctx, device); err != nil {
+			log.Debugw("adoptDevice-error", log.Fields{"id": agent.deviceID, "error": err})
+			return err
+		}
 	} else {
-		// First figure out which adapter will handle this device type.  We do it at this stage as allow devices to be
-		// pre-provisionned with the required adapter not registered.   At this stage, since we need to communicate
-		// with the adapter then we need to know the adapter that will handle this request
-		if adapterName, err := agent.adapterMgr.getAdapterName(device.Type); err != nil {
-			log.Warnw("no-adapter-registered-for-device-type", log.Fields{"deviceType": device.Type, "deviceAdapter": device.Adapter})
+		if err := agent.adapterProxy.ReEnableDevice(ctx, device); err != nil {
+			log.Debugw("renableDevice-error", log.Fields{"id": agent.deviceID, "error": err})
 			return err
-		} else {
-			device.Adapter = adapterName
-		}
-
-		if device.AdminState == voltha.AdminState_ENABLED {
-			log.Debugw("device-already-enabled", log.Fields{"id": agent.deviceId})
-			return nil
-		}
-
-		if device.AdminState == voltha.AdminState_DELETED {
-			// This is a temporary state when a device is deleted before it gets removed from the model.
-			err = status.Error(codes.FailedPrecondition, fmt.Sprintf("cannot-enable-a-deleted-device: %s ", device.Id))
-			log.Warnw("invalid-state", log.Fields{"id": agent.deviceId, "state": device.AdminState, "error": err})
-			return err
-		}
-
-		previousAdminState := device.AdminState
-
-		// Update the Admin State and set the operational state to activating before sending the request to the
-		// Adapters
-		cloned := proto.Clone(device).(*voltha.Device)
-		cloned.AdminState = voltha.AdminState_ENABLED
-		cloned.OperStatus = voltha.OperStatus_ACTIVATING
-
-		if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
-			return err
-		}
-
-		// Adopt the device if it was in preprovision state.  In all other cases, try to reenable it.
-		if previousAdminState == voltha.AdminState_PREPROVISIONED {
-			if err := agent.adapterProxy.AdoptDevice(ctx, device); err != nil {
-				log.Debugw("adoptDevice-error", log.Fields{"id": agent.deviceId, "error": err})
-				return err
-			}
-		} else {
-			if err := agent.adapterProxy.ReEnableDevice(ctx, device); err != nil {
-				log.Debugw("renableDevice-error", log.Fields{"id": agent.deviceId, "error": err})
-				return err
-			}
 		}
 	}
 	return nil
@@ -241,7 +243,7 @@
 
 func (agent *DeviceAgent) sendBulkFlowsToAdapters(device *voltha.Device, flows *voltha.Flows, groups *voltha.FlowGroups, flowMetadata *voltha.FlowMetadata, response coreutils.Response) {
 	if err := agent.adapterProxy.UpdateFlowsBulk(device, flows, groups, flowMetadata); err != nil {
-		log.Debugw("update-flow-bulk-error", log.Fields{"id": agent.deviceId, "error": err})
+		log.Debugw("update-flow-bulk-error", log.Fields{"id": agent.deviceID, "error": err})
 		response.Error(err)
 	}
 	response.Done()
@@ -249,7 +251,7 @@
 
 func (agent *DeviceAgent) sendIncrementalFlowsToAdapters(device *voltha.Device, flows *ofp.FlowChanges, groups *ofp.FlowGroupChanges, flowMetadata *voltha.FlowMetadata, response coreutils.Response) {
 	if err := agent.adapterProxy.UpdateFlowsIncremental(device, flows, groups, flowMetadata); err != nil {
-		log.Debugw("update-flow-incremental-error", log.Fields{"id": agent.deviceId, "error": err})
+		log.Debugw("update-flow-incremental-error", log.Fields{"id": agent.deviceID, "error": err})
 		response.Error(err)
 	}
 	response.Done()
@@ -258,10 +260,10 @@
 //addFlowsAndGroups adds the "newFlows" and "newGroups" from the existing flows/groups and sends the update to the
 //adapters
 func (agent *DeviceAgent) addFlowsAndGroups(newFlows []*ofp.OfpFlowStats, newGroups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("addFlowsAndGroups", log.Fields{"deviceId": agent.deviceId, "flows": newFlows, "groups": newGroups, "flowMetadata": flowMetadata})
+	log.Debugw("addFlowsAndGroups", log.Fields{"deviceId": agent.deviceID, "flows": newFlows, "groups": newGroups, "flowMetadata": flowMetadata})
 
 	if (len(newFlows) | len(newGroups)) == 0 {
-		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceId, "flows": newFlows, "groups": newGroups})
+		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceID, "flows": newFlows, "groups": newGroups})
 		return nil
 	}
 
@@ -271,7 +273,7 @@
 	var device *voltha.Device
 	var err error
 	if device, err = agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
 
 	existingFlows := proto.Clone(device.Flows).(*voltha.Flows)
@@ -283,9 +285,7 @@
 	var updatedGroups []*ofp.OfpGroupEntry
 
 	// Process flows
-	for _, flow := range newFlows {
-		updatedFlows = append(updatedFlows, flow)
-	}
+	updatedFlows = append(updatedFlows, newFlows...)
 	for _, flow := range existingFlows.Items {
 		if idx := fu.FindFlows(newFlows, flow); idx == -1 {
 			updatedFlows = append(updatedFlows, flow)
@@ -295,9 +295,7 @@
 	}
 
 	// Process groups
-	for _, g := range newGroups {
-		updatedGroups = append(updatedGroups, g)
-	}
+	updatedGroups = append(updatedGroups, newGroups...)
 	for _, group := range existingGroups.Items {
 		if fu.FindGroup(newGroups, group.Desc.GroupId) == -1 { // does not exist now
 			updatedGroups = append(updatedGroups, group)
@@ -308,7 +306,7 @@
 
 	// Sanity check
 	if (len(updatedFlows) | len(flowsToDelete) | len(updatedGroups) | len(groupsToDelete)) == 0 {
-		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceId, "flows": newFlows, "groups": newGroups})
+		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceID, "flows": newFlows, "groups": newGroups})
 		return nil
 	}
 
@@ -322,7 +320,7 @@
 	if !dType.AcceptsAddRemoveFlowUpdates {
 
 		if len(updatedGroups) != 0 && reflect.DeepEqual(existingGroups.Items, updatedGroups) && len(updatedFlows) != 0 && reflect.DeepEqual(existingFlows.Items, updatedFlows) {
-			log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceId, "flows": newFlows, "groups": newGroups})
+			log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceID, "flows": newFlows, "groups": newGroups})
 			return nil
 		}
 		go agent.sendBulkFlowsToAdapters(device, &voltha.Flows{Items: updatedFlows}, &voltha.FlowGroups{Items: updatedGroups}, flowMetadata, response)
@@ -344,7 +342,7 @@
 	device.Flows = &voltha.Flows{Items: updatedFlows}
 	device.FlowGroups = &voltha.FlowGroups{Items: updatedGroups}
 	if err := agent.updateDeviceWithoutLock(device); err != nil {
-		return status.Errorf(codes.Internal, "failure-updating-%s", agent.deviceId)
+		return status.Errorf(codes.Internal, "failure-updating-%s", agent.deviceID)
 	}
 
 	if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, response); res != nil {
@@ -358,10 +356,10 @@
 //deleteFlowsAndGroups removes the "flowsToDel" and "groupsToDel" from the existing flows/groups and sends the update to the
 //adapters
 func (agent *DeviceAgent) deleteFlowsAndGroups(flowsToDel []*ofp.OfpFlowStats, groupsToDel []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("deleteFlowsAndGroups", log.Fields{"deviceId": agent.deviceId, "flows": flowsToDel, "groups": groupsToDel})
+	log.Debugw("deleteFlowsAndGroups", log.Fields{"deviceId": agent.deviceID, "flows": flowsToDel, "groups": groupsToDel})
 
 	if (len(flowsToDel) | len(groupsToDel)) == 0 {
-		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceId, "flows": flowsToDel, "groups": groupsToDel})
+		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceID, "flows": flowsToDel, "groups": groupsToDel})
 		return nil
 	}
 
@@ -372,7 +370,7 @@
 	var err error
 
 	if device, err = agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
 
 	existingFlows := proto.Clone(device.Flows).(*voltha.Flows)
@@ -397,7 +395,7 @@
 
 	log.Debugw("deleteFlowsAndGroups",
 		log.Fields{
-			"deviceId":     agent.deviceId,
+			"deviceId":     agent.deviceID,
 			"flowsToDel":   len(flowsToDel),
 			"flowsToKeep":  len(flowsToKeep),
 			"groupsToDel":  len(groupsToDel),
@@ -406,7 +404,7 @@
 
 	// Sanity check
 	if (len(flowsToKeep) | len(flowsToDel) | len(groupsToKeep) | len(groupsToDel)) == 0 {
-		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceId, "flowsToDel": flowsToDel, "groupsToDel": groupsToDel})
+		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceID, "flowsToDel": flowsToDel, "groupsToDel": groupsToDel})
 		return nil
 	}
 
@@ -415,7 +413,7 @@
 	dType := agent.adapterMgr.getDeviceType(device.Type)
 	if !dType.AcceptsAddRemoveFlowUpdates {
 		if len(groupsToKeep) != 0 && reflect.DeepEqual(existingGroups.Items, groupsToKeep) && len(flowsToKeep) != 0 && reflect.DeepEqual(existingFlows.Items, flowsToKeep) {
-			log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceId, "flowsToDel": flowsToDel, "groupsToDel": groupsToDel})
+			log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceID, "flowsToDel": flowsToDel, "groupsToDel": groupsToDel})
 			return nil
 		}
 		go agent.sendBulkFlowsToAdapters(device, &voltha.Flows{Items: flowsToKeep}, &voltha.FlowGroups{Items: groupsToKeep}, flowMetadata, response)
@@ -436,7 +434,7 @@
 	device.Flows = &voltha.Flows{Items: flowsToKeep}
 	device.FlowGroups = &voltha.FlowGroups{Items: groupsToKeep}
 	if err := agent.updateDeviceWithoutLock(device); err != nil {
-		return status.Errorf(codes.Internal, "failure-updating-%s", agent.deviceId)
+		return status.Errorf(codes.Internal, "failure-updating-%s", agent.deviceID)
 	}
 
 	if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, response); res != nil {
@@ -449,10 +447,10 @@
 //updateFlowsAndGroups replaces the existing flows and groups with "updatedFlows" and "updatedGroups" respectively. It
 //also sends the updates to the adapters
 func (agent *DeviceAgent) updateFlowsAndGroups(updatedFlows []*ofp.OfpFlowStats, updatedGroups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("updateFlowsAndGroups", log.Fields{"deviceId": agent.deviceId, "flows": updatedFlows, "groups": updatedGroups})
+	log.Debugw("updateFlowsAndGroups", log.Fields{"deviceId": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
 
 	if (len(updatedFlows) | len(updatedGroups)) == 0 {
-		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceId, "flows": updatedFlows, "groups": updatedGroups})
+		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
 		return nil
 	}
 
@@ -461,19 +459,19 @@
 	var device *voltha.Device
 	var err error
 	if device, err = agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
 	existingFlows := proto.Clone(device.Flows).(*voltha.Flows)
 	existingGroups := proto.Clone(device.FlowGroups).(*ofp.FlowGroups)
 
 	if len(updatedGroups) != 0 && reflect.DeepEqual(existingGroups.Items, updatedGroups) && len(updatedFlows) != 0 && reflect.DeepEqual(existingFlows.Items, updatedFlows) {
-		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceId, "flows": updatedFlows, "groups": updatedGroups})
+		log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
 		return nil
 	}
 
 	log.Debugw("updating-flows-and-groups",
 		log.Fields{
-			"deviceId":      agent.deviceId,
+			"deviceId":      agent.deviceID,
 			"updatedFlows":  updatedFlows,
 			"updatedGroups": updatedGroups,
 		})
@@ -516,7 +514,7 @@
 
 		log.Debugw("updating-flows-and-groups",
 			log.Fields{
-				"deviceId":       agent.deviceId,
+				"deviceId":       agent.deviceID,
 				"flowsToAdd":     flowsToAdd,
 				"flowsToDelete":  flowsToDelete,
 				"groupsToAdd":    groupsToAdd,
@@ -525,7 +523,7 @@
 
 		// Sanity check
 		if (len(flowsToAdd) | len(flowsToDelete) | len(groupsToAdd) | len(groupsToDelete) | len(updatedGroups)) == 0 {
-			log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceId, "flows": updatedFlows, "groups": updatedGroups})
+			log.Debugw("nothing-to-update", log.Fields{"deviceId": agent.deviceID, "flows": updatedFlows, "groups": updatedGroups})
 			return nil
 		}
 
@@ -545,7 +543,7 @@
 	device.Flows = &voltha.Flows{Items: updatedFlows}
 	device.FlowGroups = &voltha.FlowGroups{Items: updatedGroups}
 	if err := agent.updateDeviceWithoutLock(device); err != nil {
-		return status.Errorf(codes.Internal, "failure-updating-%s", agent.deviceId)
+		return status.Errorf(codes.Internal, "failure-updating-%s", agent.deviceID)
 	}
 
 	if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, response); res != nil {
@@ -558,33 +556,33 @@
 func (agent *DeviceAgent) disableDevice(ctx context.Context) error {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("disableDevice", log.Fields{"id": agent.deviceId})
+	log.Debugw("disableDevice", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		if device.AdminState == voltha.AdminState_DISABLED {
-			log.Debugw("device-already-disabled", log.Fields{"id": agent.deviceId})
-			return nil
-		}
-		if device.AdminState == voltha.AdminState_PREPROVISIONED ||
-			device.AdminState == voltha.AdminState_DELETED {
-			log.Debugw("device-not-enabled", log.Fields{"id": agent.deviceId})
-			return status.Errorf(codes.FailedPrecondition, "deviceId:%s, invalid-admin-state:%s", agent.deviceId, device.AdminState)
-		}
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
+	}
+	if device.AdminState == voltha.AdminState_DISABLED {
+		log.Debugw("device-already-disabled", log.Fields{"id": agent.deviceID})
+		return nil
+	}
+	if device.AdminState == voltha.AdminState_PREPROVISIONED ||
+		device.AdminState == voltha.AdminState_DELETED {
+		log.Debugw("device-not-enabled", log.Fields{"id": agent.deviceID})
+		return status.Errorf(codes.FailedPrecondition, "deviceId:%s, invalid-admin-state:%s", agent.deviceID, device.AdminState)
+	}
 
-		// Update the Admin State and operational state before sending the request out
-		cloned := proto.Clone(device).(*voltha.Device)
-		cloned.AdminState = voltha.AdminState_DISABLED
-		cloned.OperStatus = voltha.OperStatus_UNKNOWN
-		if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
-			return err
-		}
+	// Update the Admin State and operational state before sending the request out
+	cloned := proto.Clone(device).(*voltha.Device)
+	cloned.AdminState = voltha.AdminState_DISABLED
+	cloned.OperStatus = voltha.OperStatus_UNKNOWN
+	if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
+		return err
+	}
 
-		if err := agent.adapterProxy.DisableDevice(ctx, device); err != nil {
-			log.Debugw("disableDevice-error", log.Fields{"id": agent.deviceId, "error": err})
-			return err
-		}
+	if err := agent.adapterProxy.DisableDevice(ctx, device); err != nil {
+		log.Debugw("disableDevice-error", log.Fields{"id": agent.deviceID, "error": err})
+		return err
 	}
 	return nil
 }
@@ -592,21 +590,21 @@
 func (agent *DeviceAgent) updateAdminState(adminState voltha.AdminState_AdminState) error {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("updateAdminState", log.Fields{"id": agent.deviceId})
+	log.Debugw("updateAdminState", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		if device.AdminState == adminState {
-			log.Debugw("no-change-needed", log.Fields{"id": agent.deviceId, "state": adminState})
-			return nil
-		}
-		// Received an Ack (no error found above).  Now update the device in the model to the expected state
-		cloned := proto.Clone(device).(*voltha.Device)
-		cloned.AdminState = adminState
-		if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
-			return err
-		}
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
+	}
+	if device.AdminState == adminState {
+		log.Debugw("no-change-needed", log.Fields{"id": agent.deviceID, "state": adminState})
+		return nil
+	}
+	// Received an Ack (no error found above).  Now update the device in the model to the expected state
+	cloned := proto.Clone(device).(*voltha.Device)
+	cloned.AdminState = adminState
+	if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
+		return err
 	}
 	return nil
 }
@@ -614,15 +612,15 @@
 func (agent *DeviceAgent) rebootDevice(ctx context.Context) error {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("rebootDevice", log.Fields{"id": agent.deviceId})
+	log.Debugw("rebootDevice", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		if err := agent.adapterProxy.RebootDevice(ctx, device); err != nil {
-			log.Debugw("rebootDevice-error", log.Fields{"id": agent.deviceId, "error": err})
-			return err
-		}
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
+	}
+	if err := agent.adapterProxy.RebootDevice(ctx, device); err != nil {
+		log.Debugw("rebootDevice-error", log.Fields{"id": agent.deviceID, "error": err})
+		return err
 	}
 	return nil
 }
@@ -630,59 +628,64 @@
 func (agent *DeviceAgent) deleteDevice(ctx context.Context) error {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("deleteDevice", log.Fields{"id": agent.deviceId})
+	log.Debugw("deleteDevice", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		if device.AdminState == voltha.AdminState_DELETED {
-			log.Debugw("device-already-in-deleted-state", log.Fields{"id": agent.deviceId})
-			return nil
-		}
-		if (device.AdminState != voltha.AdminState_DISABLED) &&
-			(device.AdminState != voltha.AdminState_PREPROVISIONED) {
-			log.Debugw("device-not-disabled", log.Fields{"id": agent.deviceId})
-			//TODO:  Needs customized error message
-			return status.Errorf(codes.FailedPrecondition, "deviceId:%s, expected-admin-state:%s", agent.deviceId, voltha.AdminState_DISABLED)
-		}
-		if device.AdminState != voltha.AdminState_PREPROVISIONED {
-			// Send the request to an Adapter only if the device is not in poreporovision state and wait for a response
-			if err := agent.adapterProxy.DeleteDevice(ctx, device); err != nil {
-				log.Debugw("deleteDevice-error", log.Fields{"id": agent.deviceId, "error": err})
-				return err
-			}
-		}
-		//	Set the state to deleted after we recieve an Ack - this will trigger some background process to clean up
-		//	the device as well as its association with the logical device
-		cloned := proto.Clone(device).(*voltha.Device)
-		cloned.AdminState = voltha.AdminState_DELETED
-		if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
+	}
+	if device.AdminState == voltha.AdminState_DELETED {
+		log.Debugw("device-already-in-deleted-state", log.Fields{"id": agent.deviceID})
+		return nil
+	}
+	if (device.AdminState != voltha.AdminState_DISABLED) &&
+		(device.AdminState != voltha.AdminState_PREPROVISIONED) {
+		log.Debugw("device-not-disabled", log.Fields{"id": agent.deviceID})
+		//TODO:  Needs customized error message
+		return status.Errorf(codes.FailedPrecondition, "deviceId:%s, expected-admin-state:%s", agent.deviceID, voltha.AdminState_DISABLED)
+	}
+	if device.AdminState != voltha.AdminState_PREPROVISIONED {
+		// Send the request to an Adapter only if the device is not in poreporovision state and wait for a response
+		if err := agent.adapterProxy.DeleteDevice(ctx, device); err != nil {
+			log.Debugw("deleteDevice-error", log.Fields{"id": agent.deviceID, "error": err})
 			return err
 		}
-		//	If this is a child device then remove the associated peer ports on the parent device
-		if !device.Root {
-			go agent.deviceMgr.deletePeerPorts(device.ParentId, device.Id)
-		}
+	}
+	//	Set the state to deleted after we receive an Ack - this will trigger some background process to clean up
+	//	the device as well as its association with the logical device
+	cloned := proto.Clone(device).(*voltha.Device)
+	cloned.AdminState = voltha.AdminState_DELETED
+	if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
+		return err
+	}
+	//	If this is a child device then remove the associated peer ports on the parent device
+	if !device.Root {
+		go func() {
+			err := agent.deviceMgr.deletePeerPorts(device.ParentId, device.Id)
+			if err != nil {
+				log.Errorw("unable-to-delete-peer-ports", log.Fields{"error": err})
+			}
+		}()
 	}
 	return nil
 }
 
-func (agent *DeviceAgent) setParentId(device *voltha.Device, parentId string) error {
+func (agent *DeviceAgent) setParentID(device *voltha.Device, parentID string) error {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("setParentId", log.Fields{"deviceId": device.Id, "parentId": parentId})
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// clone the device
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		cloned.ParentId = parentId
-		// Store the device
-		if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
-			return err
-		}
-		return nil
+	log.Debugw("setParentId", log.Fields{"deviceId": device.Id, "parentId": parentID})
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	// clone the device
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	cloned.ParentId = parentID
+	// Store the device
+	if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
+		return err
+	}
+	return nil
 }
 
 func (agent *DeviceAgent) updatePmConfigs(ctx context.Context, pmConfigs *voltha.PmConfigs) error {
@@ -690,23 +693,23 @@
 	defer agent.lockDevice.Unlock()
 	log.Debugw("updatePmConfigs", log.Fields{"id": pmConfigs.Id})
 	// Work only on latest data
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// clone the device
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		cloned.PmConfigs = proto.Clone(pmConfigs).(*voltha.PmConfigs)
-		// Store the device
-		if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
-			return err
-		}
-		// Send the request to the adapter
-		if err := agent.adapterProxy.UpdatePmConfigs(ctx, cloned, pmConfigs); err != nil {
-			log.Errorw("update-pm-configs-error", log.Fields{"id": agent.deviceId, "error": err})
-			return err
-		}
-		return nil
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	// clone the device
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	cloned.PmConfigs = proto.Clone(pmConfigs).(*voltha.PmConfigs)
+	// Store the device
+	if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
+		return err
+	}
+	// Send the request to the adapter
+	if err := agent.adapterProxy.UpdatePmConfigs(ctx, cloned, pmConfigs); err != nil {
+		log.Errorw("update-pm-configs-error", log.Fields{"id": agent.deviceID, "error": err})
+		return err
+	}
+	return nil
 }
 
 func (agent *DeviceAgent) initPmConfigs(pmConfigs *voltha.PmConfigs) error {
@@ -714,46 +717,58 @@
 	defer agent.lockDevice.Unlock()
 	log.Debugw("initPmConfigs", log.Fields{"id": pmConfigs.Id})
 	// Work only on latest data
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// clone the device
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		cloned.PmConfigs = proto.Clone(pmConfigs).(*voltha.PmConfigs)
-		// Store the device
-		updateCtx := context.WithValue(context.Background(), model.RequestTimestamp, time.Now().UnixNano())
-		afterUpdate := agent.clusterDataProxy.Update(updateCtx, "/devices/"+agent.deviceId, cloned, false, "")
-		if afterUpdate == nil {
-			return status.Errorf(codes.Internal, "%s", agent.deviceId)
-		}
-		return nil
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	// clone the device
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	cloned.PmConfigs = proto.Clone(pmConfigs).(*voltha.PmConfigs)
+	// Store the device
+	updateCtx := context.WithValue(context.Background(), model.RequestTimestamp, time.Now().UnixNano())
+	afterUpdate := agent.clusterDataProxy.Update(updateCtx, "/devices/"+agent.deviceID, cloned, false, "")
+	if afterUpdate == nil {
+		return status.Errorf(codes.Internal, "%s", agent.deviceID)
+	}
+	return nil
 }
 
 func (agent *DeviceAgent) listPmConfigs(ctx context.Context) (*voltha.PmConfigs, error) {
 	agent.lockDevice.RLock()
 	defer agent.lockDevice.RUnlock()
-	log.Debugw("listPmConfigs", log.Fields{"id": agent.deviceId})
+	log.Debugw("listPmConfigs", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		cloned := proto.Clone(device).(*voltha.Device)
-		return cloned.PmConfigs, nil
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	cloned := proto.Clone(device).(*voltha.Device)
+	return cloned.PmConfigs, nil
 }
 
 func (agent *DeviceAgent) downloadImage(ctx context.Context, img *voltha.ImageDownload) (*voltha.OperationResp, error) {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("downloadImage", log.Fields{"id": agent.deviceId})
+	log.Debugw("downloadImage", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceId)
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceID)
+	}
+	if device.AdminState != voltha.AdminState_ENABLED {
+		log.Debugw("device-not-enabled", log.Fields{"id": agent.deviceID})
+		return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, expected-admin-state:%s", agent.deviceID, voltha.AdminState_ENABLED)
+	}
+	// Save the image
+	clonedImg := proto.Clone(img).(*voltha.ImageDownload)
+	clonedImg.DownloadState = voltha.ImageDownload_DOWNLOAD_REQUESTED
+	cloned := proto.Clone(device).(*voltha.Device)
+	if cloned.ImageDownloads == nil {
+		cloned.ImageDownloads = []*voltha.ImageDownload{clonedImg}
 	} else {
 		if device.AdminState != voltha.AdminState_ENABLED {
-			log.Debugw("device-not-enabled", log.Fields{"id": agent.deviceId})
-			return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, expected-admin-state:%s", agent.deviceId, voltha.AdminState_ENABLED)
+			log.Debugw("device-not-enabled", log.Fields{"id": agent.deviceID})
+			return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, expected-admin-state:%s", agent.deviceID, voltha.AdminState_ENABLED)
 		}
 		// Save the image
 		clonedImg := proto.Clone(img).(*voltha.ImageDownload)
@@ -770,7 +785,7 @@
 		}
 		// Send the request to the adapter
 		if err := agent.adapterProxy.DownloadImage(ctx, cloned, clonedImg); err != nil {
-			log.Debugw("downloadImage-error", log.Fields{"id": agent.deviceId, "error": err, "image": img.Name})
+			log.Debugw("downloadImage-error", log.Fields{"id": agent.deviceID, "error": err, "image": img.Name})
 			return nil, err
 		}
 	}
@@ -790,35 +805,35 @@
 func (agent *DeviceAgent) cancelImageDownload(ctx context.Context, img *voltha.ImageDownload) (*voltha.OperationResp, error) {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("cancelImageDownload", log.Fields{"id": agent.deviceId})
+	log.Debugw("cancelImageDownload", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// Verify whether the Image is in the list of image being downloaded
-		if !isImageRegistered(img, device) {
-			return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, image-not-registered:%s", agent.deviceId, img.Name)
-		}
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceID)
+	}
+	// Verify whether the Image is in the list of image being downloaded
+	if !isImageRegistered(img, device) {
+		return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, image-not-registered:%s", agent.deviceID, img.Name)
+	}
 
-		// Update image download state
-		cloned := proto.Clone(device).(*voltha.Device)
-		for _, image := range cloned.ImageDownloads {
-			if image.Id == img.Id && image.Name == img.Name {
-				image.DownloadState = voltha.ImageDownload_DOWNLOAD_CANCELLED
-			}
+	// Update image download state
+	cloned := proto.Clone(device).(*voltha.Device)
+	for _, image := range cloned.ImageDownloads {
+		if image.Id == img.Id && image.Name == img.Name {
+			image.DownloadState = voltha.ImageDownload_DOWNLOAD_CANCELLED
 		}
+	}
 
-		if device.AdminState == voltha.AdminState_DOWNLOADING_IMAGE {
-			// Set the device to Enabled
-			cloned.AdminState = voltha.AdminState_ENABLED
-			if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
-				return nil, err
-			}
-			// Send the request to teh adapter
-			if err := agent.adapterProxy.CancelImageDownload(ctx, device, img); err != nil {
-				log.Debugw("cancelImageDownload-error", log.Fields{"id": agent.deviceId, "error": err, "image": img.Name})
-				return nil, err
-			}
+	if device.AdminState == voltha.AdminState_DOWNLOADING_IMAGE {
+		// Set the device to Enabled
+		cloned.AdminState = voltha.AdminState_ENABLED
+		if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
+			return nil, err
+		}
+		// Send the request to the adapter
+		if err := agent.adapterProxy.CancelImageDownload(ctx, device, img); err != nil {
+			log.Debugw("cancelImageDownload-error", log.Fields{"id": agent.deviceID, "error": err, "image": img.Name})
+			return nil, err
 		}
 	}
 	return &voltha.OperationResp{Code: voltha.OperationResp_OPERATION_SUCCESS}, nil
@@ -827,74 +842,74 @@
 func (agent *DeviceAgent) activateImage(ctx context.Context, img *voltha.ImageDownload) (*voltha.OperationResp, error) {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("activateImage", log.Fields{"id": agent.deviceId})
+	log.Debugw("activateImage", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// Verify whether the Image is in the list of image being downloaded
-		if !isImageRegistered(img, device) {
-			return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, image-not-registered:%s", agent.deviceId, img.Name)
-		}
-
-		if device.AdminState == voltha.AdminState_DOWNLOADING_IMAGE {
-			return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, device-in-downloading-state:%s", agent.deviceId, img.Name)
-		}
-		// Update image download state
-		cloned := proto.Clone(device).(*voltha.Device)
-		for _, image := range cloned.ImageDownloads {
-			if image.Id == img.Id && image.Name == img.Name {
-				image.ImageState = voltha.ImageDownload_IMAGE_ACTIVATING
-			}
-		}
-		// Set the device to downloading_image
-		cloned.AdminState = voltha.AdminState_DOWNLOADING_IMAGE
-		if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
-			return nil, err
-		}
-
-		if err := agent.adapterProxy.ActivateImageUpdate(ctx, device, img); err != nil {
-			log.Debugw("activateImage-error", log.Fields{"id": agent.deviceId, "error": err, "image": img.Name})
-			return nil, err
-		}
-		// The status of the AdminState will be changed following the update_download_status response from the adapter
-		// The image name will also be removed from the device list
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	// Verify whether the Image is in the list of image being downloaded
+	if !isImageRegistered(img, device) {
+		return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, image-not-registered:%s", agent.deviceID, img.Name)
+	}
+
+	if device.AdminState == voltha.AdminState_DOWNLOADING_IMAGE {
+		return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, device-in-downloading-state:%s", agent.deviceID, img.Name)
+	}
+	// Update image download state
+	cloned := proto.Clone(device).(*voltha.Device)
+	for _, image := range cloned.ImageDownloads {
+		if image.Id == img.Id && image.Name == img.Name {
+			image.ImageState = voltha.ImageDownload_IMAGE_ACTIVATING
+		}
+	}
+	// Set the device to downloading_image
+	cloned.AdminState = voltha.AdminState_DOWNLOADING_IMAGE
+	if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
+		return nil, err
+	}
+
+	if err := agent.adapterProxy.ActivateImageUpdate(ctx, device, img); err != nil {
+		log.Debugw("activateImage-error", log.Fields{"id": agent.deviceID, "error": err, "image": img.Name})
+		return nil, err
+	}
+	// The status of the AdminState will be changed following the update_download_status response from the adapter
+	// The image name will also be removed from the device list
 	return &voltha.OperationResp{Code: voltha.OperationResp_OPERATION_SUCCESS}, nil
 }
 
 func (agent *DeviceAgent) revertImage(ctx context.Context, img *voltha.ImageDownload) (*voltha.OperationResp, error) {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("revertImage", log.Fields{"id": agent.deviceId})
+	log.Debugw("revertImage", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// Verify whether the Image is in the list of image being downloaded
-		if !isImageRegistered(img, device) {
-			return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, image-not-registered:%s", agent.deviceId, img.Name)
-		}
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceID)
+	}
+	// Verify whether the Image is in the list of image being downloaded
+	if !isImageRegistered(img, device) {
+		return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, image-not-registered:%s", agent.deviceID, img.Name)
+	}
 
-		if device.AdminState != voltha.AdminState_ENABLED {
-			return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, device-not-enabled-state:%s", agent.deviceId, img.Name)
+	if device.AdminState != voltha.AdminState_ENABLED {
+		return nil, status.Errorf(codes.FailedPrecondition, "deviceId:%s, device-not-enabled-state:%s", agent.deviceID, img.Name)
+	}
+	// Update image download state
+	cloned := proto.Clone(device).(*voltha.Device)
+	for _, image := range cloned.ImageDownloads {
+		if image.Id == img.Id && image.Name == img.Name {
+			image.ImageState = voltha.ImageDownload_IMAGE_REVERTING
 		}
-		// Update image download state
-		cloned := proto.Clone(device).(*voltha.Device)
-		for _, image := range cloned.ImageDownloads {
-			if image.Id == img.Id && image.Name == img.Name {
-				image.ImageState = voltha.ImageDownload_IMAGE_REVERTING
-			}
-		}
+	}
 
-		if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
-			return nil, err
-		}
+	if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
+		return nil, err
+	}
 
-		if err := agent.adapterProxy.RevertImageUpdate(ctx, device, img); err != nil {
-			log.Debugw("revertImage-error", log.Fields{"id": agent.deviceId, "error": err, "image": img.Name})
-			return nil, err
-		}
+	if err := agent.adapterProxy.RevertImageUpdate(ctx, device, img); err != nil {
+		log.Debugw("revertImage-error", log.Fields{"id": agent.deviceID, "error": err, "image": img.Name})
+		return nil, err
 	}
 	return &voltha.OperationResp{Code: voltha.OperationResp_OPERATION_SUCCESS}, nil
 }
@@ -902,49 +917,49 @@
 func (agent *DeviceAgent) getImageDownloadStatus(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("getImageDownloadStatus", log.Fields{"id": agent.deviceId})
+	log.Debugw("getImageDownloadStatus", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		if resp, err := agent.adapterProxy.GetImageDownloadStatus(ctx, device, img); err != nil {
-			log.Debugw("getImageDownloadStatus-error", log.Fields{"id": agent.deviceId, "error": err, "image": img.Name})
-			return nil, err
-		} else {
-			return resp, nil
-		}
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	resp, err := agent.adapterProxy.GetImageDownloadStatus(ctx, device, img)
+	if err != nil {
+		log.Debugw("getImageDownloadStatus-error", log.Fields{"id": agent.deviceID, "error": err, "image": img.Name})
+		return nil, err
+	}
+	return resp, nil
 }
 
 func (agent *DeviceAgent) updateImageDownload(img *voltha.ImageDownload) error {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("updateImageDownload", log.Fields{"id": agent.deviceId})
+	log.Debugw("updateImageDownload", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// Update the image as well as remove it if the download was cancelled
-		cloned := proto.Clone(device).(*voltha.Device)
-		clonedImages := make([]*voltha.ImageDownload, len(cloned.ImageDownloads))
-		for _, image := range cloned.ImageDownloads {
-			if image.Id == img.Id && image.Name == img.Name {
-				if image.DownloadState != voltha.ImageDownload_DOWNLOAD_CANCELLED {
-					clonedImages = append(clonedImages, img)
-				}
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
+	}
+	// Update the image as well as remove it if the download was cancelled
+	cloned := proto.Clone(device).(*voltha.Device)
+	clonedImages := make([]*voltha.ImageDownload, len(cloned.ImageDownloads))
+	for _, image := range cloned.ImageDownloads {
+		if image.Id == img.Id && image.Name == img.Name {
+			if image.DownloadState != voltha.ImageDownload_DOWNLOAD_CANCELLED {
+				clonedImages = append(clonedImages, img)
 			}
 		}
-		cloned.ImageDownloads = clonedImages
-		// Set the Admin state to enabled if required
-		if (img.DownloadState != voltha.ImageDownload_DOWNLOAD_REQUESTED &&
-			img.DownloadState != voltha.ImageDownload_DOWNLOAD_STARTED) ||
-			(img.ImageState != voltha.ImageDownload_IMAGE_ACTIVATING) {
-			cloned.AdminState = voltha.AdminState_ENABLED
-		}
+	}
+	cloned.ImageDownloads = clonedImages
+	// Set the Admin state to enabled if required
+	if (img.DownloadState != voltha.ImageDownload_DOWNLOAD_REQUESTED &&
+		img.DownloadState != voltha.ImageDownload_DOWNLOAD_STARTED) ||
+		(img.ImageState != voltha.ImageDownload_IMAGE_ACTIVATING) {
+		cloned.AdminState = voltha.AdminState_ENABLED
+	}
 
-		if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
-			return err
-		}
+	if err := agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
+		return err
 	}
 	return nil
 }
@@ -952,37 +967,37 @@
 func (agent *DeviceAgent) getImageDownload(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
 	agent.lockDevice.RLock()
 	defer agent.lockDevice.RUnlock()
-	log.Debugw("getImageDownload", log.Fields{"id": agent.deviceId})
+	log.Debugw("getImageDownload", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		for _, image := range device.ImageDownloads {
-			if image.Id == img.Id && image.Name == img.Name {
-				return image, nil
-			}
-		}
-		return nil, status.Errorf(codes.NotFound, "image-not-found:%s", img.Name)
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	for _, image := range device.ImageDownloads {
+		if image.Id == img.Id && image.Name == img.Name {
+			return image, nil
+		}
+	}
+	return nil, status.Errorf(codes.NotFound, "image-not-found:%s", img.Name)
 }
 
-func (agent *DeviceAgent) listImageDownloads(ctx context.Context, deviceId string) (*voltha.ImageDownloads, error) {
+func (agent *DeviceAgent) listImageDownloads(ctx context.Context, deviceID string) (*voltha.ImageDownloads, error) {
 	agent.lockDevice.RLock()
 	defer agent.lockDevice.RUnlock()
-	log.Debugw("listImageDownloads", log.Fields{"id": agent.deviceId})
+	log.Debugw("listImageDownloads", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		return &voltha.ImageDownloads{Items: device.ImageDownloads}, nil
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return nil, status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	return &voltha.ImageDownloads{Items: device.ImageDownloads}, nil
 }
 
 // getPorts retrieves the ports information of the device based on the port type.
 func (agent *DeviceAgent) getPorts(ctx context.Context, portType voltha.Port_PortType) *voltha.Ports {
-	log.Debugw("getPorts", log.Fields{"id": agent.deviceId, "portType": portType})
+	log.Debugw("getPorts", log.Fields{"id": agent.deviceID, "portType": portType})
 	ports := &voltha.Ports{}
-	if device, _ := agent.deviceMgr.GetDevice(agent.deviceId); device != nil {
+	if device, _ := agent.deviceMgr.GetDevice(agent.deviceID); device != nil {
 		for _, port := range device.Ports {
 			if port.Type == portType {
 				ports.Items = append(ports.Items, port)
@@ -995,35 +1010,33 @@
 // getSwitchCapability is a helper method that a logical device agent uses to retrieve the switch capability of a
 // parent device
 func (agent *DeviceAgent) getSwitchCapability(ctx context.Context) (*ic.SwitchCapability, error) {
-	log.Debugw("getSwitchCapability", log.Fields{"deviceId": agent.deviceId})
-	if device, err := agent.deviceMgr.GetDevice(agent.deviceId); device == nil {
+	log.Debugw("getSwitchCapability", log.Fields{"deviceId": agent.deviceID})
+	device, err := agent.deviceMgr.GetDevice(agent.deviceID)
+	if device == nil {
 		return nil, err
-	} else {
-		var switchCap *ic.SwitchCapability
-		var err error
-		if switchCap, err = agent.adapterProxy.GetOfpDeviceInfo(ctx, device); err != nil {
-			log.Debugw("getSwitchCapability-error", log.Fields{"id": device.Id, "error": err})
-			return nil, err
-		}
-		return switchCap, nil
 	}
+	var switchCap *ic.SwitchCapability
+	if switchCap, err = agent.adapterProxy.GetOfpDeviceInfo(ctx, device); err != nil {
+		log.Debugw("getSwitchCapability-error", log.Fields{"id": device.Id, "error": err})
+		return nil, err
+	}
+	return switchCap, nil
 }
 
 // getPortCapability is a helper method that a logical device agent uses to retrieve the port capability of a
 // device
 func (agent *DeviceAgent) getPortCapability(ctx context.Context, portNo uint32) (*ic.PortCapability, error) {
-	log.Debugw("getPortCapability", log.Fields{"deviceId": agent.deviceId})
-	if device, err := agent.deviceMgr.GetDevice(agent.deviceId); device == nil {
+	log.Debugw("getPortCapability", log.Fields{"deviceId": agent.deviceID})
+	device, err := agent.deviceMgr.GetDevice(agent.deviceID)
+	if device == nil {
 		return nil, err
-	} else {
-		var portCap *ic.PortCapability
-		var err error
-		if portCap, err = agent.adapterProxy.GetOfpPortInfo(ctx, device, portNo); err != nil {
-			log.Debugw("getPortCapability-error", log.Fields{"id": device.Id, "error": err})
-			return nil, err
-		}
-		return portCap, nil
 	}
+	var portCap *ic.PortCapability
+	if portCap, err = agent.adapterProxy.GetOfpPortInfo(ctx, device, portNo); err != nil {
+		log.Debugw("getPortCapability-error", log.Fields{"id": device.Id, "error": err})
+		return nil, err
+	}
+	return portCap, nil
 }
 
 func (agent *DeviceAgent) packetOut(outPort uint32, packet *ofp.OfpPacketOut) error {
@@ -1033,9 +1046,9 @@
 		agent.reconcileWithKVStore()
 	}
 	//	Send packet to adapter
-	if err := agent.adapterProxy.packetOut(agent.deviceType, agent.deviceId, outPort, packet); err != nil {
+	if err := agent.adapterProxy.packetOut(agent.deviceType, agent.deviceID, outPort, packet); err != nil {
 		log.Debugw("packet-out-error", log.Fields{
-			"id":     agent.deviceId,
+			"id":     agent.deviceID,
 			"error":  err,
 			"packet": hex.EncodeToString(packet.Data),
 		})
@@ -1098,13 +1111,13 @@
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
 	log.Debugw("updateDeviceUsingAdapterData", log.Fields{"deviceId": device.Id})
-	if updatedDevice, err := agent.mergeDeviceInfoFromAdapter(device); err != nil {
+	updatedDevice, err := agent.mergeDeviceInfoFromAdapter(device)
+	if err != nil {
 		log.Errorw("failed to update device ", log.Fields{"deviceId": device.Id})
 		return status.Errorf(codes.Internal, "%s", err.Error())
-	} else {
-		cloned := proto.Clone(updatedDevice).(*voltha.Device)
-		return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 	}
+	cloned := proto.Clone(updatedDevice).(*voltha.Device)
+	return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 }
 
 func (agent *DeviceAgent) updateDeviceWithoutLock(device *voltha.Device) error {
@@ -1117,59 +1130,59 @@
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
 	// Work only on latest data
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// clone the device
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		// Ensure the enums passed in are valid - they will be invalid if they are not set when this function is invoked
-		if s, ok := voltha.ConnectStatus_ConnectStatus_value[connStatus.String()]; ok {
-			log.Debugw("updateDeviceStatus-conn", log.Fields{"ok": ok, "val": s})
-			cloned.ConnectStatus = connStatus
-		}
-		if s, ok := voltha.OperStatus_OperStatus_value[operStatus.String()]; ok {
-			log.Debugw("updateDeviceStatus-oper", log.Fields{"ok": ok, "val": s})
-			cloned.OperStatus = operStatus
-		}
-		log.Debugw("updateDeviceStatus", log.Fields{"deviceId": cloned.Id, "operStatus": cloned.OperStatus, "connectStatus": cloned.ConnectStatus})
-		// Store the device
-		return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	// clone the device
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	// Ensure the enums passed in are valid - they will be invalid if they are not set when this function is invoked
+	if s, ok := voltha.ConnectStatus_ConnectStatus_value[connStatus.String()]; ok {
+		log.Debugw("updateDeviceStatus-conn", log.Fields{"ok": ok, "val": s})
+		cloned.ConnectStatus = connStatus
+	}
+	if s, ok := voltha.OperStatus_OperStatus_value[operStatus.String()]; ok {
+		log.Debugw("updateDeviceStatus-oper", log.Fields{"ok": ok, "val": s})
+		cloned.OperStatus = operStatus
+	}
+	log.Debugw("updateDeviceStatus", log.Fields{"deviceId": cloned.Id, "operStatus": cloned.OperStatus, "connectStatus": cloned.ConnectStatus})
+	// Store the device
+	return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 }
 
 func (agent *DeviceAgent) enablePorts() error {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// clone the device
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		for _, port := range cloned.Ports {
-			port.AdminState = voltha.AdminState_ENABLED
-			port.OperStatus = voltha.OperStatus_ACTIVE
-		}
-		// Store the device
-		return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	// clone the device
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	for _, port := range cloned.Ports {
+		port.AdminState = voltha.AdminState_ENABLED
+		port.OperStatus = voltha.OperStatus_ACTIVE
+	}
+	// Store the device
+	return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 }
 
 func (agent *DeviceAgent) disablePorts() error {
-	log.Debugw("disablePorts", log.Fields{"deviceid": agent.deviceId})
+	log.Debugw("disablePorts", log.Fields{"deviceid": agent.deviceID})
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// clone the device
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		for _, port := range cloned.Ports {
-			port.AdminState = voltha.AdminState_DISABLED
-			port.OperStatus = voltha.OperStatus_UNKNOWN
-		}
-		// Store the device
-		return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	// clone the device
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	for _, port := range cloned.Ports {
+		port.AdminState = voltha.AdminState_DISABLED
+		port.OperStatus = voltha.OperStatus_UNKNOWN
+	}
+	// Store the device
+	return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 }
 
 func (agent *DeviceAgent) updatePortState(portType voltha.Port_PortType, portNo uint32, operStatus voltha.OperStatus_OperStatus) error {
@@ -1177,90 +1190,90 @@
 	defer agent.lockDevice.Unlock()
 	// Work only on latest data
 	// TODO: Get list of ports from device directly instead of the entire device
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// clone the device
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		// Ensure the enums passed in are valid - they will be invalid if they are not set when this function is invoked
-		if _, ok := voltha.Port_PortType_value[portType.String()]; !ok {
-			return status.Errorf(codes.InvalidArgument, "%s", portType)
-		}
-		for _, port := range cloned.Ports {
-			if port.Type == portType && port.PortNo == portNo {
-				port.OperStatus = operStatus
-				// Set the admin status to ENABLED if the operational status is ACTIVE
-				// TODO: Set by northbound system?
-				if operStatus == voltha.OperStatus_ACTIVE {
-					port.AdminState = voltha.AdminState_ENABLED
-				}
-				break
-			}
-		}
-		log.Debugw("portStatusUpdate", log.Fields{"deviceId": cloned.Id})
-		// Store the device
-		return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	// clone the device
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	// Ensure the enums passed in are valid - they will be invalid if they are not set when this function is invoked
+	if _, ok := voltha.Port_PortType_value[portType.String()]; !ok {
+		return status.Errorf(codes.InvalidArgument, "%s", portType)
+	}
+	for _, port := range cloned.Ports {
+		if port.Type == portType && port.PortNo == portNo {
+			port.OperStatus = operStatus
+			// Set the admin status to ENABLED if the operational status is ACTIVE
+			// TODO: Set by northbound system?
+			if operStatus == voltha.OperStatus_ACTIVE {
+				port.AdminState = voltha.AdminState_ENABLED
+			}
+			break
+		}
+	}
+	log.Debugw("portStatusUpdate", log.Fields{"deviceId": cloned.Id})
+	// Store the device
+	return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 }
 
 func (agent *DeviceAgent) deleteAllPorts() error {
-	log.Debugw("deleteAllPorts", log.Fields{"deviceId": agent.deviceId})
+	log.Debugw("deleteAllPorts", log.Fields{"deviceId": agent.deviceID})
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
 	// Work only on latest data
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		if storeDevice.AdminState != voltha.AdminState_DISABLED && storeDevice.AdminState != voltha.AdminState_DELETED {
-			err = status.Error(codes.FailedPrecondition, fmt.Sprintf("invalid-state-%v", storeDevice.AdminState))
-			log.Warnw("invalid-state-removing-ports", log.Fields{"state": storeDevice.AdminState, "error": err})
-			return err
-		}
-		if len(storeDevice.Ports) == 0 {
-			log.Debugw("no-ports-present", log.Fields{"deviceId": agent.deviceId})
-			return nil
-		}
-		// clone the device & set the fields to empty
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		cloned.Ports = []*voltha.Port{}
-		log.Debugw("portStatusUpdate", log.Fields{"deviceId": cloned.Id})
-		// Store the device
-		return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	if storeDevice.AdminState != voltha.AdminState_DISABLED && storeDevice.AdminState != voltha.AdminState_DELETED {
+		err = status.Error(codes.FailedPrecondition, fmt.Sprintf("invalid-state-%v", storeDevice.AdminState))
+		log.Warnw("invalid-state-removing-ports", log.Fields{"state": storeDevice.AdminState, "error": err})
+		return err
+	}
+	if len(storeDevice.Ports) == 0 {
+		log.Debugw("no-ports-present", log.Fields{"deviceId": agent.deviceID})
+		return nil
+	}
+	// clone the device & set the fields to empty
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	cloned.Ports = []*voltha.Port{}
+	log.Debugw("portStatusUpdate", log.Fields{"deviceId": cloned.Id})
+	// Store the device
+	return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 }
 
 func (agent *DeviceAgent) addPort(port *voltha.Port) error {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("addPort", log.Fields{"deviceId": agent.deviceId})
+	log.Debugw("addPort", log.Fields{"deviceId": agent.deviceID})
 	// Work only on latest data
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
+	}
+	// clone the device
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	if cloned.Ports == nil {
+		//	First port
+		log.Debugw("addPort-first-port-to-add", log.Fields{"deviceId": agent.deviceID})
+		cloned.Ports = make([]*voltha.Port, 0)
 	} else {
-		// clone the device
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		if cloned.Ports == nil {
-			//	First port
-			log.Debugw("addPort-first-port-to-add", log.Fields{"deviceId": agent.deviceId})
-			cloned.Ports = make([]*voltha.Port, 0)
-		} else {
-			for _, p := range cloned.Ports {
-				if p.Type == port.Type && p.PortNo == port.PortNo {
-					log.Debugw("port already exists", log.Fields{"port": *port})
-					return nil
-				}
+		for _, p := range cloned.Ports {
+			if p.Type == port.Type && p.PortNo == port.PortNo {
+				log.Debugw("port already exists", log.Fields{"port": *port})
+				return nil
 			}
 		}
-		cp := proto.Clone(port).(*voltha.Port)
-		// Set the admin state of the port to ENABLE if the operational state is ACTIVE
-		// TODO: Set by northbound system?
-		if cp.OperStatus == voltha.OperStatus_ACTIVE {
-			cp.AdminState = voltha.AdminState_ENABLED
-		}
-		cloned.Ports = append(cloned.Ports, cp)
-		// Store the device
-		return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 	}
+	cp := proto.Clone(port).(*voltha.Port)
+	// Set the admin state of the port to ENABLE if the operational state is ACTIVE
+	// TODO: Set by northbound system?
+	if cp.OperStatus == voltha.OperStatus_ACTIVE {
+		cp.AdminState = voltha.AdminState_ENABLED
+	}
+	cloned.Ports = append(cloned.Ports, cp)
+	// Store the device
+	return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 }
 
 func (agent *DeviceAgent) addPeerPort(port *voltha.Port_PeerPort) error {
@@ -1268,49 +1281,49 @@
 	defer agent.lockDevice.Unlock()
 	log.Debug("addPeerPort")
 	// Work only on latest data
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// clone the device
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		// Get the peer port on the device based on the port no
-		for _, peerPort := range cloned.Ports {
-			if peerPort.PortNo == port.PortNo { // found port
-				cp := proto.Clone(port).(*voltha.Port_PeerPort)
-				peerPort.Peers = append(peerPort.Peers, cp)
-				log.Debugw("found-peer", log.Fields{"portNo": port.PortNo, "deviceId": agent.deviceId})
-				break
-			}
-		}
-		// Store the device
-		return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	// clone the device
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	// Get the peer port on the device based on the port no
+	for _, peerPort := range cloned.Ports {
+		if peerPort.PortNo == port.PortNo { // found port
+			cp := proto.Clone(port).(*voltha.Port_PeerPort)
+			peerPort.Peers = append(peerPort.Peers, cp)
+			log.Debugw("found-peer", log.Fields{"portNo": port.PortNo, "deviceId": agent.deviceID})
+			break
+		}
+	}
+	// Store the device
+	return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 }
 
-func (agent *DeviceAgent) deletePeerPorts(deviceId string) error {
+func (agent *DeviceAgent) deletePeerPorts(deviceID string) error {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
 	log.Debug("deletePeerPorts")
 	// Work only on latest data
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// clone the device
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		var updatedPeers []*voltha.Port_PeerPort
-		for _, port := range cloned.Ports {
-			updatedPeers = make([]*voltha.Port_PeerPort, 0)
-			for _, peerPort := range port.Peers {
-				if peerPort.DeviceId != deviceId {
-					updatedPeers = append(updatedPeers, peerPort)
-				}
-			}
-			port.Peers = updatedPeers
-		}
-
-		// Store the device with updated peer ports
-		return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	// clone the device
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	var updatedPeers []*voltha.Port_PeerPort
+	for _, port := range cloned.Ports {
+		updatedPeers = make([]*voltha.Port_PeerPort, 0)
+		for _, peerPort := range port.Peers {
+			if peerPort.DeviceId != deviceID {
+				updatedPeers = append(updatedPeers, peerPort)
+			}
+		}
+		port.Peers = updatedPeers
+	}
+
+	// Store the device with updated peer ports
+	return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 }
 
 // TODO: A generic device update by attribute
@@ -1350,22 +1363,21 @@
 	if err = agent.updateDeviceInStoreWithoutLock(cloned, false, ""); err != nil {
 		log.Warnw("attribute-update-failed", log.Fields{"attribute": name, "value": value})
 	}
-	return
 }
 
 func (agent *DeviceAgent) simulateAlarm(ctx context.Context, simulatereq *voltha.SimulateAlarmRequest) error {
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
-	log.Debugw("simulateAlarm", log.Fields{"id": agent.deviceId})
+	log.Debugw("simulateAlarm", log.Fields{"id": agent.deviceID})
 	// Get the most up to date the device info
-	if device, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// First send the request to an Adapter and wait for a response
-		if err := agent.adapterProxy.SimulateAlarm(ctx, device, simulatereq); err != nil {
-			log.Debugw("simulateAlarm-error", log.Fields{"id": agent.deviceId, "error": err})
-			return err
-		}
+	device, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
+	}
+	// First send the request to an Adapter and wait for a response
+	if err := agent.adapterProxy.SimulateAlarm(ctx, device, simulatereq); err != nil {
+		log.Debugw("simulateAlarm-error", log.Fields{"id": agent.deviceID, "error": err})
+		return err
 	}
 	return nil
 }
@@ -1374,10 +1386,10 @@
 // It is an internal helper function.
 func (agent *DeviceAgent) updateDeviceInStoreWithoutLock(device *voltha.Device, strict bool, txid string) error {
 	updateCtx := context.WithValue(context.Background(), model.RequestTimestamp, time.Now().UnixNano())
-	if afterUpdate := agent.clusterDataProxy.Update(updateCtx, "/devices/"+agent.deviceId, device, strict, txid); afterUpdate == nil {
-		return status.Errorf(codes.Internal, "failed-update-device:%s", agent.deviceId)
+	if afterUpdate := agent.clusterDataProxy.Update(updateCtx, "/devices/"+agent.deviceID, device, strict, txid); afterUpdate == nil {
+		return status.Errorf(codes.Internal, "failed-update-device:%s", agent.deviceID)
 	}
-	log.Debugw("updated-device-in-store", log.Fields{"deviceId: ": agent.deviceId})
+	log.Debugw("updated-device-in-store", log.Fields{"deviceId: ": agent.deviceID})
 
 	return nil
 }
@@ -1386,14 +1398,14 @@
 	agent.lockDevice.Lock()
 	defer agent.lockDevice.Unlock()
 	// Work only on latest data
-	if storeDevice, err := agent.getDeviceWithoutLock(); err != nil {
-		return status.Errorf(codes.NotFound, "%s", agent.deviceId)
-	} else {
-		// clone the device
-		cloned := proto.Clone(storeDevice).(*voltha.Device)
-		cloned.Reason = reason
-		log.Debugw("updateDeviceReason", log.Fields{"deviceId": cloned.Id, "reason": cloned.Reason})
-		// Store the device
-		return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
+	storeDevice, err := agent.getDeviceWithoutLock()
+	if err != nil {
+		return status.Errorf(codes.NotFound, "%s", agent.deviceID)
 	}
+	// clone the device
+	cloned := proto.Clone(storeDevice).(*voltha.Device)
+	cloned.Reason = reason
+	log.Debugw("updateDeviceReason", log.Fields{"deviceId": cloned.Id, "reason": cloned.Reason})
+	// Store the device
+	return agent.updateDeviceInStoreWithoutLock(cloned, false, "")
 }
diff --git a/rw_core/core/device_manager.go b/rw_core/core/device_manager.go
index ce7ecd9..9e4956e 100755
--- a/rw_core/core/device_manager.go
+++ b/rw_core/core/device_manager.go
@@ -13,11 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
 	"context"
 	"errors"
+	"reflect"
+	"runtime"
+	"sync"
+
 	"github.com/opencord/voltha-go/db/model"
 	"github.com/opencord/voltha-go/rw_core/utils"
 	"github.com/opencord/voltha-lib-go/v2/pkg/kafka"
@@ -28,11 +33,9 @@
 	"github.com/opencord/voltha-protos/v2/go/voltha"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
-	"reflect"
-	"runtime"
-	"sync"
 )
 
+// DeviceManager represent device manager attributes
 type DeviceManager struct {
 	deviceAgents            sync.Map
 	rootDevices             map[string]bool
@@ -44,7 +47,7 @@
 	kafkaICProxy            *kafka.InterContainerProxy
 	stateTransitions        *TransitionMap
 	clusterDataProxy        *model.Proxy
-	coreInstanceId          string
+	coreInstanceID          string
 	exitChannel             chan int
 	defaultTimeout          int64
 	devicesLoadingLock      sync.RWMutex
@@ -58,7 +61,7 @@
 	deviceMgr.rootDevices = make(map[string]bool)
 	deviceMgr.kafkaICProxy = core.kmp
 	deviceMgr.adapterProxy = NewAdapterProxy(core.kmp, core.config.CorePairTopic)
-	deviceMgr.coreInstanceId = core.instanceId
+	deviceMgr.coreInstanceID = core.instanceID
 	deviceMgr.clusterDataProxy = core.clusterDataProxy
 	deviceMgr.adapterMgr = core.adapterMgr
 	deviceMgr.lockRootDeviceMap = sync.RWMutex{}
@@ -96,41 +99,46 @@
 }
 
 func (dMgr *DeviceManager) addDeviceAgentToMap(agent *DeviceAgent) {
-	if _, exist := dMgr.deviceAgents.Load(agent.deviceId); !exist {
-		dMgr.deviceAgents.Store(agent.deviceId, agent)
+	if _, exist := dMgr.deviceAgents.Load(agent.deviceID); !exist {
+		dMgr.deviceAgents.Store(agent.deviceID, agent)
 	}
 	dMgr.lockRootDeviceMap.Lock()
 	defer dMgr.lockRootDeviceMap.Unlock()
-	dMgr.rootDevices[agent.deviceId] = agent.isRootdevice
+	dMgr.rootDevices[agent.deviceID] = agent.isRootdevice
 
 }
 
 func (dMgr *DeviceManager) deleteDeviceAgentFromMap(agent *DeviceAgent) {
-	dMgr.deviceAgents.Delete(agent.deviceId)
+	dMgr.deviceAgents.Delete(agent.deviceID)
 	dMgr.lockRootDeviceMap.Lock()
 	defer dMgr.lockRootDeviceMap.Unlock()
-	delete(dMgr.rootDevices, agent.deviceId)
+	delete(dMgr.rootDevices, agent.deviceID)
 }
 
 // getDeviceAgent returns the agent managing the device.  If the device is not in memory, it will loads it, if it exists
-func (dMgr *DeviceManager) getDeviceAgent(deviceId string) *DeviceAgent {
-	if agent, ok := dMgr.deviceAgents.Load(deviceId); ok {
+func (dMgr *DeviceManager) getDeviceAgent(deviceID string) *DeviceAgent {
+	agent, ok := dMgr.deviceAgents.Load(deviceID)
+	if ok {
 		return agent.(*DeviceAgent)
-	} else {
-		//	Try to load into memory - loading will also create the device agent and set the device ownership
-		if err := dMgr.load(deviceId); err == nil {
-			if agent, ok = dMgr.deviceAgents.Load(deviceId); !ok {
-				return nil
-			} else {
-				// Register this device for ownership tracking
-				go dMgr.core.deviceOwnership.OwnedByMe(&utils.DeviceID{Id: deviceId})
-				return agent.(*DeviceAgent)
-			}
-		} else {
-			//TODO: Change the return params to return an error as well
-			log.Errorw("loading-device-failed", log.Fields{"deviceId": deviceId, "error": err})
-		}
 	}
+	//	Try to load into memory - loading will also create the device agent and set the device ownership
+	err := dMgr.load(deviceID)
+	if err == nil {
+		agent, ok = dMgr.deviceAgents.Load(deviceID)
+		if !ok {
+			return nil
+		}
+		// Register this device for ownership tracking
+		go func() {
+			_, err = dMgr.core.deviceOwnership.OwnedByMe(&utils.DeviceID{ID: deviceID})
+			if err != nil {
+				log.Errorw("unable-to-find-core-instance-active-owns-this-device", log.Fields{"error": err})
+			}
+		}()
+		return agent.(*DeviceAgent)
+	}
+	//TODO: Change the return params to return an error as well
+	log.Errorw("loading-device-failed", log.Fields{"deviceId": deviceID, "error": err})
 	return nil
 }
 
@@ -223,27 +231,34 @@
 func (dMgr *DeviceManager) stopManagingDevice(id string) {
 	log.Infow("stopManagingDevice", log.Fields{"deviceId": id})
 	if dMgr.IsDeviceInCache(id) { // Proceed only if an agent is present for this device
-		if root, _ := dMgr.IsRootDevice(id); root == true {
+		if root, _ := dMgr.IsRootDevice(id); root {
 			// stop managing the logical device
-			ldeviceId := dMgr.logicalDeviceMgr.stopManagingLogicalDeviceWithDeviceId(id)
-			if ldeviceId != "" { // Can happen if logical device agent was already stopped
-				dMgr.core.deviceOwnership.AbandonDevice(ldeviceId)
+			ldeviceID := dMgr.logicalDeviceMgr.stopManagingLogicalDeviceWithDeviceID(id)
+			if ldeviceID != "" { // Can happen if logical device agent was already stopped
+				err := dMgr.core.deviceOwnership.AbandonDevice(ldeviceID)
+				if err != nil {
+					log.Errorw("unable-to-abandon-the-device", log.Fields{"error": err})
+				}
 			}
 			// stop managing the child devices
-			childDeviceIds := dMgr.getAllDeviceIdsWithDeviceParentId(id)
-			for _, cId := range childDeviceIds {
-				dMgr.stopManagingDevice(cId)
+			childDeviceIds := dMgr.getAllDeviceIdsWithDeviceParentID(id)
+			for _, cID := range childDeviceIds {
+				dMgr.stopManagingDevice(cID)
 			}
 		}
 		if agent := dMgr.getDeviceAgent(id); agent != nil {
-			agent.stop(nil)
+			agent.stop(context.TODO())
 			dMgr.deleteDeviceAgentFromMap(agent)
 			// Abandon the device ownership
-			dMgr.core.deviceOwnership.AbandonDevice(id)
+			err := dMgr.core.deviceOwnership.AbandonDevice(id)
+			if err != nil {
+				log.Errorw("unable-to-abandon-device", log.Fields{"error": err})
+			}
 		}
 	}
 }
 
+// RunPostDeviceDelete removes any reference of this device
 func (dMgr *DeviceManager) RunPostDeviceDelete(cDevice *voltha.Device) error {
 	log.Infow("RunPostDeviceDelete", log.Fields{"deviceId": cDevice.Id})
 	dMgr.stopManagingDevice(cDevice.Id)
@@ -259,13 +274,14 @@
 	return nil, status.Errorf(codes.NotFound, "%s", id)
 }
 
-func (dMgr *DeviceManager) GetChildDevice(parentDeviceId string, serialNumber string, onuId int64, parentPortNo int64) (*voltha.Device, error) {
-	log.Debugw("GetChildDevice", log.Fields{"parentDeviceid": parentDeviceId, "serialNumber": serialNumber,
-		"parentPortNo": parentPortNo, "onuId": onuId})
+// GetChildDevice will return a device, either from memory or from the dB, if present
+func (dMgr *DeviceManager) GetChildDevice(parentDeviceID string, serialNumber string, onuID int64, parentPortNo int64) (*voltha.Device, error) {
+	log.Debugw("GetChildDevice", log.Fields{"parentDeviceid": parentDeviceID, "serialNumber": serialNumber,
+		"parentPortNo": parentPortNo, "onuId": onuID})
 
 	var parentDevice *voltha.Device
 	var err error
-	if parentDevice, err = dMgr.GetDevice(parentDeviceId); err != nil {
+	if parentDevice, err = dMgr.GetDevice(parentDeviceID); err != nil {
 		return nil, status.Errorf(codes.Aborted, "%s", err.Error())
 	}
 	var childDeviceIds []string
@@ -273,20 +289,20 @@
 		return nil, status.Errorf(codes.Aborted, "%s", err.Error())
 	}
 	if len(childDeviceIds) == 0 {
-		log.Debugw("no-child-devices", log.Fields{"parentDeviceId": parentDevice.Id, "serialNumber": serialNumber, "onuId": onuId})
-		return nil, status.Errorf(codes.NotFound, "%s", parentDeviceId)
+		log.Debugw("no-child-devices", log.Fields{"parentDeviceId": parentDevice.Id, "serialNumber": serialNumber, "onuId": onuID})
+		return nil, status.Errorf(codes.NotFound, "%s", parentDeviceID)
 	}
 
 	var foundChildDevice *voltha.Device
-	for _, childDeviceId := range childDeviceIds {
-		found := false
-		if searchDevice, err := dMgr.GetDevice(childDeviceId); err == nil {
+	for _, childDeviceID := range childDeviceIds {
+		var found bool
+		if searchDevice, err := dMgr.GetDevice(childDeviceID); err == nil {
 
-			foundOnuId := false
-			if searchDevice.ProxyAddress.OnuId == uint32(onuId) {
+			foundOnuID := false
+			if searchDevice.ProxyAddress.OnuId == uint32(onuID) {
 				if searchDevice.ParentPortNo == uint32(parentPortNo) {
-					log.Debugw("found-child-by-onuid", log.Fields{"parentDeviceId": parentDevice.Id, "onuId": onuId})
-					foundOnuId = true
+					log.Debugw("found-child-by-onuid", log.Fields{"parentDeviceId": parentDevice.Id, "onuId": onuID})
+					foundOnuID = true
 				}
 			}
 
@@ -298,13 +314,13 @@
 
 			// if both onuId and serialNumber are provided both must be true for the device to be found
 			// otherwise whichever one found a match is good enough
-			if onuId > 0 && serialNumber != "" {
-				found = foundOnuId && foundSerialNumber
+			if onuID > 0 && serialNumber != "" {
+				found = foundOnuID && foundSerialNumber
 			} else {
-				found = foundOnuId || foundSerialNumber
+				found = foundOnuID || foundSerialNumber
 			}
 
-			if found == true {
+			if found {
 				foundChildDevice = searchDevice
 				break
 			}
@@ -317,10 +333,11 @@
 	}
 
 	log.Warnw("child-device-not-found", log.Fields{"parentDeviceId": parentDevice.Id,
-		"serialNumber": serialNumber, "onuId": onuId, "parentPortNo": parentPortNo})
-	return nil, status.Errorf(codes.NotFound, "%s", parentDeviceId)
+		"serialNumber": serialNumber, "onuId": onuID, "parentPortNo": parentPortNo})
+	return nil, status.Errorf(codes.NotFound, "%s", parentDeviceID)
 }
 
+// GetChildDeviceWithProxyAddress will return a device based on proxy address
 func (dMgr *DeviceManager) GetChildDeviceWithProxyAddress(proxyAddress *voltha.Device_ProxyAddress) (*voltha.Device, error) {
 	log.Debugw("GetChildDeviceWithProxyAddress", log.Fields{"proxyAddress": proxyAddress})
 
@@ -339,8 +356,8 @@
 	}
 
 	var foundChildDevice *voltha.Device
-	for _, childDeviceId := range childDeviceIds {
-		if searchDevice, err := dMgr.GetDevice(childDeviceId); err == nil {
+	for _, childDeviceID := range childDeviceIds {
+		if searchDevice, err := dMgr.GetDevice(childDeviceID); err == nil {
 			if searchDevice.ProxyAddress == proxyAddress {
 				foundChildDevice = searchDevice
 				break
@@ -357,11 +374,13 @@
 	return nil, status.Errorf(codes.NotFound, "%s", proxyAddress)
 }
 
+// IsDeviceInCache returns true if device is found in the map
 func (dMgr *DeviceManager) IsDeviceInCache(id string) bool {
 	_, exist := dMgr.deviceAgents.Load(id)
 	return exist
 }
 
+// IsRootDevice returns true if root device is found in the map
 func (dMgr *DeviceManager) IsRootDevice(id string) (bool, error) {
 	dMgr.lockRootDeviceMap.RLock()
 	defer dMgr.lockRootDeviceMap.RUnlock()
@@ -381,9 +400,9 @@
 			if !dMgr.IsDeviceInCache(device.(*voltha.Device).Id) {
 				log.Debugw("loading-device-from-Model", log.Fields{"id": device.(*voltha.Device).Id})
 				agent := newDeviceAgent(dMgr.adapterProxy, device.(*voltha.Device), dMgr, dMgr.clusterDataProxy, dMgr.defaultTimeout)
-				if _, err := agent.start(nil, nil); err != nil {
+				if _, err := agent.start(context.TODO(), nil); err != nil {
 					log.Warnw("failure-starting-agent", log.Fields{"deviceId": device.(*voltha.Device).Id})
-					agent.stop(nil)
+					agent.stop(context.TODO())
 				} else {
 					dMgr.addDeviceAgentToMap(agent)
 				}
@@ -415,47 +434,47 @@
 }
 
 //getDeviceFromModelretrieves the device data from the model.
-func (dMgr *DeviceManager) getDeviceFromModel(deviceId string) (*voltha.Device, error) {
-	if device := dMgr.clusterDataProxy.Get(context.Background(), "/devices/"+deviceId, 0, false, ""); device != nil {
+func (dMgr *DeviceManager) getDeviceFromModel(deviceID string) (*voltha.Device, error) {
+	if device := dMgr.clusterDataProxy.Get(context.Background(), "/devices/"+deviceID, 0, false, ""); device != nil {
 		if d, ok := device.(*voltha.Device); ok {
 			return d, nil
 		}
 	}
-	return nil, status.Error(codes.NotFound, deviceId)
+	return nil, status.Error(codes.NotFound, deviceID)
 }
 
-// loadDevice loads the deviceId in memory, if not present
-func (dMgr *DeviceManager) loadDevice(deviceId string) (*DeviceAgent, error) {
-	if deviceId == "" {
+// loadDevice loads the deviceID in memory, if not present
+func (dMgr *DeviceManager) loadDevice(deviceID string) (*DeviceAgent, error) {
+	if deviceID == "" {
 		return nil, status.Error(codes.InvalidArgument, "deviceId empty")
 	}
 	var err error
 	var device *voltha.Device
 	dMgr.devicesLoadingLock.Lock()
-	if _, exist := dMgr.deviceLoadingInProgress[deviceId]; !exist {
-		if !dMgr.IsDeviceInCache(deviceId) {
-			dMgr.deviceLoadingInProgress[deviceId] = []chan int{make(chan int, 1)}
+	if _, exist := dMgr.deviceLoadingInProgress[deviceID]; !exist {
+		if !dMgr.IsDeviceInCache(deviceID) {
+			dMgr.deviceLoadingInProgress[deviceID] = []chan int{make(chan int, 1)}
 			dMgr.devicesLoadingLock.Unlock()
 			// Proceed with the loading only if the device exist in the Model (could have been deleted)
-			if device, err = dMgr.getDeviceFromModel(deviceId); err == nil {
-				log.Debugw("loading-device", log.Fields{"deviceId": deviceId})
+			if device, err = dMgr.getDeviceFromModel(deviceID); err == nil {
+				log.Debugw("loading-device", log.Fields{"deviceId": deviceID})
 				agent := newDeviceAgent(dMgr.adapterProxy, device, dMgr, dMgr.clusterDataProxy, dMgr.defaultTimeout)
-				if _, err = agent.start(nil, nil); err != nil {
-					log.Warnw("Failure loading device", log.Fields{"deviceId": deviceId, "error": err})
-					agent.stop(nil)
+				if _, err = agent.start(context.TODO(), nil); err != nil {
+					log.Warnw("Failure loading device", log.Fields{"deviceId": deviceID, "error": err})
+					agent.stop(context.TODO())
 				} else {
 					dMgr.addDeviceAgentToMap(agent)
 				}
 			} else {
-				log.Debugw("Device not in model", log.Fields{"deviceId": deviceId})
+				log.Debugw("Device not in model", log.Fields{"deviceId": deviceID})
 			}
 			// announce completion of task to any number of waiting channels
 			dMgr.devicesLoadingLock.Lock()
-			if v, ok := dMgr.deviceLoadingInProgress[deviceId]; ok {
+			if v, ok := dMgr.deviceLoadingInProgress[deviceID]; ok {
 				for _, ch := range v {
 					close(ch)
 				}
-				delete(dMgr.deviceLoadingInProgress, deviceId)
+				delete(dMgr.deviceLoadingInProgress, deviceID)
 			}
 			dMgr.devicesLoadingLock.Unlock()
 		} else {
@@ -463,15 +482,15 @@
 		}
 	} else {
 		ch := make(chan int, 1)
-		dMgr.deviceLoadingInProgress[deviceId] = append(dMgr.deviceLoadingInProgress[deviceId], ch)
+		dMgr.deviceLoadingInProgress[deviceID] = append(dMgr.deviceLoadingInProgress[deviceID], ch)
 		dMgr.devicesLoadingLock.Unlock()
 		//	Wait for the channel to be closed, implying the process loading this device is done.
 		<-ch
 	}
-	if agent, ok := dMgr.deviceAgents.Load(deviceId); ok {
+	if agent, ok := dMgr.deviceAgents.Load(deviceID); ok {
 		return agent.(*DeviceAgent), nil
 	}
-	return nil, status.Errorf(codes.Aborted, "Error loading device %s", deviceId)
+	return nil, status.Errorf(codes.Aborted, "Error loading device %s", deviceID)
 }
 
 // loadRootDeviceParentAndChildren loads the children and parents of a root device in memory
@@ -489,9 +508,9 @@
 		}
 		//	Load all child devices, if needed
 		if childDeviceIds, err := dMgr.getAllChildDeviceIds(device); err == nil {
-			for _, childDeviceId := range childDeviceIds {
-				if _, err := dMgr.loadDevice(childDeviceId); err != nil {
-					log.Warnw("failure-loading-device", log.Fields{"deviceId": childDeviceId, "error": err})
+			for _, childDeviceID := range childDeviceIds {
+				if _, err := dMgr.loadDevice(childDeviceID); err != nil {
+					log.Warnw("failure-loading-device", log.Fields{"deviceId": childDeviceID, "error": err})
 					return err
 				}
 			}
@@ -507,12 +526,12 @@
 // in memory is for improved performance.  It is not imperative that a device needs to be in memory when a request
 // acting on the device is received by the core. In such a scenario, the Core will load the device in memory first
 // and the proceed with the request.
-func (dMgr *DeviceManager) load(deviceId string) error {
+func (dMgr *DeviceManager) load(deviceID string) error {
 	log.Debug("load...")
 	// First load the device - this may fail in case the device was deleted intentionally by the other core
 	var dAgent *DeviceAgent
 	var err error
-	if dAgent, err = dMgr.loadDevice(deviceId); err != nil {
+	if dAgent, err = dMgr.loadDevice(deviceID); err != nil {
 		return err
 	}
 	// Get the loaded device details
@@ -530,10 +549,10 @@
 	if device.Root {
 		// Load all children as well as the parent of this device (logical_device)
 		if err := dMgr.loadRootDeviceParentAndChildren(device); err != nil {
-			log.Warnw("failure-loading-device-parent-and-children", log.Fields{"deviceId": deviceId})
+			log.Warnw("failure-loading-device-parent-and-children", log.Fields{"deviceId": deviceID})
 			return err
 		}
-		log.Debugw("successfully-loaded-parent-and-children", log.Fields{"deviceId": deviceId})
+		log.Debugw("successfully-loaded-parent-and-children", log.Fields{"deviceId": deviceID})
 	} else {
 		//	Scenario B - use the parentId of that device (root device) to trigger the loading
 		if device.ParentId != "" {
@@ -563,7 +582,7 @@
 			if err = dMgr.load(id.Id); err != nil {
 				log.Warnw("failure-reconciling-device", log.Fields{"deviceId": id.Id, "error": err})
 			} else {
-				reconciled += 1
+				reconciled++
 			}
 		}
 		if toReconcile != reconciled {
@@ -595,8 +614,8 @@
 	}
 
 	responses := make([]utils.Response, 0)
-	for _, rootDeviceId := range rootDeviceIds {
-		if rootDevice, _ := dMgr.getDeviceFromModel(rootDeviceId); rootDevice != nil {
+	for _, rootDeviceID := range rootDeviceIds {
+		if rootDevice, _ := dMgr.getDeviceFromModel(rootDeviceID); rootDevice != nil {
 			if rootDevice.Adapter == adapter.Id {
 				if isOkToReconcile(rootDevice) {
 					log.Debugw("reconciling-root-device", log.Fields{"rootId": rootDevice.Id})
@@ -641,7 +660,7 @@
 func (dMgr *DeviceManager) sendReconcileDeviceRequest(device *voltha.Device) utils.Response {
 	// Send a reconcile request to the adapter. Since this Core may not be managing this device then there is no
 	// point of creating a device agent (if the device is not being managed by this Core) before sending the request
-	// to the adapter.   We will therefore bypass the adapter adapter and send the request directly to teh adapter via
+	// to the adapter.   We will therefore bypass the adapter adapter and send the request directly to the adapter via
 	// the adapter_proxy.
 	response := utils.NewResponse()
 	go func(device *voltha.Device) {
@@ -655,8 +674,8 @@
 	return response
 }
 
-func (dMgr *DeviceManager) reconcileChildDevices(parentDeviceId string) error {
-	if parentDevice, _ := dMgr.getDeviceFromModel(parentDeviceId); parentDevice != nil {
+func (dMgr *DeviceManager) reconcileChildDevices(parentDeviceID string) error {
+	if parentDevice, _ := dMgr.getDeviceFromModel(parentDeviceID); parentDevice != nil {
 		responses := make([]utils.Response, 0)
 		for _, port := range parentDevice.Ports {
 			for _, peer := range port.Peers {
@@ -681,13 +700,14 @@
 	return status.Errorf(codes.NotFound, "%s", device.Id)
 }
 
-func (dMgr *DeviceManager) addPort(deviceId string, port *voltha.Port) error {
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) addPort(deviceID string, port *voltha.Port) error {
+	agent := dMgr.getDeviceAgent(deviceID)
+	if agent != nil {
 		if err := agent.addPort(port); err != nil {
 			return err
 		}
 		//	Setup peer ports
-		meAsPeer := &voltha.Port_PeerPort{DeviceId: deviceId, PortNo: port.PortNo}
+		meAsPeer := &voltha.Port_PeerPort{DeviceId: deviceID, PortNo: port.PortNo}
 		for _, peerPort := range port.Peers {
 			if agent := dMgr.getDeviceAgent(peerPort.DeviceId); agent != nil {
 				if err := agent.addPeerPort(meAsPeer); err != nil {
@@ -699,48 +719,52 @@
 		// Notify the logical device manager to setup a logical port, if needed.  If the added port is an NNI or UNI
 		// then a logical port will be added to the logical device and the device graph generated.  If the port is a
 		// PON port then only the device graph will be generated.
-		if device, err := dMgr.GetDevice(deviceId); err == nil {
-			go dMgr.logicalDeviceMgr.updateLogicalPort(device, port)
+		if device, err := dMgr.GetDevice(deviceID); err == nil {
+			go func() {
+				err = dMgr.logicalDeviceMgr.updateLogicalPort(device, port)
+				if err != nil {
+					log.Errorw("unable-to-update-logical-port", log.Fields{"error": err})
+				}
+			}()
 		} else {
-			log.Errorw("failed-to-retrieve-device", log.Fields{"deviceId": deviceId})
+			log.Errorw("failed-to-retrieve-device", log.Fields{"deviceId": deviceID})
 			return err
 		}
 		return nil
-	} else {
-		return status.Errorf(codes.NotFound, "%s", deviceId)
 	}
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) deletePeerPorts(fromDeviceId string, deviceId string) error {
-	log.Debugw("deletePeerPorts", log.Fields{"fromDeviceId": fromDeviceId, "deviceid": deviceId})
-	if agent := dMgr.getDeviceAgent(fromDeviceId); agent != nil {
-		return agent.deletePeerPorts(deviceId)
+func (dMgr *DeviceManager) deletePeerPorts(fromDeviceID string, deviceID string) error {
+	log.Debugw("deletePeerPorts", log.Fields{"fromDeviceId": fromDeviceID, "deviceid": deviceID})
+	if agent := dMgr.getDeviceAgent(fromDeviceID); agent != nil {
+		return agent.deletePeerPorts(deviceID)
 	}
-	return status.Errorf(codes.NotFound, "%s", deviceId)
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) addFlowsAndGroups(deviceId string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("addFlowsAndGroups", log.Fields{"deviceid": deviceId, "flowMetadata": flowMetadata})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) addFlowsAndGroups(deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
+	log.Debugw("addFlowsAndGroups", log.Fields{"deviceid": deviceID, "flowMetadata": flowMetadata})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		return agent.addFlowsAndGroups(flows, groups, flowMetadata)
 	}
-	return status.Errorf(codes.NotFound, "%s", deviceId)
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) deleteFlowsAndGroups(deviceId string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("deleteFlowsAndGroups", log.Fields{"deviceid": deviceId})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) deleteFlowsAndGroups(deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
+	log.Debugw("deleteFlowsAndGroups", log.Fields{"deviceid": deviceID})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		return agent.deleteFlowsAndGroups(flows, groups, flowMetadata)
 	}
-	return status.Errorf(codes.NotFound, "%s", deviceId)
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) updateFlowsAndGroups(deviceId string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("updateFlowsAndGroups", log.Fields{"deviceid": deviceId})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) updateFlowsAndGroups(deviceID string, flows []*ofp.OfpFlowStats, groups []*ofp.OfpGroupEntry, flowMetadata *voltha.FlowMetadata) error {
+	log.Debugw("updateFlowsAndGroups", log.Fields{"deviceid": deviceID})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		return agent.updateFlowsAndGroups(flows, groups, flowMetadata)
 	}
-	return status.Errorf(codes.NotFound, "%s", deviceId)
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
 // updatePmConfigs updates the PM configs.  This is executed when the northbound gRPC API is invoked, typically
@@ -758,60 +782,60 @@
 }
 
 // initPmConfigs initialize the pm configs as defined by the adapter.
-func (dMgr *DeviceManager) initPmConfigs(deviceId string, pmConfigs *voltha.PmConfigs) error {
+func (dMgr *DeviceManager) initPmConfigs(deviceID string, pmConfigs *voltha.PmConfigs) error {
 	if pmConfigs.Id == "" {
 		return status.Errorf(codes.FailedPrecondition, "invalid-device-Id")
 	}
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		return agent.initPmConfigs(pmConfigs)
 	}
-	return status.Errorf(codes.NotFound, "%s", deviceId)
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) listPmConfigs(ctx context.Context, deviceId string) (*voltha.PmConfigs, error) {
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) listPmConfigs(ctx context.Context, deviceID string) (*voltha.PmConfigs, error) {
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		return agent.listPmConfigs(ctx)
 	}
-	return nil, status.Errorf(codes.NotFound, "%s", deviceId)
+	return nil, status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) getSwitchCapability(ctx context.Context, deviceId string) (*ic.SwitchCapability, error) {
-	log.Debugw("getSwitchCapability", log.Fields{"deviceid": deviceId})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) getSwitchCapability(ctx context.Context, deviceID string) (*ic.SwitchCapability, error) {
+	log.Debugw("getSwitchCapability", log.Fields{"deviceid": deviceID})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		return agent.getSwitchCapability(ctx)
 	}
-	return nil, status.Errorf(codes.NotFound, "%s", deviceId)
+	return nil, status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) getPorts(ctx context.Context, deviceId string, portType voltha.Port_PortType) (*voltha.Ports, error) {
-	log.Debugw("getPorts", log.Fields{"deviceid": deviceId, "portType": portType})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) getPorts(ctx context.Context, deviceID string, portType voltha.Port_PortType) (*voltha.Ports, error) {
+	log.Debugw("getPorts", log.Fields{"deviceid": deviceID, "portType": portType})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		return agent.getPorts(ctx, portType), nil
 	}
-	return nil, status.Errorf(codes.NotFound, "%s", deviceId)
+	return nil, status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) getPortCapability(ctx context.Context, deviceId string, portNo uint32) (*ic.PortCapability, error) {
-	log.Debugw("getPortCapability", log.Fields{"deviceid": deviceId})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) getPortCapability(ctx context.Context, deviceID string, portNo uint32) (*ic.PortCapability, error) {
+	log.Debugw("getPortCapability", log.Fields{"deviceid": deviceID})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		return agent.getPortCapability(ctx, portNo)
 	}
-	return nil, status.Errorf(codes.NotFound, "%s", deviceId)
+	return nil, status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) updateDeviceStatus(deviceId string, operStatus voltha.OperStatus_OperStatus, connStatus voltha.ConnectStatus_ConnectStatus) error {
-	log.Debugw("updateDeviceStatus", log.Fields{"deviceid": deviceId, "operStatus": operStatus, "connStatus": connStatus})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) updateDeviceStatus(deviceID string, operStatus voltha.OperStatus_OperStatus, connStatus voltha.ConnectStatus_ConnectStatus) error {
+	log.Debugw("updateDeviceStatus", log.Fields{"deviceid": deviceID, "operStatus": operStatus, "connStatus": connStatus})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		return agent.updateDeviceStatus(operStatus, connStatus)
 	}
-	return status.Errorf(codes.NotFound, "%s", deviceId)
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) updateChildrenStatus(deviceId string, operStatus voltha.OperStatus_OperStatus, connStatus voltha.ConnectStatus_ConnectStatus) error {
-	log.Debugw("updateChildrenStatus", log.Fields{"parentDeviceid": deviceId, "operStatus": operStatus, "connStatus": connStatus})
+func (dMgr *DeviceManager) updateChildrenStatus(deviceID string, operStatus voltha.OperStatus_OperStatus, connStatus voltha.ConnectStatus_ConnectStatus) error {
+	log.Debugw("updateChildrenStatus", log.Fields{"parentDeviceid": deviceID, "operStatus": operStatus, "connStatus": connStatus})
 	var parentDevice *voltha.Device
 	var err error
-	if parentDevice, err = dMgr.GetDevice(deviceId); err != nil {
+	if parentDevice, err = dMgr.GetDevice(deviceID); err != nil {
 		return status.Errorf(codes.Aborted, "%s", err.Error())
 	}
 	var childDeviceIds []string
@@ -821,98 +845,108 @@
 	if len(childDeviceIds) == 0 {
 		log.Debugw("no-child-device", log.Fields{"parentDeviceId": parentDevice.Id})
 	}
-	for _, childDeviceId := range childDeviceIds {
-		if agent := dMgr.getDeviceAgent(childDeviceId); agent != nil {
+	for _, childDeviceID := range childDeviceIds {
+		if agent := dMgr.getDeviceAgent(childDeviceID); agent != nil {
 			if err = agent.updateDeviceStatus(operStatus, connStatus); err != nil {
-				return status.Errorf(codes.Aborted, "childDevice:%s, error:%s", childDeviceId, err.Error())
+				return status.Errorf(codes.Aborted, "childDevice:%s, error:%s", childDeviceID, err.Error())
 			}
 		}
 	}
 	return nil
 }
 
-func (dMgr *DeviceManager) updatePortState(deviceId string, portType voltha.Port_PortType, portNo uint32, operStatus voltha.OperStatus_OperStatus) error {
-	log.Debugw("updatePortState", log.Fields{"deviceid": deviceId, "portType": portType, "portNo": portNo, "operStatus": operStatus})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) updatePortState(deviceID string, portType voltha.Port_PortType, portNo uint32, operStatus voltha.OperStatus_OperStatus) error {
+	log.Debugw("updatePortState", log.Fields{"deviceid": deviceID, "portType": portType, "portNo": portNo, "operStatus": operStatus})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		if err := agent.updatePortState(portType, portNo, operStatus); err != nil {
-			log.Errorw("updating-port-state-failed", log.Fields{"deviceid": deviceId, "portNo": portNo, "error": err})
+			log.Errorw("updating-port-state-failed", log.Fields{"deviceid": deviceID, "portNo": portNo, "error": err})
 			return err
 		}
 		// Notify the logical device manager to change the port state
-		go dMgr.logicalDeviceMgr.updatePortState(deviceId, portNo, operStatus)
+		go func() {
+			err := dMgr.logicalDeviceMgr.updatePortState(deviceID, portNo, operStatus)
+			if err != nil {
+				log.Errorw("unable-to-update-port-state", log.Fields{"error": err})
+			}
+		}()
 	}
-	return status.Errorf(codes.NotFound, "%s", deviceId)
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) deleteAllPorts(deviceId string) error {
-	log.Debugw("DeleteAllPorts", log.Fields{"deviceid": deviceId})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) deleteAllPorts(deviceID string) error {
+	log.Debugw("DeleteAllPorts", log.Fields{"deviceid": deviceID})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		if err := agent.deleteAllPorts(); err != nil {
 			return err
 		}
 		// Notify the logical device manager to remove all logical ports, if needed.
 		// At this stage the device itself may gave been deleted already at a deleteAllPorts
 		// typically is part of a device deletion phase.
-		if device, err := dMgr.GetDevice(deviceId); err == nil {
-			go dMgr.logicalDeviceMgr.deleteAllLogicalPorts(device)
+		if device, err := dMgr.GetDevice(deviceID); err == nil {
+			go func() {
+				err = dMgr.logicalDeviceMgr.deleteAllLogicalPorts(device)
+				if err != nil {
+					log.Errorw("unable-to-delete-logical-ports", log.Fields{"error": err})
+				}
+			}()
 		} else {
-			log.Warnw("failed-to-retrieve-device", log.Fields{"deviceId": deviceId})
+			log.Warnw("failed-to-retrieve-device", log.Fields{"deviceId": deviceID})
 			return err
 		}
 		return nil
 	}
-	return status.Errorf(codes.NotFound, "%s", deviceId)
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
 //updatePortsState updates all ports on the device
-func (dMgr *DeviceManager) updatePortsState(deviceId string, state voltha.OperStatus_OperStatus) error {
-	log.Debugw("updatePortsState", log.Fields{"deviceid": deviceId})
+func (dMgr *DeviceManager) updatePortsState(deviceID string, state voltha.OperStatus_OperStatus) error {
+	log.Debugw("updatePortsState", log.Fields{"deviceid": deviceID})
 
 	var adminState voltha.AdminState_AdminState
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		switch state {
 		case voltha.OperStatus_ACTIVE:
 			adminState = voltha.AdminState_ENABLED
 			if err := agent.enablePorts(); err != nil {
-				log.Warnw("enable-all-ports-failed", log.Fields{"deviceId": deviceId, "error": err})
+				log.Warnw("enable-all-ports-failed", log.Fields{"deviceId": deviceID, "error": err})
 				return err
 			}
 		case voltha.OperStatus_UNKNOWN:
 			adminState = voltha.AdminState_DISABLED
 			if err := agent.disablePorts(); err != nil {
-				log.Warnw("disable-all-ports-failed", log.Fields{"deviceId": deviceId, "error": err})
+				log.Warnw("disable-all-ports-failed", log.Fields{"deviceId": deviceID, "error": err})
 				return err
 			}
 		default:
 			return status.Error(codes.Unimplemented, "state-change-not-implemented")
 		}
 		// Notify the logical device about the state change
-		if device, err := dMgr.GetDevice(deviceId); err != nil {
-			log.Warnw("non-existent-device", log.Fields{"deviceId": deviceId, "error": err})
+		device, err := dMgr.GetDevice(deviceID)
+		if err != nil {
+			log.Warnw("non-existent-device", log.Fields{"deviceId": deviceID, "error": err})
 			return err
-		} else {
-			if err := dMgr.logicalDeviceMgr.updatePortsState(device, adminState); err != nil {
-				log.Warnw("failed-updating-ports-state", log.Fields{"deviceId": deviceId, "error": err})
-				return err
-			}
-			return nil
 		}
+		if err := dMgr.logicalDeviceMgr.updatePortsState(device, adminState); err != nil {
+			log.Warnw("failed-updating-ports-state", log.Fields{"deviceId": deviceID, "error": err})
+			return err
+		}
+		return nil
 	}
-	return status.Errorf(codes.NotFound, "%s", deviceId)
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) childDeviceDetected(parentDeviceId string, parentPortNo int64, deviceType string,
-	channelId int64, vendorId string, serialNumber string, onuId int64) (*voltha.Device, error) {
-	log.Debugw("childDeviceDetected", log.Fields{"parentDeviceId": parentDeviceId, "parentPortNo": parentPortNo, "deviceType": deviceType, "channelId": channelId, "vendorId": vendorId, "serialNumber": serialNumber, "onuId": onuId})
+func (dMgr *DeviceManager) childDeviceDetected(parentDeviceID string, parentPortNo int64, deviceType string,
+	channelID int64, vendorID string, serialNumber string, onuID int64) (*voltha.Device, error) {
+	log.Debugw("childDeviceDetected", log.Fields{"parentDeviceId": parentDeviceID, "parentPortNo": parentPortNo, "deviceType": deviceType, "channelId": channelID, "vendorId": vendorID, "serialNumber": serialNumber, "onuId": onuID})
 
-	if deviceType == "" && vendorId != "" {
+	if deviceType == "" && vendorID != "" {
 		log.Debug("device-type-is-nil-fetching-device-type")
 		if deviceTypesIf := dMgr.adapterMgr.clusterDataProxy.List(context.Background(), "/device_types", 0, false, ""); deviceTypesIf != nil {
 		OLoop:
 			for _, deviceTypeIf := range deviceTypesIf.([]interface{}) {
 				if dType, ok := deviceTypeIf.(*voltha.DeviceType); ok {
 					for _, v := range dType.VendorIds {
-						if v == vendorId {
+						if v == vendorID {
 							deviceType = dType.Adapter
 							break OLoop
 						}
@@ -923,37 +957,37 @@
 	}
 	//if no match found for the vendorid,report adapter with the custom error message
 	if deviceType == "" {
-		log.Errorw("failed-to-fetch-adapter-name ", log.Fields{"vendorId": vendorId})
-		return nil, status.Errorf(codes.NotFound, "%s", vendorId)
+		log.Errorw("failed-to-fetch-adapter-name ", log.Fields{"vendorId": vendorID})
+		return nil, status.Errorf(codes.NotFound, "%s", vendorID)
 	}
 
 	// Create the ONU device
 	childDevice := &voltha.Device{}
 	childDevice.Type = deviceType
-	childDevice.ParentId = parentDeviceId
+	childDevice.ParentId = parentDeviceID
 	childDevice.ParentPortNo = uint32(parentPortNo)
-	childDevice.VendorId = vendorId
+	childDevice.VendorId = vendorID
 	childDevice.SerialNumber = serialNumber
 	childDevice.Root = false
 
 	//Get parent device type
-	parent, err := dMgr.GetDevice(parentDeviceId)
+	parent, err := dMgr.GetDevice(parentDeviceID)
 	if err != nil {
-		log.Error("no-parent-found", log.Fields{"parentId": parentDeviceId})
-		return nil, status.Errorf(codes.NotFound, "%s", parentDeviceId)
+		log.Error("no-parent-found", log.Fields{"parentId": parentDeviceID})
+		return nil, status.Errorf(codes.NotFound, "%s", parentDeviceID)
 	}
 
-	if device, err := dMgr.GetChildDevice(parentDeviceId, serialNumber, onuId, parentPortNo); err == nil {
-		log.Warnw("child-device-exists", log.Fields{"parentId": parentDeviceId, "serialNumber": serialNumber})
+	if device, err := dMgr.GetChildDevice(parentDeviceID, serialNumber, onuID, parentPortNo); err == nil {
+		log.Warnw("child-device-exists", log.Fields{"parentId": parentDeviceID, "serialNumber": serialNumber})
 		return device, status.Errorf(codes.AlreadyExists, "%s", serialNumber)
 	}
 
-	childDevice.ProxyAddress = &voltha.Device_ProxyAddress{DeviceId: parentDeviceId, DeviceType: parent.Type, ChannelId: uint32(channelId), OnuId: uint32(onuId)}
+	childDevice.ProxyAddress = &voltha.Device_ProxyAddress{DeviceId: parentDeviceID, DeviceType: parent.Type, ChannelId: uint32(channelID), OnuId: uint32(onuID)}
 
 	// Create and start a device agent for that device
 	agent := newDeviceAgent(dMgr.adapterProxy, childDevice, dMgr, dMgr.clusterDataProxy, dMgr.defaultTimeout)
 	dMgr.addDeviceAgentToMap(agent)
-	childDevice, err = agent.start(nil, childDevice)
+	childDevice, err = agent.start(context.TODO(), childDevice)
 	if err != nil {
 		log.Error("error-starting-child")
 		return nil, err
@@ -961,15 +995,28 @@
 
 	// Since this Core has handled this request then it therefore owns this child device.  Set the
 	// ownership of this device to this Core
-	dMgr.core.deviceOwnership.OwnedByMe(&utils.DeviceID{Id: agent.deviceId})
+	_, err = dMgr.core.deviceOwnership.OwnedByMe(&utils.DeviceID{ID: agent.deviceID})
+	if err != nil {
+		log.Errorw("unable-to-find-core-instance-active-owns-this-device", log.Fields{"error": err})
+	}
 
 	// Activate the child device
-	if agent := dMgr.getDeviceAgent(agent.deviceId); agent != nil {
-		go agent.enableDevice(nil)
+	if agent = dMgr.getDeviceAgent(agent.deviceID); agent != nil {
+		go func() {
+			err := agent.enableDevice(context.TODO())
+			if err != nil {
+				log.Errorw("unable-to-enable-device", log.Fields{"error": err})
+			}
+		}()
 	}
 
 	// Publish on the messaging bus that we have discovered new devices
-	go dMgr.kafkaICProxy.DeviceDiscovered(agent.deviceId, deviceType, parentDeviceId, dMgr.coreInstanceId)
+	go func() {
+		err := dMgr.kafkaICProxy.DeviceDiscovered(agent.deviceID, deviceType, parentDeviceID, dMgr.coreInstanceID)
+		if err != nil {
+			log.Errorw("unable-to-discover-the-device", log.Fields{"error": err})
+		}
+	}()
 
 	return childDevice, nil
 }
@@ -992,42 +1039,44 @@
 	return nil
 }
 
-func (dMgr *DeviceManager) packetOut(deviceId string, outPort uint32, packet *ofp.OfpPacketOut) error {
-	log.Debugw("packetOut", log.Fields{"deviceId": deviceId, "outPort": outPort})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) packetOut(deviceID string, outPort uint32, packet *ofp.OfpPacketOut) error {
+	log.Debugw("packetOut", log.Fields{"deviceId": deviceID, "outPort": outPort})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		return agent.packetOut(outPort, packet)
 	}
-	return status.Errorf(codes.NotFound, "%s", deviceId)
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
-func (dMgr *DeviceManager) PacketIn(deviceId string, port uint32, transactionId string, packet []byte) error {
-	log.Debugw("PacketIn", log.Fields{"deviceId": deviceId, "port": port})
+// PacketIn receives packet from adapter
+func (dMgr *DeviceManager) PacketIn(deviceID string, port uint32, transactionID string, packet []byte) error {
+	log.Debugw("PacketIn", log.Fields{"deviceId": deviceID, "port": port})
 	// Get the logical device Id based on the deviceId
 	var device *voltha.Device
 	var err error
-	if device, err = dMgr.GetDevice(deviceId); err != nil {
-		log.Errorw("device-not-found", log.Fields{"deviceId": deviceId})
+	if device, err = dMgr.GetDevice(deviceID); err != nil {
+		log.Errorw("device-not-found", log.Fields{"deviceId": deviceID})
 		return err
 	}
 	if !device.Root {
-		log.Errorw("device-not-root", log.Fields{"deviceId": deviceId})
-		return status.Errorf(codes.FailedPrecondition, "%s", deviceId)
+		log.Errorw("device-not-root", log.Fields{"deviceId": deviceID})
+		return status.Errorf(codes.FailedPrecondition, "%s", deviceID)
 	}
 
-	if err := dMgr.logicalDeviceMgr.packetIn(device.ParentId, port, transactionId, packet); err != nil {
+	if err := dMgr.logicalDeviceMgr.packetIn(device.ParentId, port, transactionID, packet); err != nil {
 		return err
 	}
 	return nil
 }
 
-func (dMgr *DeviceManager) setParentId(device *voltha.Device, parentId string) error {
-	log.Debugw("setParentId", log.Fields{"deviceId": device.Id, "parentId": parentId})
+func (dMgr *DeviceManager) setParentID(device *voltha.Device, parentID string) error {
+	log.Debugw("setParentId", log.Fields{"deviceId": device.Id, "parentId": parentID})
 	if agent := dMgr.getDeviceAgent(device.Id); agent != nil {
-		return agent.setParentId(device, parentId)
+		return agent.setParentID(device, parentID)
 	}
 	return status.Errorf(codes.NotFound, "%s", device.Id)
 }
 
+// CreateLogicalDevice creates logical device in core
 func (dMgr *DeviceManager) CreateLogicalDevice(cDevice *voltha.Device) error {
 	log.Info("CreateLogicalDevice")
 	// Verify whether the logical device has already been created
@@ -1036,42 +1085,45 @@
 		return nil
 	}
 	var err error
-	if _, err = dMgr.logicalDeviceMgr.createLogicalDevice(nil, cDevice); err != nil {
+	if _, err = dMgr.logicalDeviceMgr.createLogicalDevice(context.TODO(), cDevice); err != nil {
 		log.Warnw("createlogical-device-error", log.Fields{"device": cDevice})
 		return err
 	}
 	return nil
 }
 
+// DeleteLogicalDevice deletes logical device from core
 func (dMgr *DeviceManager) DeleteLogicalDevice(cDevice *voltha.Device) error {
 	log.Info("DeleteLogicalDevice")
 	var err error
-	if err = dMgr.logicalDeviceMgr.deleteLogicalDevice(nil, cDevice); err != nil {
+	if err = dMgr.logicalDeviceMgr.deleteLogicalDevice(context.TODO(), cDevice); err != nil {
 		log.Warnw("deleteLogical-device-error", log.Fields{"deviceId": cDevice.Id})
 		return err
 	}
 	// Remove the logical device Id from the parent device
-	logicalId := ""
-	dMgr.UpdateDeviceAttribute(cDevice.Id, "ParentId", logicalId)
+	logicalID := ""
+	dMgr.UpdateDeviceAttribute(cDevice.Id, "ParentId", logicalID)
 	return nil
 }
 
+// DeleteLogicalPort removes the logical port associated with a device
 func (dMgr *DeviceManager) DeleteLogicalPort(device *voltha.Device) error {
 	log.Info("deleteLogicalPort")
 	var err error
 	// Get the logical port associated with this device
-	var lPortId *voltha.LogicalPortId
-	if lPortId, err = dMgr.logicalDeviceMgr.getLogicalPortId(device); err != nil {
+	var lPortID *voltha.LogicalPortId
+	if lPortID, err = dMgr.logicalDeviceMgr.getLogicalPortID(device); err != nil {
 		log.Warnw("getLogical-port-error", log.Fields{"deviceId": device.Id, "error": err})
 		return err
 	}
-	if err = dMgr.logicalDeviceMgr.deleteLogicalPort(nil, lPortId); err != nil {
+	if err = dMgr.logicalDeviceMgr.deleteLogicalPort(context.TODO(), lPortID); err != nil {
 		log.Warnw("deleteLogical-port-error", log.Fields{"deviceId": device.Id})
 		return err
 	}
 	return nil
 }
 
+// DeleteLogicalPorts removes the logical ports associated with that deviceId
 func (dMgr *DeviceManager) DeleteLogicalPorts(device *voltha.Device) error {
 	log.Info("deleteLogicalPorts")
 	if err := dMgr.logicalDeviceMgr.deleteLogicalPorts(device.Id); err != nil {
@@ -1093,12 +1145,12 @@
 
 //childDevicesLost is invoked by an adapter to indicate that a parent device is in a state (Disabled) where it
 //cannot manage the child devices.  This will trigger the Core to disable all the child devices.
-func (dMgr *DeviceManager) childDevicesLost(parentDeviceId string) error {
+func (dMgr *DeviceManager) childDevicesLost(parentDeviceID string) error {
 	log.Debug("childDevicesLost")
 	var err error
 	var parentDevice *voltha.Device
-	if parentDevice, err = dMgr.GetDevice(parentDeviceId); err != nil {
-		log.Warnw("failed-getting-device", log.Fields{"deviceId": parentDeviceId, "error": err})
+	if parentDevice, err = dMgr.GetDevice(parentDeviceID); err != nil {
+		log.Warnw("failed-getting-device", log.Fields{"deviceId": parentDeviceID, "error": err})
 		return err
 	}
 	return dMgr.DisableAllChildDevices(parentDevice)
@@ -1106,14 +1158,14 @@
 
 //childDevicesDetected is invoked by an adapter when child devices are found, typically after after a
 // disable/enable sequence.  This will trigger the Core to Enable all the child devices of that parent.
-func (dMgr *DeviceManager) childDevicesDetected(parentDeviceId string) error {
+func (dMgr *DeviceManager) childDevicesDetected(parentDeviceID string) error {
 	log.Debug("childDevicesDetected")
 	var err error
 	var parentDevice *voltha.Device
 	var childDeviceIds []string
 
-	if parentDevice, err = dMgr.GetDevice(parentDeviceId); err != nil {
-		log.Warnw("failed-getting-device", log.Fields{"deviceId": parentDeviceId, "error": err})
+	if parentDevice, err = dMgr.GetDevice(parentDeviceID); err != nil {
+		log.Warnw("failed-getting-device", log.Fields{"deviceId": parentDeviceID, "error": err})
 		return err
 	}
 
@@ -1124,13 +1176,18 @@
 		log.Debugw("no-child-device", log.Fields{"parentDeviceId": parentDevice.Id})
 	}
 	allChildEnableRequestSent := true
-	for _, childDeviceId := range childDeviceIds {
-		if agent := dMgr.getDeviceAgent(childDeviceId); agent != nil {
+	for _, childDeviceID := range childDeviceIds {
+		if agent := dMgr.getDeviceAgent(childDeviceID); agent != nil {
 			// Run the children re-registration in its own routine
-			go agent.enableDevice(nil)
+			go func() {
+				err = agent.enableDevice(context.TODO())
+				if err != nil {
+					log.Errorw("unable-to-enable-device", log.Fields{"error": err})
+				}
+			}()
 		} else {
-			err = status.Errorf(codes.Unavailable, "no agent for child device %s", childDeviceId)
-			log.Errorw("no-child-device-agent", log.Fields{"parentDeviceId": parentDevice.Id, "childId": childDeviceId})
+			err = status.Errorf(codes.Unavailable, "no agent for child device %s", childDeviceID)
+			log.Errorw("no-child-device-agent", log.Fields{"parentDeviceId": parentDevice.Id, "childId": childDeviceID})
 			allChildEnableRequestSent = false
 		}
 	}
@@ -1157,10 +1214,10 @@
 		log.Debugw("no-child-device", log.Fields{"parentDeviceId": parentDevice.Id})
 	}
 	allChildDisable := true
-	for _, childDeviceId := range childDeviceIds {
-		if agent := dMgr.getDeviceAgent(childDeviceId); agent != nil {
-			if err = agent.disableDevice(nil); err != nil {
-				log.Errorw("failure-disable-device", log.Fields{"deviceId": childDeviceId, "error": err.Error()})
+	for _, childDeviceID := range childDeviceIds {
+		if agent := dMgr.getDeviceAgent(childDeviceID); agent != nil {
+			if err = agent.disableDevice(context.TODO()); err != nil {
+				log.Errorw("failure-disable-device", log.Fields{"deviceId": childDeviceID, "error": err.Error()})
 				allChildDisable = false
 			}
 		}
@@ -1183,13 +1240,13 @@
 		log.Debugw("no-child-device", log.Fields{"parentDeviceId": parentDevice.Id})
 	}
 	allChildDeleted := true
-	for _, childDeviceId := range childDeviceIds {
-		if agent := dMgr.getDeviceAgent(childDeviceId); agent != nil {
-			if err = agent.deleteDevice(nil); err != nil {
-				log.Errorw("failure-delete-device", log.Fields{"deviceId": childDeviceId, "error": err.Error()})
+	for _, childDeviceID := range childDeviceIds {
+		if agent := dMgr.getDeviceAgent(childDeviceID); agent != nil {
+			if err = agent.deleteDevice(context.TODO()); err != nil {
+				log.Errorw("failure-delete-device", log.Fields{"deviceId": childDeviceID, "error": err.Error()})
 				allChildDeleted = false
 			} else {
-				agent.stop(nil)
+				agent.stop(context.TODO())
 				dMgr.deleteDeviceAgentFromMap(agent)
 			}
 		}
@@ -1203,12 +1260,12 @@
 //getAllDeviceIdsWithDeviceParentId returns the list of device Ids which has id as parent Id.  This function uses the
 // data from the agent instead of using the data from the parent device as that data would disappear from a parent
 // device during a delete device operation.
-func (dMgr *DeviceManager) getAllDeviceIdsWithDeviceParentId(id string) []string {
+func (dMgr *DeviceManager) getAllDeviceIdsWithDeviceParentID(id string) []string {
 	log.Debugw("getAllAgentsWithDeviceParentId", log.Fields{"parentDeviceId": id})
 	deviceIds := make([]string, 0)
 	dMgr.deviceAgents.Range(func(key, value interface{}) bool {
 		agent := value.(*DeviceAgent)
-		if agent.parentId == id {
+		if agent.parentID == id {
 			deviceIds = append(deviceIds, key.(string))
 		}
 		return true
@@ -1232,25 +1289,26 @@
 }
 
 //getAllChildDevices is a helper method to get all the child device IDs from the device passed as parameter
-func (dMgr *DeviceManager) getAllChildDevices(parentDeviceId string) (*voltha.Devices, error) {
-	log.Debugw("getAllChildDevices", log.Fields{"parentDeviceId": parentDeviceId})
-	if parentDevice, err := dMgr.GetDevice(parentDeviceId); err == nil {
+func (dMgr *DeviceManager) getAllChildDevices(parentDeviceID string) (*voltha.Devices, error) {
+	log.Debugw("getAllChildDevices", log.Fields{"parentDeviceId": parentDeviceID})
+	if parentDevice, err := dMgr.GetDevice(parentDeviceID); err == nil {
 		childDevices := make([]*voltha.Device, 0)
 		if childDeviceIds, er := dMgr.getAllChildDeviceIds(parentDevice); er == nil {
-			for _, deviceId := range childDeviceIds {
-				if d, e := dMgr.GetDevice(deviceId); e == nil && d != nil {
+			for _, deviceID := range childDeviceIds {
+				if d, e := dMgr.GetDevice(deviceID); e == nil && d != nil {
 					childDevices = append(childDevices, d)
 				}
 			}
 		}
 		return &voltha.Devices{Items: childDevices}, nil
 	}
-	return nil, status.Errorf(codes.NotFound, "%s", parentDeviceId)
+	return nil, status.Errorf(codes.NotFound, "%s", parentDeviceID)
 }
 
+// SetupUNILogicalPorts creates UNI ports on the logical device that represents a child UNI interface
 func (dMgr *DeviceManager) SetupUNILogicalPorts(cDevice *voltha.Device) error {
 	log.Info("addUNILogicalPort")
-	if err := dMgr.logicalDeviceMgr.setupUNILogicalPorts(nil, cDevice); err != nil {
+	if err := dMgr.logicalDeviceMgr.setupUNILogicalPorts(context.TODO(), cDevice); err != nil {
 		log.Warnw("addUNILogicalPort-error", log.Fields{"device": cDevice, "err": err})
 		return err
 	}
@@ -1332,9 +1390,9 @@
 	sendResponse(ctx, ch, res)
 }
 
-func (dMgr *DeviceManager) updateImageDownload(deviceId string, img *voltha.ImageDownload) error {
+func (dMgr *DeviceManager) updateImageDownload(deviceID string, img *voltha.ImageDownload) error {
 	log.Debugw("updateImageDownload", log.Fields{"deviceid": img.Id, "imageName": img.Name})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		if err := agent.updateImageDownload(img); err != nil {
 			log.Debugw("updateImageDownload-failed", log.Fields{"err": err, "imageName": img.Name})
 			return err
@@ -1353,14 +1411,15 @@
 	return nil, status.Errorf(codes.NotFound, "%s", img.Id)
 }
 
-func (dMgr *DeviceManager) listImageDownloads(ctx context.Context, deviceId string) (*voltha.ImageDownloads, error) {
-	log.Debugw("listImageDownloads", log.Fields{"deviceId": deviceId})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
-		return agent.listImageDownloads(ctx, deviceId)
+func (dMgr *DeviceManager) listImageDownloads(ctx context.Context, deviceID string) (*voltha.ImageDownloads, error) {
+	log.Debugw("listImageDownloads", log.Fields{"deviceID": deviceID})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
+		return agent.listImageDownloads(ctx, deviceID)
 	}
-	return nil, status.Errorf(codes.NotFound, "%s", deviceId)
+	return nil, status.Errorf(codes.NotFound, "%s", deviceID)
 }
 
+// SetAdminStateToEnable sets admin state of device to enabled
 func (dMgr *DeviceManager) SetAdminStateToEnable(cDevice *voltha.Device) error {
 	log.Info("SetAdminStateToEnable")
 	if agent := dMgr.getDeviceAgent(cDevice.Id); agent != nil {
@@ -1369,36 +1428,7 @@
 	return status.Errorf(codes.NotFound, "%s", cDevice.Id)
 }
 
-func (dMgr *DeviceManager) activateDevice(cDevice *voltha.Device) error {
-	log.Info("activateDevice")
-	return nil
-}
-
-func (dMgr *DeviceManager) disableDeviceHandler(cDevice *voltha.Device) error {
-	log.Info("disableDevice-donothing")
-	return nil
-}
-
-func (dMgr *DeviceManager) abandonDevice(cDevice *voltha.Device) error {
-	log.Info("abandonDevice")
-	return nil
-}
-
-func (dMgr *DeviceManager) reEnableDevice(cDevice *voltha.Device) error {
-	log.Info("reEnableDevice")
-	return nil
-}
-
-func (dMgr *DeviceManager) noOp(cDevice *voltha.Device) error {
-	log.Info("noOp")
-	return nil
-}
-
-func (dMgr *DeviceManager) notAllowed(pcDevice *voltha.Device) error {
-	log.Info("notAllowed")
-	return errors.New("transition-not-allowed")
-}
-
+// NotifyInvalidTransition notifies about invalid transition
 func (dMgr *DeviceManager) NotifyInvalidTransition(pcDevice *voltha.Device) error {
 	log.Errorw("NotifyInvalidTransition", log.Fields{
 		"device":     pcDevice.Id,
@@ -1416,14 +1446,16 @@
 	return rf.Name()
 }
 
-func (dMgr *DeviceManager) UpdateDeviceAttribute(deviceId string, attribute string, value interface{}) {
-	if agent, ok := dMgr.deviceAgents.Load(deviceId); ok {
+// UpdateDeviceAttribute updates value of particular device attribute
+func (dMgr *DeviceManager) UpdateDeviceAttribute(deviceID string, attribute string, value interface{}) {
+	if agent, ok := dMgr.deviceAgents.Load(deviceID); ok {
 		agent.(*DeviceAgent).updateDeviceAttribute(attribute, value)
 	}
 }
 
-func (dMgr *DeviceManager) GetParentDeviceId(deviceId string) string {
-	if device, _ := dMgr.GetDevice(deviceId); device != nil {
+// GetParentDeviceID returns parent device id, either from memory or from the dB, if present
+func (dMgr *DeviceManager) GetParentDeviceID(deviceID string) string {
+	if device, _ := dMgr.GetDevice(deviceID); device != nil {
 		log.Infow("GetParentDeviceId", log.Fields{"deviceId": device.Id, "parentId": device.ParentId})
 		return device.ParentId
 	}
@@ -1443,10 +1475,10 @@
 	sendResponse(ctx, ch, res)
 }
 
-func (dMgr *DeviceManager) updateDeviceReason(deviceId string, reason string) error {
-	log.Debugw("updateDeviceReason", log.Fields{"deviceid": deviceId, "reason": reason})
-	if agent := dMgr.getDeviceAgent(deviceId); agent != nil {
+func (dMgr *DeviceManager) updateDeviceReason(deviceID string, reason string) error {
+	log.Debugw("updateDeviceReason", log.Fields{"deviceid": deviceID, "reason": reason})
+	if agent := dMgr.getDeviceAgent(deviceID); agent != nil {
 		return agent.updateDeviceReason(reason)
 	}
-	return status.Errorf(codes.NotFound, "%s", deviceId)
+	return status.Errorf(codes.NotFound, "%s", deviceID)
 }
diff --git a/rw_core/core/device_ownership.go b/rw_core/core/device_ownership.go
index b44e5c0..5f4d0d5 100644
--- a/rw_core/core/device_ownership.go
+++ b/rw_core/core/device_ownership.go
@@ -13,23 +13,28 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
 	"context"
 	"fmt"
+	"sync"
+	"time"
+
 	"github.com/opencord/voltha-go/rw_core/utils"
 	"github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore"
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 	"github.com/opencord/voltha-protos/v2/go/voltha"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
-	"sync"
-	"time"
 )
 
 func init() {
-	log.AddPackage(log.JSON, log.WarnLevel, nil)
+	_, err := log.AddPackage(log.JSON, log.WarnLevel, nil)
+	if err != nil {
+		log.Errorw("unable-to-register-package-to-the-log-map", log.Fields{"error": err})
+	}
 }
 
 type ownership struct {
@@ -38,8 +43,9 @@
 	chnl  chan int
 }
 
+// DeviceOwnership represent device ownership attributes
 type DeviceOwnership struct {
-	instanceId         string
+	instanceID         string
 	exitChannel        chan int
 	kvClient           kvstore.Client
 	reservationTimeout int64 // Duration in seconds
@@ -53,9 +59,10 @@
 	ownershipLock      sync.RWMutex
 }
 
+// NewDeviceOwnership creates device ownership instance
 func NewDeviceOwnership(id string, kvClient kvstore.Client, deviceMgr *DeviceManager, logicalDeviceMgr *LogicalDeviceManager, ownershipPrefix string, reservationTimeout int64) *DeviceOwnership {
 	var deviceOwnership DeviceOwnership
-	deviceOwnership.instanceId = id
+	deviceOwnership.instanceID = id
 	deviceOwnership.exitChannel = make(chan int, 1)
 	deviceOwnership.kvClient = kvClient
 	deviceOwnership.deviceMgr = deviceMgr
@@ -70,11 +77,13 @@
 	return &deviceOwnership
 }
 
+// Start starts device device ownership
 func (da *DeviceOwnership) Start(ctx context.Context) {
-	log.Info("starting-deviceOwnership", log.Fields{"instanceId": da.instanceId})
+	log.Info("starting-deviceOwnership", log.Fields{"instanceId": da.instanceID})
 	log.Info("deviceOwnership-started")
 }
 
+// Stop stops device ownership
 func (da *DeviceOwnership) Stop(ctx context.Context) {
 	log.Info("stopping-deviceOwnership")
 	da.exitChannel <- 1
@@ -87,15 +96,15 @@
 	var currOwner string
 	//Try to reserve the key
 	kvKey := fmt.Sprintf("%s_%s", da.ownershipPrefix, id)
-	value, err := da.kvClient.Reserve(kvKey, da.instanceId, da.reservationTimeout)
+	value, err := da.kvClient.Reserve(kvKey, da.instanceID, da.reservationTimeout)
 	if err != nil {
-		log.Errorw("error", log.Fields{"error": err, "id": id, "instanceId": da.instanceId})
+		log.Errorw("error", log.Fields{"error": err, "id": id, "instanceId": da.instanceID})
 	}
 	if value != nil {
 		if currOwner, err = kvstore.ToString(value); err != nil {
 			log.Error("unexpected-owner-type")
 		}
-		return currOwner == da.instanceId
+		return currOwner == da.instanceID
 	}
 	return false
 }
@@ -104,7 +113,7 @@
 	// Try to reserve the key
 	kvKey := fmt.Sprintf("%s_%s", da.ownershipPrefix, id)
 	if err := da.kvClient.RenewReservation(kvKey); err != nil {
-		log.Errorw("reservation-renewal-error", log.Fields{"error": err, "instance": da.instanceId})
+		log.Errorw("reservation-renewal-error", log.Fields{"error": err, "instance": da.instanceID})
 		return false
 	}
 	return true
@@ -136,9 +145,9 @@
 			// Device owned; renew reservation
 			op = "renew"
 			if da.renewReservation(id) {
-				log.Debugw("reservation-renewed", log.Fields{"id": id, "instanceId": da.instanceId})
+				log.Debugw("reservation-renewed", log.Fields{"id": id, "instanceId": da.instanceID})
 			} else {
-				log.Debugw("reservation-not-renewed", log.Fields{"id": id, "instanceId": da.instanceId})
+				log.Debugw("reservation-not-renewed", log.Fields{"id": id, "instanceId": da.instanceID})
 			}
 		} else {
 			// Device not owned or not owned by me; try to seize ownership
@@ -173,7 +182,7 @@
 	return status.Error(codes.NotFound, fmt.Sprintf("id-inexistent-%s", id))
 }
 
-// getAllDeviceIdsOwnedByMe returns all the deviceIds (root device Ids) that is managed by this Core
+// GetAllDeviceIdsOwnedByMe returns all the deviceIds (root device Ids) that is managed by this Core
 func (da *DeviceOwnership) GetAllDeviceIdsOwnedByMe() []string {
 	deviceIds := []string{}
 	da.deviceMapLock.Lock()
@@ -240,7 +249,8 @@
 	}
 	da.deviceMapLock.Lock()
 	defer da.deviceMapLock.Unlock()
-	if o, exist := da.deviceMap[id]; exist { // id is ownership key
+	o, exist := da.deviceMap[id]
+	if exist { // id is ownership key
 		// Need to clean up all deviceToKeyMap entries using this device as key
 		da.deviceToKeyMapLock.Lock()
 		defer da.deviceToKeyMapLock.Unlock()
@@ -257,9 +267,9 @@
 		delete(da.deviceMap, id)
 		log.Debugw("abandoning-device", log.Fields{"Id": id})
 		return nil
-	} else { // id is not ownership key
-		da.deleteDeviceKey(id)
 	}
+	// id is not ownership key
+	da.deleteDeviceKey(id)
 	return nil
 }
 
@@ -269,7 +279,7 @@
 	defer da.deviceMapLock.Unlock()
 	da.deviceToKeyMapLock.Lock()
 	defer da.deviceToKeyMapLock.Unlock()
-	for k, _ := range da.deviceToKeyMap {
+	for k := range da.deviceToKeyMap {
 		delete(da.deviceToKeyMap, k)
 	}
 	for _, val := range da.deviceMap {
@@ -277,25 +287,6 @@
 	}
 }
 
-func (da *DeviceOwnership) getDeviceKey(id string) (string, error) {
-	da.deviceToKeyMapLock.RLock()
-	defer da.deviceToKeyMapLock.RUnlock()
-	if val, exist := da.deviceToKeyMap[id]; exist {
-		return val, nil
-	}
-	return "", status.Error(codes.NotFound, fmt.Sprintf("not-present-%s", id))
-}
-
-func (da *DeviceOwnership) updateDeviceKey(id string, key string) error {
-	da.deviceToKeyMapLock.Lock()
-	defer da.deviceToKeyMapLock.Unlock()
-	if _, exist := da.deviceToKeyMap[id]; exist {
-		return status.Error(codes.AlreadyExists, fmt.Sprintf("already-present-%s", id))
-	}
-	da.deviceToKeyMap[id] = key
-	return nil
-}
-
 func (da *DeviceOwnership) deleteDeviceKey(id string) {
 	da.deviceToKeyMapLock.Lock()
 	defer da.deviceToKeyMapLock.Unlock()
@@ -317,28 +308,27 @@
 	var device *voltha.Device
 	var lDevice *voltha.LogicalDevice
 	// The id can either be a device Id or a logical device id.
-	if dId, ok := id.(*utils.DeviceID); ok {
+	if dID, ok := id.(*utils.DeviceID); ok {
 		// Use cache if present
-		if val, exist := da.deviceToKeyMap[dId.Id]; exist {
-			return val, dId.Id, true, nil
+		if val, exist := da.deviceToKeyMap[dID.ID]; exist {
+			return val, dID.ID, true, nil
 		}
-		if device, _ = da.deviceMgr.GetDevice(dId.Id); device == nil {
-			return "", dId.Id, false, status.Errorf(codes.NotFound, "id-absent-%s", dId)
+		if device, _ = da.deviceMgr.GetDevice(dID.ID); device == nil {
+			return "", dID.ID, false, status.Errorf(codes.NotFound, "id-absent-%s", dID)
 		}
 		if device.Root {
-			return device.Id, dId.Id, false, nil
-		} else {
-			return device.ParentId, dId.Id, false, nil
+			return device.Id, dID.ID, false, nil
 		}
-	} else if ldId, ok := id.(*utils.LogicalDeviceID); ok {
+		return device.ParentId, dID.ID, false, nil
+	} else if ldID, ok := id.(*utils.LogicalDeviceID); ok {
 		// Use cache if present
-		if val, exist := da.deviceToKeyMap[ldId.Id]; exist {
-			return val, ldId.Id, true, nil
+		if val, exist := da.deviceToKeyMap[ldID.ID]; exist {
+			return val, ldID.ID, true, nil
 		}
-		if lDevice, _ = da.logicalDeviceMgr.getLogicalDevice(ldId.Id); lDevice == nil {
-			return "", ldId.Id, false, status.Errorf(codes.NotFound, "id-absent-%s", dId)
+		if lDevice, _ = da.logicalDeviceMgr.getLogicalDevice(ldID.ID); lDevice == nil {
+			return "", ldID.ID, false, status.Errorf(codes.NotFound, "id-absent-%s", dID)
 		}
-		return lDevice.RootDeviceId, ldId.Id, false, nil
+		return lDevice.RootDeviceId, ldID.ID, false, nil
 	}
 	return "", "", false, status.Error(codes.NotFound, fmt.Sprintf("id-%v", id))
 }
diff --git a/rw_core/core/device_state_transitions.go b/rw_core/core/device_state_transitions.go
index a48346a..5188e56 100644
--- a/rw_core/core/device_state_transitions.go
+++ b/rw_core/core/device_state_transitions.go
@@ -13,14 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
-	"github.com/opencord/voltha-go/rw_core/coreIf"
+	"github.com/opencord/voltha-go/rw_core/coreif"
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 	"github.com/opencord/voltha-protos/v2/go/voltha"
 )
 
+// DeviceType mentions type of device like parent, child
 type DeviceType int32
 
 const (
@@ -29,14 +31,17 @@
 	any    DeviceType = 2
 )
 
+// DeviceState has admin, operational and connection status of device
 type DeviceState struct {
 	Admin       voltha.AdminState_AdminState
 	Connection  voltha.ConnectStatus_ConnectStatus
 	Operational voltha.OperStatus_OperStatus
 }
 
+// TransitionHandler function type which takes device as input parameter
 type TransitionHandler func(*voltha.Device) error
 
+// Transition represent transition related attributes
 type Transition struct {
 	deviceType    DeviceType
 	previousState DeviceState
@@ -44,12 +49,14 @@
 	handlers      []TransitionHandler
 }
 
+// TransitionMap represent map of transitions and device manager
 type TransitionMap struct {
 	transitions []Transition
-	dMgr        coreIf.DeviceManager
+	dMgr        coreif.DeviceManager
 }
 
-func NewTransitionMap(dMgr coreIf.DeviceManager) *TransitionMap {
+// NewTransitionMap creates transition map
+func NewTransitionMap(dMgr coreif.DeviceManager) *TransitionMap {
 	var transitionMap TransitionMap
 	transitionMap.dMgr = dMgr
 	transitionMap.transitions = make([]Transition, 0)
@@ -197,6 +204,7 @@
 	return nil, false
 }
 
+// GetTransitionHandler returns transition handler
 func (tMap *TransitionMap) GetTransitionHandler(pDevice *voltha.Device, cDevice *voltha.Device) []TransitionHandler {
 	//1. Get the previous and current set of states
 	pState := getDeviceStates(pDevice)
diff --git a/rw_core/core/device_state_transitions_test.go b/rw_core/core/device_state_transitions_test.go
index 0e7b4b3..fdd58ca 100644
--- a/rw_core/core/device_state_transitions_test.go
+++ b/rw_core/core/device_state_transitions_test.go
@@ -16,17 +16,18 @@
 package core
 
 import (
-	"github.com/opencord/voltha-go/rw_core/coreIf"
+	"reflect"
+	"testing"
+
+	"github.com/opencord/voltha-go/rw_core/coreif"
 	"github.com/opencord/voltha-go/rw_core/mocks"
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 	"github.com/opencord/voltha-protos/v2/go/voltha"
 	"github.com/stretchr/testify/assert"
-	"reflect"
-	"testing"
 )
 
 var transitionMap *TransitionMap
-var tdm coreIf.DeviceManager
+var tdm coreif.DeviceManager
 
 type testDeviceManager struct {
 	mocks.DeviceManager
diff --git a/rw_core/core/grpc_nbi_api_handler.go b/rw_core/core/grpc_nbi_api_handler.go
index 725fb3e..7bbf5ee 100755
--- a/rw_core/core/grpc_nbi_api_handler.go
+++ b/rw_core/core/grpc_nbi_api_handler.go
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
@@ -20,6 +21,9 @@
 	"encoding/hex"
 	"encoding/json"
 	"errors"
+	"io"
+	"sync"
+
 	"github.com/golang/protobuf/ptypes/empty"
 	da "github.com/opencord/voltha-go/common/core/northbound/grpc"
 	"github.com/opencord/voltha-go/rw_core/utils"
@@ -32,19 +36,19 @@
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/metadata"
 	"google.golang.org/grpc/status"
-	"io"
-	"sync"
 )
 
-var errorIdNotFound = status.Error(codes.NotFound, "id-not-found")
+var errorIDNotFound = status.Error(codes.NotFound, "id-not-found")
 
+// Image related constants
 const (
-	IMAGE_DOWNLOAD        = iota
-	CANCEL_IMAGE_DOWNLOAD = iota
-	ACTIVATE_IMAGE        = iota
-	REVERT_IMAGE          = iota
+	ImageDownload       = iota
+	CancelImageDownload = iota
+	ActivateImage       = iota
+	RevertImage         = iota
 )
 
+// APIHandler represent attributes of API handler
 type APIHandler struct {
 	deviceMgr                 *DeviceManager
 	logicalDeviceMgr          *LogicalDeviceManager
@@ -60,6 +64,7 @@
 	core *Core
 }
 
+// NewAPIHandler creates API handler instance
 func NewAPIHandler(core *Core) *APIHandler {
 	handler := &APIHandler{
 		deviceMgr:                 core.deviceMgr,
@@ -147,19 +152,18 @@
 		var ownedByMe bool
 		if ownedByMe, err = handler.core.deviceOwnership.OwnedByMe(id); err != nil {
 			log.Warnw("getting-ownership-failed", log.Fields{"deviceId": id, "error": err})
-			return nil, errorIdNotFound
+			return nil, errorIDNotFound
 		}
 		acquired, err = txn.Acquired(timeout, ownedByMe)
 	} else {
 		acquired, err = txn.Acquired(timeout)
 	}
 	if err == nil && acquired {
-		log.Debugw("transaction-acquired", log.Fields{"transactionId": txn.txnId})
+		log.Debugw("transaction-acquired", log.Fields{"transactionId": txn.txnID})
 		return txn, nil
-	} else {
-		log.Debugw("transaction-not-acquired", log.Fields{"transactionId": txn.txnId, "error": err})
-		return nil, errorTransactionNotAcquired
 	}
+	log.Debugw("transaction-not-acquired", log.Fields{"transactionId": txn.txnID, "error": err})
+	return nil, errorTransactionNotAcquired
 }
 
 // waitForNilResponseOnSuccess is a helper function to wait for a response on channel monitorCh where an nil
@@ -182,6 +186,7 @@
 	}
 }
 
+// UpdateLogLevel dynamically sets the log level of a given package to level
 func (handler *APIHandler) UpdateLogLevel(ctx context.Context, logging *voltha.Logging) (*empty.Empty, error) {
 	log.Debugw("UpdateLogLevel-request", log.Fields{"package": logging.PackageName, "intval": int(logging.Level)})
 
@@ -197,7 +202,8 @@
 	return &empty.Empty{}, nil
 }
 
-func (_ APIHandler) GetLogLevels(ctx context.Context, in *voltha.LoggingComponent) (*voltha.Loggings, error) {
+// GetLogLevels returns log levels of packages
+func (APIHandler) GetLogLevels(ctx context.Context, in *voltha.LoggingComponent) (*voltha.Loggings, error) {
 	logLevels := &voltha.Loggings{}
 
 	// do the per-package log levels
@@ -237,19 +243,21 @@
 	return &voltha.CoreInstance{}, status.Errorf(codes.NotFound, "core-instance-%s", id.Id)
 }
 
+// GetLogicalDevicePort returns logical device port details
 func (handler *APIHandler) GetLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*voltha.LogicalPort, error) {
 	log.Debugw("GetLogicalDevicePort-request", log.Fields{"id": *id})
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
+		if err != nil {
 			return &voltha.LogicalPort{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 	return handler.logicalDeviceMgr.getLogicalPort(id)
 }
 
+// EnableLogicalDevicePort enables logical device port
 func (handler *APIHandler) EnableLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*empty.Empty, error) {
 	log.Debugw("EnableLogicalDevicePort-request", log.Fields{"id": id, "test": common.TestModeKeys_api_test.String()})
 	if isTestMode(ctx) {
@@ -257,11 +265,11 @@
 	}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
+		if err != nil {
 			return &empty.Empty{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -270,6 +278,7 @@
 	return waitForNilResponseOnSuccess(ctx, ch)
 }
 
+// DisableLogicalDevicePort disables logical device port
 func (handler *APIHandler) DisableLogicalDevicePort(ctx context.Context, id *voltha.LogicalPortId) (*empty.Empty, error) {
 	log.Debugw("DisableLogicalDevicePort-request", log.Fields{"id": id, "test": common.TestModeKeys_api_test.String()})
 	if isTestMode(ctx) {
@@ -277,11 +286,11 @@
 	}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
+		if err != nil {
 			return &empty.Empty{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -290,6 +299,7 @@
 	return waitForNilResponseOnSuccess(ctx, ch)
 }
 
+// UpdateLogicalDeviceFlowTable updates logical device flow table
 func (handler *APIHandler) UpdateLogicalDeviceFlowTable(ctx context.Context, flow *openflow_13.FlowTableUpdate) (*empty.Empty, error) {
 	log.Debugw("UpdateLogicalDeviceFlowTable-request", log.Fields{"flow": flow, "test": common.TestModeKeys_api_test.String()})
 	if isTestMode(ctx) {
@@ -297,11 +307,11 @@
 	}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: flow.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: flow.Id})
+		if err != nil {
 			return &empty.Empty{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -310,6 +320,7 @@
 	return waitForNilResponseOnSuccess(ctx, ch)
 }
 
+// UpdateLogicalDeviceFlowGroupTable updates logical device flow group table
 func (handler *APIHandler) UpdateLogicalDeviceFlowGroupTable(ctx context.Context, flow *openflow_13.FlowGroupTableUpdate) (*empty.Empty, error) {
 	log.Debugw("UpdateLogicalDeviceFlowGroupTable-request", log.Fields{"flow": flow, "test": common.TestModeKeys_api_test.String()})
 	if isTestMode(ctx) {
@@ -317,11 +328,11 @@
 	}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: flow.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: flow.Id})
+		if err != nil {
 			return &empty.Empty{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -337,6 +348,8 @@
 }
 
 // GetDevice must be implemented in the read-only containers - should it also be implemented here?
+
+// ListDevices retrieves the latest devices from the data model
 func (handler *APIHandler) ListDevices(ctx context.Context, empty *empty.Empty) (*voltha.Devices, error) {
 	log.Debug("ListDevices")
 	return handler.deviceMgr.ListDevices()
@@ -366,26 +379,28 @@
 	return waitForNilResponseOnSuccess(ctx, ch)
 }
 
+// GetLogicalDevice provides a cloned most up to date logical device
 func (handler *APIHandler) GetLogicalDevice(ctx context.Context, id *voltha.ID) (*voltha.LogicalDevice, error) {
 	log.Debugw("GetLogicalDevice-request", log.Fields{"id": id})
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
+		if err != nil {
 			return &voltha.LogicalDevice{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 	return handler.logicalDeviceMgr.getLogicalDevice(id.Id)
 }
 
+// ListLogicalDevices returns the list of all logical devices
 func (handler *APIHandler) ListLogicalDevices(ctx context.Context, empty *empty.Empty) (*voltha.LogicalDevices, error) {
 	log.Debug("ListLogicalDevices-request")
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, nil); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, nil)
+		if err != nil {
 			return &voltha.LogicalDevices{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 		if handler.isOFControllerRequest(ctx) {
 			//	Since an OF controller is only interested in the set of logical devices managed by thgis Core then return
 			//	only logical devices managed/monitored by this Core.
@@ -401,38 +416,41 @@
 	return handler.adapterMgr.listAdapters(ctx)
 }
 
+// ListLogicalDeviceFlows returns the flows of logical device
 func (handler *APIHandler) ListLogicalDeviceFlows(ctx context.Context, id *voltha.ID) (*openflow_13.Flows, error) {
 	log.Debugw("ListLogicalDeviceFlows", log.Fields{"id": *id})
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
+		if err != nil {
 			return &openflow_13.Flows{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 	return handler.logicalDeviceMgr.ListLogicalDeviceFlows(ctx, id.Id)
 }
 
+// ListLogicalDeviceFlowGroups returns logical device flow groups
 func (handler *APIHandler) ListLogicalDeviceFlowGroups(ctx context.Context, id *voltha.ID) (*openflow_13.FlowGroups, error) {
 	log.Debugw("ListLogicalDeviceFlowGroups", log.Fields{"id": *id})
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
+		if err != nil {
 			return &openflow_13.FlowGroups{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 	return handler.logicalDeviceMgr.ListLogicalDeviceFlowGroups(ctx, id.Id)
 }
 
+// ListLogicalDevicePorts returns ports of logical device
 func (handler *APIHandler) ListLogicalDevicePorts(ctx context.Context, id *voltha.ID) (*voltha.LogicalPorts, error) {
 	log.Debugw("ListLogicalDevicePorts", log.Fields{"logicaldeviceid": id})
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
+		if err != nil {
 			return &voltha.LogicalPorts{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 	return handler.logicalDeviceMgr.ListLogicalDevicePorts(ctx, id.Id)
 }
@@ -450,11 +468,11 @@
 
 	if handler.competeForTransaction() {
 		// There are no device Id present in this function.
-		if txn, err := handler.takeRequestOwnership(ctx, nil); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, nil)
+		if err != nil {
 			return &voltha.Device{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -467,7 +485,10 @@
 				return &voltha.Device{}, err
 			}
 			if d, ok := res.(*voltha.Device); ok {
-				handler.core.deviceOwnership.OwnedByMe(&utils.DeviceID{Id: d.Id})
+				_, err := handler.core.deviceOwnership.OwnedByMe(&utils.DeviceID{ID: d.Id})
+				if err != nil {
+					log.Errorw("unable-to-find-core-instance-active-owns-this-device", log.Fields{"error": err})
+				}
 				return d, nil
 			}
 		}
@@ -488,11 +509,11 @@
 	}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{Id: id.Id}, handler.longRunningRequestTimeout); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: id.Id}, handler.longRunningRequestTimeout)
+		if err != nil {
 			return &empty.Empty{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -509,11 +530,11 @@
 	}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: id.Id})
+		if err != nil {
 			return &empty.Empty{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -530,11 +551,11 @@
 	}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: id.Id})
+		if err != nil {
 			return &empty.Empty{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -551,17 +572,17 @@
 	}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: id.Id})
+		if err != nil {
 			if err == errorTransactionNotAcquired {
-				if ownedByMe, err := handler.core.deviceOwnership.OwnedByMe(&utils.DeviceID{Id: id.Id}); !ownedByMe && err == nil {
+				if ownedByMe, err := handler.core.deviceOwnership.OwnedByMe(&utils.DeviceID{ID: id.Id}); !ownedByMe && err == nil {
 					// Remove the device in memory
 					handler.deviceMgr.stopManagingDevice(id.Id)
 				}
 			}
 			return &empty.Empty{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -574,11 +595,11 @@
 func (handler *APIHandler) ListDevicePorts(ctx context.Context, id *voltha.ID) (*voltha.Ports, error) {
 	log.Debugw("listdeviceports-request", log.Fields{"id": id})
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: id.Id})
+		if err != nil {
 			return &voltha.Ports{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	device, err := handler.deviceMgr.GetDevice(id.Id)
@@ -586,9 +607,7 @@
 		return &voltha.Ports{}, err
 	}
 	ports := &voltha.Ports{}
-	for _, port := range device.Ports {
-		ports.Items = append(ports.Items, port)
-	}
+	ports.Items = append(ports.Items, device.Ports...)
 	return ports, nil
 }
 
@@ -596,11 +615,11 @@
 func (handler *APIHandler) ListDeviceFlows(ctx context.Context, id *voltha.ID) (*openflow_13.Flows, error) {
 	log.Debugw("listdeviceflows-request", log.Fields{"id": id})
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: id.Id})
+		if err != nil {
 			return &openflow_13.Flows{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	device, err := handler.deviceMgr.GetDevice(id.Id)
@@ -608,9 +627,7 @@
 		return &openflow_13.Flows{}, err
 	}
 	flows := &openflow_13.Flows{}
-	for _, flow := range device.Flows.Items {
-		flows.Items = append(flows.Items, flow)
-	}
+	flows.Items = append(flows.Items, device.Flows.Items...)
 	return flows, nil
 }
 
@@ -685,11 +702,11 @@
 	}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{Id: img.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: img.Id})
+		if err != nil {
 			return &common.OperationResp{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	failedresponse := &common.OperationResp{Code: voltha.OperationResp_OPERATION_FAILURE}
@@ -697,13 +714,13 @@
 	ch := make(chan interface{})
 	defer close(ch)
 	switch requestType {
-	case IMAGE_DOWNLOAD:
+	case ImageDownload:
 		go handler.deviceMgr.downloadImage(ctx, img, ch)
-	case CANCEL_IMAGE_DOWNLOAD:
+	case CancelImageDownload:
 		go handler.deviceMgr.cancelImageDownload(ctx, img, ch)
-	case ACTIVATE_IMAGE:
+	case ActivateImage:
 		go handler.deviceMgr.activateImage(ctx, img, ch)
-	case REVERT_IMAGE:
+	case RevertImage:
 		go handler.deviceMgr.revertImage(ctx, img, ch)
 	default:
 		log.Warn("invalid-request-type", log.Fields{"requestType": requestType})
@@ -727,6 +744,7 @@
 	}
 }
 
+// DownloadImage execute an image download request
 func (handler *APIHandler) DownloadImage(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
 	log.Debugw("DownloadImage-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
@@ -734,18 +752,20 @@
 		return resp, nil
 	}
 
-	return handler.processImageRequest(ctx, img, IMAGE_DOWNLOAD)
+	return handler.processImageRequest(ctx, img, ImageDownload)
 }
 
+// CancelImageDownload cancels image download request
 func (handler *APIHandler) CancelImageDownload(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
 	log.Debugw("cancelImageDownload-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
 		resp := &common.OperationResp{Code: common.OperationResp_OPERATION_SUCCESS}
 		return resp, nil
 	}
-	return handler.processImageRequest(ctx, img, CANCEL_IMAGE_DOWNLOAD)
+	return handler.processImageRequest(ctx, img, CancelImageDownload)
 }
 
+// ActivateImageUpdate activates image update request
 func (handler *APIHandler) ActivateImageUpdate(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
 	log.Debugw("activateImageUpdate-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
@@ -753,9 +773,10 @@
 		return resp, nil
 	}
 
-	return handler.processImageRequest(ctx, img, ACTIVATE_IMAGE)
+	return handler.processImageRequest(ctx, img, ActivateImage)
 }
 
+// RevertImageUpdate reverts image update
 func (handler *APIHandler) RevertImageUpdate(ctx context.Context, img *voltha.ImageDownload) (*common.OperationResp, error) {
 	log.Debugw("revertImageUpdate-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
@@ -763,9 +784,10 @@
 		return resp, nil
 	}
 
-	return handler.processImageRequest(ctx, img, REVERT_IMAGE)
+	return handler.processImageRequest(ctx, img, RevertImage)
 }
 
+// GetImageDownloadStatus returns status of image download
 func (handler *APIHandler) GetImageDownloadStatus(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
 	log.Debugw("getImageDownloadStatus-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
@@ -776,11 +798,11 @@
 	failedresponse := &voltha.ImageDownload{DownloadState: voltha.ImageDownload_DOWNLOAD_UNKNOWN}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{Id: img.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: img.Id})
+		if err != nil {
 			return failedresponse, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -805,6 +827,7 @@
 	}
 }
 
+// GetImageDownload returns image download
 func (handler *APIHandler) GetImageDownload(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
 	log.Debugw("GetImageDownload-request", log.Fields{"img": *img})
 	if isTestMode(ctx) {
@@ -812,13 +835,14 @@
 		return resp, nil
 	}
 
-	if download, err := handler.deviceMgr.getImageDownload(ctx, img); err != nil {
+	download, err := handler.deviceMgr.getImageDownload(ctx, img)
+	if err != nil {
 		return &voltha.ImageDownload{DownloadState: voltha.ImageDownload_DOWNLOAD_UNKNOWN}, err
-	} else {
-		return download, nil
 	}
+	return download, nil
 }
 
+// ListImageDownloads returns image downloads
 func (handler *APIHandler) ListImageDownloads(ctx context.Context, id *voltha.ID) (*voltha.ImageDownloads, error) {
 	log.Debugw("ListImageDownloads-request", log.Fields{"deviceId": id.Id})
 	if isTestMode(ctx) {
@@ -826,16 +850,16 @@
 		return resp, nil
 	}
 
-	if downloads, err := handler.deviceMgr.listImageDownloads(ctx, id.Id); err != nil {
+	downloads, err := handler.deviceMgr.listImageDownloads(ctx, id.Id)
+	if err != nil {
 		failedResp := &voltha.ImageDownloads{
 			Items: []*voltha.ImageDownload{
 				{DownloadState: voltha.ImageDownload_DOWNLOAD_UNKNOWN},
 			},
 		}
 		return failedResp, err
-	} else {
-		return downloads, nil
 	}
+	return downloads, nil
 }
 
 // GetImages returns all images for a specific device entry
@@ -848,17 +872,18 @@
 	return device.GetImages(), nil
 }
 
+// UpdateDevicePmConfigs updates the PM configs
 func (handler *APIHandler) UpdateDevicePmConfigs(ctx context.Context, configs *voltha.PmConfigs) (*empty.Empty, error) {
 	log.Debugw("UpdateDevicePmConfigs-request", log.Fields{"configs": *configs})
 	if isTestMode(ctx) {
 		return &empty.Empty{}, nil
 	}
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{Id: configs.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: configs.Id})
+		if err != nil {
 			return &empty.Empty{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -867,18 +892,20 @@
 	return waitForNilResponseOnSuccess(ctx, ch)
 }
 
+// ListDevicePmConfigs returns pm configs of device
 func (handler *APIHandler) ListDevicePmConfigs(ctx context.Context, id *voltha.ID) (*voltha.PmConfigs, error) {
 	log.Debugw("ListDevicePmConfigs-request", log.Fields{"deviceId": *id})
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
+		if err != nil {
 			return &voltha.PmConfigs{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 	return handler.deviceMgr.listPmConfigs(ctx, id.Id)
 }
 
+// CreateAlarmFilter creates alarm filter
 func (handler *APIHandler) CreateAlarmFilter(ctx context.Context, filter *voltha.AlarmFilter) (*voltha.AlarmFilter, error) {
 	log.Debugw("CreateAlarmFilter-request", log.Fields{"filter": *filter})
 	if isTestMode(ctx) {
@@ -888,6 +915,7 @@
 	return &voltha.AlarmFilter{}, errors.New("UnImplemented")
 }
 
+// UpdateAlarmFilter updates alarm filter
 func (handler *APIHandler) UpdateAlarmFilter(ctx context.Context, filter *voltha.AlarmFilter) (*voltha.AlarmFilter, error) {
 	log.Debugw("UpdateAlarmFilter-request", log.Fields{"filter": *filter})
 	if isTestMode(ctx) {
@@ -897,6 +925,7 @@
 	return &voltha.AlarmFilter{}, errors.New("UnImplemented")
 }
 
+// DeleteAlarmFilter deletes alarm filter
 func (handler *APIHandler) DeleteAlarmFilter(ctx context.Context, id *voltha.ID) (*empty.Empty, error) {
 	log.Debugw("DeleteAlarmFilter-request", log.Fields{"id": *id})
 	if isTestMode(ctx) {
@@ -905,16 +934,19 @@
 	return &empty.Empty{}, errors.New("UnImplemented")
 }
 
+// ListAlarmFilters returns alarm filters
 func (handler *APIHandler) ListAlarmFilters(ctx context.Context, empty *empty.Empty) (*voltha.AlarmFilters, error) {
 	log.Debug("ListAlarmFilters")
 	return &voltha.AlarmFilters{}, errors.New("UnImplemented")
 }
 
+// GetAlarmFilter returns alarm filter
 func (handler *APIHandler) GetAlarmFilter(ctx context.Context, id *voltha.ID) (*voltha.AlarmFilter, error) {
 	log.Debug("GetAlarmFilter")
 	return &voltha.AlarmFilter{}, errors.New("UnImplemented")
 }
 
+// SelfTest executes self test
 func (handler *APIHandler) SelfTest(ctx context.Context, id *voltha.ID) (*voltha.SelfTestResponse, error) {
 	log.Debugw("SelfTest-request", log.Fields{"id": id})
 	if isTestMode(ctx) {
@@ -929,12 +961,13 @@
 	//TODO: Update this logic once the OF Controller (OFAgent in this case) can include a transaction Id in its
 	// request.  For performance reason we can let both Cores in a Core-Pair forward the Packet to the adapters and
 	// let once of the shim layer (kafka proxy or adapter request handler filters out the duplicate packet)
-	if ownedByMe, err := handler.core.deviceOwnership.OwnedByMe(&utils.LogicalDeviceID{Id: packet.Id}); ownedByMe && err == nil {
+	if ownedByMe, err := handler.core.deviceOwnership.OwnedByMe(&utils.LogicalDeviceID{ID: packet.Id}); ownedByMe && err == nil {
 		agent := handler.logicalDeviceMgr.getLogicalDeviceAgent(packet.Id)
 		agent.packetOut(packet.PacketOut)
 	}
 }
 
+// StreamPacketsOut sends packets to adapter
 func (handler *APIHandler) StreamPacketsOut(packets voltha.VolthaService_StreamPacketsOutServer) error {
 	log.Debugw("StreamPacketsOut-request", log.Fields{"packets": packets})
 loop:
@@ -965,9 +998,9 @@
 	return nil
 }
 
-func (handler *APIHandler) sendPacketIn(deviceId string, transationId string, packet *openflow_13.OfpPacketIn) {
+func (handler *APIHandler) sendPacketIn(deviceID string, transationID string, packet *openflow_13.OfpPacketIn) {
 	// TODO: Augment the OF PacketIn to include the transactionId
-	packetIn := openflow_13.PacketIn{Id: deviceId, PacketIn: packet}
+	packetIn := openflow_13.PacketIn{Id: deviceID, PacketIn: packet}
 	log.Debugw("sendPacketIn", log.Fields{"packetIn": packetIn})
 	handler.packetInQueue <- packetIn
 }
@@ -1010,11 +1043,15 @@
 	return nil
 }
 
+// ReceivePacketsIn receives packets from adapter
 func (handler *APIHandler) ReceivePacketsIn(empty *empty.Empty, packetsIn voltha.VolthaService_ReceivePacketsInServer) error {
 	var streamingTracker = handler.getStreamingTracker("ReceivePacketsIn", handler.packetInQueueDone)
 	log.Debugw("ReceivePacketsIn-request", log.Fields{"packetsIn": packetsIn})
 
-	handler.flushFailedPackets(streamingTracker)
+	err := handler.flushFailedPackets(streamingTracker)
+	if err != nil {
+		log.Errorw("unable-to-flush-failed-packets", log.Fields{"error": err})
+	}
 
 loop:
 	for {
@@ -1043,20 +1080,24 @@
 	return nil
 }
 
-func (handler *APIHandler) sendChangeEvent(deviceId string, portStatus *openflow_13.OfpPortStatus) {
+func (handler *APIHandler) sendChangeEvent(deviceID string, portStatus *openflow_13.OfpPortStatus) {
 	// TODO: validate the type of portStatus parameter
 	//if _, ok := portStatus.(*openflow_13.OfpPortStatus); ok {
 	//}
-	event := openflow_13.ChangeEvent{Id: deviceId, Event: &openflow_13.ChangeEvent_PortStatus{PortStatus: portStatus}}
+	event := openflow_13.ChangeEvent{Id: deviceID, Event: &openflow_13.ChangeEvent_PortStatus{PortStatus: portStatus}}
 	log.Debugw("sendChangeEvent", log.Fields{"event": event})
 	handler.changeEventQueue <- event
 }
 
+// ReceiveChangeEvents receives change in events
 func (handler *APIHandler) ReceiveChangeEvents(empty *empty.Empty, changeEvents voltha.VolthaService_ReceiveChangeEventsServer) error {
 	var streamingTracker = handler.getStreamingTracker("ReceiveChangeEvents", handler.changeEventQueueDone)
 	log.Debugw("ReceiveChangeEvents-request", log.Fields{"changeEvents": changeEvents})
 
-	handler.flushFailedPackets(streamingTracker)
+	err := handler.flushFailedPackets(streamingTracker)
+	if err != nil {
+		log.Errorw("unable-to-flush-failed-packets", log.Fields{"error": err})
+	}
 
 loop:
 	for {
@@ -1083,6 +1124,7 @@
 	return nil
 }
 
+// Subscribe subscribing request of ofagent
 func (handler *APIHandler) Subscribe(
 	ctx context.Context,
 	ofAgent *voltha.OfAgentSubscriber,
@@ -1091,37 +1133,39 @@
 	return &voltha.OfAgentSubscriber{OfagentId: ofAgent.OfagentId, VolthaId: ofAgent.VolthaId}, nil
 }
 
-//@TODO useless stub, what should this actually do?
+// GetAlarmDeviceData @TODO useless stub, what should this actually do?
 func (handler *APIHandler) GetAlarmDeviceData(ctx context.Context, in *common.ID) (*omci.AlarmDeviceData, error) {
 	log.Debug("GetAlarmDeviceData-stub")
 	return &omci.AlarmDeviceData{}, errors.New("UnImplemented")
 }
 
+// ListLogicalDeviceMeters returns logical device meters
 func (handler *APIHandler) ListLogicalDeviceMeters(ctx context.Context, id *voltha.ID) (*openflow_13.Meters, error) {
 
 	log.Debugw("ListLogicalDeviceMeters", log.Fields{"id": *id})
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: id.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: id.Id})
+		if err != nil {
 			return &openflow_13.Meters{}, err // TODO: Return empty meter entry
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 	return handler.logicalDeviceMgr.ListLogicalDeviceMeters(ctx, id.Id)
 }
 
-//@TODO useless stub, what should this actually do?
+// GetMeterStatsOfLogicalDevice @TODO useless stub, what should this actually do?
 func (handler *APIHandler) GetMeterStatsOfLogicalDevice(ctx context.Context, in *common.ID) (*openflow_13.MeterStatsReply, error) {
 	log.Debug("GetMeterStatsOfLogicalDevice")
 	return &openflow_13.MeterStatsReply{}, errors.New("UnImplemented")
 }
 
-//@TODO useless stub, what should this actually do?
+// GetMibDeviceData @TODO useless stub, what should this actually do?
 func (handler *APIHandler) GetMibDeviceData(ctx context.Context, in *common.ID) (*omci.MibDeviceData, error) {
 	log.Debug("GetMibDeviceData")
 	return &omci.MibDeviceData{}, errors.New("UnImplemented")
 }
 
+// SimulateAlarm sends simulate alarm request
 func (handler *APIHandler) SimulateAlarm(
 	ctx context.Context,
 	in *voltha.SimulateAlarmRequest,
@@ -1133,12 +1177,12 @@
 	}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{Id: in.Id}, handler.longRunningRequestTimeout); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.DeviceID{ID: in.Id}, handler.longRunningRequestTimeout)
+		if err != nil {
 			failedresponse := &common.OperationResp{Code: voltha.OperationResp_OPERATION_FAILURE}
 			return failedresponse, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -1147,7 +1191,7 @@
 	return successResp, nil
 }
 
-// This function sends meter mod request to logical device manager and waits for response
+// UpdateLogicalDeviceMeterTable - This function sends meter mod request to logical device manager and waits for response
 func (handler *APIHandler) UpdateLogicalDeviceMeterTable(ctx context.Context, meter *openflow_13.MeterModUpdate) (*empty.Empty, error) {
 	log.Debugw("UpdateLogicalDeviceMeterTable-request",
 		log.Fields{"meter": meter, "test": common.TestModeKeys_api_test.String()})
@@ -1156,11 +1200,11 @@
 	}
 
 	if handler.competeForTransaction() {
-		if txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{Id: meter.Id}); err != nil {
+		txn, err := handler.takeRequestOwnership(ctx, &utils.LogicalDeviceID{ID: meter.Id})
+		if err != nil {
 			return &empty.Empty{}, err
-		} else {
-			defer txn.Close()
 		}
+		defer txn.Close()
 	}
 
 	ch := make(chan interface{})
@@ -1169,10 +1213,12 @@
 	return waitForNilResponseOnSuccess(ctx, ch)
 }
 
+// GetMembership returns membership
 func (handler *APIHandler) GetMembership(context.Context, *empty.Empty) (*voltha.Membership, error) {
 	return &voltha.Membership{}, errors.New("UnImplemented")
 }
 
+// UpdateMembership updates membership
 func (handler *APIHandler) UpdateMembership(context.Context, *voltha.Membership) (*empty.Empty, error) {
 	return &empty.Empty{}, errors.New("UnImplemented")
 }
diff --git a/rw_core/core/id.go b/rw_core/core/id.go
index 369b4f1..399bf1d 100644
--- a/rw_core/core/id.go
+++ b/rw_core/core/id.go
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
@@ -32,36 +33,37 @@
 	return hex.EncodeToString(bytes), nil
 }
 
-// CreateDeviceId produces a device ID. DeviceId is 16 hex long - lower 12 hex is the device id.
+// CreateDeviceID produces a device ID. DeviceId is 16 hex long - lower 12 hex is the device id.
 // TODO:  A cluster unique ID may be required
-func CreateDeviceId() string {
+func CreateDeviceID() string {
 	val, _ := randomHex(12)
 	return val
 }
 
-// CreateLogicalDeviceId is not used for now as the logical device ID is derived from the
+// CreateLogicalDeviceID is not used for now as the logical device ID is derived from the
 // OLT MAC address
-func CreateLogicalDeviceId() string {
+func CreateLogicalDeviceID() string {
 	// logical device id is 16 hex long - lower 12 hex is the logical device id.  For now just generate the 12 hex
 	val, _ := randomHex(12)
 	return val
 }
 
-// CreateLogicalPortId produces a random port ID for a logical device.
-func CreateLogicalPortId() uint32 {
+// CreateLogicalPortID produces a random port ID for a logical device.
+func CreateLogicalPortID() uint32 {
 	//	A logical port is a uint32
 	return m.Uint32()
 }
 
-func CreateDataPathId(idInHexString string) (uint64, error) {
+// CreateDataPathID creates uint64 pathid from string pathid
+func CreateDataPathID(idInHexString string) (uint64, error) {
 	if idInHexString == "" {
 		return 0, errors.New("id-empty")
 	}
 	// First prepend 0x to the string
-	newId := fmt.Sprintf("0x%s", idInHexString)
-	if d, err := strconv.ParseUint(newId, 0, 64); err != nil {
+	newID := fmt.Sprintf("0x%s", idInHexString)
+	d, err := strconv.ParseUint(newID, 0, 64)
+	if err != nil {
 		return 0, err
-	} else {
-		return d, nil
 	}
+	return d, nil
 }
diff --git a/rw_core/core/logical_device_agent.go b/rw_core/core/logical_device_agent.go
index 3dbc2df..ca07454 100644
--- a/rw_core/core/logical_device_agent.go
+++ b/rw_core/core/logical_device_agent.go
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
@@ -20,9 +21,13 @@
 	"encoding/hex"
 	"errors"
 	"fmt"
+	"reflect"
+	"sync"
+	"time"
+
 	"github.com/gogo/protobuf/proto"
 	"github.com/opencord/voltha-go/db/model"
-	fd "github.com/opencord/voltha-go/rw_core/flow_decomposition"
+	fd "github.com/opencord/voltha-go/rw_core/flowdecomposition"
 	"github.com/opencord/voltha-go/rw_core/graph"
 	coreutils "github.com/opencord/voltha-go/rw_core/utils"
 	fu "github.com/opencord/voltha-lib-go/v2/pkg/flows"
@@ -32,14 +37,12 @@
 	"github.com/opencord/voltha-protos/v2/go/voltha"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
-	"reflect"
-	"sync"
-	"time"
 )
 
+// LogicalDeviceAgent represent attributes of logical device agent
 type LogicalDeviceAgent struct {
-	logicalDeviceId    string
-	rootDeviceId       string
+	logicalDeviceID    string
+	rootDeviceID       string
 	deviceMgr          *DeviceManager
 	ldeviceMgr         *LogicalDeviceManager
 	clusterDataProxy   *model.Proxy
@@ -59,13 +62,13 @@
 	defaultTimeout     int64
 }
 
-func newLogicalDeviceAgent(id string, deviceId string, ldeviceMgr *LogicalDeviceManager,
+func newLogicalDeviceAgent(id string, deviceID string, ldeviceMgr *LogicalDeviceManager,
 	deviceMgr *DeviceManager,
 	cdProxy *model.Proxy, timeout int64) *LogicalDeviceAgent {
 	var agent LogicalDeviceAgent
 	agent.exitChannel = make(chan int, 1)
-	agent.logicalDeviceId = id
-	agent.rootDeviceId = deviceId
+	agent.logicalDeviceID = id
+	agent.rootDeviceID = deviceID
 	agent.deviceMgr = deviceMgr
 	agent.clusterDataProxy = cdProxy
 	agent.ldeviceMgr = ldeviceMgr
@@ -82,21 +85,21 @@
 
 // start creates the logical device and add it to the data model
 func (agent *LogicalDeviceAgent) start(ctx context.Context, loadFromdB bool) error {
-	log.Infow("starting-logical_device-agent", log.Fields{"logicaldeviceId": agent.logicalDeviceId, "loadFromdB": loadFromdB})
+	log.Infow("starting-logical_device-agent", log.Fields{"logicaldeviceId": agent.logicalDeviceID, "loadFromdB": loadFromdB})
 	var ld *voltha.LogicalDevice
 	if !loadFromdB {
 		//Build the logical device based on information retrieved from the device adapter
 		var switchCap *ic.SwitchCapability
 		var err error
-		if switchCap, err = agent.deviceMgr.getSwitchCapability(ctx, agent.rootDeviceId); err != nil {
+		if switchCap, err = agent.deviceMgr.getSwitchCapability(ctx, agent.rootDeviceID); err != nil {
 			log.Errorw("error-creating-logical-device", log.Fields{"error": err})
 			return err
 		}
-		ld = &voltha.LogicalDevice{Id: agent.logicalDeviceId, RootDeviceId: agent.rootDeviceId}
+		ld = &voltha.LogicalDevice{Id: agent.logicalDeviceID, RootDeviceId: agent.rootDeviceID}
 
 		// Create the datapath ID (uint64) using the logical device ID (based on the MAC Address)
 		var datapathID uint64
-		if datapathID, err = CreateDataPathId(agent.logicalDeviceId); err != nil {
+		if datapathID, err = CreateDataPathID(agent.logicalDeviceID); err != nil {
 			log.Errorw("error-creating-datapath-id", log.Fields{"error": err})
 			return err
 		}
@@ -110,26 +113,31 @@
 		agent.lockLogicalDevice.Lock()
 		// Save the logical device
 		if added := agent.clusterDataProxy.AddWithID(ctx, "/logical_devices", ld.Id, ld, ""); added == nil {
-			log.Errorw("failed-to-add-logical-device", log.Fields{"logicaldeviceId": agent.logicalDeviceId})
+			log.Errorw("failed-to-add-logical-device", log.Fields{"logicaldeviceId": agent.logicalDeviceID})
 		} else {
-			log.Debugw("logicaldevice-created", log.Fields{"logicaldeviceId": agent.logicalDeviceId})
+			log.Debugw("logicaldevice-created", log.Fields{"logicaldeviceId": agent.logicalDeviceID})
 		}
 		agent.lockLogicalDevice.Unlock()
 
 		// TODO:  Set the logical ports in a separate call once the port update issue is fixed.
-		go agent.setupLogicalPorts(ctx)
+		go func() {
+			err := agent.setupLogicalPorts(ctx)
+			if err != nil {
+				log.Errorw("unable-to-setup-logical-ports", log.Fields{"error": err})
+			}
+		}()
 
 	} else {
 		//	load from dB - the logical may not exist at this time.  On error, just return and the calling function
 		// will destroy this agent.
 		var err error
 		if ld, err = agent.GetLogicalDevice(); err != nil {
-			log.Warnw("failed-to-load-logical-device", log.Fields{"logicaldeviceId": agent.logicalDeviceId})
+			log.Warnw("failed-to-load-logical-device", log.Fields{"logicaldeviceId": agent.logicalDeviceID})
 			return err
 		}
 
 		// Update the root device Id
-		agent.rootDeviceId = ld.RootDeviceId
+		agent.rootDeviceID = ld.RootDeviceId
 
 		// Setup the local list of logical ports
 		agent.addLogicalPortsToMap(ld.Ports)
@@ -140,26 +148,26 @@
 
 	agent.flowProxy = agent.clusterDataProxy.CreateProxy(
 		ctx,
-		fmt.Sprintf("/logical_devices/%s/flows", agent.logicalDeviceId),
+		fmt.Sprintf("/logical_devices/%s/flows", agent.logicalDeviceID),
 		false)
 	agent.meterProxy = agent.clusterDataProxy.CreateProxy(
 		ctx,
-		fmt.Sprintf("/logical_devices/%s/meters", agent.logicalDeviceId),
+		fmt.Sprintf("/logical_devices/%s/meters", agent.logicalDeviceID),
 		false)
 	agent.groupProxy = agent.clusterDataProxy.CreateProxy(
 		ctx,
-		fmt.Sprintf("/logical_devices/%s/flow_groups", agent.logicalDeviceId),
+		fmt.Sprintf("/logical_devices/%s/flow_groups", agent.logicalDeviceID),
 		false)
 	agent.ldProxy = agent.clusterDataProxy.CreateProxy(
 		ctx,
-		fmt.Sprintf("/logical_devices/%s", agent.logicalDeviceId),
+		fmt.Sprintf("/logical_devices/%s", agent.logicalDeviceID),
 		false)
 
 	// TODO:  Use a port proxy once the POST_ADD is fixed
 	if agent.ldProxy != nil {
 		agent.ldProxy.RegisterCallback(model.POST_UPDATE, agent.portUpdated)
 	} else {
-		log.Errorw("logical-device-proxy-null", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+		log.Errorw("logical-device-proxy-null", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 		return status.Error(codes.Internal, "logical-device-proxy-null")
 	}
 
@@ -177,10 +185,10 @@
 	defer agent.lockLogicalDevice.Unlock()
 
 	//Remove the logical device from the model
-	if removed := agent.clusterDataProxy.Remove(ctx, "/logical_devices/"+agent.logicalDeviceId, ""); removed == nil {
-		log.Errorw("failed-to-remove-logical-device", log.Fields{"logicaldeviceId": agent.logicalDeviceId})
+	if removed := agent.clusterDataProxy.Remove(ctx, "/logical_devices/"+agent.logicalDeviceID, ""); removed == nil {
+		log.Errorw("failed-to-remove-logical-device", log.Fields{"logicaldeviceId": agent.logicalDeviceID})
 	} else {
-		log.Debugw("logicaldevice-removed", log.Fields{"logicaldeviceId": agent.logicalDeviceId})
+		log.Debugw("logicaldevice-removed", log.Fields{"logicaldeviceId": agent.logicalDeviceID})
 	}
 	agent.exitChannel <- 1
 	log.Info("logical_device-agent-stopped")
@@ -191,30 +199,32 @@
 	log.Debug("GetLogicalDevice")
 	agent.lockLogicalDevice.RLock()
 	defer agent.lockLogicalDevice.RUnlock()
-	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceId, 0, false, "")
+	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceID, 0, false, "")
 	if lDevice, ok := logicalDevice.(*voltha.LogicalDevice); ok {
 		return lDevice, nil
 	}
-	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceId)
+	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceID)
 }
 
+// ListLogicalDeviceFlows returns logical device flows
 func (agent *LogicalDeviceAgent) ListLogicalDeviceFlows() (*ofp.Flows, error) {
 	log.Debug("ListLogicalDeviceFlows")
 	agent.lockLogicalDevice.RLock()
 	defer agent.lockLogicalDevice.RUnlock()
-	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceId, 0, false, "")
+	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceID, 0, false, "")
 	if lDevice, ok := logicalDevice.(*voltha.LogicalDevice); ok {
 		cFlows := (proto.Clone(lDevice.Flows)).(*ofp.Flows)
 		return cFlows, nil
 	}
-	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceId)
+	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceID)
 }
 
+// ListLogicalDeviceMeters returns logical device meters
 func (agent *LogicalDeviceAgent) ListLogicalDeviceMeters() (*ofp.Meters, error) {
 	log.Debug("ListLogicalDeviceMeters")
 	agent.lockLogicalDevice.RLock()
 	defer agent.lockLogicalDevice.RUnlock()
-	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceId, 0, false, "")
+	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceID, 0, false, "")
 	if lDevice, ok := logicalDevice.(*voltha.LogicalDevice); ok {
 		if lDevice.Meters == nil {
 			return &ofp.Meters{}, nil
@@ -222,65 +232,41 @@
 		cMeters := (proto.Clone(lDevice.Meters)).(*ofp.Meters)
 		return cMeters, nil
 	}
-	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceId)
+	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceID)
 }
 
+// ListLogicalDeviceFlowGroups returns logical device flow groups
 func (agent *LogicalDeviceAgent) ListLogicalDeviceFlowGroups() (*ofp.FlowGroups, error) {
 	log.Debug("ListLogicalDeviceFlowGroups")
 	agent.lockLogicalDevice.RLock()
 	defer agent.lockLogicalDevice.RUnlock()
-	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceId, 0, false, "")
+	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceID, 0, false, "")
 	if lDevice, ok := logicalDevice.(*voltha.LogicalDevice); ok {
 		cFlowGroups := (proto.Clone(lDevice.FlowGroups)).(*ofp.FlowGroups)
 		return cFlowGroups, nil
 	}
-	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceId)
+	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceID)
 }
 
+// ListLogicalDevicePorts returns logical device ports
 func (agent *LogicalDeviceAgent) ListLogicalDevicePorts() (*voltha.LogicalPorts, error) {
 	log.Debug("ListLogicalDevicePorts")
 	agent.lockLogicalDevice.RLock()
 	defer agent.lockLogicalDevice.RUnlock()
-	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceId, 0, false, "")
+	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceID, 0, false, "")
 	if lDevice, ok := logicalDevice.(*voltha.LogicalDevice); ok {
 		lPorts := make([]*voltha.LogicalPort, 0)
-		for _, port := range lDevice.Ports {
-			lPorts = append(lPorts, port)
-		}
+		lPorts = append(lPorts, lDevice.Ports...)
 		return &voltha.LogicalPorts{Items: lPorts}, nil
 	}
-	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceId)
-}
-
-// listFlows locks the logical device model and then retrieves the latest flow information
-func (agent *LogicalDeviceAgent) listFlows() []*ofp.OfpFlowStats {
-	log.Debug("listFlows")
-	agent.lockLogicalDevice.RLock()
-	defer agent.lockLogicalDevice.RUnlock()
-	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceId, 0, false, "")
-	if lDevice, ok := logicalDevice.(*voltha.LogicalDevice); ok {
-		return lDevice.Flows.Items
-	}
-	return nil
-}
-
-// listFlowGroups locks the logical device model and then retrieves the latest flow groups information
-func (agent *LogicalDeviceAgent) listFlowGroups() []*ofp.OfpGroupEntry {
-	log.Debug("listFlowGroups")
-	agent.lockLogicalDevice.RLock()
-	defer agent.lockLogicalDevice.RUnlock()
-	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceId, 0, false, "")
-	if lDevice, ok := logicalDevice.(*voltha.LogicalDevice); ok {
-		return lDevice.FlowGroups.Items
-	}
-	return nil
+	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceID)
 }
 
 //updateLogicalDeviceFlowsWithoutLock updates the logical device with the latest flows in the model.
 func (agent *LogicalDeviceAgent) updateLogicalDeviceFlowsWithoutLock(flows *ofp.Flows) error {
 	ld, err := agent.getLogicalDeviceWithoutLock()
 	if err != nil {
-		return status.Errorf(codes.Internal, "logical-device-absent:%s", agent.logicalDeviceId)
+		return status.Errorf(codes.Internal, "logical-device-absent:%s", agent.logicalDeviceID)
 	}
 	log.Debugw("logical-device-before", log.Fields{"lports": len(ld.Ports)})
 	cloned := (proto.Clone(ld)).(*voltha.LogicalDevice)
@@ -297,7 +283,7 @@
 func (agent *LogicalDeviceAgent) updateLogicalDeviceMetersWithoutLock(meters *ofp.Meters) error {
 	ld, err := agent.getLogicalDeviceWithoutLock()
 	if err != nil {
-		return status.Errorf(codes.Internal, "logical-device-absent:%s", agent.logicalDeviceId)
+		return status.Errorf(codes.Internal, "logical-device-absent:%s", agent.logicalDeviceID)
 	}
 	log.Debugw("logical-device-before", log.Fields{"lports": len(ld.Ports)})
 	cloned := (proto.Clone(ld)).(*voltha.LogicalDevice)
@@ -314,7 +300,7 @@
 func (agent *LogicalDeviceAgent) updateLogicalDeviceFlowGroupsWithoutLock(flowGroups *ofp.FlowGroups) error {
 	ld, err := agent.getLogicalDeviceWithoutLock()
 	if err != nil {
-		return status.Errorf(codes.Internal, "logical-device-absent:%s", agent.logicalDeviceId)
+		return status.Errorf(codes.Internal, "logical-device-absent:%s", agent.logicalDeviceID)
 	}
 	log.Debugw("logical-device-before", log.Fields{"lports": len(ld.Ports)})
 	cloned := (proto.Clone(ld)).(*voltha.LogicalDevice)
@@ -331,12 +317,12 @@
 // functions that have already acquired the logical device lock to the model
 func (agent *LogicalDeviceAgent) getLogicalDeviceWithoutLock() (*voltha.LogicalDevice, error) {
 	log.Debug("getLogicalDeviceWithoutLock")
-	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceId, 0, false, "")
+	logicalDevice := agent.clusterDataProxy.Get(context.Background(), "/logical_devices/"+agent.logicalDeviceID, 0, false, "")
 	if lDevice, ok := logicalDevice.(*voltha.LogicalDevice); ok {
 		//log.Debug("getLogicalDeviceWithoutLock", log.Fields{"ldevice": lDevice})
 		return lDevice, nil
 	}
-	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceId)
+	return nil, status.Errorf(codes.NotFound, "logical_device-%s", agent.logicalDeviceID)
 }
 
 func (agent *LogicalDeviceAgent) updateLogicalPort(device *voltha.Device, port *voltha.Port) error {
@@ -362,71 +348,51 @@
 	return nil
 }
 
-func (agent *LogicalDeviceAgent) addLogicalPort(device *voltha.Device, port *voltha.Port) error {
-	log.Debugw("addLogicalPort", log.Fields{"deviceId": device.Id, "port": port})
-	var err error
-	if port.Type == voltha.Port_ETHERNET_NNI {
-		if _, err = agent.addNNILogicalPort(device, port); err != nil {
-			return err
-		}
-		agent.addLogicalPortToMap(port.PortNo, true)
-	} else if port.Type == voltha.Port_ETHERNET_UNI {
-		if _, err = agent.addUNILogicalPort(device, port); err != nil {
-			return err
-		}
-		agent.addLogicalPortToMap(port.PortNo, false)
-	} else {
-		log.Debugw("invalid-port-type", log.Fields{"deviceId": device.Id, "port": port})
-		return nil
-	}
-	return nil
-}
-
 // setupLogicalPorts is invoked once the logical device has been created and is ready to get ports
 // added to it.  While the logical device was being created we could have received requests to add
 // NNI and UNI ports which were discarded.  Now is the time to add them if needed
 func (agent *LogicalDeviceAgent) setupLogicalPorts(ctx context.Context) error {
-	log.Infow("setupLogicalPorts", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+	log.Infow("setupLogicalPorts", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	// First add any NNI ports which could have been missing
-	if err := agent.setupNNILogicalPorts(nil, agent.rootDeviceId); err != nil {
-		log.Errorw("error-setting-up-NNI-ports", log.Fields{"error": err, "deviceId": agent.rootDeviceId})
+	if err := agent.setupNNILogicalPorts(context.TODO(), agent.rootDeviceID); err != nil {
+		log.Errorw("error-setting-up-NNI-ports", log.Fields{"error": err, "deviceId": agent.rootDeviceID})
 		return err
 	}
 
 	// Now, set up the UNI ports if needed.
-	if children, err := agent.deviceMgr.getAllChildDevices(agent.rootDeviceId); err != nil {
-		log.Errorw("error-getting-child-devices", log.Fields{"error": err, "deviceId": agent.rootDeviceId})
+	children, err := agent.deviceMgr.getAllChildDevices(agent.rootDeviceID)
+	if err != nil {
+		log.Errorw("error-getting-child-devices", log.Fields{"error": err, "deviceId": agent.rootDeviceID})
 		return err
-	} else {
-		responses := make([]coreutils.Response, 0)
-		for _, child := range children.Items {
-			response := coreutils.NewResponse()
-			responses = append(responses, response)
-			go func(child *voltha.Device) {
-				if err = agent.setupUNILogicalPorts(nil, child); err != nil {
-					log.Error("setting-up-UNI-ports-failed", log.Fields{"deviceID": child.Id})
-					response.Error(status.Errorf(codes.Internal, "UNI-ports-setup-failed: %s", child.Id))
-				}
-				response.Done()
-			}(child)
-		}
-		// Wait for completion
-		if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, responses...); res != nil {
-			return status.Errorf(codes.Aborted, "errors-%s", res)
-		}
+	}
+	responses := make([]coreutils.Response, 0)
+	for _, child := range children.Items {
+		response := coreutils.NewResponse()
+		responses = append(responses, response)
+		go func(child *voltha.Device) {
+			if err = agent.setupUNILogicalPorts(context.TODO(), child); err != nil {
+				log.Error("setting-up-UNI-ports-failed", log.Fields{"deviceID": child.Id})
+				response.Error(status.Errorf(codes.Internal, "UNI-ports-setup-failed: %s", child.Id))
+			}
+			response.Done()
+		}(child)
+	}
+	// Wait for completion
+	if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, responses...); res != nil {
+		return status.Errorf(codes.Aborted, "errors-%s", res)
 	}
 	return nil
 }
 
 // setupNNILogicalPorts creates an NNI port on the logical device that represents an NNI interface on a root device
-func (agent *LogicalDeviceAgent) setupNNILogicalPorts(ctx context.Context, deviceId string) error {
-	log.Infow("setupNNILogicalPorts-start", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+func (agent *LogicalDeviceAgent) setupNNILogicalPorts(ctx context.Context, deviceID string) error {
+	log.Infow("setupNNILogicalPorts-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	// Build the logical device based on information retrieved from the device adapter
 	var err error
 
 	var device *voltha.Device
-	if device, err = agent.deviceMgr.GetDevice(deviceId); err != nil {
-		log.Errorw("error-retrieving-device", log.Fields{"error": err, "deviceId": deviceId})
+	if device, err = agent.deviceMgr.GetDevice(deviceID); err != nil {
+		log.Errorw("error-retrieving-device", log.Fields{"error": err, "deviceId": deviceID})
 		return err
 	}
 
@@ -443,74 +409,74 @@
 }
 
 // updatePortState updates the port state of the device
-func (agent *LogicalDeviceAgent) updatePortState(deviceId string, portNo uint32, operStatus voltha.OperStatus_OperStatus) error {
-	log.Infow("updatePortState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "portNo": portNo, "state": operStatus})
+func (agent *LogicalDeviceAgent) updatePortState(deviceID string, portNo uint32, operStatus voltha.OperStatus_OperStatus) error {
+	log.Infow("updatePortState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "portNo": portNo, "state": operStatus})
 	agent.lockLogicalDevice.Lock()
 	defer agent.lockLogicalDevice.Unlock()
 	// Get the latest logical device info
-	if ld, err := agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Warnw("logical-device-unknown", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "error": err})
+	ld, err := agent.getLogicalDeviceWithoutLock()
+	if err != nil {
+		log.Warnw("logical-device-unknown", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "error": err})
 		return err
-	} else {
-		for idx, lPort := range ld.Ports {
-			if lPort.DeviceId == deviceId && lPort.DevicePortNo == portNo {
-				cloned := (proto.Clone(ld)).(*voltha.LogicalDevice)
-				if operStatus == voltha.OperStatus_ACTIVE {
-					cloned.Ports[idx].OfpPort.Config = cloned.Ports[idx].OfpPort.Config & ^uint32(ofp.OfpPortConfig_OFPPC_PORT_DOWN)
-					cloned.Ports[idx].OfpPort.State = uint32(ofp.OfpPortState_OFPPS_LIVE)
-				} else {
-					cloned.Ports[idx].OfpPort.Config = cloned.Ports[idx].OfpPort.Config | uint32(ofp.OfpPortConfig_OFPPC_PORT_DOWN)
-					cloned.Ports[idx].OfpPort.State = uint32(ofp.OfpPortState_OFPPS_LINK_DOWN)
-				}
-				// Update the logical device
-				if err := agent.updateLogicalDeviceWithoutLock(cloned); err != nil {
-					log.Errorw("error-updating-logical-device", log.Fields{"error": err})
-					return err
-				}
-				return nil
-			}
-		}
-		return status.Errorf(codes.NotFound, "port-%d-not-exist", portNo)
 	}
+	for idx, lPort := range ld.Ports {
+		if lPort.DeviceId == deviceID && lPort.DevicePortNo == portNo {
+			cloned := (proto.Clone(ld)).(*voltha.LogicalDevice)
+			if operStatus == voltha.OperStatus_ACTIVE {
+				cloned.Ports[idx].OfpPort.Config = cloned.Ports[idx].OfpPort.Config & ^uint32(ofp.OfpPortConfig_OFPPC_PORT_DOWN)
+				cloned.Ports[idx].OfpPort.State = uint32(ofp.OfpPortState_OFPPS_LIVE)
+			} else {
+				cloned.Ports[idx].OfpPort.Config = cloned.Ports[idx].OfpPort.Config | uint32(ofp.OfpPortConfig_OFPPC_PORT_DOWN)
+				cloned.Ports[idx].OfpPort.State = uint32(ofp.OfpPortState_OFPPS_LINK_DOWN)
+			}
+			// Update the logical device
+			if err := agent.updateLogicalDeviceWithoutLock(cloned); err != nil {
+				log.Errorw("error-updating-logical-device", log.Fields{"error": err})
+				return err
+			}
+			return nil
+		}
+	}
+	return status.Errorf(codes.NotFound, "port-%d-not-exist", portNo)
 }
 
 // updatePortsState updates the ports state related to the device
 func (agent *LogicalDeviceAgent) updatePortsState(device *voltha.Device, state voltha.AdminState_AdminState) error {
-	log.Infow("updatePortsState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+	log.Infow("updatePortsState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	agent.lockLogicalDevice.Lock()
 	defer agent.lockLogicalDevice.Unlock()
 	// Get the latest logical device info
-	if ld, err := agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Warnw("logical-device-unknown", log.Fields{"ldeviceId": agent.logicalDeviceId, "error": err})
+	ld, err := agent.getLogicalDeviceWithoutLock()
+	if err != nil {
+		log.Warnw("logical-device-unknown", log.Fields{"ldeviceId": agent.logicalDeviceID, "error": err})
 		return err
-	} else {
-		cloned := (proto.Clone(ld)).(*voltha.LogicalDevice)
-		for _, lport := range cloned.Ports {
-			if lport.DeviceId == device.Id {
-				switch state {
-				case voltha.AdminState_ENABLED:
-					lport.OfpPort.Config = lport.OfpPort.Config & ^uint32(ofp.OfpPortConfig_OFPPC_PORT_DOWN)
-					lport.OfpPort.State = uint32(ofp.OfpPortState_OFPPS_LIVE)
-				case voltha.AdminState_DISABLED:
-					lport.OfpPort.Config = lport.OfpPort.Config | uint32(ofp.OfpPortConfig_OFPPC_PORT_DOWN)
-					lport.OfpPort.State = uint32(ofp.OfpPortState_OFPPS_LINK_DOWN)
-				default:
-					log.Warnw("unsupported-state-change", log.Fields{"deviceId": device.Id, "state": state})
-				}
+	}
+	cloned := (proto.Clone(ld)).(*voltha.LogicalDevice)
+	for _, lport := range cloned.Ports {
+		if lport.DeviceId == device.Id {
+			switch state {
+			case voltha.AdminState_ENABLED:
+				lport.OfpPort.Config = lport.OfpPort.Config & ^uint32(ofp.OfpPortConfig_OFPPC_PORT_DOWN)
+				lport.OfpPort.State = uint32(ofp.OfpPortState_OFPPS_LIVE)
+			case voltha.AdminState_DISABLED:
+				lport.OfpPort.Config = lport.OfpPort.Config | uint32(ofp.OfpPortConfig_OFPPC_PORT_DOWN)
+				lport.OfpPort.State = uint32(ofp.OfpPortState_OFPPS_LINK_DOWN)
+			default:
+				log.Warnw("unsupported-state-change", log.Fields{"deviceId": device.Id, "state": state})
 			}
 		}
-		// Updating the logical device will trigger the poprt change events to be populated to the controller
-		if err := agent.updateLogicalDeviceWithoutLock(cloned); err != nil {
-			log.Warnw("logical-device-update-failed", log.Fields{"ldeviceId": agent.logicalDeviceId, "error": err})
-			return err
-		}
+	}
+	// Updating the logical device will trigger the poprt change events to be populated to the controller
+	if err := agent.updateLogicalDeviceWithoutLock(cloned); err != nil {
+		log.Warnw("logical-device-update-failed", log.Fields{"ldeviceId": agent.logicalDeviceID, "error": err})
+		return err
 	}
 	return nil
 }
 
 // setupUNILogicalPorts creates a UNI port on the logical device that represents a child UNI interface
 func (agent *LogicalDeviceAgent) setupUNILogicalPorts(ctx context.Context, childDevice *voltha.Device) error {
-	log.Infow("setupUNILogicalPort", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+	log.Infow("setupUNILogicalPort", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	// Build the logical device based on information retrieved from the device adapter
 	var err error
 	var added bool
@@ -530,31 +496,31 @@
 
 // deleteAllLogicalPorts deletes all logical ports associated with this device
 func (agent *LogicalDeviceAgent) deleteAllLogicalPorts(device *voltha.Device) error {
-	log.Infow("updatePortsState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+	log.Infow("updatePortsState-start", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	agent.lockLogicalDevice.Lock()
 	defer agent.lockLogicalDevice.Unlock()
 	// Get the latest logical device info
-	if ld, err := agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Warnw("logical-device-unknown", log.Fields{"ldeviceId": agent.logicalDeviceId, "error": err})
+	ld, err := agent.getLogicalDeviceWithoutLock()
+	if err != nil {
+		log.Warnw("logical-device-unknown", log.Fields{"ldeviceId": agent.logicalDeviceID, "error": err})
 		return err
+	}
+	cloned := (proto.Clone(ld)).(*voltha.LogicalDevice)
+	updateLogicalPorts := []*voltha.LogicalPort{}
+	for _, lport := range cloned.Ports {
+		if lport.DeviceId != device.Id {
+			updateLogicalPorts = append(updateLogicalPorts, lport)
+		}
+	}
+	if len(updateLogicalPorts) < len(cloned.Ports) {
+		cloned.Ports = updateLogicalPorts
+		// Updating the logical device will trigger the poprt change events to be populated to the controller
+		if err := agent.updateLogicalDeviceWithoutLock(cloned); err != nil {
+			log.Warnw("logical-device-update-failed", log.Fields{"ldeviceId": agent.logicalDeviceID, "error": err})
+			return err
+		}
 	} else {
-		cloned := (proto.Clone(ld)).(*voltha.LogicalDevice)
-		updateLogicalPorts := []*voltha.LogicalPort{}
-		for _, lport := range cloned.Ports {
-			if lport.DeviceId != device.Id {
-				updateLogicalPorts = append(updateLogicalPorts, lport)
-			}
-		}
-		if len(updateLogicalPorts) < len(cloned.Ports) {
-			cloned.Ports = updateLogicalPorts
-			// Updating the logical device will trigger the poprt change events to be populated to the controller
-			if err := agent.updateLogicalDeviceWithoutLock(cloned); err != nil {
-				log.Warnw("logical-device-update-failed", log.Fields{"ldeviceId": agent.logicalDeviceId, "error": err})
-				return err
-			}
-		} else {
-			log.Debugw("no-change-required", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
-		}
+		log.Debugw("no-change-required", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	}
 	return nil
 }
@@ -562,9 +528,9 @@
 //updateLogicalDeviceWithoutLock updates the model with the logical device.  It clones the logicaldevice before saving it
 func (agent *LogicalDeviceAgent) updateLogicalDeviceWithoutLock(logicalDevice *voltha.LogicalDevice) error {
 	updateCtx := context.WithValue(context.Background(), model.RequestTimestamp, time.Now().UnixNano())
-	afterUpdate := agent.clusterDataProxy.Update(updateCtx, "/logical_devices/"+agent.logicalDeviceId, logicalDevice, false, "")
+	afterUpdate := agent.clusterDataProxy.Update(updateCtx, "/logical_devices/"+agent.logicalDeviceID, logicalDevice, false, "")
 	if afterUpdate == nil {
-		return status.Errorf(codes.Internal, "failed-updating-logical-device:%s", agent.logicalDeviceId)
+		return status.Errorf(codes.Internal, "failed-updating-logical-device:%s", agent.logicalDeviceID)
 	}
 	return nil
 }
@@ -572,18 +538,18 @@
 //generateDeviceGraphIfNeeded generates the device graph if the logical device has been updated since the last time
 //that device graph was generated.
 func (agent *LogicalDeviceAgent) generateDeviceGraphIfNeeded() error {
-	if ld, err := agent.GetLogicalDevice(); err != nil {
+	ld, err := agent.GetLogicalDevice()
+	if err != nil {
 		log.Errorw("get-logical-device-error", log.Fields{"error": err})
 		return err
-	} else {
-		agent.lockDeviceGraph.Lock()
-		defer agent.lockDeviceGraph.Unlock()
-		if agent.deviceGraph != nil && agent.deviceGraph.IsUpToDate(ld) {
-			return nil
-		}
-		log.Debug("Generation of device graph required")
-		agent.generateDeviceGraph()
 	}
+	agent.lockDeviceGraph.Lock()
+	defer agent.lockDeviceGraph.Unlock()
+	if agent.deviceGraph != nil && agent.deviceGraph.IsUpToDate(ld) {
+		return nil
+	}
+	log.Debug("Generation of device graph required")
+	agent.generateDeviceGraph()
 	return nil
 }
 
@@ -609,7 +575,7 @@
 		return agent.flowModifyStrict(flow)
 	}
 	return status.Errorf(codes.Internal,
-		"unhandled-command: lDeviceId:%s, command:%s", agent.logicalDeviceId, flow.GetCommand())
+		"unhandled-command: lDeviceId:%s, command:%s", agent.logicalDeviceID, flow.GetCommand())
 }
 
 //updateGroupTable updates the group table of that logical device
@@ -630,7 +596,7 @@
 		return agent.groupModify(groupMod)
 	}
 	return status.Errorf(codes.Internal,
-		"unhandled-command: lDeviceId:%s, command:%s", agent.logicalDeviceId, groupMod.GetCommand())
+		"unhandled-command: lDeviceId:%s, command:%s", agent.logicalDeviceID, groupMod.GetCommand())
 }
 
 // updateMeterTable updates the meter table of that logical device
@@ -651,7 +617,7 @@
 		return agent.meterModify(meterMod)
 	}
 	return status.Errorf(codes.Internal,
-		"unhandled-command: lDeviceId:%s, command:%s", agent.logicalDeviceId, meterMod.GetCommand())
+		"unhandled-command: lDeviceId:%s, command:%s", agent.logicalDeviceID, meterMod.GetCommand())
 
 }
 
@@ -667,8 +633,8 @@
 	var lDevice *voltha.LogicalDevice
 	var err error
 	if lDevice, err = agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
-		return errors.New(fmt.Sprintf("no-logical-device-present:%s", agent.logicalDeviceId))
+		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		return fmt.Errorf("no-logical-device-present:%s", agent.logicalDeviceID)
 	}
 
 	var meters []*ofp.OfpMeterEntry
@@ -688,7 +654,7 @@
 	meters = append(meters, meterEntry)
 	//Update model
 	if err := agent.updateLogicalDeviceMetersWithoutLock(&ofp.Meters{Items: meters}); err != nil {
-		log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+		log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 		return err
 	}
 	log.Debugw("Meter-added-successfully", log.Fields{"Added-meter": meterEntry, "updated-meters": lDevice.Meters})
@@ -706,8 +672,8 @@
 	var lDevice *voltha.LogicalDevice
 	var err error
 	if lDevice, err = agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
-		return errors.New(fmt.Sprintf("no-logical-device-present:%s", agent.logicalDeviceId))
+		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		return fmt.Errorf("no-logical-device-present:%s", agent.logicalDeviceID)
 	}
 
 	var meters []*ofp.OfpMeterEntry
@@ -716,9 +682,6 @@
 	if lDevice.Meters != nil && lDevice.Meters.Items != nil {
 		meters = lDevice.Meters.Items
 	}
-	if lDevice.Flows != nil && lDevice.Flows.Items != nil {
-		flows = lDevice.Flows.Items
-	}
 
 	changedMeter := false
 	changedFow := false
@@ -726,7 +689,7 @@
 	for index, meter := range meters {
 		if meterMod.MeterId == meter.Config.MeterId {
 			flows = lDevice.Flows.Items
-			changedFow, updatedFlows = agent.getUpdatedFlowsAfterDeletebyMeterId(flows, meterMod.MeterId)
+			changedFow, updatedFlows = agent.getUpdatedFlowsAfterDeletebyMeterID(flows, meterMod.MeterId)
 			meters = append(meters[:index], meters[index+1:]...)
 			log.Debugw("Meter has been deleted", log.Fields{"meter": meter, "index": index})
 			changedMeter = true
@@ -740,7 +703,7 @@
 			metersToUpdate = &ofp.Meters{Items: meters}
 		}
 		if err := agent.updateLogicalDeviceMetersWithoutLock(metersToUpdate); err != nil {
-			log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 		log.Debug("Meter-deleted-from-DB-successfully", log.Fields{"updatedMeters": metersToUpdate, "no-of-meter": len(metersToUpdate.Items)})
@@ -749,7 +712,7 @@
 	if changedFow {
 		//Update model
 		if err := agent.updateLogicalDeviceFlowsWithoutLock(&ofp.Flows{Items: updatedFlows}); err != nil {
-			log.Errorw("db-flow-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("db-flow-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 		log.Debug("Flows-associated-with-meter-deleted-from-DB-successfully",
@@ -770,8 +733,8 @@
 	var lDevice *voltha.LogicalDevice
 	var err error
 	if lDevice, err = agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
-		return errors.New(fmt.Sprintf("no-logical-device-present:%s", agent.logicalDeviceId))
+		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		return fmt.Errorf("no-logical-device-present:%s", agent.logicalDeviceID)
 	}
 
 	var meters []*ofp.OfpMeterEntry
@@ -796,7 +759,7 @@
 			metersToUpdate = &ofp.Meters{Items: meters}
 		}
 		if err := agent.updateLogicalDeviceMetersWithoutLock(metersToUpdate); err != nil {
-			log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 		log.Debugw("meter-updated-in-DB-successfully", log.Fields{"updated_meters": meters})
@@ -804,16 +767,16 @@
 	}
 
 	log.Errorw("Meter not found ", log.Fields{"meter": meterMod})
-	return errors.New(fmt.Sprintf("no-logical-device-present:%d", meterMod.MeterId))
+	return fmt.Errorf("no-logical-device-present:%d", meterMod.MeterId)
 
 }
 
-func (agent *LogicalDeviceAgent) getUpdatedFlowsAfterDeletebyMeterId(flows []*ofp.OfpFlowStats, meterId uint32) (bool, []*ofp.OfpFlowStats) {
-	log.Infow("Delete flows matching meter", log.Fields{"meter": meterId})
+func (agent *LogicalDeviceAgent) getUpdatedFlowsAfterDeletebyMeterID(flows []*ofp.OfpFlowStats, meterID uint32) (bool, []*ofp.OfpFlowStats) {
+	log.Infow("Delete flows matching meter", log.Fields{"meter": meterID})
 	changed := false
 	//updatedFlows := make([]*ofp.OfpFlowStats, 0)
 	for index := len(flows) - 1; index >= 0; index-- {
-		if mId := fu.GetMeterIdFromFlow(flows[index]); mId != 0 && mId == meterId {
+		if mID := fu.GetMeterIdFromFlow(flows[index]); mID != 0 && mID == meterID {
 			log.Debugw("Flow to be deleted", log.Fields{"flow": flows[index], "index": index})
 			flows = append(flows[:index], flows[index+1:]...)
 			changed = true
@@ -825,9 +788,9 @@
 func (agent *LogicalDeviceAgent) updateFlowCountOfMeterStats(modCommand *ofp.OfpFlowMod, meters []*ofp.OfpMeterEntry, flow *ofp.OfpFlowStats) bool {
 
 	flowCommand := modCommand.GetCommand()
-	meterId := fu.GetMeterIdFromFlow(flow)
-	log.Debugw("Meter-id-in-flow-mod", log.Fields{"meterId": meterId})
-	if meterId == 0 {
+	meterID := fu.GetMeterIdFromFlow(flow)
+	log.Debugw("Meter-id-in-flow-mod", log.Fields{"meterId": meterID})
+	if meterID == 0 {
 		log.Debugw("No meter present in the flow", log.Fields{"flow": *flow})
 		return false
 	}
@@ -837,15 +800,15 @@
 	}
 	changedMeter := false
 	for _, meter := range meters {
-		if meterId == meter.Config.MeterId { // Found meter in Logicaldevice
+		if meterID == meter.Config.MeterId { // Found meter in Logicaldevice
 			if flowCommand == ofp.OfpFlowModCommand_OFPFC_ADD {
-				meter.Stats.FlowCount += 1
+				meter.Stats.FlowCount++
 				changedMeter = true
 			} else if flowCommand == ofp.OfpFlowModCommand_OFPFC_DELETE_STRICT {
-				meter.Stats.FlowCount -= 1
+				meter.Stats.FlowCount--
 				changedMeter = true
 			}
-			log.Debugw("Found meter, updated meter flow stats", log.Fields{" meterId": meterId})
+			log.Debugw("Found meter, updated meter flow stats", log.Fields{" meterId": meterID})
 			break
 		}
 	}
@@ -864,8 +827,8 @@
 	var lDevice *voltha.LogicalDevice
 	var err error
 	if lDevice, err = agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
-		return errors.New(fmt.Sprintf("no-logical-device-present:%s", agent.logicalDeviceId))
+		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		return fmt.Errorf("no-logical-device-present:%s", agent.logicalDeviceID)
 	}
 
 	var flows []*ofp.OfpFlowStats
@@ -886,7 +849,7 @@
 	if checkOverlap {
 		if overlapped := fu.FindOverlappingFlows(flows, mod); len(overlapped) != 0 {
 			//	TODO:  should this error be notified other than being logged?
-			log.Warnw("overlapped-flows", log.Fields{"logicaldeviceId": agent.logicalDeviceId})
+			log.Warnw("overlapped-flows", log.Fields{"logicaldeviceId": agent.logicalDeviceID})
 		} else {
 			//	Add flow
 			flow = fu.FlowStatsEntryFromFlowModMessage(mod)
@@ -927,13 +890,13 @@
 		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 
 		if err := agent.addDeviceFlowsAndGroups(deviceRules, &flowMetadata); err != nil {
-			log.Errorw("failure-updating-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "error": err})
+			log.Errorw("failure-updating-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "error": err})
 			return err
 		}
 
 		//	Update model
 		if err := agent.updateLogicalDeviceFlowsWithoutLock(&ofp.Flows{Items: flows}); err != nil {
-			log.Errorw("db-flow-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("db-flow-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 		if !updated {
@@ -945,7 +908,7 @@
 			if changedMeterStats {
 				//Update model
 				if err := agent.updateLogicalDeviceMetersWithoutLock(metersToUpdate); err != nil {
-					log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+					log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 					return err
 				}
 				log.Debugw("meter-stats-updated-in-DB-successfully", log.Fields{"updated_meters": meters})
@@ -957,10 +920,11 @@
 	return nil
 }
 
+// GetMeterConfig returns meter config
 func (agent *LogicalDeviceAgent) GetMeterConfig(flows []*ofp.OfpFlowStats, meters []*ofp.OfpMeterEntry, metadata *voltha.FlowMetadata) error {
 	m := make(map[uint32]bool)
 	for _, flow := range flows {
-		if flowMeterID := fu.GetMeterIdFromFlow(flow); flowMeterID != 0 && m[flowMeterID] == false {
+		if flowMeterID := fu.GetMeterIdFromFlow(flow); flowMeterID != 0 && !m[flowMeterID] {
 			foundMeter := false
 			// Meter is present in the flow , Get from logical device
 			for _, meter := range meters {
@@ -975,7 +939,7 @@
 			}
 			if !foundMeter {
 				log.Errorw("Meter-referred-by-flow-is-not-found-in-logicaldevice",
-					log.Fields{"meterID": flowMeterID, "Avaliable-meters": meters, "flow": *flow})
+					log.Fields{"meterID": flowMeterID, "Available-meters": meters, "flow": *flow})
 				return errors.New("Meter-referred-by-flow-is-not-found-in-logicaldevice")
 			}
 		}
@@ -997,8 +961,8 @@
 	var lDevice *voltha.LogicalDevice
 	var err error
 	if lDevice, err = agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
-		return errors.New(fmt.Sprintf("no-logical-device-present:%s", agent.logicalDeviceId))
+		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		return fmt.Errorf("no-logical-device-present:%s", agent.logicalDeviceID)
 	}
 
 	var meters []*ofp.OfpMeterEntry
@@ -1028,7 +992,7 @@
 		}
 	}
 
-	log.Debugw("flowDelete", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "toKeep": len(toKeep), "toDelete": toDelete})
+	log.Debugw("flowDelete", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "toKeep": len(toKeep), "toDelete": toDelete})
 
 	//Update flows
 	if len(toDelete) > 0 {
@@ -1041,12 +1005,12 @@
 		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 
 		if err := agent.deleteDeviceFlowsAndGroups(deviceRules, &flowMetadata); err != nil {
-			log.Errorw("failure-updating-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "error": err})
+			log.Errorw("failure-updating-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "error": err})
 			return err
 		}
 
 		if err := agent.updateLogicalDeviceFlowsWithoutLock(&ofp.Flows{Items: toKeep}); err != nil {
-			log.Errorw("Cannot-update-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("Cannot-update-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 	}
@@ -1056,10 +1020,10 @@
 }
 
 func (agent *LogicalDeviceAgent) addDeviceFlowsAndGroups(deviceRules *fu.DeviceRules, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("addDeviceFlowsAndGroups", log.Fields{"logicalDeviceID": agent.logicalDeviceId, "deviceRules": deviceRules, "flowMetadata": flowMetadata})
+	log.Debugw("addDeviceFlowsAndGroups", log.Fields{"logicalDeviceID": agent.logicalDeviceID, "deviceRules": deviceRules, "flowMetadata": flowMetadata})
 
 	responses := make([]coreutils.Response, 0)
-	for deviceId, value := range deviceRules.GetRules() {
+	for deviceID, value := range deviceRules.GetRules() {
 		response := coreutils.NewResponse()
 		responses = append(responses, response)
 		go func(deviceId string, value *fu.FlowsAndGroups) {
@@ -1068,7 +1032,7 @@
 				response.Error(status.Errorf(codes.Internal, "flow-add-failed: %s", deviceId))
 			}
 			response.Done()
-		}(deviceId, value)
+		}(deviceID, value)
 	}
 	// Wait for completion
 	if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, responses...); res != nil {
@@ -1078,10 +1042,10 @@
 }
 
 func (agent *LogicalDeviceAgent) deleteDeviceFlowsAndGroups(deviceRules *fu.DeviceRules, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("deleteDeviceFlowsAndGroups", log.Fields{"logicalDeviceID": agent.logicalDeviceId})
+	log.Debugw("deleteDeviceFlowsAndGroups", log.Fields{"logicalDeviceID": agent.logicalDeviceID})
 
 	responses := make([]coreutils.Response, 0)
-	for deviceId, value := range deviceRules.GetRules() {
+	for deviceID, value := range deviceRules.GetRules() {
 		response := coreutils.NewResponse()
 		responses = append(responses, response)
 		go func(deviceId string, value *fu.FlowsAndGroups) {
@@ -1090,7 +1054,7 @@
 				response.Error(status.Errorf(codes.Internal, "flow-delete-failed: %s", deviceId))
 			}
 			response.Done()
-		}(deviceId, value)
+		}(deviceID, value)
 	}
 	// Wait for completion
 	if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, responses...); res != nil {
@@ -1100,10 +1064,10 @@
 }
 
 func (agent *LogicalDeviceAgent) updateDeviceFlowsAndGroups(deviceRules *fu.DeviceRules, flowMetadata *voltha.FlowMetadata) error {
-	log.Debugw("updateDeviceFlowsAndGroups", log.Fields{"logicalDeviceID": agent.logicalDeviceId})
+	log.Debugw("updateDeviceFlowsAndGroups", log.Fields{"logicalDeviceID": agent.logicalDeviceID})
 
 	responses := make([]coreutils.Response, 0)
-	for deviceId, value := range deviceRules.GetRules() {
+	for deviceID, value := range deviceRules.GetRules() {
 		response := coreutils.NewResponse()
 		responses = append(responses, response)
 		go func(deviceId string, value *fu.FlowsAndGroups) {
@@ -1112,7 +1076,7 @@
 				response.Error(status.Errorf(codes.Internal, "flow-update-failed: %s", deviceId))
 			}
 			response.Done()
-		}(deviceId, value)
+		}(deviceID, value)
 	}
 	// Wait for completion
 	if res := coreutils.WaitForNilOrErrorResponses(agent.defaultTimeout, responses...); res != nil {
@@ -1133,8 +1097,8 @@
 	var lDevice *voltha.LogicalDevice
 	var err error
 	if lDevice, err = agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
-		return errors.New(fmt.Sprintf("no-logical-device-present:%s", agent.logicalDeviceId))
+		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		return fmt.Errorf("no-logical-device-present:%s", agent.logicalDeviceID)
 	}
 	var meters []*ofp.OfpMeterEntry
 	var flows []*ofp.OfpFlowStats
@@ -1156,7 +1120,7 @@
 		flows = append(flows[:idx], flows[idx+1:]...)
 		changedFlow = true
 	} else {
-		return errors.New(fmt.Sprintf("Cannot delete flow - %s", flow))
+		return fmt.Errorf("Cannot delete flow - %s", flow)
 	}
 	if changedMeter {
 		//Update model
@@ -1165,7 +1129,7 @@
 			metersToUpdate = &ofp.Meters{Items: meters}
 		}
 		if err := agent.updateLogicalDeviceMetersWithoutLock(metersToUpdate); err != nil {
-			log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("db-meter-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 
@@ -1180,12 +1144,12 @@
 		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 
 		if err := agent.deleteDeviceFlowsAndGroups(deviceRules, &flowMetadata); err != nil {
-			log.Errorw("failure-deleting-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "error": err})
+			log.Errorw("failure-deleting-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "error": err})
 			return err
 		}
 
 		if err := agent.updateLogicalDeviceFlowsWithoutLock(&ofp.Flows{Items: flows}); err != nil {
-			log.Errorw("Cannot-update-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("Cannot-update-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 	}
@@ -1213,8 +1177,8 @@
 	var lDevice *voltha.LogicalDevice
 	var err error
 	if lDevice, err = agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
-		return errors.New(fmt.Sprintf("no-logical-device-present:%s", agent.logicalDeviceId))
+		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		return fmt.Errorf("no-logical-device-present:%s", agent.logicalDeviceID)
 	}
 	groups := lDevice.FlowGroups.Items
 	if fu.FindGroup(groups, groupMod.GroupId) == -1 {
@@ -1223,16 +1187,16 @@
 		deviceRules := agent.flowDecomposer.DecomposeRules(agent, *lDevice.Flows, ofp.FlowGroups{Items: groups})
 		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 		if err := agent.addDeviceFlowsAndGroups(deviceRules, nil); err != nil {
-			log.Errorw("failure-updating-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "error": err})
+			log.Errorw("failure-updating-device-flows", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "error": err})
 			return err
 		}
 
 		if err := agent.updateLogicalDeviceFlowGroupsWithoutLock(&ofp.FlowGroups{Items: groups}); err != nil {
-			log.Errorw("Cannot-update-group", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("Cannot-update-group", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 	} else {
-		return errors.New(fmt.Sprintf("Groups %d already present", groupMod.GroupId))
+		return fmt.Errorf("Groups %d already present", groupMod.GroupId)
 	}
 	return nil
 }
@@ -1248,47 +1212,47 @@
 	var lDevice *voltha.LogicalDevice
 	var err error
 	if lDevice, err = agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
-		return errors.New(fmt.Sprintf("no-logical-device-present:%s", agent.logicalDeviceId))
+		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		return fmt.Errorf("no-logical-device-present:%s", agent.logicalDeviceID)
 	}
 	groups := lDevice.FlowGroups.Items
 	flows := lDevice.Flows.Items
-	groupsChanged := false
+	var groupsChanged bool
 	flowsChanged := false
-	groupId := groupMod.GroupId
-	if groupId == uint32(ofp.OfpGroup_OFPG_ALL) {
+	groupID := groupMod.GroupId
+	if groupID == uint32(ofp.OfpGroup_OFPG_ALL) {
 		//TODO we must delete all flows that point to this group and
 		//signal controller as requested by flow's flag
 		groups = []*ofp.OfpGroupEntry{}
 		groupsChanged = true
 	} else {
-		if idx := fu.FindGroup(groups, groupId); idx == -1 {
+		idx := fu.FindGroup(groups, groupID)
+		if idx == -1 {
 			return nil // Valid case
-		} else {
-			flowsChanged, flows = fu.FlowsDeleteByGroupId(flows, groupId)
-			groups = append(groups[:idx], groups[idx+1:]...)
-			groupsChanged = true
 		}
+		flowsChanged, flows = fu.FlowsDeleteByGroupId(flows, groupID)
+		groups = append(groups[:idx], groups[idx+1:]...)
+		groupsChanged = true
 	}
 	if flowsChanged || groupsChanged {
 		deviceRules := agent.flowDecomposer.DecomposeRules(agent, ofp.Flows{Items: flows}, ofp.FlowGroups{Items: groups})
 		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 
 		if err := agent.updateDeviceFlowsAndGroups(deviceRules, nil); err != nil {
-			log.Errorw("failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "error": err})
+			log.Errorw("failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "error": err})
 			return err
 		}
 	}
 
 	if groupsChanged {
 		if err := agent.updateLogicalDeviceFlowGroupsWithoutLock(&ofp.FlowGroups{Items: groups}); err != nil {
-			log.Errorw("Cannot-update-group", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("Cannot-update-group", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 	}
 	if flowsChanged {
 		if err := agent.updateLogicalDeviceFlowsWithoutLock(&ofp.Flows{Items: flows}); err != nil {
-			log.Errorw("Cannot-update-flow", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("Cannot-update-flow", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 	}
@@ -1306,32 +1270,32 @@
 	var lDevice *voltha.LogicalDevice
 	var err error
 	if lDevice, err = agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
-		return errors.New(fmt.Sprintf("no-logical-device-present:%s", agent.logicalDeviceId))
+		log.Errorw("no-logical-device-present", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
+		return fmt.Errorf("no-logical-device-present:%s", agent.logicalDeviceID)
 	}
 	groups := lDevice.FlowGroups.Items
-	groupsChanged := false
-	groupId := groupMod.GroupId
-	if idx := fu.FindGroup(groups, groupId); idx == -1 {
-		return errors.New(fmt.Sprintf("group-absent:%d", groupId))
-	} else {
-		//replace existing group entry with new group definition
-		groupEntry := fu.GroupEntryFromGroupMod(groupMod)
-		groups[idx] = groupEntry
-		groupsChanged = true
+	var groupsChanged bool
+	groupID := groupMod.GroupId
+	idx := fu.FindGroup(groups, groupID)
+	if idx == -1 {
+		return fmt.Errorf("group-absent:%d", groupID)
 	}
+	//replace existing group entry with new group definition
+	groupEntry := fu.GroupEntryFromGroupMod(groupMod)
+	groups[idx] = groupEntry
+	groupsChanged = true
 	if groupsChanged {
 		deviceRules := agent.flowDecomposer.DecomposeRules(agent, ofp.Flows{Items: lDevice.Flows.Items}, ofp.FlowGroups{Items: groups})
 		log.Debugw("rules", log.Fields{"rules": deviceRules.String()})
 
 		if err := agent.updateDeviceFlowsAndGroups(deviceRules, nil); err != nil {
-			log.Errorw("failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "error": err})
+			log.Errorw("failure-updating-device-flows-groups", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "error": err})
 			return err
 		}
 
 		//lDevice.FlowGroups.Items = groups
 		if err := agent.updateLogicalDeviceFlowGroupsWithoutLock(&ofp.FlowGroups{Items: groups}); err != nil {
-			log.Errorw("Cannot-update-logical-group", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("Cannot-update-logical-group", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 	}
@@ -1346,7 +1310,7 @@
 	// Get the most up to date logical device
 	var logicaldevice *voltha.LogicalDevice
 	if logicaldevice, _ = agent.getLogicalDeviceWithoutLock(); logicaldevice == nil {
-		log.Debugw("no-logical-device", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "logicalPortId": lPort.Id})
+		log.Debugw("no-logical-device", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "logicalPortId": lPort.Id})
 		return nil
 	}
 	index := -1
@@ -1360,9 +1324,9 @@
 		copy(logicaldevice.Ports[index:], logicaldevice.Ports[index+1:])
 		logicaldevice.Ports[len(logicaldevice.Ports)-1] = nil
 		logicaldevice.Ports = logicaldevice.Ports[:len(logicaldevice.Ports)-1]
-		log.Debugw("logical-port-deleted", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+		log.Debugw("logical-port-deleted", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 		if err := agent.updateLogicalDeviceWithoutLock(logicaldevice); err != nil {
-			log.Errorw("logical-device-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+			log.Errorw("logical-device-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 			return err
 		}
 		// Reset the logical device graph
@@ -1372,26 +1336,26 @@
 }
 
 // deleteLogicalPorts removes the logical ports associated with that deviceId
-func (agent *LogicalDeviceAgent) deleteLogicalPorts(deviceId string) error {
+func (agent *LogicalDeviceAgent) deleteLogicalPorts(deviceID string) error {
 	agent.lockLogicalDevice.Lock()
 	defer agent.lockLogicalDevice.Unlock()
 
 	// Get the most up to date logical device
 	var logicaldevice *voltha.LogicalDevice
 	if logicaldevice, _ = agent.getLogicalDeviceWithoutLock(); logicaldevice == nil {
-		log.Debugw("no-logical-device", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+		log.Debugw("no-logical-device", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 		return nil
 	}
 	updatedLPorts := []*voltha.LogicalPort{}
 	for _, logicalPort := range logicaldevice.Ports {
-		if logicalPort.DeviceId != deviceId {
+		if logicalPort.DeviceId != deviceID {
 			updatedLPorts = append(updatedLPorts, logicalPort)
 		}
 	}
 	logicaldevice.Ports = updatedLPorts
 	log.Debugw("updated-logical-ports", log.Fields{"ports": updatedLPorts})
 	if err := agent.updateLogicalDeviceWithoutLock(logicaldevice); err != nil {
-		log.Errorw("logical-device-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+		log.Errorw("logical-device-update-failed", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 		return err
 	}
 	// Reset the logical device graph
@@ -1401,19 +1365,19 @@
 }
 
 // enableLogicalPort enables the logical port
-func (agent *LogicalDeviceAgent) enableLogicalPort(lPortId string) error {
+func (agent *LogicalDeviceAgent) enableLogicalPort(lPortID string) error {
 	agent.lockLogicalDevice.Lock()
 	defer agent.lockLogicalDevice.Unlock()
 
 	// Get the most up to date logical device
 	var logicaldevice *voltha.LogicalDevice
 	if logicaldevice, _ = agent.getLogicalDeviceWithoutLock(); logicaldevice == nil {
-		log.Debugw("no-logical-device", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "logicalPortId": lPortId})
+		log.Debugw("no-logical-device", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "logicalPortId": lPortID})
 		return nil
 	}
 	index := -1
 	for i, logicalPort := range logicaldevice.Ports {
-		if logicalPort.Id == lPortId {
+		if logicalPort.Id == lPortID {
 			index = i
 			break
 		}
@@ -1421,25 +1385,24 @@
 	if index >= 0 {
 		logicaldevice.Ports[index].OfpPort.Config = logicaldevice.Ports[index].OfpPort.Config & ^uint32(ofp.OfpPortConfig_OFPPC_PORT_DOWN)
 		return agent.updateLogicalDeviceWithoutLock(logicaldevice)
-	} else {
-		return status.Errorf(codes.NotFound, "Port %s on Logical Device %s", lPortId, agent.logicalDeviceId)
 	}
+	return status.Errorf(codes.NotFound, "Port %s on Logical Device %s", lPortID, agent.logicalDeviceID)
 }
 
 // disableLogicalPort disabled the logical port
-func (agent *LogicalDeviceAgent) disableLogicalPort(lPortId string) error {
+func (agent *LogicalDeviceAgent) disableLogicalPort(lPortID string) error {
 	agent.lockLogicalDevice.Lock()
 	defer agent.lockLogicalDevice.Unlock()
 
 	// Get the most up to date logical device
 	var logicaldevice *voltha.LogicalDevice
 	if logicaldevice, _ = agent.getLogicalDeviceWithoutLock(); logicaldevice == nil {
-		log.Debugw("no-logical-device", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "logicalPortId": lPortId})
+		log.Debugw("no-logical-device", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "logicalPortId": lPortID})
 		return nil
 	}
 	index := -1
 	for i, logicalPort := range logicaldevice.Ports {
-		if logicalPort.Id == lPortId {
+		if logicalPort.Id == lPortID {
 			index = i
 			break
 		}
@@ -1447,9 +1410,8 @@
 	if index >= 0 {
 		logicaldevice.Ports[index].OfpPort.Config = (logicaldevice.Ports[index].OfpPort.Config & ^uint32(ofp.OfpPortConfig_OFPPC_PORT_DOWN)) | uint32(ofp.OfpPortConfig_OFPPC_PORT_DOWN)
 		return agent.updateLogicalDeviceWithoutLock(logicaldevice)
-	} else {
-		return status.Errorf(codes.NotFound, "Port %s on Logical Device %s", lPortId, agent.logicalDeviceId)
 	}
+	return status.Errorf(codes.NotFound, "Port %s on Logical Device %s", lPortID, agent.logicalDeviceID)
 }
 
 func (agent *LogicalDeviceAgent) getPreCalculatedRoute(ingress, egress uint32) []graph.RouteHop {
@@ -1460,10 +1422,11 @@
 			return route
 		}
 	}
-	log.Warnw("no-route", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "ingress": ingress, "egress": egress})
+	log.Warnw("no-route", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "ingress": ingress, "egress": egress})
 	return nil
 }
 
+// GetRoute returns route
 func (agent *LogicalDeviceAgent) GetRoute(ingressPortNo uint32, egressPortNo uint32) []graph.RouteHop {
 	log.Debugw("getting-route", log.Fields{"ingress-port": ingressPortNo, "egress-port": egressPortNo})
 	routes := make([]graph.RouteHop, 0)
@@ -1478,7 +1441,7 @@
 			if len(agent.deviceGraph.Routes) == 0 {
 				// If there are no routes set (usually when the logical device has only NNI port(s), then just return an
 				// route with same IngressHop and EgressHop
-				hop := graph.RouteHop{DeviceID: agent.rootDeviceId, Ingress: ingressPortNo, Egress: ingressPortNo}
+				hop := graph.RouteHop{DeviceID: agent.rootDeviceID, Ingress: ingressPortNo, Egress: ingressPortNo}
 				routes = append(routes, hop)
 				routes = append(routes, hop)
 				return routes
@@ -1552,37 +1515,38 @@
 	return lPorts
 }
 
+// GetDeviceGraph returns device graph
 func (agent *LogicalDeviceAgent) GetDeviceGraph() *graph.DeviceGraph {
 	return agent.deviceGraph
 }
 
 //updateRoutes rebuilds the device graph if not done already
 func (agent *LogicalDeviceAgent) updateRoutes(device *voltha.Device, port *voltha.Port) error {
-	log.Debugf("updateRoutes", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "device": device.Id, "port": port})
+	log.Debugf("updateRoutes", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "device": device.Id, "port": port})
 	agent.lockLogicalDevice.Lock()
 	defer agent.lockLogicalDevice.Unlock()
 	if agent.deviceGraph == nil {
-		agent.deviceGraph = graph.NewDeviceGraph(agent.logicalDeviceId, agent.deviceMgr.GetDevice)
+		agent.deviceGraph = graph.NewDeviceGraph(agent.logicalDeviceID, agent.deviceMgr.GetDevice)
 	}
 	// Get all the logical ports on that logical device
-	if lDevice, err := agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Errorw("unknown-logical-device", log.Fields{"error": err, "logicalDeviceId": agent.logicalDeviceId})
+	lDevice, err := agent.getLogicalDeviceWithoutLock()
+	if err != nil {
+		log.Errorw("unknown-logical-device", log.Fields{"error": err, "logicalDeviceId": agent.logicalDeviceID})
 		return err
-	} else {
-		//TODO:  Find a better way to refresh only missing routes
-		agent.deviceGraph.ComputeRoutes(lDevice.Ports)
 	}
+	//TODO:  Find a better way to refresh only missing routes
+	agent.deviceGraph.ComputeRoutes(lDevice.Ports)
 	agent.deviceGraph.Print()
 	return nil
 }
 
 //updateDeviceGraph updates the device graph if not done already and setup the default rules as well
 func (agent *LogicalDeviceAgent) updateDeviceGraph(lp *voltha.LogicalPort) {
-	log.Debugf("updateDeviceGraph", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+	log.Debugf("updateDeviceGraph", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	agent.lockLogicalDevice.Lock()
 	defer agent.lockLogicalDevice.Unlock()
 	if agent.deviceGraph == nil {
-		agent.deviceGraph = graph.NewDeviceGraph(agent.logicalDeviceId, agent.deviceMgr.GetDevice)
+		agent.deviceGraph = graph.NewDeviceGraph(agent.logicalDeviceID, agent.deviceMgr.GetDevice)
 	}
 	agent.deviceGraph.AddPort(lp)
 	agent.deviceGraph.Print()
@@ -1590,85 +1554,22 @@
 
 //generateDeviceGraph regenerates the device graph
 func (agent *LogicalDeviceAgent) generateDeviceGraph() {
-	log.Debugw("generateDeviceGraph", log.Fields{"logicalDeviceId": agent.logicalDeviceId})
+	log.Debugw("generateDeviceGraph", log.Fields{"logicalDeviceId": agent.logicalDeviceID})
 	agent.lockLogicalDevice.Lock()
 	defer agent.lockLogicalDevice.Unlock()
 	// Get the latest logical device
 	if ld, err := agent.getLogicalDeviceWithoutLock(); err != nil {
-		log.Errorw("logical-device-not-present", log.Fields{"logicalDeviceId": agent.logicalDeviceId, "error": err})
+		log.Errorw("logical-device-not-present", log.Fields{"logicalDeviceId": agent.logicalDeviceID, "error": err})
 	} else {
-		log.Debugw("generating-graph", log.Fields{"lDeviceId": agent.logicalDeviceId, "lPorts": len(ld.Ports)})
+		log.Debugw("generating-graph", log.Fields{"lDeviceId": agent.logicalDeviceID, "lPorts": len(ld.Ports)})
 		if agent.deviceGraph == nil {
-			agent.deviceGraph = graph.NewDeviceGraph(agent.logicalDeviceId, agent.deviceMgr.GetDevice)
+			agent.deviceGraph = graph.NewDeviceGraph(agent.logicalDeviceID, agent.deviceMgr.GetDevice)
 		}
 		agent.deviceGraph.ComputeRoutes(ld.Ports)
 		agent.deviceGraph.Print()
 	}
 }
 
-// portAdded is a callback invoked when a port is added to the logical device.
-// TODO: To use when POST_ADD is fixed.
-func (agent *LogicalDeviceAgent) portAdded(args ...interface{}) interface{} {
-	log.Debugw("portAdded-callback", log.Fields{"argsLen": len(args)})
-
-	var port *voltha.LogicalPort
-
-	// Sanity check
-	if args[0] != nil {
-		log.Warnw("previous-data-not-nil", log.Fields{"args0": args[0]})
-	}
-	var ok bool
-	if port, ok = args[1].(*voltha.LogicalPort); !ok {
-		log.Errorw("invalid-args", log.Fields{"args1": args[1]})
-		return nil
-	}
-
-	// Set the proxy and callback for that port
-	agent.portProxiesLock.Lock()
-	agent.portProxies[port.Id] = agent.clusterDataProxy.CreateProxy(
-		context.Background(),
-		fmt.Sprintf("/logical_devices/%s/ports/%s", agent.logicalDeviceId, port.Id),
-		false)
-	agent.portProxies[port.Id].RegisterCallback(model.POST_UPDATE, agent.portUpdated)
-	agent.portProxiesLock.Unlock()
-
-	// Send the port change event to the OF controller
-	agent.ldeviceMgr.grpcNbiHdlr.sendChangeEvent(agent.logicalDeviceId,
-		&ofp.OfpPortStatus{Reason: ofp.OfpPortReason_OFPPR_ADD, Desc: port.OfpPort})
-
-	return nil
-}
-
-// portRemoved is a callback invoked when a port is removed from the logical device.
-// TODO: To use when POST_ADD is fixed.
-func (agent *LogicalDeviceAgent) portRemoved(args ...interface{}) interface{} {
-	log.Debugw("portRemoved-callback", log.Fields{"argsLen": len(args)})
-
-	var port *voltha.LogicalPort
-
-	// Sanity check
-	if args[1] != nil {
-		log.Warnw("data-not-nil", log.Fields{"args1": args[1]})
-	}
-	var ok bool
-	if port, ok = args[0].(*voltha.LogicalPort); !ok {
-		log.Errorw("invalid-args", log.Fields{"args0": args[0]})
-		return nil
-	}
-
-	// Remove the proxy and callback for that port
-	agent.portProxiesLock.Lock()
-	agent.portProxies[port.Id].UnregisterCallback(model.POST_UPDATE, agent.portUpdated)
-	delete(agent.portProxies, port.Id)
-	agent.portProxiesLock.Unlock()
-
-	// Send the port change event to the OF controller
-	agent.ldeviceMgr.grpcNbiHdlr.sendChangeEvent(agent.logicalDeviceId,
-		&ofp.OfpPortStatus{Reason: ofp.OfpPortReason_OFPPR_DELETE, Desc: port.OfpPort})
-
-	return nil
-}
-
 // diff go over two lists of logical ports and return what's new, what's changed and what's removed.
 func diff(oldList, newList []*voltha.LogicalPort) (newPorts, changedPorts, deletedPorts []*voltha.LogicalPort) {
 	newPorts = make([]*voltha.LogicalPort, 0)
@@ -1735,15 +1636,15 @@
 
 	// Send the port change events to the OF controller
 	for _, newP := range newPorts {
-		go agent.ldeviceMgr.grpcNbiHdlr.sendChangeEvent(agent.logicalDeviceId,
+		go agent.ldeviceMgr.grpcNbiHdlr.sendChangeEvent(agent.logicalDeviceID,
 			&ofp.OfpPortStatus{Reason: ofp.OfpPortReason_OFPPR_ADD, Desc: newP.OfpPort})
 	}
 	for _, change := range changedPorts {
-		go agent.ldeviceMgr.grpcNbiHdlr.sendChangeEvent(agent.logicalDeviceId,
+		go agent.ldeviceMgr.grpcNbiHdlr.sendChangeEvent(agent.logicalDeviceID,
 			&ofp.OfpPortStatus{Reason: ofp.OfpPortReason_OFPPR_MODIFY, Desc: change.OfpPort})
 	}
 	for _, del := range deletedPorts {
-		go agent.ldeviceMgr.grpcNbiHdlr.sendChangeEvent(agent.logicalDeviceId,
+		go agent.ldeviceMgr.grpcNbiHdlr.sendChangeEvent(agent.logicalDeviceID,
 			&ofp.OfpPortStatus{Reason: ofp.OfpPortReason_OFPPR_DELETE, Desc: del.OfpPort})
 	}
 
@@ -1771,7 +1672,7 @@
 	var portCap *ic.PortCapability
 	var err error
 	// First get the port capability
-	if portCap, err = agent.deviceMgr.getPortCapability(nil, device.Id, port.PortNo); err != nil {
+	if portCap, err = agent.deviceMgr.getPortCapability(context.TODO(), device.Id, port.PortNo); err != nil {
 		log.Errorw("error-retrieving-port-capabilities", log.Fields{"error": err})
 		return false, err
 	}
@@ -1846,7 +1747,7 @@
 	var portCap *ic.PortCapability
 	var err error
 	// First get the port capability
-	if portCap, err = agent.deviceMgr.getPortCapability(nil, childDevice.Id, port.PortNo); err != nil {
+	if portCap, err = agent.deviceMgr.getPortCapability(context.TODO(), childDevice.Id, port.PortNo); err != nil {
 		log.Errorw("error-retrieving-port-capabilities", log.Fields{"error": err})
 		return false, err
 	}
@@ -1858,28 +1759,28 @@
 		return false, nil
 	}
 	// Get stored logical device
-	if ldevice, err := agent.getLogicalDeviceWithoutLock(); err != nil {
-		return false, status.Error(codes.NotFound, agent.logicalDeviceId)
-	} else {
-		log.Debugw("adding-uni", log.Fields{"deviceId": childDevice.Id})
-		portCap.Port.RootPort = false
-		portCap.Port.Id = port.Label
-		portCap.Port.OfpPort.PortNo = port.PortNo
-		portCap.Port.DeviceId = childDevice.Id
-		portCap.Port.DevicePortNo = port.PortNo
-		cloned := (proto.Clone(ldevice)).(*voltha.LogicalDevice)
-		if cloned.Ports == nil {
-			cloned.Ports = make([]*voltha.LogicalPort, 0)
-		}
-		cloned.Ports = append(cloned.Ports, portCap.Port)
-		if err := agent.updateLogicalDeviceWithoutLock(cloned); err != nil {
-			return false, err
-		}
-		// Update the device graph with this new logical port
-		clonedLP := (proto.Clone(portCap.Port)).(*voltha.LogicalPort)
-		go agent.updateDeviceGraph(clonedLP)
-		return true, nil
+	ldevice, err := agent.getLogicalDeviceWithoutLock()
+	if err != nil {
+		return false, status.Error(codes.NotFound, agent.logicalDeviceID)
 	}
+	log.Debugw("adding-uni", log.Fields{"deviceId": childDevice.Id})
+	portCap.Port.RootPort = false
+	portCap.Port.Id = port.Label
+	portCap.Port.OfpPort.PortNo = port.PortNo
+	portCap.Port.DeviceId = childDevice.Id
+	portCap.Port.DevicePortNo = port.PortNo
+	cloned := (proto.Clone(ldevice)).(*voltha.LogicalDevice)
+	if cloned.Ports == nil {
+		cloned.Ports = make([]*voltha.LogicalPort, 0)
+	}
+	cloned.Ports = append(cloned.Ports, portCap.Port)
+	if err := agent.updateLogicalDeviceWithoutLock(cloned); err != nil {
+		return false, err
+	}
+	// Update the device graph with this new logical port
+	clonedLP := (proto.Clone(portCap.Port)).(*voltha.LogicalPort)
+	go agent.updateDeviceGraph(clonedLP)
+	return true, nil
 }
 
 func (agent *LogicalDeviceAgent) packetOut(packet *ofp.OfpPacketOut) {
@@ -1890,19 +1791,19 @@
 	outPort := fu.GetPacketOutPort(packet)
 	//frame := packet.GetData()
 	//TODO: Use a channel between the logical agent and the device agent
-	if err := agent.deviceMgr.packetOut(agent.rootDeviceId, outPort, packet); err != nil {
-		log.Error("packetout-failed", log.Fields{"logicalDeviceID": agent.rootDeviceId})
+	if err := agent.deviceMgr.packetOut(agent.rootDeviceID, outPort, packet); err != nil {
+		log.Error("packetout-failed", log.Fields{"logicalDeviceID": agent.rootDeviceID})
 	}
 }
 
-func (agent *LogicalDeviceAgent) packetIn(port uint32, transactionId string, packet []byte) {
+func (agent *LogicalDeviceAgent) packetIn(port uint32, transactionID string, packet []byte) {
 	log.Debugw("packet-in", log.Fields{
 		"port":          port,
 		"packet":        hex.EncodeToString(packet),
-		"transactionId": transactionId,
+		"transactionId": transactionID,
 	})
 	packetIn := fu.MkPacketIn(port, packet)
-	agent.ldeviceMgr.grpcNbiHdlr.sendPacketIn(agent.logicalDeviceId, transactionId, packetIn)
+	agent.ldeviceMgr.grpcNbiHdlr.sendPacketIn(agent.logicalDeviceID, transactionID, packetIn)
 	log.Debugw("sending-packet-in", log.Fields{"packet": hex.EncodeToString(packetIn.Data)})
 }
 
@@ -1924,14 +1825,6 @@
 	}
 }
 
-func (agent *LogicalDeviceAgent) deleteLogicalPortFromMap(portNo uint32) {
-	agent.lockLogicalPortsNo.Lock()
-	defer agent.lockLogicalPortsNo.Unlock()
-	if exist := agent.logicalPortsNo[portNo]; exist {
-		delete(agent.logicalPortsNo, portNo)
-	}
-}
-
 func (agent *LogicalDeviceAgent) isNNIPort(portNo uint32) bool {
 	agent.lockLogicalPortsNo.RLock()
 	defer agent.lockLogicalPortsNo.RUnlock()
diff --git a/rw_core/core/logical_device_manager.go b/rw_core/core/logical_device_manager.go
index ebe72b3..8c326a8 100644
--- a/rw_core/core/logical_device_manager.go
+++ b/rw_core/core/logical_device_manager.go
@@ -13,11 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package core
 
 import (
 	"context"
 	"errors"
+	"strings"
+	"sync"
+
 	"github.com/opencord/voltha-go/db/model"
 	"github.com/opencord/voltha-lib-go/v2/pkg/kafka"
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
@@ -26,16 +30,14 @@
 	"github.com/opencord/voltha-protos/v2/go/voltha"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
-	"strings"
-	"sync"
 )
 
+// LogicalDeviceManager represent logical device manager attributes
 type LogicalDeviceManager struct {
 	logicalDeviceAgents            sync.Map
 	core                           *Core
 	deviceMgr                      *DeviceManager
 	grpcNbiHdlr                    *APIHandler
-	adapterProxy                   *AdapterProxy
 	kafkaICProxy                   *kafka.InterContainerProxy
 	clusterDataProxy               *model.Proxy
 	exitChannel                    chan int
@@ -87,34 +89,29 @@
 }
 
 func (ldMgr *LogicalDeviceManager) addLogicalDeviceAgentToMap(agent *LogicalDeviceAgent) {
-	if _, exist := ldMgr.logicalDeviceAgents.Load(agent.logicalDeviceId); !exist {
-		ldMgr.logicalDeviceAgents.Store(agent.logicalDeviceId, agent)
+	if _, exist := ldMgr.logicalDeviceAgents.Load(agent.logicalDeviceID); !exist {
+		ldMgr.logicalDeviceAgents.Store(agent.logicalDeviceID, agent)
 	}
 }
 
-func (ldMgr *LogicalDeviceManager) isLogicalDeviceInCache(logicalDeviceId string) bool {
-	_, inCache := ldMgr.logicalDeviceAgents.Load(logicalDeviceId)
-	return inCache
-}
-
 // getLogicalDeviceAgent returns the logical device agent.  If the device is not in memory then the device will
 // be loaded from dB and a logical device agent created to managed it.
-func (ldMgr *LogicalDeviceManager) getLogicalDeviceAgent(logicalDeviceId string) *LogicalDeviceAgent {
-	if agent, ok := ldMgr.logicalDeviceAgents.Load(logicalDeviceId); ok {
+func (ldMgr *LogicalDeviceManager) getLogicalDeviceAgent(logicalDeviceID string) *LogicalDeviceAgent {
+	agent, ok := ldMgr.logicalDeviceAgents.Load(logicalDeviceID)
+	if ok {
 		return agent.(*LogicalDeviceAgent)
-	} else {
-		//	Try to load into memory - loading will also create the logical device agent
-		if err := ldMgr.load(logicalDeviceId); err == nil {
-			if agent, ok = ldMgr.logicalDeviceAgents.Load(logicalDeviceId); ok {
-				return agent.(*LogicalDeviceAgent)
-			}
+	}
+	//	Try to load into memory - loading will also create the logical device agent
+	if err := ldMgr.load(logicalDeviceID); err == nil {
+		if agent, ok = ldMgr.logicalDeviceAgents.Load(logicalDeviceID); ok {
+			return agent.(*LogicalDeviceAgent)
 		}
 	}
 	return nil
 }
 
-func (ldMgr *LogicalDeviceManager) deleteLogicalDeviceAgent(logicalDeviceId string) {
-	ldMgr.logicalDeviceAgents.Delete(logicalDeviceId)
+func (ldMgr *LogicalDeviceManager) deleteLogicalDeviceAgent(logicalDeviceID string) {
+	ldMgr.logicalDeviceAgents.Delete(logicalDeviceID)
 }
 
 // GetLogicalDevice provides a cloned most up to date logical device.  If device is not in memory
@@ -176,12 +173,17 @@
 	ldMgr.addLogicalDeviceAgentToMap(agent)
 
 	// Update the root device with the logical device Id reference
-	if err := ldMgr.deviceMgr.setParentId(device, id); err != nil {
+	if err := ldMgr.deviceMgr.setParentID(device, id); err != nil {
 		log.Errorw("failed-setting-parent-id", log.Fields{"logicalDeviceId": id, "deviceId": device.Id})
 		return nil, err
 	}
 
-	go agent.start(ctx, false)
+	go func() {
+		err := agent.start(ctx, false)
+		if err != nil {
+			log.Errorw("unable-to-create-the-logical-device", log.Fields{"error": err})
+		}
+	}()
 
 	log.Debug("creating-logical-device-ends")
 	return &id, nil
@@ -190,62 +192,62 @@
 // stopManagingLogicalDeviceWithDeviceId stops the management of the logical device.  This implies removal of any
 // reference of this logical device in cache.  The device Id is passed as param because the logical device may already
 // have been removed from the model.  This function returns the logical device Id if found
-func (ldMgr *LogicalDeviceManager) stopManagingLogicalDeviceWithDeviceId(id string) string {
+func (ldMgr *LogicalDeviceManager) stopManagingLogicalDeviceWithDeviceID(id string) string {
 	log.Infow("stop-managing-logical-device", log.Fields{"deviceId": id})
 	// Go over the list of logical device agents to find the one which has rootDeviceId as id
-	var ldId = ""
+	var ldID = ""
 	ldMgr.logicalDeviceAgents.Range(func(key, value interface{}) bool {
 		ldAgent := value.(*LogicalDeviceAgent)
-		if ldAgent.rootDeviceId == id {
+		if ldAgent.rootDeviceID == id {
 			log.Infow("stopping-logical-device-agent", log.Fields{"lDeviceId": key})
-			ldAgent.stop(nil)
-			ldId = key.(string)
-			ldMgr.logicalDeviceAgents.Delete(ldId)
+			ldAgent.stop(context.TODO())
+			ldID = key.(string)
+			ldMgr.logicalDeviceAgents.Delete(ldID)
 		}
 		return true
 	})
-	return ldId
+	return ldID
 }
 
 //getLogicalDeviceFromModel retrieves the logical device data from the model.
-func (ldMgr *LogicalDeviceManager) getLogicalDeviceFromModel(lDeviceId string) (*voltha.LogicalDevice, error) {
-	if logicalDevice := ldMgr.clusterDataProxy.Get(context.Background(), "/logical_devices/"+lDeviceId, 0, false, ""); logicalDevice != nil {
+func (ldMgr *LogicalDeviceManager) getLogicalDeviceFromModel(lDeviceID string) (*voltha.LogicalDevice, error) {
+	if logicalDevice := ldMgr.clusterDataProxy.Get(context.Background(), "/logical_devices/"+lDeviceID, 0, false, ""); logicalDevice != nil {
 		if lDevice, ok := logicalDevice.(*voltha.LogicalDevice); ok {
 			return lDevice, nil
 		}
 	}
-	return nil, status.Error(codes.NotFound, lDeviceId)
+	return nil, status.Error(codes.NotFound, lDeviceID)
 }
 
 // load loads a logical device manager in memory
-func (ldMgr *LogicalDeviceManager) load(lDeviceId string) error {
-	if lDeviceId == "" {
+func (ldMgr *LogicalDeviceManager) load(lDeviceID string) error {
+	if lDeviceID == "" {
 		return nil
 	}
 	// Add a lock to prevent two concurrent calls from loading the same device twice
 	ldMgr.logicalDevicesLoadingLock.Lock()
-	if _, exist := ldMgr.logicalDeviceLoadingInProgress[lDeviceId]; !exist {
-		if ldAgent, _ := ldMgr.logicalDeviceAgents.Load(lDeviceId); ldAgent == nil {
-			ldMgr.logicalDeviceLoadingInProgress[lDeviceId] = []chan int{make(chan int, 1)}
+	if _, exist := ldMgr.logicalDeviceLoadingInProgress[lDeviceID]; !exist {
+		if ldAgent, _ := ldMgr.logicalDeviceAgents.Load(lDeviceID); ldAgent == nil {
+			ldMgr.logicalDeviceLoadingInProgress[lDeviceID] = []chan int{make(chan int, 1)}
 			ldMgr.logicalDevicesLoadingLock.Unlock()
-			if _, err := ldMgr.getLogicalDeviceFromModel(lDeviceId); err == nil {
-				log.Debugw("loading-logical-device", log.Fields{"lDeviceId": lDeviceId})
-				agent := newLogicalDeviceAgent(lDeviceId, "", ldMgr, ldMgr.deviceMgr, ldMgr.clusterDataProxy, ldMgr.defaultTimeout)
-				if err := agent.start(nil, true); err != nil {
-					agent.stop(nil)
+			if _, err := ldMgr.getLogicalDeviceFromModel(lDeviceID); err == nil {
+				log.Debugw("loading-logical-device", log.Fields{"lDeviceId": lDeviceID})
+				agent := newLogicalDeviceAgent(lDeviceID, "", ldMgr, ldMgr.deviceMgr, ldMgr.clusterDataProxy, ldMgr.defaultTimeout)
+				if err := agent.start(context.TODO(), true); err != nil {
+					agent.stop(context.TODO())
 				} else {
-					ldMgr.logicalDeviceAgents.Store(agent.logicalDeviceId, agent)
+					ldMgr.logicalDeviceAgents.Store(agent.logicalDeviceID, agent)
 				}
 			} else {
-				log.Debugw("logicalDevice not in model", log.Fields{"lDeviceId": lDeviceId})
+				log.Debugw("logicalDevice not in model", log.Fields{"lDeviceId": lDeviceID})
 			}
 			// announce completion of task to any number of waiting channels
 			ldMgr.logicalDevicesLoadingLock.Lock()
-			if v, ok := ldMgr.logicalDeviceLoadingInProgress[lDeviceId]; ok {
+			if v, ok := ldMgr.logicalDeviceLoadingInProgress[lDeviceID]; ok {
 				for _, ch := range v {
 					close(ch)
 				}
-				delete(ldMgr.logicalDeviceLoadingInProgress, lDeviceId)
+				delete(ldMgr.logicalDeviceLoadingInProgress, lDeviceID)
 			}
 			ldMgr.logicalDevicesLoadingLock.Unlock()
 		} else {
@@ -253,15 +255,15 @@
 		}
 	} else {
 		ch := make(chan int, 1)
-		ldMgr.logicalDeviceLoadingInProgress[lDeviceId] = append(ldMgr.logicalDeviceLoadingInProgress[lDeviceId], ch)
+		ldMgr.logicalDeviceLoadingInProgress[lDeviceID] = append(ldMgr.logicalDeviceLoadingInProgress[lDeviceID], ch)
 		ldMgr.logicalDevicesLoadingLock.Unlock()
 		//	Wait for the channel to be closed, implying the process loading this device is done.
 		<-ch
 	}
-	if _, exist := ldMgr.logicalDeviceAgents.Load(lDeviceId); exist {
+	if _, exist := ldMgr.logicalDeviceAgents.Load(lDeviceID); exist {
 		return nil
 	}
-	return status.Errorf(codes.Aborted, "Error loading logical device %s", lDeviceId)
+	return status.Errorf(codes.Aborted, "Error loading logical device %s", lDeviceID)
 }
 
 func (ldMgr *LogicalDeviceManager) deleteLogicalDevice(ctx context.Context, device *voltha.Device) error {
@@ -270,20 +272,23 @@
 	if !device.Root {
 		return errors.New("device-not-root")
 	}
-	logDeviceId := device.ParentId
-	if agent := ldMgr.getLogicalDeviceAgent(logDeviceId); agent != nil {
+	logDeviceID := device.ParentId
+	if agent := ldMgr.getLogicalDeviceAgent(logDeviceID); agent != nil {
 		// Stop the logical device agent
 		agent.stop(ctx)
 		//Remove the logical device agent from the Map
-		ldMgr.deleteLogicalDeviceAgent(logDeviceId)
-		ldMgr.core.deviceOwnership.AbandonDevice(logDeviceId)
+		ldMgr.deleteLogicalDeviceAgent(logDeviceID)
+		err := ldMgr.core.deviceOwnership.AbandonDevice(logDeviceID)
+		if err != nil {
+			log.Errorw("unable-to-abandon-the-device", log.Fields{"error": err})
+		}
 	}
 
 	log.Debug("deleting-logical-device-ends")
 	return nil
 }
 
-func (ldMgr *LogicalDeviceManager) getLogicalDeviceId(device *voltha.Device) (*string, error) {
+func (ldMgr *LogicalDeviceManager) getLogicalDeviceID(device *voltha.Device) (*string, error) {
 	// Device can either be a parent or a child device
 	if device.Root {
 		// Parent device.  The ID of a parent device is the logical device ID
@@ -297,36 +302,37 @@
 	return nil, status.Errorf(codes.NotFound, "%s", device.Id)
 }
 
-func (ldMgr *LogicalDeviceManager) getLogicalDeviceIdFromDeviceId(deviceId string) (*string, error) {
+func (ldMgr *LogicalDeviceManager) getLogicalDeviceIDFromDeviceID(deviceID string) (*string, error) {
 	// Get the device
 	var device *voltha.Device
 	var err error
-	if device, err = ldMgr.deviceMgr.GetDevice(deviceId); err != nil {
+	if device, err = ldMgr.deviceMgr.GetDevice(deviceID); err != nil {
 		return nil, err
 	}
-	return ldMgr.getLogicalDeviceId(device)
+	return ldMgr.getLogicalDeviceID(device)
 }
 
-func (ldMgr *LogicalDeviceManager) getLogicalPortId(device *voltha.Device) (*voltha.LogicalPortId, error) {
+func (ldMgr *LogicalDeviceManager) getLogicalPortID(device *voltha.Device) (*voltha.LogicalPortId, error) {
 	// Get the logical device where this device is attached
-	var lDeviceId *string
+	var lDeviceID *string
 	var err error
-	if lDeviceId, err = ldMgr.getLogicalDeviceId(device); err != nil {
+	if lDeviceID, err = ldMgr.getLogicalDeviceID(device); err != nil {
 		return nil, err
 	}
 	var lDevice *voltha.LogicalDevice
-	if lDevice, err = ldMgr.getLogicalDevice(*lDeviceId); err != nil {
+	if lDevice, err = ldMgr.getLogicalDevice(*lDeviceID); err != nil {
 		return nil, err
 	}
 	// Go over list of ports
 	for _, port := range lDevice.Ports {
 		if port.DeviceId == device.Id {
-			return &voltha.LogicalPortId{Id: *lDeviceId, PortId: port.Id}, nil
+			return &voltha.LogicalPortId{Id: *lDeviceID, PortId: port.Id}, nil
 		}
 	}
 	return nil, status.Errorf(codes.NotFound, "%s", device.Id)
 }
 
+// ListLogicalDeviceFlows returns the flows of logical device
 func (ldMgr *LogicalDeviceManager) ListLogicalDeviceFlows(ctx context.Context, id string) (*openflow_13.Flows, error) {
 	log.Debugw("ListLogicalDeviceFlows", log.Fields{"logicaldeviceid": id})
 	if agent := ldMgr.getLogicalDeviceAgent(id); agent != nil {
@@ -335,6 +341,7 @@
 	return nil, status.Errorf(codes.NotFound, "%s", id)
 }
 
+// ListLogicalDeviceFlowGroups returns logical device flow groups
 func (ldMgr *LogicalDeviceManager) ListLogicalDeviceFlowGroups(ctx context.Context, id string) (*openflow_13.FlowGroups, error) {
 	log.Debugw("ListLogicalDeviceFlowGroups", log.Fields{"logicaldeviceid": id})
 	if agent := ldMgr.getLogicalDeviceAgent(id); agent != nil {
@@ -343,6 +350,7 @@
 	return nil, status.Errorf(codes.NotFound, "%s", id)
 }
 
+// ListLogicalDevicePorts returns logical device ports
 func (ldMgr *LogicalDeviceManager) ListLogicalDevicePorts(ctx context.Context, id string) (*voltha.LogicalPorts, error) {
 	log.Debugw("ListLogicalDevicePorts", log.Fields{"logicaldeviceid": id})
 	if agent := ldMgr.getLogicalDeviceAgent(id); agent != nil {
@@ -351,73 +359,56 @@
 	return nil, status.Errorf(codes.NotFound, "%s", id)
 }
 
-func (ldMgr *LogicalDeviceManager) getLogicalPort(lPortId *voltha.LogicalPortId) (*voltha.LogicalPort, error) {
+func (ldMgr *LogicalDeviceManager) getLogicalPort(lPortID *voltha.LogicalPortId) (*voltha.LogicalPort, error) {
 	// Get the logical device where this device is attached
 	var err error
 	var lDevice *voltha.LogicalDevice
-	if lDevice, err = ldMgr.getLogicalDevice(lPortId.Id); err != nil {
+	if lDevice, err = ldMgr.getLogicalDevice(lPortID.Id); err != nil {
 		return nil, err
 	}
 	// Go over list of ports
 	for _, port := range lDevice.Ports {
-		if port.Id == lPortId.PortId {
+		if port.Id == lPortID.PortId {
 			return port, nil
 		}
 	}
-	return nil, status.Errorf(codes.NotFound, "%s-%s", lPortId.Id, lPortId.PortId)
+	return nil, status.Errorf(codes.NotFound, "%s-%s", lPortID.Id, lPortID.PortId)
 }
 
 // updateLogicalPort sets up a logical port on the logical device based on the device port
 // information, if needed
 func (ldMgr *LogicalDeviceManager) updateLogicalPort(device *voltha.Device, port *voltha.Port) error {
-	if ldID, err := ldMgr.getLogicalDeviceId(device); err != nil || *ldID == "" {
+	ldID, err := ldMgr.getLogicalDeviceID(device)
+	if err != nil || *ldID == "" {
 		// This is not an error as the logical device may not have been created at this time.  In such a case,
 		// the ports will be created when the logical device is ready.
 		return nil
-	} else {
-		if agent := ldMgr.getLogicalDeviceAgent(*ldID); agent != nil {
-			if err := agent.updateLogicalPort(device, port); err != nil {
-				return err
-			}
-		}
 	}
-	return nil
-}
-
-// addLogicalPort sets up a logical port on the logical device based on the device port
-// information.
-func (ldMgr *LogicalDeviceManager) addLogicalPort(device *voltha.Device, port *voltha.Port) error {
-	if ldID, err := ldMgr.getLogicalDeviceId(device); err != nil || *ldID == "" {
-		// This is not an error as the logical device may not have been created at this time.  In such a case,
-		// the ports will be created when the logical device is ready.
-		return nil
-	} else {
-		if agent := ldMgr.getLogicalDeviceAgent(*ldID); agent != nil {
-			if err := agent.addLogicalPort(device, port); err != nil {
-				return err
-			}
+	if agent := ldMgr.getLogicalDeviceAgent(*ldID); agent != nil {
+		if err := agent.updateLogicalPort(device, port); err != nil {
+			return err
 		}
 	}
 	return nil
 }
 
 // deleteLogicalPort removes the logical port associated with a device
-func (ldMgr *LogicalDeviceManager) deleteLogicalPort(ctx context.Context, lPortId *voltha.LogicalPortId) error {
-	log.Debugw("deleting-logical-port", log.Fields{"LDeviceId": lPortId.Id})
+func (ldMgr *LogicalDeviceManager) deleteLogicalPort(ctx context.Context, lPortID *voltha.LogicalPortId) error {
+	log.Debugw("deleting-logical-port", log.Fields{"LDeviceId": lPortID.Id})
 	// Get logical port
 	var logicalPort *voltha.LogicalPort
 	var err error
-	if logicalPort, err = ldMgr.getLogicalPort(lPortId); err != nil {
-		log.Debugw("no-logical-device-port-present", log.Fields{"logicalPortId": lPortId.PortId})
+	if logicalPort, err = ldMgr.getLogicalPort(lPortID); err != nil {
+		log.Debugw("no-logical-device-port-present", log.Fields{"logicalPortId": lPortID.PortId})
 		return err
 	}
 	// Sanity check
 	if logicalPort.RootPort {
 		return errors.New("device-root")
 	}
-	if agent := ldMgr.getLogicalDeviceAgent(lPortId.Id); agent != nil {
+	if agent := ldMgr.getLogicalDeviceAgent(lPortID.Id); agent != nil {
 		if err := agent.deleteLogicalPort(logicalPort); err != nil {
-			log.Warnw("deleting-logicalport-failed", log.Fields{"LDeviceId": lPortId.Id, "error": err})
+			log.Warnw("deleting-logicalport-failed", log.Fields{"LDeviceId": lPortID.Id, "error": err})
 		}
 	}
 
@@ -426,17 +417,17 @@
 }
 
 // deleteLogicalPort removes the logical port associated with a child device
-func (ldMgr *LogicalDeviceManager) deleteLogicalPorts(deviceId string) error {
-	log.Debugw("deleting-logical-ports", log.Fields{"deviceId": deviceId})
+func (ldMgr *LogicalDeviceManager) deleteLogicalPorts(deviceID string) error {
+	log.Debugw("deleting-logical-ports", log.Fields{"deviceId": deviceID})
 	// Get logical port
-	if ldId, err := ldMgr.getLogicalDeviceIdFromDeviceId(deviceId); err != nil {
+	ldID, err := ldMgr.getLogicalDeviceIDFromDeviceID(deviceID)
+	if err != nil {
 		return err
-	} else {
-		if agent := ldMgr.getLogicalDeviceAgent(*ldId); agent != nil {
-			if err = agent.deleteLogicalPorts(deviceId); err != nil {
-				log.Warnw("deleteLogicalPorts-failed", log.Fields{"ldeviceId": *ldId})
-				return err
-			}
+	}
+	if agent := ldMgr.getLogicalDeviceAgent(*ldID); agent != nil {
+		if err = agent.deleteLogicalPorts(deviceID); err != nil {
+			log.Warnw("deleteLogicalPorts-failed", log.Fields{"ldeviceId": *ldID})
+			return err
 		}
 	}
 	log.Debug("deleting-logical-port-ends")
@@ -451,16 +442,16 @@
 	}
 
 	// Get the logical device id parent device
-	parentId := childDevice.ParentId
-	logDeviceId := ldMgr.deviceMgr.GetParentDeviceId(parentId)
+	parentID := childDevice.ParentId
+	logDeviceID := ldMgr.deviceMgr.GetParentDeviceID(parentID)
 
-	log.Debugw("setupUNILogicalPorts", log.Fields{"logDeviceId": logDeviceId, "parentId": parentId})
+	log.Debugw("setupUNILogicalPorts", log.Fields{"logDeviceId": logDeviceID, "parentId": parentID})
 
-	if parentId == "" || logDeviceId == "" {
+	if parentID == "" || logDeviceID == "" {
 		return errors.New("device-in-invalid-state")
 	}
 
-	if agent := ldMgr.getLogicalDeviceAgent(logDeviceId); agent != nil {
+	if agent := ldMgr.getLogicalDeviceAgent(logDeviceID); agent != nil {
 		if err := agent.setupUNILogicalPorts(ctx, childDevice); err != nil {
 			return err
 		}
@@ -471,32 +462,32 @@
 func (ldMgr *LogicalDeviceManager) deleteAllLogicalPorts(device *voltha.Device) error {
 	log.Debugw("deleteAllLogicalPorts", log.Fields{"deviceId": device.Id})
 
-	var ldId *string
+	var ldID *string
 	var err error
 	//Get the logical device Id for this device
-	if ldId, err = ldMgr.getLogicalDeviceId(device); err != nil {
+	if ldID, err = ldMgr.getLogicalDeviceID(device); err != nil {
 		log.Warnw("no-logical-device-found", log.Fields{"deviceId": device.Id, "error": err})
 		return err
 	}
-	if agent := ldMgr.getLogicalDeviceAgent(*ldId); agent != nil {
+	if agent := ldMgr.getLogicalDeviceAgent(*ldID); agent != nil {
 		if err := agent.deleteAllLogicalPorts(device); err != nil {
 			return err
 		}
 	}
 	return nil
 }
-func (ldMgr *LogicalDeviceManager) updatePortState(deviceId string, portNo uint32, state voltha.OperStatus_OperStatus) error {
-	log.Debugw("updatePortState", log.Fields{"deviceId": deviceId, "state": state, "portNo": portNo})
+func (ldMgr *LogicalDeviceManager) updatePortState(deviceID string, portNo uint32, state voltha.OperStatus_OperStatus) error {
+	log.Debugw("updatePortState", log.Fields{"deviceId": deviceID, "state": state, "portNo": portNo})
 
-	var ldId *string
+	var ldID *string
 	var err error
 	//Get the logical device Id for this device
-	if ldId, err = ldMgr.getLogicalDeviceIdFromDeviceId(deviceId); err != nil {
-		log.Warnw("no-logical-device-found", log.Fields{"deviceId": deviceId, "error": err})
+	if ldID, err = ldMgr.getLogicalDeviceIDFromDeviceID(deviceID); err != nil {
+		log.Warnw("no-logical-device-found", log.Fields{"deviceId": deviceID, "error": err})
 		return err
 	}
-	if agent := ldMgr.getLogicalDeviceAgent(*ldId); agent != nil {
-		if err := agent.updatePortState(deviceId, portNo, state); err != nil {
+	if agent := ldMgr.getLogicalDeviceAgent(*ldID); agent != nil {
+		if err := agent.updatePortState(deviceID, portNo, state); err != nil {
 			return err
 		}
 	}
@@ -506,14 +497,14 @@
 func (ldMgr *LogicalDeviceManager) updatePortsState(device *voltha.Device, state voltha.AdminState_AdminState) error {
 	log.Debugw("updatePortsState", log.Fields{"deviceId": device.Id, "state": state, "current-data": device})
 
-	var ldId *string
+	var ldID *string
 	var err error
 	//Get the logical device Id for this device
-	if ldId, err = ldMgr.getLogicalDeviceId(device); err != nil {
+	if ldID, err = ldMgr.getLogicalDeviceID(device); err != nil {
 		log.Warnw("no-logical-device-found", log.Fields{"deviceId": device.Id, "error": err})
 		return err
 	}
-	if agent := ldMgr.getLogicalDeviceAgent(*ldId); agent != nil {
+	if agent := ldMgr.getLogicalDeviceAgent(*ldID); agent != nil {
 		if err := agent.updatePortsState(device, state); err != nil {
 			return err
 		}
@@ -545,6 +536,7 @@
 	sendAPIResponse(ctx, ch, res)
 }
 
+// ListLogicalDeviceMeters returns logical device meters
 func (ldMgr *LogicalDeviceManager) ListLogicalDeviceMeters(ctx context.Context, id string) (*openflow_13.Meters, error) {
 	log.Debugw("ListLogicalDeviceMeters", log.Fields{"logicalDeviceId": id})
 	if agent := ldMgr.getLogicalDeviceAgent(id); agent != nil {
@@ -567,7 +559,6 @@
 func (ldMgr *LogicalDeviceManager) enableLogicalPort(ctx context.Context, id *voltha.LogicalPortId, ch chan interface{}) {
 	log.Debugw("enableLogicalPort", log.Fields{"logicalDeviceId": id})
 	var res interface{}
-
 	if agent := ldMgr.getLogicalDeviceAgent(id.Id); agent != nil {
 		res = agent.enableLogicalPort(id.PortId)
 		log.Debugw("enableLogicalPort-result", log.Fields{"result": res})
@@ -580,7 +571,6 @@
 func (ldMgr *LogicalDeviceManager) disableLogicalPort(ctx context.Context, id *voltha.LogicalPortId, ch chan interface{}) {
 	log.Debugw("disableLogicalPort", log.Fields{"logicalDeviceId": id})
 	var res interface{}
-
 	if agent := ldMgr.getLogicalDeviceAgent(id.Id); agent != nil {
 		res = agent.disableLogicalPort(id.PortId)
 		log.Debugw("disableLogicalPort-result", log.Fields{"result": res})
@@ -590,21 +580,12 @@
 	sendAPIResponse(ctx, ch, res)
 }
 
-func (ldMgr *LogicalDeviceManager) packetOut(packetOut *openflow_13.PacketOut) {
-	log.Debugw("packetOut", log.Fields{"logicalDeviceId": packetOut.Id})
-	if agent := ldMgr.getLogicalDeviceAgent(packetOut.Id); agent != nil {
-		agent.packetOut(packetOut.PacketOut)
+func (ldMgr *LogicalDeviceManager) packetIn(logicalDeviceID string, port uint32, transactionID string, packet []byte) error {
+	log.Debugw("packetIn", log.Fields{"logicalDeviceId": logicalDeviceID, "port": port})
+	if agent := ldMgr.getLogicalDeviceAgent(logicalDeviceID); agent != nil {
+		agent.packetIn(port, transactionID, packet)
 	} else {
-		log.Error("logical-device-not-exist", log.Fields{"logicalDeviceId": packetOut.Id})
-	}
-}
-
-func (ldMgr *LogicalDeviceManager) packetIn(logicalDeviceId string, port uint32, transactionId string, packet []byte) error {
-	log.Debugw("packetIn", log.Fields{"logicalDeviceId": logicalDeviceId, "port": port})
-	if agent := ldMgr.getLogicalDeviceAgent(logicalDeviceId); agent != nil {
-		agent.packetIn(port, transactionId, packet)
-	} else {
-		log.Error("logical-device-not-exist", log.Fields{"logicalDeviceId": logicalDeviceId})
+		log.Error("logical-device-not-exist", log.Fields{"logicalDeviceId": logicalDeviceID})
 	}
 	return nil
 }
diff --git a/rw_core/core/transaction.go b/rw_core/core/transaction.go
index 4ce00f9..1f63deb 100644
--- a/rw_core/core/transaction.go
+++ b/rw_core/core/transaction.go
@@ -26,29 +26,32 @@
  * and then deletes the transaction key.
  *
  */
+
 package core
 
 import (
+	"time"
+
 	"github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore"
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
-	"time"
 )
 
 // Transaction acquisition results
 const (
 	UNKNOWN = iota
-	SEIZED_BY_SELF
-	COMPLETED_BY_OTHER
-	ABANDONED_BY_OTHER
-	ABANDONED_WATCH_BY_SELF
+	SeizedBySelf
+	CompletedByOther
+	AbandonedByOther
+	AbandonedWatchBySelf
 )
 
 var errorTransactionNotAcquired = status.Error(codes.Canceled, "transaction-not-acquired")
 
+// Transaction constant
 const (
-	TRANSACTION_COMPLETE = "TRANSACTION-COMPLETE"
+	TransactionComplete = "TRANSACTION-COMPLETE"
 )
 
 // Transaction constants used to guarantee the Core processing a request hold on to the transaction until
@@ -62,11 +65,12 @@
 // Since the MIN_TXN_RENEWAL_INTERVAL_IN_SEC is 3 seconds then for any transaction that completes within 3 seconds
 // there won't be a transaction renewal done.
 const (
-	NUM_TXN_RENEWAL_PER_REQUEST         = 2
-	MIN_TXN_RENEWAL_INTERVAL_IN_SEC     = 3
-	MIN_TXN_RESERVATION_DURATION_IN_SEC = 5
+	NumTxnRenewalPerRequest        = 2
+	MinTxnRenewalIntervalInSec     = 3
+	MinTxnReservationDurationInSec = 5
 )
 
+// TransactionContext represent transaction context attributes
 type TransactionContext struct {
 	kvClient           kvstore.Client
 	kvOperationTimeout int
@@ -84,9 +88,13 @@
 	"ABANDONED_WATCH_BY_SELF"}
 
 func init() {
-	log.AddPackage(log.JSON, log.DebugLevel, nil)
+	_, err := log.AddPackage(log.JSON, log.DebugLevel, nil)
+	if err != nil {
+		log.Errorw("unable-to-register-package-to-the-log-map", log.Fields{"error": err})
+	}
 }
 
+// NewTransactionContext creates transaction context instance
 func NewTransactionContext(
 	owner string,
 	txnPrefix string,
@@ -102,7 +110,7 @@
 
 /*
  * Before instantiating a KVTransaction, a TransactionContext must be created.
- * The parameters stored in the context govern the behaviour of all KVTransaction
+ * The parameters stored in the context govern the behavior of all KVTransaction
  * instances.
  *
  * :param owner: The owner (i.e. voltha core name) of a transaction
@@ -113,6 +121,8 @@
  * :param: kvOpTimeout: The maximum time, in seconds, to be taken by any KV operation
  *                      used by this package
  */
+
+// SetTransactionContext creates new transaction context
 func SetTransactionContext(owner string,
 	txnPrefix string,
 	kvClient kvstore.Client,
@@ -122,9 +132,10 @@
 	return nil
 }
 
+// KVTransaction represent KV transaction attributes
 type KVTransaction struct {
 	monitorCh chan int
-	txnId     string
+	txnID     string
 	txnKey    string
 }
 
@@ -134,10 +145,12 @@
  * :param txnId: The serial number of a voltha request.
  * :return: A KVTransaction instance
  */
-func NewKVTransaction(txnId string) *KVTransaction {
+
+// NewKVTransaction creates KV transaction instance
+func NewKVTransaction(txnID string) *KVTransaction {
 	return &KVTransaction{
-		txnId:  txnId,
-		txnKey: ctx.txnPrefix + txnId}
+		txnID:  txnID,
+		txnKey: ctx.txnPrefix + txnID}
 }
 
 /*
@@ -158,9 +171,11 @@
  * :return: A boolean specifying whether the resource was acquired. An error is return in case this function is invoked
  * for a resource that is nonexistent.
  */
+
+// Acquired aquires transaction status
 func (c *KVTransaction) Acquired(minDuration int64, ownedByMe ...bool) (bool, error) {
 	var acquired bool
-	var currOwner string = ""
+	var currOwner string
 	var res int
 
 	// Convert milliseconds to seconds, rounding up
@@ -169,8 +184,8 @@
 	if remainder := minDuration % 1000; remainder > 0 {
 		durationInSecs++
 	}
-	if durationInSecs < int64(MIN_TXN_RESERVATION_DURATION_IN_SEC) {
-		durationInSecs = int64(MIN_TXN_RESERVATION_DURATION_IN_SEC)
+	if durationInSecs < int64(MinTxnReservationDurationInSec) {
+		durationInSecs = int64(MinTxnReservationDurationInSec)
 	}
 	genericRequest := true
 	resourceOwned := false
@@ -183,36 +198,37 @@
 		// transaction key stays in the KV store until after the Core finalize a request timeout condition (which is
 		// a success from a request completion perspective).
 		if err := c.tryToReserveTxn(durationInSecs * 2); err == nil {
-			res = SEIZED_BY_SELF
+			res = SeizedBySelf
 		} else {
 			log.Debugw("watch-other-server",
-				log.Fields{"transactionId": c.txnId, "owner": currOwner, "timeout": durationInSecs})
+				log.Fields{"transactionId": c.txnID, "owner": currOwner, "timeout": durationInSecs})
 			res = c.Watch(durationInSecs)
 		}
 	} else {
 		res = c.Watch(durationInSecs)
 	}
 	switch res {
-	case SEIZED_BY_SELF, ABANDONED_BY_OTHER:
+	case SeizedBySelf, AbandonedByOther:
 		acquired = true
 	default:
 		acquired = false
 	}
-	log.Debugw("acquire-transaction-status", log.Fields{"transactionId": c.txnId, "acquired": acquired, "result": txnState[res]})
+	log.Debugw("acquire-transaction-status", log.Fields{"transactionId": c.txnID, "acquired": acquired, "result": txnState[res]})
 	return acquired, nil
 }
 
 func (c *KVTransaction) tryToReserveTxn(durationInSecs int64) error {
-	var currOwner string = ""
+	var currOwner string
 	var res int
-	value, err := ctx.kvClient.Reserve(c.txnKey, ctx.owner, durationInSecs)
+	var err error
+	value, _ := ctx.kvClient.Reserve(c.txnKey, ctx.owner, durationInSecs)
 	if value != nil {
 		if currOwner, err = kvstore.ToString(value); err != nil { // This should never happen
-			log.Errorw("unexpected-owner-type", log.Fields{"transactionId": c.txnId, "error": err})
+			log.Errorw("unexpected-owner-type", log.Fields{"transactionId": c.txnID, "error": err})
 			return err
 		}
 		if currOwner == ctx.owner {
-			log.Debugw("acquired-transaction", log.Fields{"transactionId": c.txnId, "result": txnState[res]})
+			log.Debugw("acquired-transaction", log.Fields{"transactionId": c.txnID, "result": txnState[res]})
 			// Setup the monitoring channel
 			c.monitorCh = make(chan int)
 			go c.holdOnToTxnUntilProcessingCompleted(c.txnKey, ctx.owner, durationInSecs)
@@ -222,6 +238,7 @@
 	return status.Error(codes.PermissionDenied, "reservation-denied")
 }
 
+// Watch watches transaction
 func (c *KVTransaction) Watch(durationInSecs int64) int {
 	var res int
 
@@ -234,16 +251,19 @@
 	if kvp, _ := ctx.kvClient.Get(c.txnKey, ctx.kvOperationTimeout); kvp != nil {
 		transactionWasAcquiredByOther = true
 		if val, err := kvstore.ToString(kvp.Value); err == nil {
-			if val == TRANSACTION_COMPLETE {
-				res = COMPLETED_BY_OTHER
+			if val == TransactionComplete {
+				res = CompletedByOther
 				// Do an immediate delete of the transaction in the KV Store to free up KV Storage faster
-				c.Delete()
+				err = c.Delete()
+				if err != nil {
+					log.Errorw("unable-to-delete-the-transaction", log.Fields{"error": err})
+				}
 				return res
 			}
 		} else {
 			// An unexpected value - let's get out of here as something did not go according to plan
-			res = ABANDONED_WATCH_BY_SELF
-			log.Debugw("cannot-read-transaction-value", log.Fields{"txn": c.txnId, "error": err})
+			res = AbandonedWatchBySelf
+			log.Debugw("cannot-read-transaction-value", log.Fields{"txn": c.txnID, "error": err})
 			return res
 		}
 	}
@@ -252,24 +272,27 @@
 		select {
 		case event := <-events:
 			transactionWasAcquiredByOther = true
-			log.Debugw("received-event", log.Fields{"txn": c.txnId, "type": event.EventType})
+			log.Debugw("received-event", log.Fields{"txn": c.txnID, "type": event.EventType})
 			if event.EventType == kvstore.DELETE {
 				// The other core failed to process the request
-				res = ABANDONED_BY_OTHER
+				res = AbandonedByOther
 			} else if event.EventType == kvstore.PUT {
 				key, e1 := kvstore.ToString(event.Key)
 				val, e2 := kvstore.ToString(event.Value)
 				if e1 == nil && e2 == nil && key == c.txnKey {
-					if val == TRANSACTION_COMPLETE {
-						res = COMPLETED_BY_OTHER
+					if val == TransactionComplete {
+						res = CompletedByOther
 						// Successful request completion has been detected. Remove the transaction key
-						c.Delete()
+						err := c.Delete()
+						if err != nil {
+							log.Errorw("unable-to-delete-the-transaction", log.Fields{"error": err})
+						}
 					} else {
 						log.Debugw("Ignoring-PUT-event", log.Fields{"val": val, "key": key})
 						continue
 					}
 				} else {
-					log.Warnw("received-unexpected-PUT-event", log.Fields{"txn": c.txnId, "key": key, "ctxKey": c.txnKey})
+					log.Warnw("received-unexpected-PUT-event", log.Fields{"txn": c.txnID, "key": key, "ctxKey": c.txnKey})
 				}
 			}
 		case <-time.After(time.Duration(durationInSecs) * time.Second):
@@ -280,8 +303,8 @@
 			// guarantee that the peer is actually gone instead of limiting the time the peer can get hold of a
 			// request.
 			if !transactionWasAcquiredByOther {
-				log.Debugw("timeout-no-peer", log.Fields{"txId": c.txnId})
-				res = ABANDONED_BY_OTHER
+				log.Debugw("timeout-no-peer", log.Fields{"txId": c.txnID})
+				res = AbandonedByOther
 			} else {
 				continue
 			}
@@ -291,18 +314,24 @@
 	return res
 }
 
+// Close closes transaction
 func (c *KVTransaction) Close() error {
-	log.Debugw("close", log.Fields{"txn": c.txnId})
+	log.Debugw("close", log.Fields{"txn": c.txnID})
 	// Stop monitoring the key (applies only when there has been no transaction switch over)
 	if c.monitorCh != nil {
 		close(c.monitorCh)
-		ctx.kvClient.Put(c.txnKey, TRANSACTION_COMPLETE, ctx.kvOperationTimeout)
+		err := ctx.kvClient.Put(c.txnKey, TransactionComplete, ctx.kvOperationTimeout)
+
+		if err != nil {
+			log.Errorw("unable-to-write-a-key-value-pair-to-the-KV-store", log.Fields{"error": err})
+		}
 	}
 	return nil
 }
 
+// Delete deletes transaction
 func (c *KVTransaction) Delete() error {
-	log.Debugw("delete", log.Fields{"txn": c.txnId})
+	log.Debugw("delete", log.Fields{"txn": c.txnID})
 	return ctx.kvClient.Delete(c.txnKey, ctx.kvOperationTimeout)
 }
 
@@ -310,16 +339,16 @@
 // is used to calculate the frequency at which the Core processing the transaction renews the lease.  This function
 // exits only when the transaction is Closed, i.e completed.
 func (c *KVTransaction) holdOnToTxnUntilProcessingCompleted(key string, owner string, durationInSecs int64) {
-	log.Debugw("holdOnToTxnUntilProcessingCompleted", log.Fields{"txn": c.txnId})
-	renewInterval := durationInSecs / NUM_TXN_RENEWAL_PER_REQUEST
-	if renewInterval < MIN_TXN_RENEWAL_INTERVAL_IN_SEC {
-		renewInterval = MIN_TXN_RENEWAL_INTERVAL_IN_SEC
+	log.Debugw("holdOnToTxnUntilProcessingCompleted", log.Fields{"txn": c.txnID})
+	renewInterval := durationInSecs / NumTxnRenewalPerRequest
+	if renewInterval < MinTxnRenewalIntervalInSec {
+		renewInterval = MinTxnRenewalIntervalInSec
 	}
 forLoop:
 	for {
 		select {
 		case <-c.monitorCh:
-			log.Debugw("transaction-renewal-exits", log.Fields{"txn": c.txnId})
+			log.Debugw("transaction-renewal-exits", log.Fields{"txn": c.txnID})
 			break forLoop
 		case <-time.After(time.Duration(renewInterval) * time.Second):
 			if err := ctx.kvClient.RenewReservation(c.txnKey); err != nil {
diff --git a/rw_core/coreIf/adapter_manager_if.go b/rw_core/coreif/adapter_manager_if.go
similarity index 92%
rename from rw_core/coreIf/adapter_manager_if.go
rename to rw_core/coreif/adapter_manager_if.go
index b48852c..a4b0b63 100644
--- a/rw_core/coreIf/adapter_manager_if.go
+++ b/rw_core/coreif/adapter_manager_if.go
@@ -13,13 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package coreIf
+
+package coreif
 
 import (
 	"context"
+
 	"github.com/opencord/voltha-protos/v2/go/voltha"
 )
 
+// AdapterManager represent adapter manager related methods
 type AdapterManager interface {
 	ListAdapters(ctx context.Context) (*voltha.Adapters, error)
 	GetAdapterName(deviceType string) (string, error)
diff --git a/rw_core/coreIf/core_if.go b/rw_core/coreif/core_if.go
similarity index 96%
rename from rw_core/coreIf/core_if.go
rename to rw_core/coreif/core_if.go
index bf9a661..c63a738 100644
--- a/rw_core/coreIf/core_if.go
+++ b/rw_core/coreif/core_if.go
@@ -17,15 +17,18 @@
 Defines a DeviceManager Interface - Used for unit testing of the flow decomposer only at this
 time.
 */
-package coreIf
+
+package coreif
 
 import (
 	"context"
+
 	"github.com/opencord/voltha-go/db/model"
 	"github.com/opencord/voltha-go/rw_core/config"
 	"github.com/opencord/voltha-lib-go/v2/pkg/kafka"
 )
 
+// Core represent core methods
 type Core interface {
 	Start(ctx context.Context)
 	Stop(ctx context.Context)
diff --git a/rw_core/coreIf/device_manager_if.go b/rw_core/coreif/device_manager_if.go
similarity index 98%
rename from rw_core/coreIf/device_manager_if.go
rename to rw_core/coreif/device_manager_if.go
index 04a3d72..292a7b9 100644
--- a/rw_core/coreIf/device_manager_if.go
+++ b/rw_core/coreif/device_manager_if.go
@@ -17,7 +17,8 @@
 Defines a DeviceManager Interface - Used for unit testing of the flow decomposer only at this
 time.
 */
-package coreIf
+
+package coreif
 
 import "github.com/opencord/voltha-protos/v2/go/voltha"
 
diff --git a/rw_core/coreIf/device_ownership_if.go b/rw_core/coreif/device_ownership_if.go
similarity index 91%
rename from rw_core/coreIf/device_ownership_if.go
rename to rw_core/coreif/device_ownership_if.go
index fb19097..fc6fe78 100644
--- a/rw_core/coreIf/device_ownership_if.go
+++ b/rw_core/coreif/device_ownership_if.go
@@ -13,12 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package coreIf
+
+package coreif
 
 import (
 	"context"
 )
 
+// DeviceOwnership represent device ownership related methods
 type DeviceOwnership interface {
 	Start(ctx context.Context)
 	Stop(ctx context.Context)
diff --git a/rw_core/coreIf/logical_device_agent_if.go b/rw_core/coreif/logical_device_agent_if.go
similarity index 94%
rename from rw_core/coreIf/logical_device_agent_if.go
rename to rw_core/coreif/logical_device_agent_if.go
index bcde284..34a71e5 100644
--- a/rw_core/coreIf/logical_device_agent_if.go
+++ b/rw_core/coreif/logical_device_agent_if.go
@@ -17,14 +17,15 @@
   Defines a logicalDeviceAgent Interface - Used for unit testing of the flow decomposer only at this
  time.
 */
-package coreIf
+
+package coreif
 
 import (
 	"github.com/opencord/voltha-go/rw_core/graph"
 	"github.com/opencord/voltha-protos/v2/go/voltha"
 )
 
-// LogicalAgent represents a generic agent
+// LogicalDeviceAgent represents a generic agent
 type LogicalDeviceAgent interface {
 	GetLogicalDevice() (*voltha.LogicalDevice, error)
 	GetDeviceGraph() *graph.DeviceGraph
diff --git a/rw_core/coreIf/logical_device_manager_if.go b/rw_core/coreif/logical_device_manager_if.go
similarity index 92%
rename from rw_core/coreIf/logical_device_manager_if.go
rename to rw_core/coreif/logical_device_manager_if.go
index a10a3c8..2beaea5 100644
--- a/rw_core/coreIf/logical_device_manager_if.go
+++ b/rw_core/coreif/logical_device_manager_if.go
@@ -17,16 +17,19 @@
 Defines a DeviceManager Interface - Used for unit testing of the flow decomposer only at this
 time.
 */
-package coreIf
+
+package coreif
 
 import (
 	"context"
+
 	"github.com/opencord/voltha-protos/v2/go/openflow_13"
 	"github.com/opencord/voltha-protos/v2/go/voltha"
 )
 
+// LogicalDeviceManager represent logical device manager related methods
 type LogicalDeviceManager interface {
-	GetLogicalPort(lPortId *voltha.LogicalPortId) (*voltha.LogicalPort, error)
+	GetLogicalPort(lPortID *voltha.LogicalPortId) (*voltha.LogicalPort, error)
 	EnableLogicalPort(ctx context.Context, id *voltha.LogicalPortId, ch chan interface{})
 	DisableLogicalPort(ctx context.Context, id *voltha.LogicalPortId, ch chan interface{})
 	UpdateFlowTable(ctx context.Context, id string, flow *openflow_13.OfpFlowMod, ch chan interface{})
diff --git a/rw_core/flow_decomposition/flow_decomposer.go b/rw_core/flowdecomposition/flow_decomposer.go
similarity index 88%
rename from rw_core/flow_decomposition/flow_decomposer.go
rename to rw_core/flowdecomposition/flow_decomposer.go
index 4ced06e..330a4af 100644
--- a/rw_core/flow_decomposition/flow_decomposer.go
+++ b/rw_core/flowdecomposition/flow_decomposer.go
@@ -14,11 +14,11 @@
  * limitations under the License.
  */
 
-package flow_decomposition
+package flowdecomposition
 
 import (
 	"github.com/gogo/protobuf/proto"
-	"github.com/opencord/voltha-go/rw_core/coreIf"
+	"github.com/opencord/voltha-go/rw_core/coreif"
 	"github.com/opencord/voltha-go/rw_core/graph"
 	fu "github.com/opencord/voltha-lib-go/v2/pkg/flows"
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
@@ -27,21 +27,26 @@
 )
 
 func init() {
-	log.AddPackage(log.JSON, log.DebugLevel, nil)
+	_, err := log.AddPackage(log.JSON, log.DebugLevel, nil)
+	if err != nil {
+		log.Errorw("unable-to-register-package-to-the-log-map", log.Fields{"error": err})
+	}
 }
 
+// FlowDecomposer represent flow decomposer attribute
 type FlowDecomposer struct {
-	deviceMgr coreIf.DeviceManager
+	deviceMgr coreif.DeviceManager
 }
 
-func NewFlowDecomposer(deviceMgr coreIf.DeviceManager) *FlowDecomposer {
+// NewFlowDecomposer creates flow decomposer instance
+func NewFlowDecomposer(deviceMgr coreif.DeviceManager) *FlowDecomposer {
 	var decomposer FlowDecomposer
 	decomposer.deviceMgr = deviceMgr
 	return &decomposer
 }
 
 //DecomposeRules decomposes per-device flows and flow-groups from the flows and groups defined on a logical device
-func (fd *FlowDecomposer) DecomposeRules(agent coreIf.LogicalDeviceAgent, flows ofp.Flows, groups ofp.FlowGroups) *fu.DeviceRules {
+func (fd *FlowDecomposer) DecomposeRules(agent coreif.LogicalDeviceAgent, flows ofp.Flows, groups ofp.FlowGroups) *fu.DeviceRules {
 	deviceRules := *fu.NewDeviceRules()
 	devicesToUpdate := make(map[string]string)
 
@@ -53,10 +58,10 @@
 	var decomposedRules *fu.DeviceRules
 	for _, flow := range flows.Items {
 		decomposedRules = fd.decomposeFlow(agent, flow, groupMap)
-		for deviceId, flowAndGroups := range decomposedRules.Rules {
-			deviceRules.CreateEntryIfNotExist(deviceId)
-			deviceRules.Rules[deviceId].AddFrom(flowAndGroups)
-			devicesToUpdate[deviceId] = deviceId
+		for deviceID, flowAndGroups := range decomposedRules.Rules {
+			deviceRules.CreateEntryIfNotExist(deviceID)
+			deviceRules.Rules[deviceID].AddFrom(flowAndGroups)
+			devicesToUpdate[deviceID] = deviceID
 		}
 	}
 	return deviceRules.FilterRules(devicesToUpdate)
@@ -71,9 +76,9 @@
 
 	newDeviceRules := dr.Copy()
 	//	Check whether we are dealing with a parent device
-	for deviceId, fg := range dr.GetRules() {
-		if root, _ := fd.deviceMgr.IsRootDevice(deviceId); root {
-			newDeviceRules.ClearFlows(deviceId)
+	for deviceID, fg := range dr.GetRules() {
+		if root, _ := fd.deviceMgr.IsRootDevice(deviceID); root {
+			newDeviceRules.ClearFlows(deviceID)
 			for i := 0; i < fg.Flows.Len(); i++ {
 				f := fg.GetFlow(i)
 				UpdateOutPortNo := false
@@ -91,7 +96,7 @@
 				}
 				// Update flow Id as a change in the instruction field will result in a new flow ID
 				f.Id = fu.HashFlowStats(f)
-				newDeviceRules.AddFlow(deviceId, (proto.Clone(f)).(*ofp.OfpFlowStats))
+				newDeviceRules.AddFlow(deviceID, (proto.Clone(f)).(*ofp.OfpFlowStats))
 			}
 		}
 	}
@@ -100,12 +105,12 @@
 }
 
 //processControllerBoundFlow decomposes trap flows
-func (fd *FlowDecomposer) processControllerBoundFlow(agent coreIf.LogicalDeviceAgent, route []graph.RouteHop,
+func (fd *FlowDecomposer) processControllerBoundFlow(agent coreif.LogicalDeviceAgent, route []graph.RouteHop,
 	inPortNo uint32, outPortNo uint32, flow *ofp.OfpFlowStats) *fu.DeviceRules {
 
 	log.Debugw("trap-flow", log.Fields{"inPortNo": inPortNo, "outPortNo": outPortNo, "flow": flow})
 	deviceRules := fu.NewDeviceRules()
-	meterId := fu.GetMeterIdFromFlow(flow)
+	meterID := fu.GetMeterIdFromFlow(flow)
 	metadataFromwriteMetadata := fu.GetMetadataFromWriteMetadataAction(flow)
 
 	ingressHop := route[0]
@@ -116,8 +121,7 @@
 		// Trap flow for NNI port
 		log.Debug("trap-nni")
 
-		var fa *fu.FlowArgs
-		fa = &fu.FlowArgs{
+		fa := &fu.FlowArgs{
 			KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie},
 			MatchFields: []*ofp.OfpOxmOfbField{
 				fu.InPort(egressHop.Egress),
@@ -142,9 +146,8 @@
 		}
 		for _, inputPort := range inPorts {
 			// Upstream flow on parent (olt) device
-			var faParent *fu.FlowArgs
-			faParent = &fu.FlowArgs{
-				KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterId), "write_metadata": metadataFromwriteMetadata},
+			faParent := &fu.FlowArgs{
+				KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterID), "write_metadata": metadataFromwriteMetadata},
 				MatchFields: []*ofp.OfpOxmOfbField{
 					fu.InPort(egressHop.Ingress),
 					fu.TunnelId(uint64(inputPort)),
@@ -178,9 +181,8 @@
 					fu.Output(ingressHop.Egress),
 				}
 			}
-			var faChild *fu.FlowArgs
-			faChild = &fu.FlowArgs{
-				KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterId), "write_metadata": metadataFromwriteMetadata},
+			faChild := &fu.FlowArgs{
+				KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterID), "write_metadata": metadataFromwriteMetadata},
 				MatchFields: []*ofp.OfpOxmOfbField{
 					fu.InPort(ingressHop.Ingress),
 					fu.TunnelId(uint64(inputPort)),
@@ -209,13 +211,13 @@
 // upstream needs to get Q-in-Q treatment and that this is expressed via two flow rules, the first using the
 // goto-statement. We also assume that the inner tag is applied at the ONU, while the outer tag is
 // applied at the OLT
-func (fd *FlowDecomposer) processUpstreamNonControllerBoundFlow(agent coreIf.LogicalDeviceAgent,
+func (fd *FlowDecomposer) processUpstreamNonControllerBoundFlow(agent coreif.LogicalDeviceAgent,
 	route []graph.RouteHop, inPortNo uint32, outPortNo uint32, flow *ofp.OfpFlowStats) *fu.DeviceRules {
 
 	log.Debugw("upstream-non-controller-bound-flow", log.Fields{"inPortNo": inPortNo, "outPortNo": outPortNo})
 	deviceRules := fu.NewDeviceRules()
 
-	meterId := fu.GetMeterIdFromFlow(flow)
+	meterID := fu.GetMeterIdFromFlow(flow)
 	metadataFromwriteMetadata := fu.GetMetadataFromWriteMetadataAction(flow)
 
 	ingressHop := route[0]
@@ -227,9 +229,8 @@
 			log.Warnw("outPort-should-not-be-specified", log.Fields{"outPortNo": outPortNo})
 			return deviceRules
 		}
-		var fa *fu.FlowArgs
-		fa = &fu.FlowArgs{
-			KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterId), "write_metadata": metadataFromwriteMetadata},
+		fa := &fu.FlowArgs{
+			KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterID), "write_metadata": metadataFromwriteMetadata},
 			MatchFields: []*ofp.OfpOxmOfbField{
 				fu.InPort(ingressHop.Ingress),
 				fu.TunnelId(uint64(inPortNo)),
@@ -247,9 +248,8 @@
 		deviceRules.AddFlowsAndGroup(ingressHop.DeviceID, fg)
 	} else if flow.TableId == 1 && outPortNo != 0 {
 		log.Debugw("decomposing-olt-flow-in-upstream-has-next-table", log.Fields{"table_id": flow.TableId})
-		var fa *fu.FlowArgs
-		fa = &fu.FlowArgs{
-			KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterId), "write_metadata": metadataFromwriteMetadata},
+		fa := &fu.FlowArgs{
+			KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterID), "write_metadata": metadataFromwriteMetadata},
 			MatchFields: []*ofp.OfpOxmOfbField{
 				fu.InPort(egressHop.Ingress),
 				fu.TunnelId(uint64(inPortNo)),
@@ -271,11 +271,11 @@
 }
 
 // processDownstreamFlowWithNextTable decomposes downstream flows containing next table ID instructions
-func (fd *FlowDecomposer) processDownstreamFlowWithNextTable(agent coreIf.LogicalDeviceAgent, route []graph.RouteHop,
+func (fd *FlowDecomposer) processDownstreamFlowWithNextTable(agent coreif.LogicalDeviceAgent, route []graph.RouteHop,
 	inPortNo uint32, outPortNo uint32, flow *ofp.OfpFlowStats) *fu.DeviceRules {
 	log.Debugw("decomposing-olt-flow-in-downstream-flow-with-next-table", log.Fields{"inPortNo": inPortNo, "outPortNo": outPortNo})
 	deviceRules := fu.NewDeviceRules()
-	meterId := fu.GetMeterIdFromFlow(flow)
+	meterID := fu.GetMeterIdFromFlow(flow)
 	metadataFromwriteMetadata := fu.GetMetadataFromWriteMetadataAction(flow)
 
 	if outPortNo != 0 {
@@ -302,7 +302,6 @@
 				return deviceRules
 			case 2:
 				log.Debugw("route-found", log.Fields{"ingressHop": ingressHop, "egressHop": egressHop})
-				break
 			default:
 				log.Errorw("invalid-route-length", log.Fields{"routeLen": len(route)})
 				return deviceRules
@@ -315,9 +314,8 @@
 			//TODO: Delete flow
 			return deviceRules
 		}
-		var fa *fu.FlowArgs
-		fa = &fu.FlowArgs{
-			KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterId), "write_metadata": metadataFromwriteMetadata},
+		fa := &fu.FlowArgs{
+			KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterID), "write_metadata": metadataFromwriteMetadata},
 			MatchFields: []*ofp.OfpOxmOfbField{
 				fu.InPort(ingressHop.Ingress),
 				fu.Metadata_ofp(uint64(innerTag)),
@@ -336,9 +334,8 @@
 		deviceRules.AddFlowsAndGroup(ingressHop.DeviceID, fg)
 	} else { // Create standard flow
 		log.Debugw("creating-standard-flow", log.Fields{"flow": flow})
-		var fa *fu.FlowArgs
-		fa = &fu.FlowArgs{
-			KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterId), "write_metadata": metadataFromwriteMetadata},
+		fa := &fu.FlowArgs{
+			KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterID), "write_metadata": metadataFromwriteMetadata},
 			MatchFields: []*ofp.OfpOxmOfbField{
 				fu.InPort(ingressHop.Ingress),
 				fu.TunnelId(uint64(inPortNo)),
@@ -360,7 +357,7 @@
 }
 
 // processUnicastFlow decomposes unicast flows
-func (fd *FlowDecomposer) processUnicastFlow(agent coreIf.LogicalDeviceAgent, route []graph.RouteHop,
+func (fd *FlowDecomposer) processUnicastFlow(agent coreif.LogicalDeviceAgent, route []graph.RouteHop,
 	inPortNo uint32, outPortNo uint32, flow *ofp.OfpFlowStats) *fu.DeviceRules {
 
 	log.Debugw("decomposing-onu-flow-in-downstream-unicast-flow", log.Fields{"inPortNo": inPortNo, "outPortNo": outPortNo})
@@ -368,11 +365,10 @@
 
 	egressHop := route[1]
 
-	meterId := fu.GetMeterIdFromFlow(flow)
+	meterID := fu.GetMeterIdFromFlow(flow)
 	metadataFromwriteMetadata := fu.GetMetadataFromWriteMetadataAction(flow)
-	var fa *fu.FlowArgs
-	fa = &fu.FlowArgs{
-		KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterId), "write_metadata": metadataFromwriteMetadata},
+	fa := &fu.FlowArgs{
+		KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie, "meter_id": uint64(meterID), "write_metadata": metadataFromwriteMetadata},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(egressHop.Ingress),
 		},
@@ -392,8 +388,8 @@
 }
 
 // processMulticastFlow decompose multicast flows
-func (fd *FlowDecomposer) processMulticastFlow(agent coreIf.LogicalDeviceAgent, route []graph.RouteHop,
-	inPortNo uint32, outPortNo uint32, flow *ofp.OfpFlowStats, grpId uint32,
+func (fd *FlowDecomposer) processMulticastFlow(agent coreif.LogicalDeviceAgent, route []graph.RouteHop,
+	inPortNo uint32, outPortNo uint32, flow *ofp.OfpFlowStats, grpID uint32,
 	groupMap map[uint32]*ofp.OfpGroupEntry) *fu.DeviceRules {
 
 	log.Debugw("multicast-flow", log.Fields{"inPortNo": inPortNo, "outPortNo": outPortNo})
@@ -402,12 +398,12 @@
 	//having no Group yet is the same as having a Group with no buckets
 	var grp *ofp.OfpGroupEntry
 	var ok bool
-	if grp, ok = groupMap[grpId]; !ok {
-		log.Warnw("Group-id-not-present-in-map", log.Fields{"grpId": grpId, "groupMap": groupMap})
+	if grp, ok = groupMap[grpID]; !ok {
+		log.Warnw("Group-id-not-present-in-map", log.Fields{"grpId": grpID, "groupMap": groupMap})
 		return deviceRules
 	}
 	if grp == nil || grp.Desc == nil {
-		log.Warnw("Group-or-desc-nil", log.Fields{"grpId": grpId, "grp": grp})
+		log.Warnw("Group-or-desc-nil", log.Fields{"grpId": grpID, "grp": grp})
 		return deviceRules
 	}
 	for _, bucket := range grp.Desc.Buckets {
@@ -428,7 +424,6 @@
 			return deviceRules
 		case 2:
 			log.Debugw("route-found", log.Fields{"ingressHop": route2[0], "egressHop": route2[1]})
-			break
 		default:
 			log.Errorw("invalid-route-length", log.Fields{"routeLen": len(route)})
 			return deviceRules
@@ -443,8 +438,7 @@
 			return deviceRules
 		}
 		// Set the parent device flow
-		var fa *fu.FlowArgs
-		fa = &fu.FlowArgs{
+		fa := &fu.FlowArgs{
 			KV: fu.OfpFlowModArgs{"priority": uint64(flow.Priority), "cookie": flow.Cookie},
 			MatchFields: []*ofp.OfpOxmOfbField{
 				fu.InPort(ingressHop.Ingress),
@@ -485,7 +479,7 @@
 }
 
 // decomposeFlow decomposes a flow for a logical device into flows for each physical device
-func (fd *FlowDecomposer) decomposeFlow(agent coreIf.LogicalDeviceAgent, flow *ofp.OfpFlowStats,
+func (fd *FlowDecomposer) decomposeFlow(agent coreif.LogicalDeviceAgent, flow *ofp.OfpFlowStats,
 	groupMap map[uint32]*ofp.OfpGroupEntry) *fu.DeviceRules {
 
 	inPortNo := fu.GetInPort(flow)
@@ -500,7 +494,6 @@
 		return deviceRules
 	case 2:
 		log.Debugw("route-found", log.Fields{"ingressHop": route[0], "egressHop": route[1]})
-		break
 	default:
 		log.Errorw("invalid-route-length", log.Fields{"routeLen": len(route)})
 		return deviceRules
@@ -526,9 +519,9 @@
 		} else if flow.TableId == 1 && outPortNo != 0 { // Unicast ONU flow DL
 			log.Debugw("processOnuDownstreamUnicastFlow", log.Fields{"flows": flow})
 			deviceRules = fd.processUnicastFlow(agent, route, inPortNo, outPortNo, flow)
-		} else if grpId := fu.GetGroup(flow); grpId != 0 && flow.TableId == 0 { //Multicast
+		} else if grpID := fu.GetGroup(flow); grpID != 0 && flow.TableId == 0 { //Multicast
 			log.Debugw("processMulticastFlow", log.Fields{"flows": flow})
-			deviceRules = fd.processMulticastFlow(agent, route, inPortNo, outPortNo, flow, grpId, groupMap)
+			deviceRules = fd.processMulticastFlow(agent, route, inPortNo, outPortNo, flow, grpID, groupMap)
 		} else {
 			log.Errorw("unknown-downstream-flow", log.Fields{"flow": *flow})
 		}
diff --git a/rw_core/flow_decomposition/flow_decomposer_test.go b/rw_core/flowdecomposition/flow_decomposer_test.go
similarity index 95%
rename from rw_core/flow_decomposition/flow_decomposer_test.go
rename to rw_core/flowdecomposition/flow_decomposer_test.go
index a24765e..cc89331 100644
--- a/rw_core/flow_decomposition/flow_decomposer_test.go
+++ b/rw_core/flowdecomposition/flow_decomposer_test.go
@@ -13,10 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package flow_decomposition
+package flowdecomposition
 
 import (
 	"errors"
+
 	"github.com/opencord/voltha-go/rw_core/graph"
 	"github.com/opencord/voltha-go/rw_core/mocks"
 	fu "github.com/opencord/voltha-lib-go/v2/pkg/flows"
@@ -99,17 +100,17 @@
 	return &tdm
 }
 
-func (tdm *testDeviceManager) GetDevice(deviceId string) (*voltha.Device, error) {
-	if d, ok := tdm.devices[deviceId]; ok {
+func (tdm *testDeviceManager) GetDevice(deviceID string) (*voltha.Device, error) {
+	if d, ok := tdm.devices[deviceID]; ok {
 		return d, nil
 	}
-	return nil, errors.New("ABSENT.")
+	return nil, errors.New("ABSENT")
 }
-func (tdm *testDeviceManager) IsRootDevice(deviceId string) (bool, error) {
-	if d, ok := tdm.devices[deviceId]; ok {
+func (tdm *testDeviceManager) IsRootDevice(deviceID string) (bool, error) {
+	if d, ok := tdm.devices[deviceID]; ok {
 		return d.Root, nil
 	}
-	return false, errors.New("ABSENT.")
+	return false, errors.New("ABSENT")
 }
 
 type testFlowDecomposer struct {
@@ -327,8 +328,7 @@
 
 	tfd.defaultRules = fu.NewDeviceRules()
 	fg := fu.NewFlowsAndGroups()
-	var fa *fu.FlowArgs
-	fa = &fu.FlowArgs{
+	fa := &fu.FlowArgs{
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(2),
 			fu.VlanVid(uint32(ofp.OfpVlanId_OFPVID_PRESENT) | 0),
@@ -393,11 +393,11 @@
 	return &tfd
 }
 
-func (tfd *testFlowDecomposer) getDeviceHelper(deviceId string) (*voltha.Device, error) {
-	return tfd.dMgr.GetDevice(deviceId)
+func (tfd *testFlowDecomposer) getDeviceHelper(deviceID string) (*voltha.Device, error) {
+	return tfd.dMgr.GetDevice(deviceID)
 }
 
-func (tfd *testFlowDecomposer) GetDeviceLogicalId() string {
+func (tfd *testFlowDecomposer) GetDeviceLogicalID() string {
 	return ""
 }
 
@@ -451,8 +451,7 @@
 
 func TestEapolReRouteRuleVlanDecomposition(t *testing.T) {
 
-	var fa *fu.FlowArgs
-	fa = &fu.FlowArgs{
+	fa := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(1),
@@ -476,8 +475,7 @@
 	assert.Equal(t, 1, oltFlowAndGroup.Flows.Len())
 	assert.Equal(t, 0, oltFlowAndGroup.Groups.Len())
 
-	var faParent *fu.FlowArgs
-	faParent = &fu.FlowArgs{
+	faParent := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(1),
@@ -495,8 +493,7 @@
 	derivedFlow := oltFlowAndGroup.GetFlow(0)
 	assert.Equal(t, expectedOltFlow.String(), derivedFlow.String())
 
-	var faChild *fu.FlowArgs
-	faChild = &fu.FlowArgs{
+	faChild := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(2),
@@ -516,8 +513,7 @@
 
 func TestEapolReRouteRuleZeroVlanDecomposition(t *testing.T) {
 
-	var fa *fu.FlowArgs
-	fa = &fu.FlowArgs{
+	fa := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(1),
@@ -541,8 +537,7 @@
 	assert.Equal(t, 1, oltFlowAndGroup.Flows.Len())
 	assert.Equal(t, 0, oltFlowAndGroup.Groups.Len())
 
-	var faParent *fu.FlowArgs
-	faParent = &fu.FlowArgs{
+	faParent := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(1),
@@ -560,8 +555,7 @@
 	derivedFlow := oltFlowAndGroup.GetFlow(0)
 	assert.Equal(t, expectedOltFlow.String(), derivedFlow.String())
 
-	var faChild *fu.FlowArgs
-	faChild = &fu.FlowArgs{
+	faChild := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(2),
@@ -581,8 +575,7 @@
 
 func TestEapolReRouteRuleNoVlanDecomposition(t *testing.T) {
 
-	var fa *fu.FlowArgs
-	fa = &fu.FlowArgs{
+	fa := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(1),
@@ -605,8 +598,7 @@
 	assert.Equal(t, 1, oltFlowAndGroup.Flows.Len())
 	assert.Equal(t, 0, oltFlowAndGroup.Groups.Len())
 
-	var faParent *fu.FlowArgs
-	faParent = &fu.FlowArgs{
+	faParent := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(1),
@@ -623,8 +615,7 @@
 	derivedFlow := oltFlowAndGroup.GetFlow(0)
 	assert.Equal(t, expectedOltFlow.String(), derivedFlow.String())
 
-	var faChild *fu.FlowArgs
-	faChild = &fu.FlowArgs{
+	faChild := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(2),
@@ -642,8 +633,7 @@
 
 func TestDhcpReRouteRuleDecomposition(t *testing.T) {
 
-	var fa *fu.FlowArgs
-	fa = &fu.FlowArgs{
+	fa := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(1),
@@ -670,8 +660,7 @@
 	assert.Equal(t, 1, oltFlowAndGroup.Flows.Len())
 	assert.Equal(t, 0, oltFlowAndGroup.Groups.Len())
 
-	var faParent *fu.FlowArgs
-	faParent = &fu.FlowArgs{
+	faParent := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(1),
@@ -692,8 +681,7 @@
 	derivedFlow := oltFlowAndGroup.GetFlow(0)
 	assert.Equal(t, expectedOltFlow.String(), derivedFlow.String())
 
-	var faChild *fu.FlowArgs
-	faChild = &fu.FlowArgs{
+	faChild := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(2),
@@ -714,8 +702,7 @@
 }
 
 func TestLldpReRouteRuleDecomposition(t *testing.T) {
-	var fa *fu.FlowArgs
-	fa = &fu.FlowArgs{
+	fa := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 1000},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(10),
@@ -752,8 +739,7 @@
 }
 
 func TestUnicastUpstreamRuleDecomposition(t *testing.T) {
-	var fa *fu.FlowArgs
-	fa = &fu.FlowArgs{
+	fa := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 5000, "table_id": 0},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(1),
@@ -765,8 +751,7 @@
 		},
 	}
 
-	var fa2 *fu.FlowArgs
-	fa2 = &fu.FlowArgs{
+	fa2 := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 500, "table_id": 1},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(1),
@@ -858,8 +843,7 @@
 
 func TestUnicastDownstreamRuleDecomposition(t *testing.T) {
 	log.Debugf("Starting Test Unicast Downstream")
-	var fa1 *fu.FlowArgs
-	fa1 = &fu.FlowArgs{
+	fa1 := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 500, "table_id": 0},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(10),
@@ -871,8 +855,7 @@
 		},
 	}
 
-	var fa2 *fu.FlowArgs
-	fa2 = &fu.FlowArgs{
+	fa2 := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 500, "table_id": 1},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(10),
@@ -955,8 +938,7 @@
 }
 
 func TestMulticastDownstreamRuleDecomposition(t *testing.T) {
-	var fa *fu.FlowArgs
-	fa = &fu.FlowArgs{
+	fa := &fu.FlowArgs{
 		KV: fu.OfpFlowModArgs{"priority": 500},
 		MatchFields: []*ofp.OfpOxmOfbField{
 			fu.InPort(10),
@@ -970,8 +952,7 @@
 		},
 	}
 
-	var ga *fu.GroupArgs
-	ga = &fu.GroupArgs{
+	ga := &fu.GroupArgs{
 		GroupId: 10,
 		Buckets: []*ofp.OfpBucket{
 			{Actions: []*ofp.OfpAction{
diff --git a/rw_core/graph/device_graph.go b/rw_core/graph/device_graph.go
index 229a3a4..4c89134 100644
--- a/rw_core/graph/device_graph.go
+++ b/rw_core/graph/device_graph.go
@@ -17,26 +17,31 @@
 package graph
 
 import (
-	"errors"
 	"fmt"
-	"github.com/gyuho/goraph"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"github.com/opencord/voltha-protos/v2/go/voltha"
 	"strconv"
 	"strings"
 	"sync"
+
+	"github.com/gyuho/goraph"
+	"github.com/opencord/voltha-lib-go/v2/pkg/log"
+	"github.com/opencord/voltha-protos/v2/go/voltha"
 )
 
 func init() {
-	log.AddPackage(log.JSON, log.WarnLevel, nil)
+	_, err := log.AddPackage(log.JSON, log.WarnLevel, nil)
+	if err != nil {
+		log.Errorw("unable-to-register-package-to-the-log-map", log.Fields{"error": err})
+	}
 }
 
+// RouteHop represent route hop attributes
 type RouteHop struct {
 	DeviceID string
 	Ingress  uint32
 	Egress   uint32
 }
 
+// OFPortLink represent of port link attributes
 type OFPortLink struct {
 	Ingress uint32
 	Egress  uint32
@@ -47,10 +52,12 @@
 	path []RouteHop
 }
 
+// GetDeviceFunc returns device function
 type GetDeviceFunc func(id string) (*voltha.Device, error)
 
+// DeviceGraph represent device graph attributes
 type DeviceGraph struct {
-	logicalDeviceId    string
+	logicalDeviceID    string
 	GGraph             goraph.Graph
 	getDeviceFromModel GetDeviceFunc
 	logicalPorts       []*voltha.LogicalPort
@@ -68,9 +75,10 @@
 	portsAdded         map[string]string
 }
 
-func NewDeviceGraph(logicalDeviceId string, getDevice GetDeviceFunc) *DeviceGraph {
+// NewDeviceGraph creates device graph instance
+func NewDeviceGraph(logicalDeviceID string, getDevice GetDeviceFunc) *DeviceGraph {
 	var dg DeviceGraph
-	dg.logicalDeviceId = logicalDeviceId
+	dg.logicalDeviceID = logicalDeviceID
 	dg.GGraph = goraph.NewGraph()
 	dg.getDeviceFromModel = getDevice
 	dg.graphBuildLock = sync.RWMutex{}
@@ -126,14 +134,14 @@
 
 	// Set the root, non-root ports and boundary ports
 	for _, lp := range lps {
-		portId := concatDeviceIdPortId(lp.DeviceId, lp.DevicePortNo)
+		portID := concatDeviceIDPortID(lp.DeviceId, lp.DevicePortNo)
 		if lp.RootPort {
-			dg.rootPortsString[portId] = lp.OfpPort.PortNo
+			dg.rootPortsString[portID] = lp.OfpPort.PortNo
 			dg.RootPorts[lp.OfpPort.PortNo] = lp.OfpPort.PortNo
 		} else {
-			dg.nonRootPortsString[portId] = lp.OfpPort.PortNo
+			dg.nonRootPortsString[portID] = lp.OfpPort.PortNo
 		}
-		dg.boundaryPorts[portId] = lp.OfpPort.PortNo
+		dg.boundaryPorts[portID] = lp.OfpPort.PortNo
 	}
 
 	// Build the graph
@@ -158,14 +166,14 @@
 	dg.graphBuildLock.Lock()
 	defer dg.graphBuildLock.Unlock()
 
-	portId := concatDeviceIdPortId(lp.DeviceId, lp.DevicePortNo)
+	portID := concatDeviceIDPortID(lp.DeviceId, lp.DevicePortNo)
 
 	//	If the port is already part of the boundary ports, do nothing
-	if dg.portExist(portId) {
+	if dg.portExist(portID) {
 		return
 	}
 	// Add the port to the set of boundary ports
-	dg.boundaryPorts[portId] = lp.OfpPort.PortNo
+	dg.boundaryPorts[portID] = lp.OfpPort.PortNo
 
 	// Add the device where this port is located to the device graph. If the device is already added then
 	// only the missing port will be added
@@ -174,20 +182,21 @@
 
 	if lp.RootPort {
 		// Compute the route from this root port to all non-root ports
-		dg.rootPortsString[portId] = lp.OfpPort.PortNo
+		dg.rootPortsString[portID] = lp.OfpPort.PortNo
 		dg.RootPorts[lp.OfpPort.PortNo] = lp.OfpPort.PortNo
 		dg.Routes = dg.buildPathsToAllNonRootPorts(lp)
 	} else {
 		// Compute the route from this port to all root ports
-		dg.nonRootPortsString[portId] = lp.OfpPort.PortNo
+		dg.nonRootPortsString[portID] = lp.OfpPort.PortNo
 		dg.Routes = dg.buildPathsToAllRootPorts(lp)
 	}
 
 	dg.Print()
 }
 
+// Print prints routes
 func (dg *DeviceGraph) Print() error {
-	log.Debugw("Print", log.Fields{"graph": dg.logicalDeviceId, "boundaryPorts": dg.boundaryPorts})
+	log.Debugw("Print", log.Fields{"graph": dg.logicalDeviceID, "boundaryPorts": dg.boundaryPorts})
 	if level, err := log.GetPackageLogLevel(); err == nil && level == log.DebugLevel {
 		output := ""
 		routeNumber := 1
@@ -199,28 +208,29 @@
 			}
 			val = val[:len(val)-1]
 			output += fmt.Sprintf("%d:{%s=>%s}   ", routeNumber, key, fmt.Sprintf("[%s]", val))
-			routeNumber += 1
+			routeNumber++
 		}
 		if len(dg.Routes) == 0 {
-			log.Debugw("no-routes-found", log.Fields{"lDeviceId": dg.logicalDeviceId, "Graph": dg.GGraph.String()})
+			log.Debugw("no-routes-found", log.Fields{"lDeviceId": dg.logicalDeviceID, "Graph": dg.GGraph.String()})
 		} else {
-			log.Debugw("graph_routes", log.Fields{"lDeviceId": dg.logicalDeviceId, "Routes": output})
+			log.Debugw("graph_routes", log.Fields{"lDeviceId": dg.logicalDeviceID, "Routes": output})
 		}
 	}
 	return nil
 }
 
+// IsUpToDate returns true if device is up to date
 func (dg *DeviceGraph) IsUpToDate(ld *voltha.LogicalDevice) bool {
 	if ld != nil {
 		if len(dg.boundaryPorts) != len(ld.Ports) {
 			return false
 		}
-		var portId string
+		var portID string
 		var val uint32
 		var exist bool
 		for _, lp := range ld.Ports {
-			portId = concatDeviceIdPortId(lp.DeviceId, lp.DevicePortNo)
-			if val, exist = dg.boundaryPorts[portId]; !exist || val != lp.OfpPort.PortNo {
+			portID = concatDeviceIDPortID(lp.DeviceId, lp.DevicePortNo)
+			if val, exist = dg.boundaryPorts[portID]; !exist || val != lp.OfpPort.PortNo {
 				return false
 			}
 		}
@@ -243,16 +253,17 @@
 		dg.cachedDevicesLock.RUnlock()
 	}
 	//	Not cached
-	if d, err := dg.getDeviceFromModel(id); err != nil {
+	d, err := dg.getDeviceFromModel(id)
+	if err != nil {
 		log.Errorw("device-not-found", log.Fields{"deviceId": id, "error": err})
 		return nil, err
-	} else { // cache it
-		dg.cachedDevicesLock.Lock()
-		dg.cachedDevices[id] = d
-		dg.cachedDevicesLock.Unlock()
-		//log.Debugw("getDevice - returned from model", log.Fields{"deviceId": id})
-		return d, nil
 	}
+	// cache it
+	dg.cachedDevicesLock.Lock()
+	dg.cachedDevices[id] = d
+	dg.cachedDevicesLock.Unlock()
+	//log.Debugw("getDevice - returned from model", log.Fields{"deviceId": id})
+	return d, nil
 }
 
 // addDevice adds a device to a device graph and setup edges that represent the device connections to its peers
@@ -270,25 +281,36 @@
 		(*devicesAdded)[device.Id] = device.Id
 	}
 
-	var portId string
-	var peerPortId string
+	var portID string
+	var peerPortID string
 	for _, port := range device.Ports {
-		portId = concatDeviceIdPortId(device.Id, port.PortNo)
-		if _, exist := (*portsAdded)[portId]; !exist {
-			(*portsAdded)[portId] = portId
-			g.AddNode(goraph.NewNode(portId))
-			g.AddEdge(goraph.StringID(device.Id), goraph.StringID(portId), 1)
-			g.AddEdge(goraph.StringID(portId), goraph.StringID(device.Id), 1)
+		portID = concatDeviceIDPortID(device.Id, port.PortNo)
+		if _, exist := (*portsAdded)[portID]; !exist {
+			(*portsAdded)[portID] = portID
+			g.AddNode(goraph.NewNode(portID))
+			err := g.AddEdge(goraph.StringID(device.Id), goraph.StringID(portID), 1)
+			if err != nil {
+				log.Errorw("unable-to-add-edge", log.Fields{"error": err})
+			}
+			err = g.AddEdge(goraph.StringID(portID), goraph.StringID(device.Id), 1)
+			if err != nil {
+				log.Errorw("unable-to-add-edge", log.Fields{"error": err})
+			}
 		}
 		for _, peer := range port.Peers {
 			if _, exist := (*devicesAdded)[peer.DeviceId]; !exist {
 				d, _ := dg.getDevice(peer.DeviceId, true)
 				g = dg.addDevice(d, g, devicesAdded, portsAdded, boundaryPorts)
 			}
-			peerPortId = concatDeviceIdPortId(peer.DeviceId, peer.PortNo)
-			g.AddEdge(goraph.StringID(portId), goraph.StringID(peerPortId), 1)
-			g.AddEdge(goraph.StringID(peerPortId), goraph.StringID(portId), 1)
-
+			peerPortID = concatDeviceIDPortID(peer.DeviceId, peer.PortNo)
+			err := g.AddEdge(goraph.StringID(portID), goraph.StringID(peerPortID), 1)
+			if err != nil {
+				log.Errorw("unable-to-add-edge", log.Fields{"error": err})
+			}
+			err = g.AddEdge(goraph.StringID(peerPortID), goraph.StringID(portID), 1)
+			if err != nil {
+				log.Errorw("unable-to-add-edge", log.Fields{"error": err})
+			}
 		}
 	}
 	return g
@@ -306,13 +328,13 @@
 // on the logical device
 func (dg *DeviceGraph) buildPathsToAllRootPorts(lp *voltha.LogicalPort) map[OFPortLink][]RouteHop {
 	paths := dg.Routes
-	source := concatDeviceIdPortId(lp.DeviceId, lp.DevicePortNo)
+	source := concatDeviceIDPortID(lp.DeviceId, lp.DevicePortNo)
 	sourcePort := lp.OfpPort.PortNo
 	ch := make(chan *ofPortLinkToPath)
 	numBuildRequest := 0
 	for target, targetPort := range dg.rootPortsString {
 		go dg.buildRoute(source, target, sourcePort, targetPort, ch)
-		numBuildRequest += 1
+		numBuildRequest++
 	}
 	responseReceived := 0
 forloop:
@@ -320,18 +342,16 @@
 		if responseReceived == numBuildRequest {
 			break
 		}
-		select {
-		case res, ok := <-ch:
-			if !ok {
-				log.Debug("channel closed")
-				break forloop
-			}
-			if res != nil && len(res.path) > 0 {
-				paths[res.link] = res.path
-				paths[OFPortLink{Ingress: res.link.Egress, Egress: res.link.Ingress}] = getReverseRoute(res.path)
-			}
+		res, ok := <-ch
+		if !ok {
+			log.Debug("channel closed")
+			break forloop
 		}
-		responseReceived += 1
+		if res != nil && len(res.path) > 0 {
+			paths[res.link] = res.path
+			paths[OFPortLink{Ingress: res.link.Egress, Egress: res.link.Ingress}] = getReverseRoute(res.path)
+		}
+		responseReceived++
 	}
 	return paths
 }
@@ -340,13 +360,13 @@
 // on the logical device
 func (dg *DeviceGraph) buildPathsToAllNonRootPorts(lp *voltha.LogicalPort) map[OFPortLink][]RouteHop {
 	paths := dg.Routes
-	source := concatDeviceIdPortId(lp.DeviceId, lp.DevicePortNo)
+	source := concatDeviceIDPortID(lp.DeviceId, lp.DevicePortNo)
 	sourcePort := lp.OfpPort.PortNo
 	ch := make(chan *ofPortLinkToPath)
 	numBuildRequest := 0
 	for target, targetPort := range dg.nonRootPortsString {
 		go dg.buildRoute(source, target, sourcePort, targetPort, ch)
-		numBuildRequest += 1
+		numBuildRequest++
 	}
 	responseReceived := 0
 forloop:
@@ -354,31 +374,29 @@
 		if responseReceived == numBuildRequest {
 			break
 		}
-		select {
-		case res, ok := <-ch:
-			if !ok {
-				log.Debug("channel closed")
-				break forloop
-			}
-			if res != nil && len(res.path) > 0 {
-				paths[res.link] = res.path
-				paths[OFPortLink{Ingress: res.link.Egress, Egress: res.link.Ingress}] = getReverseRoute(res.path)
-			}
+		res, ok := <-ch
+		if !ok {
+			log.Debug("channel closed")
+			break forloop
 		}
-		responseReceived += 1
+		if res != nil && len(res.path) > 0 {
+			paths[res.link] = res.path
+			paths[OFPortLink{Ingress: res.link.Egress, Egress: res.link.Ingress}] = getReverseRoute(res.path)
+		}
+		responseReceived++
 	}
 	return paths
 }
 
 //buildRoute builds a route between a source and a target logical port
-func (dg *DeviceGraph) buildRoute(sourceId, targetId string, sourcePort, targetPort uint32, ch chan *ofPortLinkToPath) {
+func (dg *DeviceGraph) buildRoute(sourceID, targetID string, sourcePort, targetPort uint32, ch chan *ofPortLinkToPath) {
 	var pathIds []goraph.ID
 	path := make([]RouteHop, 0)
 	var err error
 	var hop RouteHop
 	var result *ofPortLinkToPath
 
-	if sourceId == targetId {
+	if sourceID == targetID {
 		ch <- result
 		return
 	}
@@ -394,8 +412,8 @@
 		return
 	}
 
-	if pathIds, _, err = goraph.Dijkstra(dg.GGraph, goraph.StringID(sourceId), goraph.StringID(targetId)); err != nil {
-		log.Errorw("no-path", log.Fields{"sourceId": sourceId, "targetId": targetId, "error": err})
+	if pathIds, _, err = goraph.Dijkstra(dg.GGraph, goraph.StringID(sourceID), goraph.StringID(targetID)); err != nil {
+		log.Errorw("no-path", log.Fields{"sourceId": sourceID, "targetId": targetID, "error": err})
 		ch <- result
 		return
 	}
@@ -403,19 +421,19 @@
 		ch <- result
 		return
 	}
-	var deviceId string
+	var deviceID string
 	var ingressPort uint32
 	var egressPort uint32
 	for i := 0; i < len(pathIds); i = i + 3 {
-		if deviceId, ingressPort, err = splitIntoDeviceIdPortId(pathIds[i].String()); err != nil {
-			log.Errorw("id-error", log.Fields{"sourceId": sourceId, "targetId": targetId, "error": err})
+		if deviceID, ingressPort, err = splitIntoDeviceIDPortID(pathIds[i].String()); err != nil {
+			log.Errorw("id-error", log.Fields{"sourceId": sourceID, "targetId": targetID, "error": err})
 			break
 		}
-		if _, egressPort, err = splitIntoDeviceIdPortId(pathIds[i+2].String()); err != nil {
-			log.Errorw("id-error", log.Fields{"sourceId": sourceId, "targetId": targetId, "error": err})
+		if _, egressPort, err = splitIntoDeviceIDPortID(pathIds[i+2].String()); err != nil {
+			log.Errorw("id-error", log.Fields{"sourceId": sourceID, "targetId": targetID, "error": err})
 			break
 		}
-		hop = RouteHop{Ingress: ingressPort, DeviceID: deviceId, Egress: egressPort}
+		hop = RouteHop{Ingress: ingressPort, DeviceID: deviceID, Egress: egressPort}
 		path = append(path, hop)
 	}
 	result = &ofPortLinkToPath{link: OFPortLink{Ingress: sourcePort, Egress: targetPort}, path: path}
@@ -430,7 +448,7 @@
 	for source, sourcePort := range dg.boundaryPorts {
 		for target, targetPort := range dg.boundaryPorts {
 			go dg.buildRoute(source, target, sourcePort, targetPort, ch)
-			numBuildRequest += 1
+			numBuildRequest++
 		}
 	}
 	responseReceived := 0
@@ -439,17 +457,15 @@
 		if responseReceived == numBuildRequest {
 			break
 		}
-		select {
-		case res, ok := <-ch:
-			if !ok {
-				log.Debug("channel closed")
-				break forloop
-			}
-			if res != nil && len(res.path) > 0 {
-				paths[res.link] = res.path
-			}
+		res, ok := <-ch
+		if !ok {
+			log.Debug("channel closed")
+			break forloop
 		}
-		responseReceived += 1
+		if res != nil && len(res.path) > 0 {
+			paths[res.link] = res.path
+		}
+		responseReceived++
 	}
 	return paths
 }
@@ -467,21 +483,21 @@
 }
 
 //concatDeviceIdPortId formats a portid using the device id and the port number
-func concatDeviceIdPortId(deviceId string, portNo uint32) string {
-	return fmt.Sprintf("%s:%d", deviceId, portNo)
+func concatDeviceIDPortID(deviceID string, portNo uint32) string {
+	return fmt.Sprintf("%s:%d", deviceID, portNo)
 }
 
 // splitIntoDeviceIdPortId extracts the device id and port number from the portId
-func splitIntoDeviceIdPortId(id string) (string, uint32, error) {
+func splitIntoDeviceIDPortID(id string) (string, uint32, error) {
 	result := strings.Split(id, ":")
 	if len(result) != 2 {
-		return "", 0, errors.New(fmt.Sprintf("invalid-id-%s", id))
+		return "", 0, fmt.Errorf("invalid-id-%s", id)
 	}
-	if temp, err := strconv.ParseInt(result[1], 10, 32); err != nil {
-		return "", 0, errors.New(fmt.Sprintf("invalid-id-%s-%s", id, err.Error()))
-	} else {
-		return result[0], uint32(temp), nil
+	temp, err := strconv.ParseInt(result[1], 10, 32)
+	if err != nil {
+		return "", 0, fmt.Errorf("invalid-id-%s-%s", id, err.Error())
 	}
+	return result[0], uint32(temp), nil
 }
 
 //getReverseRoute returns the reverse of the route
diff --git a/rw_core/graph/device_graph_test.go b/rw_core/graph/device_graph_test.go
index cb777fb..a4214e9 100644
--- a/rw_core/graph/device_graph_test.go
+++ b/rw_core/graph/device_graph_test.go
@@ -33,24 +33,24 @@
 	ld              voltha.LogicalDevice
 	olt             voltha.Device
 	onus            map[int][]voltha.Device
-	logicalDeviceId string
-	oltDeviceId     string
+	logicalDeviceID string
+	oltDeviceID     string
 	numCalled       int
 	lock            sync.RWMutex
 )
 
 func init() {
-	logicalDeviceId = "ld"
-	oltDeviceId = "olt"
+	logicalDeviceID = "ld"
+	oltDeviceID = "olt"
 	lock = sync.RWMutex{}
 }
 
 func setupDevices(numNNIPort, numPonPortOnOlt, numOnuPerOltPonPort, numUniPerOnu int) {
 	// Create the OLT and add the NNI ports
-	olt = voltha.Device{Id: oltDeviceId, ParentId: logicalDeviceId}
+	olt = voltha.Device{Id: oltDeviceID, ParentId: logicalDeviceID}
 	olt.Ports = make([]*voltha.Port, 0)
 	for nniPort := 1; nniPort < numNNIPort+1; nniPort++ {
-		p := voltha.Port{PortNo: uint32(nniPort), DeviceId: oltDeviceId, Type: voltha.Port_ETHERNET_NNI}
+		p := voltha.Port{PortNo: uint32(nniPort), DeviceId: oltDeviceID, Type: voltha.Port_ETHERNET_NNI}
 		olt.Ports = append(olt.Ports, &p)
 	}
 
@@ -60,14 +60,14 @@
 		onusOnPon := make([]voltha.Device, 0)
 		var onu voltha.Device
 		oltPeerPort := uint32(pPortNo)
-		oltPonPort := voltha.Port{PortNo: uint32(pPortNo), DeviceId: oltDeviceId, Type: voltha.Port_PON_OLT}
+		oltPonPort := voltha.Port{PortNo: uint32(pPortNo), DeviceId: oltDeviceID, Type: voltha.Port_PON_OLT}
 		oltPonPort.Peers = make([]*voltha.Port_PeerPort, 0)
 		for i := 0; i < numOnuPerOltPonPort; i++ {
 			id := fmt.Sprintf("%d-onu-%d", pPortNo, i)
-			onu = voltha.Device{Id: id, ParentId: oltDeviceId, ParentPortNo: uint32(pPortNo)}
+			onu = voltha.Device{Id: id, ParentId: oltDeviceID, ParentPortNo: uint32(pPortNo)}
 			ponPort := voltha.Port{PortNo: 1, DeviceId: onu.Id, Type: voltha.Port_PON_ONU}
 			ponPort.Peers = make([]*voltha.Port_PeerPort, 0)
-			peerPort := voltha.Port_PeerPort{DeviceId: oltDeviceId, PortNo: oltPeerPort}
+			peerPort := voltha.Port_PeerPort{DeviceId: oltDeviceID, PortNo: oltPeerPort}
 			ponPort.Peers = append(ponPort.Peers, &peerPort)
 			onu.Ports = make([]*voltha.Port, 0)
 			onu.Ports = append(onu.Ports, &ponPort)
@@ -84,7 +84,7 @@
 	}
 
 	// Create the logical device
-	ld = voltha.LogicalDevice{Id: logicalDeviceId}
+	ld = voltha.LogicalDevice{Id: logicalDeviceID}
 	ld.Ports = make([]*voltha.LogicalPort, 0)
 	ofpPortNo := 1
 	var id string
@@ -114,7 +114,7 @@
 
 func GetDeviceHelper(id string) (*voltha.Device, error) {
 	lock.Lock()
-	numCalled += 1
+	numCalled++
 	lock.Unlock()
 	if id == "olt" {
 		return &olt, nil
@@ -146,7 +146,7 @@
 	fmt.Println(fmt.Sprintf("Test: Computing all routes. LogicalPorts:%d,  NNI:%d, Pon/OLT:%d, ONU/Pon:%d, Uni/Onu:%d", len(ld.Ports), numNNIPort, numPonPortOnOlt, numOnuPerOltPonPort, numUniPerOnu))
 	// Create a device graph and computes Routes
 	start := time.Now()
-	dg := NewDeviceGraph(logicalDeviceId, getDevice)
+	dg := NewDeviceGraph(logicalDeviceID, getDevice)
 	dg.ComputeRoutes(ld.Ports)
 	assert.NotNil(t, dg.GGraph)
 	fmt.Println(fmt.Sprintf("Total Time:%dms  Total Routes:%d", time.Since(start)/time.Millisecond, len(dg.Routes)))
@@ -167,7 +167,7 @@
 	// Create a device graph and computes Routes
 	start := time.Now()
 	var pt time.Time
-	dg := NewDeviceGraph(logicalDeviceId, getDevice)
+	dg := NewDeviceGraph(logicalDeviceID, getDevice)
 	for k, lp := range ld.Ports {
 		if k == len(ld.Ports)-1 {
 			pt = time.Now()
@@ -193,7 +193,7 @@
 	// Create a device graph and computes Routes
 	start := time.Now()
 	var pt time.Time
-	dg := NewDeviceGraph(logicalDeviceId, getDevice)
+	dg := NewDeviceGraph(logicalDeviceID, getDevice)
 	for k, lp := range ld.Ports {
 		if k == len(ld.Ports)-1 {
 			pt = time.Now()
@@ -220,7 +220,7 @@
 	// Create a device graph and computes Routes
 	start := time.Now()
 	var pt time.Time
-	dg := NewDeviceGraph(logicalDeviceId, getDevice)
+	dg := NewDeviceGraph(logicalDeviceID, getDevice)
 	for k, lp := range ld.Ports {
 		if k == len(ld.Ports)-1 {
 			pt = time.Now()
@@ -247,7 +247,7 @@
 	// Create a device graph and computes Routes
 	start := time.Now()
 	var pt time.Time
-	dg := NewDeviceGraph(logicalDeviceId, getDevice)
+	dg := NewDeviceGraph(logicalDeviceID, getDevice)
 	for k, lp := range ld.Ports {
 		if k == len(ld.Ports)-1 {
 			pt = time.Now()
@@ -274,7 +274,7 @@
 	// Create a device graph and computes Routes
 	start := time.Now()
 	var pt time.Time
-	dg := NewDeviceGraph(logicalDeviceId, getDevice)
+	dg := NewDeviceGraph(logicalDeviceID, getDevice)
 	for k, lp := range ld.Ports {
 		if k == len(ld.Ports)-1 {
 			pt = time.Now()
diff --git a/rw_core/main.go b/rw_core/main.go
index 8ad3833..c066275 100644
--- a/rw_core/main.go
+++ b/rw_core/main.go
@@ -13,27 +13,28 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package main
 
 import (
 	"context"
 	"errors"
 	"fmt"
-	"github.com/opencord/voltha-go/rw_core/config"
-	c "github.com/opencord/voltha-go/rw_core/core"
-	"github.com/opencord/voltha-go/rw_core/utils"
-	"github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore"
-	grpcserver "github.com/opencord/voltha-lib-go/v2/pkg/grpc"
-	"github.com/opencord/voltha-lib-go/v2/pkg/kafka"
-	"github.com/opencord/voltha-lib-go/v2/pkg/log"
-	"github.com/opencord/voltha-lib-go/v2/pkg/probe"
-	"github.com/opencord/voltha-lib-go/v2/pkg/version"
-	ic "github.com/opencord/voltha-protos/v2/go/inter_container"
 	"os"
 	"os/signal"
 	"strconv"
 	"syscall"
 	"time"
+
+	"github.com/opencord/voltha-go/rw_core/config"
+	c "github.com/opencord/voltha-go/rw_core/core"
+	"github.com/opencord/voltha-go/rw_core/utils"
+	"github.com/opencord/voltha-lib-go/v2/pkg/db/kvstore"
+	"github.com/opencord/voltha-lib-go/v2/pkg/kafka"
+	"github.com/opencord/voltha-lib-go/v2/pkg/log"
+	"github.com/opencord/voltha-lib-go/v2/pkg/probe"
+	"github.com/opencord/voltha-lib-go/v2/pkg/version"
+	ic "github.com/opencord/voltha-protos/v2/go/inter_container"
 )
 
 type rwCore struct {
@@ -42,7 +43,6 @@
 	halted      bool
 	exitChannel chan int
 	//kmp         *kafka.KafkaMessagingProxy
-	grpcServer  *grpcserver.GrpcServer
 	kafkaClient kafka.Client
 	core        *c.Core
 	//For test
@@ -50,7 +50,10 @@
 }
 
 func init() {
-	log.AddPackage(log.JSON, log.DebugLevel, nil)
+	_, err := log.AddPackage(log.JSON, log.DebugLevel, nil)
+	if err != nil {
+		log.Errorw("unable-to-register-package-to-the-log-map", log.Fields{"error": err})
+	}
 }
 
 func newKVClient(storeType string, address string, timeout int) (kvstore.Client, error) {
@@ -110,18 +113,7 @@
 	return nil
 }
 
-func toString(value interface{}) (string, error) {
-	switch t := value.(type) {
-	case []byte:
-		return string(value.([]byte)), nil
-	case string:
-		return value.(string), nil
-	default:
-		return "", fmt.Errorf("unexpected-type-%T", t)
-	}
-}
-
-func (rw *rwCore) start(ctx context.Context, instanceId string) {
+func (rw *rwCore) start(ctx context.Context, instanceID string) {
 	log.Info("Starting RW Core components")
 
 	// Setup KV Client
@@ -130,7 +122,7 @@
 	if err == nil {
 		// Setup KV transaction context
 		txnPrefix := rw.config.KVStoreDataPrefix + "/transactions/"
-		if err = c.SetTransactionContext(instanceId,
+		if err = c.SetTransactionContext(instanceID,
 			txnPrefix,
 			rw.kvClient,
 			rw.config.KVStoreTimeout); err != nil {
@@ -142,13 +134,13 @@
 	if rw.kafkaClient, err = newKafkaClient("sarama",
 		rw.config.KafkaAdapterHost,
 		rw.config.KafkaAdapterPort,
-		instanceId,
+		instanceID,
 		rw.config.LiveProbeInterval/2); err != nil {
 		log.Fatal("Unsupported-kafka-client")
 	}
 
 	// Create the core service
-	rw.core = c.NewCore(instanceId, rw.config, rw.kvClient, rw.kafkaClient)
+	rw.core = c.NewCore(instanceID, rw.config, rw.kvClient, rw.kafkaClient)
 
 	// start the core
 	rw.core.Start(ctx)
@@ -229,21 +221,21 @@
 	cf.ParseCommandArguments()
 
 	// Set the instance ID as the hostname
-	var instanceId string
+	var instanceID string
 	hostName := utils.GetHostName()
 	if len(hostName) > 0 {
-		instanceId = hostName
+		instanceID = hostName
 	} else {
 		log.Fatal("HOSTNAME not set")
 	}
 
 	//Setup default logger - applies for packages that do not have specific logger set
-	if _, err := log.SetDefaultLogger(log.JSON, cf.LogLevel, log.Fields{"instanceId": instanceId}); err != nil {
+	if _, err := log.SetDefaultLogger(log.JSON, cf.LogLevel, log.Fields{"instanceId": instanceID}); err != nil {
 		log.With(log.Fields{"error": err}).Fatal("Cannot setup logging")
 	}
 
 	// Update all loggers (provisioned via init) with a common field
-	if err := log.UpdateAllLoggers(log.Fields{"instanceId": instanceId}); err != nil {
+	if err := log.UpdateAllLoggers(log.Fields{"instanceId": instanceID}); err != nil {
 		log.With(log.Fields{"error": err}).Fatal("Cannot setup logging")
 	}
 
@@ -252,7 +244,12 @@
 
 	//log.SetPackageLogLevel("github.com/opencord/voltha-go/rw_core/core", log.DebugLevel)
 
-	defer log.CleanUp()
+	defer func() {
+		err := log.CleanUp()
+		if err != nil {
+			log.Errorw("unable-to-flush-any-buffered-log-entries", log.Fields{"error": err})
+		}
+	}()
 
 	// Print version / build information and exit
 	if cf.DisplayVersionOnly {
@@ -286,7 +283,7 @@
 	probeCtx := context.WithValue(ctx, probe.ProbeContextKey, p)
 
 	// Start the core
-	go rw.start(probeCtx, instanceId)
+	go rw.start(probeCtx, instanceID)
 
 	code := waitForExit()
 	log.Infow("received-a-closing-signal", log.Fields{"code": code})
@@ -295,5 +292,5 @@
 	rw.stop(probeCtx)
 
 	elapsed := time.Since(start)
-	log.Infow("rw-core-run-time", log.Fields{"core": instanceId, "time": elapsed / time.Second})
+	log.Infow("rw-core-run-time", log.Fields{"core": instanceID, "time": elapsed / time.Second})
 }
diff --git a/rw_core/mocks/adapter.go b/rw_core/mocks/adapter.go
index a510e58..4908573 100644
--- a/rw_core/mocks/adapter.go
+++ b/rw_core/mocks/adapter.go
@@ -13,18 +13,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package mocks
 
 import (
+	"strconv"
+	"strings"
+	"sync"
+
 	"github.com/opencord/voltha-lib-go/v2/pkg/adapters/adapterif"
 	ic "github.com/opencord/voltha-protos/v2/go/inter_container"
 	of "github.com/opencord/voltha-protos/v2/go/openflow_13"
 	"github.com/opencord/voltha-protos/v2/go/voltha"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
-	"strconv"
-	"strings"
-	"sync"
 )
 
 func macAddressToUint32Array(mac string) []uint32 {
@@ -41,11 +43,13 @@
 	return result
 }
 
+// Adapter represents adapter attributes
 type Adapter struct {
 	coreProxy adapterif.CoreProxy
 	devices   sync.Map
 }
 
+// NewAdapter creates adapter instance
 func NewAdapter(cp adapterif.CoreProxy) *Adapter {
 	return &Adapter{
 		coreProxy: cp,
@@ -58,10 +62,6 @@
 	}
 }
 
-func (ta *Adapter) deleteDevice(id string) {
-	ta.devices.Delete(id)
-}
-
 func (ta *Adapter) getDevice(id string) *voltha.Device {
 	if val, ok := ta.devices.Load(id); ok && val != nil {
 		if device, ok := val.(*voltha.Device); ok {
@@ -80,75 +80,98 @@
 	return nil
 }
 
-func (ta *Adapter) Adapter_descriptor() error {
+// Adapter_descriptor -
+func (ta *Adapter) Adapter_descriptor() error { // nolint
 	return nil
 }
-func (ta *Adapter) Device_types() (*voltha.DeviceTypes, error) {
+
+// Device_types -
+func (ta *Adapter) Device_types() (*voltha.DeviceTypes, error) { // nolint
 	return nil, nil
 }
+
+// Health -
 func (ta *Adapter) Health() (*voltha.HealthStatus, error) {
 	return nil, nil
 }
-func (ta *Adapter) Adopt_device(device *voltha.Device) error {
+
+// Adopt_device -
+func (ta *Adapter) Adopt_device(device *voltha.Device) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Reconcile_device(device *voltha.Device) error {
+// Reconcile_device -
+func (ta *Adapter) Reconcile_device(device *voltha.Device) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Abandon_device(device *voltha.Device) error {
+// Abandon_device -
+func (ta *Adapter) Abandon_device(device *voltha.Device) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Disable_device(device *voltha.Device) error {
+// Disable_device -
+func (ta *Adapter) Disable_device(device *voltha.Device) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Reenable_device(device *voltha.Device) error {
+// Reenable_device -
+func (ta *Adapter) Reenable_device(device *voltha.Device) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Reboot_device(device *voltha.Device) error {
+// Reboot_device -
+func (ta *Adapter) Reboot_device(device *voltha.Device) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Self_test_device(device *voltha.Device) error {
+// Self_test_device -
+func (ta *Adapter) Self_test_device(device *voltha.Device) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Delete_device(device *voltha.Device) error {
+// Delete_device -
+func (ta *Adapter) Delete_device(device *voltha.Device) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Get_device_details(device *voltha.Device) error {
+// Get_device_details -
+func (ta *Adapter) Get_device_details(device *voltha.Device) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Update_flows_bulk(device *voltha.Device, flows *voltha.Flows, groups *voltha.FlowGroups, flowMetadata *voltha.FlowMetadata) error {
+// Update_flows_bulk -
+func (ta *Adapter) Update_flows_bulk(device *voltha.Device, flows *voltha.Flows, groups *voltha.FlowGroups, flowMetadata *voltha.FlowMetadata) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Update_flows_incrementally(device *voltha.Device, flows *of.FlowChanges, groups *of.FlowGroupChanges, flowMetadata *voltha.FlowMetadata) error {
-	return nil
-}
-func (ta *Adapter) Update_pm_config(device *voltha.Device, pm_configs *voltha.PmConfigs) error {
+// Update_flows_incrementally -
+func (ta *Adapter) Update_flows_incrementally(device *voltha.Device, flows *of.FlowChanges, groups *of.FlowGroupChanges, flowMetadata *voltha.FlowMetadata) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Receive_packet_out(deviceId string, egress_port_no int, msg *of.OfpPacketOut) error {
+// Update_pm_config -
+func (ta *Adapter) Update_pm_config(device *voltha.Device, pmConfigs *voltha.PmConfigs) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Suppress_alarm(filter *voltha.AlarmFilter) error {
+// Receive_packet_out -
+func (ta *Adapter) Receive_packet_out(deviceID string, egressPortNo int, msg *of.OfpPacketOut) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Unsuppress_alarm(filter *voltha.AlarmFilter) error {
+// Suppress_alarm -
+func (ta *Adapter) Suppress_alarm(filter *voltha.AlarmFilter) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Get_ofp_device_info(device *voltha.Device) (*ic.SwitchCapability, error) {
+// Unsuppress_alarm -
+func (ta *Adapter) Unsuppress_alarm(filter *voltha.AlarmFilter) error { // nolint
+	return nil
+}
+
+// Get_ofp_device_info -
+func (ta *Adapter) Get_ofp_device_info(device *voltha.Device) (*ic.SwitchCapability, error) { // nolint
 	return &ic.SwitchCapability{
 		Desc: &of.OfpDesc{
 			HwDesc:    "adapter_mock",
@@ -166,7 +189,8 @@
 	}, nil
 }
 
-func (ta *Adapter) Get_ofp_port_info(device *voltha.Device, port_no int64) (*ic.PortCapability, error) {
+// Get_ofp_port_info -
+func (ta *Adapter) Get_ofp_port_info(device *voltha.Device, portNo int64) (*ic.PortCapability, error) { // nolint
 	capability := uint32(of.OfpPortFeatures_OFPPF_1GB_FD | of.OfpPortFeatures_OFPPF_FIBER)
 	return &ic.PortCapability{
 		Port: &voltha.LogicalPort{
@@ -181,31 +205,37 @@
 				MaxSpeed:   uint32(of.OfpPortFeatures_OFPPF_1GB_FD),
 			},
 			DeviceId:     device.Id,
-			DevicePortNo: uint32(port_no),
+			DevicePortNo: uint32(portNo),
 		},
 	}, nil
 }
 
-func (ta *Adapter) Process_inter_adapter_message(msg *ic.InterAdapterMessage) error {
+// Process_inter_adapter_message -
+func (ta *Adapter) Process_inter_adapter_message(msg *ic.InterAdapterMessage) error { // nolint
 	return nil
 }
 
-func (ta *Adapter) Download_image(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
+// Download_image -
+func (ta *Adapter) Download_image(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { // nolint
 	return nil, nil
 }
 
-func (ta *Adapter) Get_image_download_status(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
+// Get_image_download_status -
+func (ta *Adapter) Get_image_download_status(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { // nolint
 	return nil, nil
 }
 
-func (ta *Adapter) Cancel_image_download(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
+// Cancel_image_download -
+func (ta *Adapter) Cancel_image_download(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { // nolint
 	return nil, nil
 }
 
-func (ta *Adapter) Activate_image_update(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
+// Activate_image_update -
+func (ta *Adapter) Activate_image_update(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { // nolint
 	return nil, nil
 }
 
-func (ta *Adapter) Revert_image_update(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) {
+// Revert_image_update -
+func (ta *Adapter) Revert_image_update(device *voltha.Device, request *voltha.ImageDownload) (*voltha.ImageDownload, error) { // nolint
 	return nil, nil
 }
diff --git a/rw_core/mocks/adapter_olt.go b/rw_core/mocks/adapter_olt.go
index 89f6c20..7cf0d47 100644
--- a/rw_core/mocks/adapter_olt.go
+++ b/rw_core/mocks/adapter_olt.go
@@ -13,11 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package mocks
 
 import (
 	"context"
 	"fmt"
+	"strings"
+
 	"github.com/gogo/protobuf/proto"
 	"github.com/opencord/voltha-lib-go/v2/pkg/adapters/adapterif"
 	com "github.com/opencord/voltha-lib-go/v2/pkg/adapters/common"
@@ -25,24 +28,26 @@
 	ic "github.com/opencord/voltha-protos/v2/go/inter_container"
 	of "github.com/opencord/voltha-protos/v2/go/openflow_13"
 	"github.com/opencord/voltha-protos/v2/go/voltha"
-	"strings"
 )
 
 const (
 	numONUPerOLT = 4
 )
 
+// OLTAdapter represent OLT adapter
 type OLTAdapter struct {
 	Adapter
 }
 
+// NewOLTAdapter - creates OLT adapter instance
 func NewOLTAdapter(cp adapterif.CoreProxy) *OLTAdapter {
 	a := &OLTAdapter{}
 	a.coreProxy = cp
 	return a
 }
 
-func (oltA *OLTAdapter) Adopt_device(device *voltha.Device) error {
+// Adopt_device creates new handler for added device
+func (oltA *OLTAdapter) Adopt_device(device *voltha.Device) error { // nolint
 	go func() {
 		d := proto.Clone(device).(*voltha.Device)
 		d.Root = true
@@ -112,7 +117,8 @@
 	return nil
 }
 
-func (oltA *OLTAdapter) Get_ofp_device_info(device *voltha.Device) (*ic.SwitchCapability, error) {
+// 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 {
 		log.Fatalf("device-not-found-%s", device.Id)
 	}
@@ -133,7 +139,8 @@
 	}, nil
 }
 
-func (oltA *OLTAdapter) Get_ofp_port_info(device *voltha.Device, port_no int64) (*ic.PortCapability, error) {
+// 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 {
 		log.Fatalf("device-not-found-%s", device.Id)
 	}
@@ -151,16 +158,18 @@
 				MaxSpeed:   uint32(of.OfpPortFeatures_OFPPF_1GB_FD),
 			},
 			DeviceId:     device.Id,
-			DevicePortNo: uint32(port_no),
+			DevicePortNo: uint32(portNo),
 		},
 	}, nil
 }
 
+// GetNumONUPerOLT returns number of ONUs per OLT
 func (oltA *OLTAdapter) GetNumONUPerOLT() int {
 	return numONUPerOLT
 }
 
-func (oltA *OLTAdapter) Disable_device(device *voltha.Device) error {
+// Disable_device disables device
+func (oltA *OLTAdapter) Disable_device(device *voltha.Device) error { // nolint
 	go func() {
 		if d := oltA.getDevice(device.Id); d == nil {
 			log.Fatalf("device-not-found-%s", device.Id)
@@ -192,7 +201,8 @@
 	return nil
 }
 
-func (oltA *OLTAdapter) Reenable_device(device *voltha.Device) error {
+// Reenable_device reenables device
+func (oltA *OLTAdapter) Reenable_device(device *voltha.Device) error { // nolint
 	go func() {
 		if d := oltA.getDevice(device.Id); d == nil {
 			log.Fatalf("device-not-found-%s", device.Id)
diff --git a/rw_core/mocks/adapter_olt_test.go b/rw_core/mocks/adapter_olt_test.go
index 6d61e1f..aa91ab5 100644
--- a/rw_core/mocks/adapter_olt_test.go
+++ b/rw_core/mocks/adapter_olt_test.go
@@ -17,8 +17,9 @@
 package mocks
 
 import (
-	"github.com/opencord/voltha-lib-go/v2/pkg/adapters"
 	"testing"
+
+	"github.com/opencord/voltha-lib-go/v2/pkg/adapters"
 )
 
 func TestOLTAdapterImplementsIAdapter(t *testing.T) {
diff --git a/rw_core/mocks/adapter_onu.go b/rw_core/mocks/adapter_onu.go
index 66a3538..bb6f58a 100644
--- a/rw_core/mocks/adapter_onu.go
+++ b/rw_core/mocks/adapter_onu.go
@@ -13,11 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package mocks
 
 import (
 	"context"
 	"fmt"
+	"strings"
+
 	"github.com/gogo/protobuf/proto"
 	"github.com/opencord/voltha-lib-go/v2/pkg/adapters/adapterif"
 	com "github.com/opencord/voltha-lib-go/v2/pkg/adapters/common"
@@ -25,21 +28,23 @@
 	ic "github.com/opencord/voltha-protos/v2/go/inter_container"
 	of "github.com/opencord/voltha-protos/v2/go/openflow_13"
 	"github.com/opencord/voltha-protos/v2/go/voltha"
-	"strings"
 )
 
+// ONUAdapter represent ONU adapter attributes
 type ONUAdapter struct {
 	coreProxy adapterif.CoreProxy
 	Adapter
 }
 
+// NewONUAdapter creates ONU adapter
 func NewONUAdapter(cp adapterif.CoreProxy) *ONUAdapter {
 	a := &ONUAdapter{}
 	a.coreProxy = cp
 	return a
 }
 
-func (onuA *ONUAdapter) Adopt_device(device *voltha.Device) error {
+// Adopt_device creates new handler for added device
+func (onuA *ONUAdapter) Adopt_device(device *voltha.Device) error { // nolint
 	go func() {
 		d := proto.Clone(device).(*voltha.Device)
 		d.Root = false
@@ -89,7 +94,7 @@
 			Peers: []*voltha.Port_PeerPort{{DeviceId: d.ParentId, // Peer device  is OLT
 				PortNo: uniPortNo}}, // Peer port is UNI port
 		}
-		if err := onuA.coreProxy.PortCreated(context.TODO(), d.Id, ponPort); err != nil {
+		if err = onuA.coreProxy.PortCreated(context.TODO(), d.Id, ponPort); err != nil {
 			log.Fatalf("PortCreated-failed-%s", err)
 		}
 
@@ -111,7 +116,8 @@
 	return nil
 }
 
-func (onuA *ONUAdapter) Get_ofp_port_info(device *voltha.Device, port_no int64) (*ic.PortCapability, error) {
+// Get_ofp_port_info returns ofp device info
+func (onuA *ONUAdapter) Get_ofp_port_info(device *voltha.Device, portNo int64) (*ic.PortCapability, error) { // nolint
 	if d := onuA.getDevice(device.Id); d == nil {
 		log.Fatalf("device-not-found-%s", device.Id)
 	}
@@ -129,12 +135,13 @@
 				MaxSpeed:   uint32(of.OfpPortFeatures_OFPPF_1GB_FD),
 			},
 			DeviceId:     device.Id,
-			DevicePortNo: uint32(port_no),
+			DevicePortNo: uint32(portNo),
 		},
 	}, nil
 }
 
-func (onuA *ONUAdapter) Disable_device(device *voltha.Device) error {
+// Disable_device disables device
+func (onuA *ONUAdapter) Disable_device(device *voltha.Device) error { // nolint
 	go func() {
 		if d := onuA.getDevice(device.Id); d == nil {
 			log.Fatalf("device-not-found-%s", device.Id)
@@ -158,7 +165,8 @@
 	return nil
 }
 
-func (onuA *ONUAdapter) Reenable_device(device *voltha.Device) error {
+// Reenable_device reenables device
+func (onuA *ONUAdapter) Reenable_device(device *voltha.Device) error { // nolint
 	go func() {
 		if d := onuA.getDevice(device.Id); d == nil {
 			log.Fatalf("device-not-found-%s", device.Id)
diff --git a/rw_core/mocks/device_manager.go b/rw_core/mocks/device_manager.go
index c8bf1ca..1968efa 100644
--- a/rw_core/mocks/device_manager.go
+++ b/rw_core/mocks/device_manager.go
@@ -13,129 +13,166 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package mocks
 
 import (
 	"context"
+
 	"github.com/opencord/voltha-protos/v2/go/voltha"
 )
 
+// DeviceManager -
 type DeviceManager struct {
 }
 
-func (dm *DeviceManager) GetDevice(deviceId string) (*voltha.Device, error) {
+// GetDevice -
+func (dm *DeviceManager) GetDevice(deviceID string) (*voltha.Device, error) {
 	return nil, nil
 }
-func (dm *DeviceManager) IsRootDevice(deviceId string) (bool, error) {
+
+// IsRootDevice -
+func (dm *DeviceManager) IsRootDevice(deviceID string) (bool, error) {
 	return false, nil
 }
 
+// NotifyInvalidTransition -
 func (dm *DeviceManager) NotifyInvalidTransition(pcDevice *voltha.Device) error {
 	return nil
 }
 
+// SetAdminStateToEnable -
 func (dm *DeviceManager) SetAdminStateToEnable(cDevice *voltha.Device) error {
 	return nil
 }
 
+// CreateLogicalDevice -
 func (dm *DeviceManager) CreateLogicalDevice(cDevice *voltha.Device) error {
 	return nil
 }
 
+// SetupUNILogicalPorts -
 func (dm *DeviceManager) SetupUNILogicalPorts(cDevice *voltha.Device) error {
 	return nil
 }
 
+// DisableAllChildDevices -
 func (dm *DeviceManager) DisableAllChildDevices(cDevice *voltha.Device) error {
 	return nil
 }
 
+// DeleteLogicalDevice -
 func (dm *DeviceManager) DeleteLogicalDevice(cDevice *voltha.Device) error {
 	return nil
 }
 
+// DeleteLogicalPorts -
 func (dm *DeviceManager) DeleteLogicalPorts(cDevice *voltha.Device) error {
 	return nil
 }
 
+// DeleteAllChildDevices -
 func (dm *DeviceManager) DeleteAllChildDevices(cDevice *voltha.Device) error {
 	return nil
 }
 
+// RunPostDeviceDelete -
 func (dm *DeviceManager) RunPostDeviceDelete(cDevice *voltha.Device) error {
 	return nil
 }
 
+// ListDevices -
 func (dm *DeviceManager) ListDevices() (*voltha.Devices, error) {
 	return nil, nil
 }
 
+// ListDeviceIds -
 func (dm *DeviceManager) ListDeviceIds() (*voltha.IDs, error) {
 	return nil, nil
 }
 
+// ReconcileDevices -
 func (dm *DeviceManager) ReconcileDevices(ctx context.Context, ids *voltha.IDs, ch chan interface{}) {
 }
 
+// CreateDevice -
 func (dm *DeviceManager) CreateDevice(ctx context.Context, device *voltha.Device, ch chan interface{}) {
 }
 
+// EnableDevice -
 func (dm *DeviceManager) EnableDevice(ctx context.Context, id *voltha.ID, ch chan interface{}) {
 }
 
+// DisableDevice -
 func (dm *DeviceManager) DisableDevice(ctx context.Context, id *voltha.ID, ch chan interface{}) {
 }
 
+// RebootDevice -
 func (dm *DeviceManager) RebootDevice(ctx context.Context, id *voltha.ID, ch chan interface{}) {
 }
 
+// DeleteDevice -
 func (dm *DeviceManager) DeleteDevice(ctx context.Context, id *voltha.ID, ch chan interface{}) {
 }
 
+// StopManagingDevice -
 func (dm *DeviceManager) StopManagingDevice(id string) {
 }
 
+// DownloadImage -
 func (dm *DeviceManager) DownloadImage(ctx context.Context, img *voltha.ImageDownload, ch chan interface{}) {
 }
 
+// CancelImageDownload -
 func (dm *DeviceManager) CancelImageDownload(ctx context.Context, img *voltha.ImageDownload, ch chan interface{}) {
 }
 
+// ActivateImage -
 func (dm *DeviceManager) ActivateImage(ctx context.Context, img *voltha.ImageDownload, ch chan interface{}) {
 }
 
+// RevertImage -
 func (dm *DeviceManager) RevertImage(ctx context.Context, img *voltha.ImageDownload, ch chan interface{}) {
 }
 
+// GetImageDownloadStatus -
 func (dm *DeviceManager) GetImageDownloadStatus(ctx context.Context, img *voltha.ImageDownload, ch chan interface{}) {
 }
 
-func (dm *DeviceManager) UpdateImageDownload(deviceId string, img *voltha.ImageDownload) error {
+// UpdateImageDownload -
+func (dm *DeviceManager) UpdateImageDownload(deviceID string, img *voltha.ImageDownload) error {
 	return nil
 }
 
+// SimulateAlarm -
 func (dm *DeviceManager) SimulateAlarm(ctx context.Context, simulatereq *voltha.SimulateAlarmRequest, ch chan interface{}) {
 }
 
+// GetImageDownload -
 func (dm *DeviceManager) GetImageDownload(ctx context.Context, img *voltha.ImageDownload) (*voltha.ImageDownload, error) {
 	return nil, nil
 }
 
-func (dm *DeviceManager) ListImageDownloads(ctx context.Context, deviceId string) (*voltha.ImageDownloads, error) {
+// ListImageDownloads -
+func (dm *DeviceManager) ListImageDownloads(ctx context.Context, deviceID string) (*voltha.ImageDownloads, error) {
 	return nil, nil
 }
 
+// UpdatePmConfigs -
 func (dm *DeviceManager) UpdatePmConfigs(ctx context.Context, pmConfigs *voltha.PmConfigs, ch chan interface{}) {
 }
 
-func (dm *DeviceManager) ListPmConfigs(ctx context.Context, deviceId string) (*voltha.PmConfigs, error) {
+// ListPmConfigs -
+func (dm *DeviceManager) ListPmConfigs(ctx context.Context, deviceID string) (*voltha.PmConfigs, error) {
 	return nil, nil
 }
 
-func (dm *DeviceManager) DeletePeerPorts(fromDeviceId string, deviceId string) error {
+// DeletePeerPorts -
+func (dm *DeviceManager) DeletePeerPorts(fromDeviceID string, deviceID string) error {
 	return nil
 }
 
+// ProcessTransition -
 func (dm *DeviceManager) ProcessTransition(previous *voltha.Device, current *voltha.Device) error {
 	return nil
 }
diff --git a/rw_core/mocks/device_manager_test.go b/rw_core/mocks/device_manager_test.go
index ab2226b..e92d62f 100644
--- a/rw_core/mocks/device_manager_test.go
+++ b/rw_core/mocks/device_manager_test.go
@@ -17,14 +17,15 @@
 package mocks
 
 import (
-	"github.com/opencord/voltha-go/rw_core/coreIf"
 	"testing"
+
+	"github.com/opencord/voltha-go/rw_core/coreif"
 )
 
 func TestDeviceManagerImplementsDeviceManagerIf(t *testing.T) {
 	deviceMgr := &DeviceManager{}
 
-	if _, ok := interface{}(deviceMgr).(coreIf.DeviceManager); !ok {
-		t.Error("Device manager does not implement the coreIf.DeviceManager interface")
+	if _, ok := interface{}(deviceMgr).(coreif.DeviceManager); !ok {
+		t.Error("Device manager does not implement the coreif.DeviceManager interface")
 	}
 }
diff --git a/rw_core/utils/core_utils.go b/rw_core/utils/core_utils.go
index 3a71623..584d923 100644
--- a/rw_core/utils/core_utils.go
+++ b/rw_core/utils/core_utils.go
@@ -13,27 +13,33 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package utils
 
 import (
-	"google.golang.org/grpc/codes"
-	"google.golang.org/grpc/status"
 	"os"
 	"time"
+
+	"google.golang.org/grpc/codes"
+	"google.golang.org/grpc/status"
 )
 
+// DeviceID represent device id attribute
 type DeviceID struct {
-	Id string
+	ID string
 }
 
+// LogicalDeviceID rpresent logical device id attribute
 type LogicalDeviceID struct {
-	Id string
+	ID string
 }
 
+// GetHostName returns host name
 func GetHostName() string {
 	return os.Getenv("HOSTNAME")
 }
 
+// Response -
 type Response struct {
 	*response
 }
@@ -43,6 +49,7 @@
 	done bool
 }
 
+// NewResponse -
 func NewResponse() Response {
 	return Response{
 		&response{
diff --git a/rw_core/utils/core_utils_test.go b/rw_core/utils/core_utils_test.go
index 9f8dd87..cc48b10 100644
--- a/rw_core/utils/core_utils_test.go
+++ b/rw_core/utils/core_utils_test.go
@@ -16,13 +16,14 @@
 package utils
 
 import (
+	"math/rand"
+	"testing"
+	"time"
+
 	"github.com/opencord/voltha-lib-go/v2/pkg/log"
 	"github.com/stretchr/testify/assert"
 	"google.golang.org/grpc/codes"
 	"google.golang.org/grpc/status"
-	"math/rand"
-	"testing"
-	"time"
 )
 
 var (
@@ -31,7 +32,10 @@
 )
 
 func init() {
-	log.AddPackage(log.JSON, log.WarnLevel, nil)
+	_, err := log.AddPackage(log.JSON, log.WarnLevel, nil)
+	if err != nil {
+		log.Errorw("unable-to-register-package-to-the-log-map", log.Fields{"error": err})
+	}
 	timeoutError = status.Errorf(codes.Aborted, "timeout")
 	taskFailureError = status.Error(codes.Internal, "test failure task")
 }
@@ -56,7 +60,7 @@
 		responses[i] = NewResponse()
 		if numSuccessfulTaskCreated < numSuccessfulTask {
 			go runSuccessfulTask(responses[i], taskDurationRange)
-			numSuccessfulTaskCreated += 1
+			numSuccessfulTaskCreated++
 			continue
 		}
 		go runFailureTask(responses[i], taskDurationRange)
@@ -71,11 +75,11 @@
 	for _, input := range inputs {
 		if input != nil {
 			if input.Error() == timeoutError.Error() {
-				numTimeout += 1
+				numTimeout++
 			}
-			numFailure += 1
+			numFailure++
 		} else {
-			numSuccess += 1
+			numSuccess++
 		}
 	}
 	return