VOL-1025: Implement a Go language library for affinity proxy request/response handling
- Both etcd and consul KV stores are supported
- Incorporated feedback from last code inspection
- Connected Core object to a KV client
- Added docker compose file for etcd testing

Change-Id: I5e3c9637f4e57d6cf7fa1102e4b3507f17bc8979
diff --git a/rw_core/main.go b/rw_core/main.go
index f53a6ba..cd5dbe9 100644
--- a/rw_core/main.go
+++ b/rw_core/main.go
@@ -73,6 +73,7 @@
 	addr := rw.config.KVStoreHost + ":" + strconv.Itoa(rw.config.KVStorePort)
 	client, err := newKVClient(rw.config.KVStoreType, addr, rw.config.KVStoreTimeout)
 	if err != nil {
+		rw.kvClient = nil
 		log.Error(err)
 		return err
 	}
@@ -131,13 +132,23 @@
 	//	log.Fatalw("failed-to-start-kafka-proxy", log.Fields{"err":err})
 	//}
 
+	// Setup KV Client
+	log.Debugw("create-kv-client", log.Fields{"kvstore": rw.config.KVStoreType})
+	err := rw.setKVClient()
+	if err == nil {
+		// Setup KV transaction context
+		c.SetTransactionContext(rw.config.InstanceID,
+			"service/voltha/transactions/",
+			rw.kvClient,
+			rw.config.KVStoreTimeout,
+			rw.config.KVTxnKeyDelTime)
+	}
+
 	// Create the core service
-	rw.core = c.NewCore(rw.config.InstanceID, rw.config)
+	rw.core = c.NewCore(rw.config.InstanceID, rw.config, rw.kvClient)
 
 	// start the core
 	rw.core.Start(ctx)
-
-	// Setup KV Client
 }
 
 func (rw *rwCore) stop() {