[VOL-1512] Set device ownership

This commit consists of the following:
1) Set device ownership per Core in a Core-pair such that only 1
Core actively process a device (i.e. handles all the requests for
that device) while the other Core in the pair passively watch for
updates on that device and will take over in case the owner Core
failed to process the transaction.
2) Cleanup the lock mechanisms to ensure we use a read lock when
needed instead of just a lock.
3) Update logical port additions such that ports are added only when
the device is enabled.
4) Update the port Ids for the logical ports.
5) Update some sarama client configs for performance - this is an
ongoing tune up.
6) Update the adapter request handler in the Core to send back an
ACK immediately to the adapter request instead of processing the
request fully and then sending an ACK.  This reduces the latency
over kafka and therefore reduces the likelihood of timeouts.

Change-Id: I9149bf3ba6fbad38e3a29c76ea8dba2f9f731d29
diff --git a/rw_core/core/logical_device_manager.go b/rw_core/core/logical_device_manager.go
index 47249f6..5f572b1 100644
--- a/rw_core/core/logical_device_manager.go
+++ b/rw_core/core/logical_device_manager.go
@@ -91,16 +91,16 @@
 // 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 {
-	ldMgr.lockLogicalDeviceAgentsMap.Lock()
+	ldMgr.lockLogicalDeviceAgentsMap.RLock()
 	if agent, ok := ldMgr.logicalDeviceAgents[logicalDeviceId]; ok {
-		ldMgr.lockLogicalDeviceAgentsMap.Unlock()
+		ldMgr.lockLogicalDeviceAgentsMap.RUnlock()
 		return agent
 	} else {
 		//	Try to load into memory - loading will also create the logical device agent
-		ldMgr.lockLogicalDeviceAgentsMap.Unlock()
+		ldMgr.lockLogicalDeviceAgentsMap.RUnlock()
 		if err := ldMgr.load(logicalDeviceId); err == nil {
-			ldMgr.lockLogicalDeviceAgentsMap.Lock()
-			defer ldMgr.lockLogicalDeviceAgentsMap.Unlock()
+			ldMgr.lockLogicalDeviceAgentsMap.RLock()
+			defer ldMgr.lockLogicalDeviceAgentsMap.RUnlock()
 			if agent, ok = ldMgr.logicalDeviceAgents[logicalDeviceId]; ok {
 				return agent
 			}
@@ -147,20 +147,6 @@
 	return result, nil
 }
 
-// List only logical devices that are in memory
-//func (ldMgr *LogicalDeviceManager) listLogicalDevices() (*voltha.LogicalDevices, error) {
-//	log.Debug("listLogicalDevices")
-//	result := &voltha.LogicalDevices{}
-//	ldMgr.lockLogicalDeviceAgentsMap.Lock()
-//	defer ldMgr.lockLogicalDeviceAgentsMap.Unlock()
-//	for _, agent := range ldMgr.logicalDeviceAgents {
-//		if lDevice, err := agent.GetLogicalDevice(); err == nil {
-//			result.Items = append(result.Items, lDevice)
-//		}
-//	}
-//	return result, nil
-//}
-
 func (ldMgr *LogicalDeviceManager) createLogicalDevice(ctx context.Context, device *voltha.Device) (*string, error) {
 	log.Debugw("creating-logical-device", log.Fields{"deviceId": device.Id})
 	// Sanity check
@@ -184,8 +170,8 @@
 	ldMgr.addLogicalDeviceAgentToMap(agent)
 	go agent.start(ctx, false)
 
-	// Set device ownership
-	ldMgr.core.deviceOwnership.OwnedByMe(id)
+	//// Set device ownership
+	//ldMgr.core.deviceOwnership.OwnedByMe(id)
 
 	log.Debug("creating-logical-device-ends")
 	return &id, nil
@@ -193,8 +179,7 @@
 
 // load loads a logical device manager in memory
 func (ldMgr *LogicalDeviceManager) load(lDeviceId string) error {
-	//log.Debugw("loading-logical-device", log.Fields{"lDeviceId": lDeviceId})
-	log.Errorw("loading-logical-device", log.Fields{"lDeviceId": lDeviceId})
+	log.Debugw("loading-logical-device", log.Fields{"lDeviceId": lDeviceId})
 	// To prevent a race condition, let's hold the logical device agent map lock.  This will prevent a loading and
 	// a create logical device callback from occurring at the same time.
 	ldMgr.lockLogicalDeviceAgentsMap.Lock()