[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/device_manager.go b/rw_core/core/device_manager.go
index 06d3bd4..b27f01a 100644
--- a/rw_core/core/device_manager.go
+++ b/rw_core/core/device_manager.go
@@ -100,16 +100,16 @@
 
 // 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 {
-	dMgr.lockDeviceAgentsMap.Lock()
+	dMgr.lockDeviceAgentsMap.RLock()
 	if agent, ok := dMgr.deviceAgents[deviceId]; ok {
-		dMgr.lockDeviceAgentsMap.Unlock()
+		dMgr.lockDeviceAgentsMap.RUnlock()
 		return agent
 	} else {
 		//	Try to load into memory - loading will also create the device agent
-		dMgr.lockDeviceAgentsMap.Unlock()
+		dMgr.lockDeviceAgentsMap.RUnlock()
 		if err := dMgr.load(deviceId); err == nil {
-			dMgr.lockDeviceAgentsMap.Lock()
-			defer dMgr.lockDeviceAgentsMap.Unlock()
+			dMgr.lockDeviceAgentsMap.RLock()
+			defer dMgr.lockDeviceAgentsMap.RUnlock()
 			if agent, ok = dMgr.deviceAgents[deviceId]; ok {
 				return agent
 			}
@@ -120,8 +120,8 @@
 
 // listDeviceIdsFromMap returns the list of device IDs that are in memory
 func (dMgr *DeviceManager) listDeviceIdsFromMap() *voltha.IDs {
-	dMgr.lockDeviceAgentsMap.Lock()
-	defer dMgr.lockDeviceAgentsMap.Unlock()
+	dMgr.lockDeviceAgentsMap.RLock()
+	defer dMgr.lockDeviceAgentsMap.RUnlock()
 	result := &voltha.IDs{Items: make([]*voltha.ID, 0)}
 	for key, _ := range dMgr.deviceAgents {
 		result.Items = append(result.Items, &voltha.ID{Id: key})
@@ -302,8 +302,8 @@
 }
 
 func (dMgr *DeviceManager) IsDeviceInCache(id string) bool {
-	dMgr.lockDeviceAgentsMap.Lock()
-	defer dMgr.lockDeviceAgentsMap.Unlock()
+	dMgr.lockDeviceAgentsMap.RLock()
+	defer dMgr.lockDeviceAgentsMap.RUnlock()
 	_, exist := dMgr.deviceAgents[id]
 	return exist
 }
@@ -627,8 +627,8 @@
 	dMgr.addDeviceAgentToMap(agent)
 	agent.start(nil, false)
 
-	// Set device ownership
-	dMgr.core.deviceOwnership.OwnedByMe(agent.deviceId)
+	//// Set device ownership
+	//dMgr.core.deviceOwnership.OwnedByMe(agent.deviceId)
 
 	// Activate the child device
 	if agent := dMgr.getDeviceAgent(agent.deviceId); agent != nil {