VOL-3789, VOL-3790: Change KPI frequency units to seconds and adopt voltha-lib-go KPI event titles (ETHERNET_NNI, PON_OLT)

Change-Id: I213601e69a9bebaf11c95cce21a03cbe6e7de36c
diff --git a/README.rst b/README.rst
index fa537f9..a7c825a 100644
--- a/README.rst
+++ b/README.rst
@@ -31,7 +31,17 @@
 +---------+------------+-----------------------------------------------+
 
 Detailed Release History
-~~~~~~~~~~~~~~~~~~~~~~~~
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+v2.7.0 (2021-01-27)
+^^^^^^^^^^^^^^^^^^^
+
+-  Changed KPI frequency units from 1/10 second to 1 second to match
+   what is implemented in the voltha-lib-go library.
+
+-  Changed KPI Event titles from "Ethernet" and "PON" to "ETHERNET_NNI"
+   and "PON_OLT" to match what is implemented in the voltha-lib-go
+   library.
 
 v0.1.0 (2019-02-01)
 ^^^^^^^^^^^^^^^^^^^
diff --git a/VERSION b/VERSION
index 35d16fb..24ba9a3 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.5.7
+2.7.0
diff --git a/pyvoltha/adapters/extensions/events/kpi/README.md b/pyvoltha/adapters/extensions/events/kpi/README.md
index 43d72bb..62c0e09 100644
--- a/pyvoltha/adapters/extensions/events/kpi/README.md
+++ b/pyvoltha/adapters/extensions/events/kpi/README.md
@@ -173,7 +173,7 @@
   "slice_data": [
     {
       "metadata": {
-        "title": "Ethernet",
+        "title": "ETHERNET_NNI",
         "ts": 1534440704.0,
         "logical_device_id": "000000139521a269",
         "device_id": "000115929ed71696",
@@ -200,7 +200,7 @@
     },
     {
       "metadata": {
-        "title": "PON",
+        "title": "PON_OLT",
         "logical_device_id": "000000139521a269",
         "device_id": "000115929ed71696",
         "serial_no": "dummy_sn2209199",
diff --git a/pyvoltha/adapters/extensions/events/kpi/adapter_pm_metrics.py b/pyvoltha/adapters/extensions/events/kpi/adapter_pm_metrics.py
index 0a34033..b743d72 100644
--- a/pyvoltha/adapters/extensions/events/kpi/adapter_pm_metrics.py
+++ b/pyvoltha/adapters/extensions/events/kpi/adapter_pm_metrics.py
@@ -30,7 +30,7 @@
     start, and stop statistics collection.
     """
     DEFAULT_FREQUENCY_KEY = 'default-collection-frequency'
-    DEFAULT_COLLECTION_FREQUENCY = 15 * 10      # 1/10ths of a second
+    DEFAULT_COLLECTION_FREQUENCY = 15          # units of a second
 
     # If the collection object has a property of the following name, it will be used
     # to retrieve the UTC Collection Timestamp (UTC seconds since epoch). If the collection
@@ -91,7 +91,7 @@
             self.lc = LoopingCall(callback)
 
         if self.default_freq > 0:
-            self.lc.start(interval=self.default_freq / 10)
+            self.lc.start(interval=self.default_freq)
 
     def stop_collector(self):
         """ Stop the collection loop"""
diff --git a/pyvoltha/adapters/extensions/events/kpi/olt/olt_pm_metrics.py b/pyvoltha/adapters/extensions/events/kpi/olt/olt_pm_metrics.py
index 5107e0f..a07e2c7 100644
--- a/pyvoltha/adapters/extensions/events/kpi/olt/olt_pm_metrics.py
+++ b/pyvoltha/adapters/extensions/events/kpi/olt/olt_pm_metrics.py
@@ -125,7 +125,7 @@
                 # Update the callback to the new frequency.
                 self.default_freq = pm_config.default_freq
                 self.lc.stop()
-                self.lc.start(interval=self.default_freq / 10)
+                self.lc.start(interval=self.default_freq)
 
             if pm_config.grouped:
                 for group in pm_config.groups:
@@ -151,7 +151,7 @@
 
         if self.grouped:
             if have_nni:
-                pm_ether_stats = PmGroupConfig(group_name='Ethernet',
+                pm_ether_stats = PmGroupConfig(group_name='ETHERNET_NNI',
                                                group_freq=self.default_freq,
                                                enabled=True)
                 self.pm_group_metrics[pm_ether_stats.group_name] = pm_ether_stats
@@ -160,7 +160,7 @@
                 pm_ether_stats = None
 
             if have_pon:
-                pm_pon_stats = PmGroupConfig(group_name='PON',
+                pm_pon_stats = PmGroupConfig(group_name='PON_OLT',
                                              group_freq=self.default_freq,
                                              enabled=True)
 
@@ -255,7 +255,7 @@
         if data is None:
             data = list()
 
-        group_name = 'Ethernet'
+        group_name = 'ETHERNET_NNI'
         if self.pm_group_metrics[group_name].enabled:
             for port in self._nni_ports:
                 group_data = self.collect_group_metrics(group_name,
@@ -266,7 +266,7 @@
                     data.append(group_data)
 
         for port in self._pon_ports:
-            group_name = 'PON'
+            group_name = 'PON_OLT'
             if self.pm_group_metrics[group_name].enabled:
                 group_data = self.collect_group_metrics(group_name,
                                                         port,
diff --git a/pyvoltha/adapters/extensions/events/kpi/onu/onu_omci_pm.py b/pyvoltha/adapters/extensions/events/kpi/onu/onu_omci_pm.py
index cfa3c7a..c137b0e 100644
--- a/pyvoltha/adapters/extensions/events/kpi/onu/onu_omci_pm.py
+++ b/pyvoltha/adapters/extensions/events/kpi/onu/onu_omci_pm.py
@@ -27,20 +27,20 @@
 
     # Metric default settings
     #
-    #  Frequency values are in 1/10ths of a second
+    #  Frequency values are in units of one second
     #
     OMCI_DEV_KEY = 'omci-onu-dev'
     OMCI_CC_GROUP_NAME = 'OMCI_CC'
     DEFAULT_OMCI_CC_ENABLED = False
-    DEFAULT_OMCI_CC_FREQUENCY = (2 * 60) * 10
+    DEFAULT_OMCI_CC_FREQUENCY = (2 * 60)
 
     OPTICAL_GROUP_NAME = 'PON_Optical'
     DEFAULT_OPTICAL_ENABLED = True
-    DEFAULT_OPTICAL_FREQUENCY = (15 * 60 * 10)
+    DEFAULT_OPTICAL_FREQUENCY = (15 * 60)
 
     UNI_STATUS_GROUP_NAME = 'UNI_Status'
     DEFAULT_UNI_STATUS_ENABLED = True
-    DEFAULT_UNI_STATUS_FREQUENCY = (15 * 60 * 10)
+    DEFAULT_UNI_STATUS_FREQUENCY = (15 * 60)
 
     def __init__(self, event_mgr, core_proxy, device_id, logical_device_id, serial_number,
                  grouped=False, freq_override=False, **kwargs):
@@ -227,7 +227,7 @@
         # and the collection interval may be more often than the group interval,
         # check and make sure these metrics are actually due at this time.
         if self.last_collect_optical_metrics:
-            elapsed_tenths = (now-self.last_collect_optical_metrics)*10
+            elapsed_tenths = now - self.last_collect_optical_metrics
             if elapsed_tenths < self.pm_group_metrics[group_name].group_freq:
                 self.log.info("collect-optical-metrics-not-time-yet", elapsed_tenths=elapsed_tenths)
                 return []
diff --git a/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_metrics.py b/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_metrics.py
index e3671f5..09eb5b2 100644
--- a/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_metrics.py
+++ b/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_metrics.py
@@ -29,12 +29,12 @@
 
     # Metric default settings
     DEFAULT_HEARTBEAT_ENABLED = False
-    DEFAULT_HEARTBEAT_FREQUENCY = 1200  # 1/10ths of a second
+    DEFAULT_HEARTBEAT_FREQUENCY = 12  # Units of 1 second
     #
     # Currently only a single KPI metrics collection occurs (individual group
     # frequency not supported). The next value defines this single frequency until
     # the KPI shared library supports individual collection.
-    DEFAULT_ONU_COLLECTION_FREQUENCY = 60 * 10      # 1 minute
+    DEFAULT_ONU_COLLECTION_FREQUENCY = 60      # 1 minute
 
     def __init__(self, event_mgr, core_proxy, device_id, logical_device_id, serial_number,
                  grouped=False, freq_override=False, **kwargs):