Add transaction key for ofagent request.

Since the afrouter (api-server) binds an ofagent to two rw_core
forming a core-pair and transparently forward requests/responses,
then the ofagent needs to include a transaction key-value when
sending a request to the rw_core.  This will allow the rw_cores in
the pair to compete for the transaction with the winning one
fulfilling the requests while the other Core monitoring the
transaction in case the winning core fails to process the
transaction.

Change-Id: I231ac3c027d40a475f0c395fc8123e9b54fd35d0
diff --git a/python/ofagent/main.py b/python/ofagent/main.py
index e18e480..fa2b5c0 100755
--- a/python/ofagent/main.py
+++ b/python/ofagent/main.py
@@ -35,6 +35,7 @@
     grpc_endpoint=os.environ.get('GRPC_ENDPOINT', 'localhost:50055'),
     grpc_timeout=os.environ.get('GRPC_TIMEOUT', '10'),
     core_binding_key=os.environ.get('CORE_BINDING_KEY', 'voltha_backend_name'),
+    core_transaction_key=os.environ.get('CORE_TRANSACTION_KEY', 'voltha_serial_number'),
     instance_id=os.environ.get('INSTANCE_ID', os.environ.get('HOSTNAME', '1')),
     internal_host_address=os.environ.get('INTERNAL_HOST_ADDRESS',
                                          get_my_primary_local_ipv4()),
@@ -106,6 +107,15 @@
                         default=defs['core_binding_key'],
                         help=_help)
 
+    _help = ('The name of the meta-key whose value is the transaction ID '
+             'used by the OFAgent to send requests to the Voltha RW Core. '
+             '(default: %s)' % defs['core_transaction_key'])
+    parser.add_argument('-ctk', '--core_transaction_key',
+                        dest='core_transaction_key',
+                        action='store',
+                        default=defs['core_transaction_key'],
+                        help=_help)
+
     _help = ('<hostname> or <ip> at which ofagent is reachable from inside '
              'the cluster (default: %s)' % defs['internal_host_address'])
     parser.add_argument('-H', '--internal-host-address',
@@ -246,9 +256,16 @@
         self.log.info('starting-internal-components')
         args = self.args
         self.connection_manager = yield ConnectionManager(
-            args.consul, args.grpc_endpoint, self.grpc_timeout,
-            args.core_binding_key, args.controller, args.instance_id,
-            args.enable_tls, args.key_file, args.cert_file).start()
+            args.consul,
+            args.grpc_endpoint,
+            self.grpc_timeout,
+            args.core_binding_key,
+            args.core_transaction_key,
+            args.controller,
+            args.instance_id,
+            args.enable_tls,
+            args.key_file,
+            args.cert_file).start()
         self.log.info('started-internal-services')
 
     @inlineCallbacks