[VOL-2164] Update rw-core to use the Async Kafka API

This commit consists of the following:

1. Process per-device requests in the Core in the order they are
received. If there are lots of requests on a given device then
there will be some latencies introduced due to ordering.  With
recent changes in the model along with keeping the request lock
to a minimal then these latencies are reduced.  Testing did not
show and noticeable latencies.

2) Keep the request lock from the moment a request started
processing to the moment that request is sent to kafka (when
applicable).  Adapter responses are received and processed
asynchronously. Therefore, an adapter can takes all the time it
needs to process a transaction.  The Core still has a context
with timeout (configurable) to cater for cases where the adapter
does not return a response.

3) Adapter requests are processed to completion before sending a
reponse back to the adapter.  Previously, in some cases, a
separate go routine was created to process the request and a
successful response is sent to the adapter.  Now if the request
fails then the adapter will receive an error. The adapter
requests for a given device are therefore processed in the
order they are received.

4) Some changes are made when retrieving a handler to execute
a device state transition.  This was necessary as there was some
transition overlap found.

Update after multiple reviews.

Change-Id: I55a189efec1549a662f2d71e18e6eca9015a3a17
diff --git a/rw_core/config/config.go b/rw_core/config/config.go
index 0c2c3ce..2ec9d18 100644
--- a/rw_core/config/config.go
+++ b/rw_core/config/config.go
@@ -51,9 +51,9 @@
 	defaultRWCoreCA                  = "pki/voltha-CA.pem"
 	defaultAffinityRouterTopic       = "affinityRouter"
 	defaultInCompetingMode           = true
-	defaultLongRunningRequestTimeout = int64(2000)
-	defaultDefaultRequestTimeout     = int64(500)
-	defaultCoreTimeout               = int64(500)
+	defaultLongRunningRequestTimeout = 2000 * time.Millisecond
+	defaultDefaultRequestTimeout     = 1000 * time.Millisecond
+	defaultCoreTimeout               = 1000 * time.Millisecond
 	defaultCoreBindingKey            = "voltha_backend_name"
 	defaultCorePairTopic             = "rwcore_1"
 	defaultMaxConnectionRetries      = -1 // retries forever
@@ -89,9 +89,9 @@
 	RWCoreCA                  string
 	AffinityRouterTopic       string
 	InCompetingMode           bool
-	LongRunningRequestTimeout int64
-	DefaultRequestTimeout     int64
-	DefaultCoreTimeout        int64
+	LongRunningRequestTimeout time.Duration
+	DefaultRequestTimeout     time.Duration
+	DefaultCoreTimeout        time.Duration
 	CoreBindingKey            string
 	CorePairTopic             string
 	MaxConnectionRetries      int
@@ -204,13 +204,18 @@
 	flag.StringVar(&(cf.LogLevel), "log_level", defaultLogLevel, help)
 
 	help = fmt.Sprintf("Timeout for long running request")
-	flag.Int64Var(&(cf.LongRunningRequestTimeout), "timeout_long_request", defaultLongRunningRequestTimeout, help)
+	// TODO:  Change this code once all the params and helm charts have been changed to use the different type
+	var temp int64
+	flag.Int64Var(&temp, "timeout_long_request", defaultLongRunningRequestTimeout.Milliseconds(), help)
+	cf.LongRunningRequestTimeout = time.Duration(temp) * time.Millisecond
 
 	help = fmt.Sprintf("Default timeout for regular request")
-	flag.Int64Var(&(cf.DefaultRequestTimeout), "timeout_request", defaultDefaultRequestTimeout, help)
+	flag.Int64Var(&temp, "timeout_request", defaultDefaultRequestTimeout.Milliseconds(), help)
+	cf.DefaultRequestTimeout = time.Duration(temp) * time.Millisecond
 
 	help = fmt.Sprintf("Default Core timeout")
-	flag.Int64Var(&(cf.DefaultCoreTimeout), "core_timeout", defaultCoreTimeout, help)
+	flag.Int64Var(&temp, "core_timeout", defaultCoreTimeout.Milliseconds(), help)
+	cf.DefaultCoreTimeout = time.Duration(temp) * time.Millisecond
 
 	help = fmt.Sprintf("Show startup banner log lines")
 	flag.BoolVar(&cf.Banner, "banner", defaultBanner, help)