Additional logging fixes, primarily in brcm_openomci_onu:

- Fix issues with wrong number of positional parameters to logging calls

- Don't use 'msg' as a key in logging calls as logging uses that
  internally, overwriting the value

- Don't use 'key' as a key in logging calls as kafkaloghandler uses that
  as the kafka key.

Change-Id: I27d2ed4a4069a4535edb2674140cd70d0fdf0643
diff --git a/voltha/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py b/voltha/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
index 146253d..0b4b614 100644
--- a/voltha/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
+++ b/voltha/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
@@ -419,7 +419,8 @@
                                       field=_field, in_port=_in_port)
                         if _field.type == fd.VLAN_VID:
                             _set_vlan_vid = _field.vlan_vid & 0xfff
-                            self.log.debug('set-field-type-vlan-vid', _set_vlan_vid)
+                            self.log.debug('set-field-type-vlan-vid',
+                                           vlan_vid=_set_vlan_vid)
                         else:
                             self.log.error('unsupported-action-set-field-type',
                                            field_type=_field.type)
@@ -781,7 +782,7 @@
 
                 for entity_id in veip_list:
                     veip_value = config.veip_entities[entity_id]
-                    self.log.debug("discovered-veip", key=entity_id, value=veip_value)
+                    self.log.debug("discovered-veip", entity_id=entity_id, value=veip_value)
 
                 for entity_id in uni_list:
                     uni_value = config.uni_g_entities[entity_id]
@@ -795,7 +796,8 @@
                         self._add_uni_port(entity_id, uni_type=UniType.VEIP)
                         break
                     else:
-                        self.log.warn("unable-to-find-uni-in-pptp-or-veip", key=entity_id, value=uni_value)
+                        self.log.warn("unable-to-find-uni-in-pptp-or-veip",
+                                      entity_id=entity_id, value=uni_value)
 
                 self._qos_flexibility = config.qos_configuration_flexibility or 0
                 self._omcc_version = config.omcc_version or OMCCVersion.Unknown
diff --git a/voltha/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py b/voltha/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py
index cbdb914..af14bb8 100644
--- a/voltha/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py
+++ b/voltha/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py
@@ -151,8 +151,10 @@
         failed_mask = omci_msg.get('failed_attributes_mask', 'n/a')
         unsupported_mask = omci_msg.get('unsupported_attributes_mask', 'n/a')
 
-        self.log.debug("OMCI Result:", operation, omci_msg=omci_msg, status=status, error_mask=error_mask,
-                       failed_mask=failed_mask, unsupported_mask=unsupported_mask)
+        self.log.debug("OMCI Result: %s", operation,
+                       omci_msg=omci_msg, status=status,
+                       error_mask=error_mask, failed_mask=failed_mask,
+                       unsupported_mask=unsupported_mask)
 
         if status == RC.Success:
             self.strobe_watchdog()
@@ -234,7 +236,7 @@
                 max_gem_payload_size=self._max_gem_payload
             )
             frame = msg.create()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci_cc.send(frame)
             self.check_status_and_state(results, 'create-gal-ethernet-profile')
 
@@ -263,7 +265,7 @@
                 attributes
             )
             frame = msg.create()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci_cc.send(frame)
             self.check_status_and_state(results, 'create-mac-bridge-service-profile')
 
@@ -280,7 +282,7 @@
 
             msg = Ieee8021pMapperServiceProfileFrame(self._ieee_mapper_service_profile_entity_id)
             frame = msg.create()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci_cc.send(frame)
             self.check_status_and_state(results, 'create-8021p-mapper-service-profile')
 
@@ -308,7 +310,7 @@
                 tp_pointer=self._ieee_mapper_service_profile_entity_id  # TP ID, 8021p mapper ID
             )
             frame = msg.create()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci_cc.send(frame)
             self.check_status_and_state(results, 'create-mac-bridge-port-configuration-data-part-1')
 
@@ -329,7 +331,7 @@
                 forward_operation=0x10
             )
             frame = msg.create()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci_cc.send(frame)
             self.check_status_and_state(results, 'create-vlan-tagging-filter-data')
 
@@ -365,7 +367,7 @@
                 tp_pointer=self._uni_port.entity_id            # Ethernet UNI ID
             )
             frame = msg.create()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci_cc.send(frame)
             self.check_status_and_state(results, 'create-mac-bridge-port-configuration-data-part-2')
 
@@ -475,7 +477,7 @@
                 interwork_tp_pointers=gem_entity_ids          # Interworking TP IDs
             )
             frame = msg.set()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci_cc.send(frame)
             self.check_status_and_state(results, 'set-8021p-mapper-service-profile')
 
@@ -536,7 +538,7 @@
             )
 
             frame = msg.create()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci_cc.send(frame)
             self.check_status_and_state(results, 'create-extended-vlan-tagging-operation-configuration-data')
 
@@ -583,7 +585,7 @@
             )
 
             frame = msg.set()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci_cc.send(frame)
             self.check_status_and_state(results, 'set-extended-vlan-tagging-operation-configuration-data')
 
@@ -631,7 +633,7 @@
 
             if msg:
                frame = msg.set()
-               self.log.debug('openomci-msg', msg=msg)
+               self.log.debug('openomci-msg', omci_msg=msg)
                results = yield omci_cc.send(frame)
                self.check_status_and_state(results, 'set-pptp-ethernet-uni-lock-restore')
 
diff --git a/voltha/adapters/brcm_openomci_onu/omci/brcm_vlan_filter_task.py b/voltha/adapters/brcm_openomci_onu/omci/brcm_vlan_filter_task.py
index c8b3a62..81f101a 100644
--- a/voltha/adapters/brcm_openomci_onu/omci/brcm_vlan_filter_task.py
+++ b/voltha/adapters/brcm_openomci_onu/omci/brcm_vlan_filter_task.py
@@ -200,7 +200,8 @@
         failed_mask = omci_msg.get('failed_attributes_mask', 'n/a')
         unsupported_mask = omci_msg.get('unsupported_attributes_mask', 'n/a')
 
-        self.log.debug("OMCI Result:", operation, omci_msg=omci_msg, status=status, error_mask=error_mask,
+        self.log.debug("OMCI Result: %s", operation, omci_msg=omci_msg,
+                       status=status, error_mask=error_mask,
                        failed_mask=failed_mask, unsupported_mask=unsupported_mask)
 
         if status == RC.Success:
diff --git a/voltha/adapters/brcm_openomci_onu/onu_gem_port.py b/voltha/adapters/brcm_openomci_onu/onu_gem_port.py
index ae729da..51c3468 100644
--- a/voltha/adapters/brcm_openomci_onu/onu_gem_port.py
+++ b/voltha/adapters/brcm_openomci_onu/onu_gem_port.py
@@ -180,7 +180,7 @@
                     #upstream_tm=0x100
             )
             frame = msg.create()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci.send(frame)
             self.check_status_and_state(results, 'create-gem-port-network-ctp')
 
@@ -200,7 +200,7 @@
                 gal_profile_pointer=gal_enet_profile_entity_id
             )
             frame = msg.create()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci.send(frame)
             self.check_status_and_state(results, 'create-gem-interworking-tp')
 
@@ -218,7 +218,7 @@
         try:
             msg = GemInterworkingTpFrame(self.entity_id)
             frame = msg.delete()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci.send(frame)
             self.check_status_and_state(results, 'delete-gem-port-network-ctp')
         except Exception as e:
@@ -228,7 +228,7 @@
         try:
             msg = GemPortNetworkCtpFrame(self.entity_id)
             frame = msg.delete()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci.send(frame)
             self.check_status_and_state(results, 'delete-gem-interworking-tp')
         except Exception as e:
@@ -246,7 +246,8 @@
         failed_mask = omci_msg.get('failed_attributes_mask', 'n/a')
         unsupported_mask = omci_msg.get('unsupported_attributes_mask', 'n/a')
 
-        self.log.debug("OMCI Result:", operation, omci_msg=omci_msg, status=status, error_mask=error_mask,
+        self.log.debug("OMCI Result: %s", operation, omci_msg=omci_msg,
+                       status=status, error_mask=error_mask,
                        failed_mask=failed_mask, unsupported_mask=unsupported_mask)
 
         if status == RC.Success:
diff --git a/voltha/adapters/brcm_openomci_onu/onu_tcont.py b/voltha/adapters/brcm_openomci_onu/onu_tcont.py
index b353a7b..16414cd 100644
--- a/voltha/adapters/brcm_openomci_onu/onu_tcont.py
+++ b/voltha/adapters/brcm_openomci_onu/onu_tcont.py
@@ -66,7 +66,7 @@
         try:
             msg = TcontFrame(self.entity_id, self.alloc_id)
             frame = msg.set()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci.send(frame)
             self.check_status_and_state(results, 'set-tcont')
 
@@ -87,7 +87,7 @@
         try:
             msg = TcontFrame(self.entity_id, 0xFFFF)
             frame = msg.set()
-            self.log.debug('openomci-msg', msg=msg)
+            self.log.debug('openomci-msg', omci_msg=msg)
             results = yield omci.send(frame)
             self.check_status_and_state(results, 'delete-tcont')
 
@@ -106,7 +106,8 @@
         failed_mask = omci_msg.get('failed_attributes_mask', 'n/a')
         unsupported_mask = omci_msg.get('unsupported_attributes_mask', 'n/a')
 
-        self.log.debug("OMCI Result:", operation, omci_msg=omci_msg, status=status, error_mask=error_mask,
+        self.log.debug("OMCI Result: %s", operation, omci_msg=omci_msg,
+                       status=status, error_mask=error_mask,
                        failed_mask=failed_mask, unsupported_mask=unsupported_mask)
 
         if status == RC.Success:
diff --git a/voltha/coordinator.py b/voltha/coordinator.py
index aaf8f77..61fee26 100644
--- a/voltha/coordinator.py
+++ b/voltha/coordinator.py
@@ -595,7 +595,7 @@
                 log.debug('result-received', result=result)
                 returnValue((False, result))
             except TimeOutError as e:
-                log.debug('timeout-or-no-data-change', key=key)
+                log.debug('timeout-or-no-data-change', consul_key=key)
             except Exception as e:
                 log.exception('exception', e=e)
         except Exception as e:
diff --git a/voltha/coordinator_etcd.py b/voltha/coordinator_etcd.py
index 99baacc..9550744 100644
--- a/voltha/coordinator_etcd.py
+++ b/voltha/coordinator_etcd.py
@@ -612,7 +612,7 @@
                 log.debug('result-received', result=result)
                 returnValue((False, result))
             except TimeOutError as e:
-                log.debug('timeout-or-no-data-change', key=key)
+                log.debug('timeout-or-no-data-change', etcd_key=key)
             except Exception as e:
                 log.exception('exception', e=e)
         except Exception as e:
diff --git a/voltha/extensions/omci/state_machines/performance_intervals.py b/voltha/extensions/omci/state_machines/performance_intervals.py
index 0b8d9c4..73e145b 100644
--- a/voltha/extensions/omci/state_machines/performance_intervals.py
+++ b/voltha/extensions/omci/state_machines/performance_intervals.py
@@ -584,7 +584,8 @@
             class_id = key[0]
             entity_id = key[1]
 
-            self.log.debug("in-enter-collect-data", key=key, retries=self._pm_me_collect_retries[key])
+            self.log.debug("in-enter-collect-data", data_key=key,
+                           retries=self._pm_me_collect_retries[key])
 
             # Collect the data ?
             if self._pm_me_collect_retries[key] > 0:
@@ -606,12 +607,13 @@
 
                 # start the task
                 if key in self._pm_me_extended_info:
-                    self.log.debug('collect-extended-info-found', key=key, extended_info=self._pm_me_extended_info[key])
+                    self.log.debug('collect-extended-info-found', data_key=key,
+                                   extended_info=self._pm_me_extended_info[key])
                     parent_class_id = self._pm_me_extended_info[key][0]
                     parent_entity_id = self._pm_me_extended_info[key][1]
                     upstream = self._pm_me_extended_info[key][2]
                 else:
-                    self.log.debug('collect-extended-info-not-found', key=key)
+                    self.log.debug('collect-extended-info-not-found', data_key=key)
                     parent_class_id = None
                     parent_entity_id = None
                     upstream = None