Initial commit for the PM management apis and placeholders for
implementation
Amendment: Made changes recommended by reviewers with the actual
changes this time.

Change-Id: I9a0d98d456f95a0eee67614f0bec43923815537b
diff --git a/voltha/adapters/interface.py b/voltha/adapters/interface.py
index c7016d1..9aef84f 100644
--- a/voltha/adapters/interface.py
+++ b/voltha/adapters/interface.py
@@ -150,6 +150,13 @@
         :return:
         """
 
+    #def update_pm_collection(device, pm_collection_config):
+        """
+        Called every time a request is made to change pm collection behavior
+        :param device: A Voltha.Device object
+        :param pm_collection_config: A Pms
+        """
+
     def send_proxied_message(proxy_address, msg):
         """
         Forward a msg to a child device of device, addressed by the given
diff --git a/voltha/adapters/simulated_olt/simulated_olt.py b/voltha/adapters/simulated_olt/simulated_olt.py
index b5a6c3f..067ab2f 100644
--- a/voltha/adapters/simulated_olt/simulated_olt.py
+++ b/voltha/adapters/simulated_olt/simulated_olt.py
@@ -35,7 +35,8 @@
 from voltha.core.flow_decomposer import *
 from voltha.core.logical_device_agent import mac_str_to_tuple
 from voltha.protos.adapter_pb2 import Adapter, AdapterConfig
-from voltha.protos.device_pb2 import DeviceType, DeviceTypes, Device, Port
+from voltha.protos.device_pb2 import DeviceType, DeviceTypes, Device, Port, \
+PmConfigs, PmConfig, PmGroupConfig
 from voltha.protos.events_pb2 import KpiEvent, KpiEventType, MetricValuePairs
 from voltha.protos.health_pb2 import HealthStatus
 from voltha.protos.common_pb2 import LogLevel, OperStatus, ConnectStatus, \
@@ -46,6 +47,7 @@
     OFPC_GROUP_STATS, OFPC_TABLE_STATS, OFPC_FLOW_STATS
 from voltha.protos.events_pb2 import AlarmEvent, AlarmEventType, \
     AlarmEventSeverity, AlarmEventState, AlarmEventCategory
+import sys
 
 log = structlog.get_logger()
 
@@ -330,6 +332,50 @@
             oper_status=OperStatus.ACTIVE
         ))
 
+        # then shortly after, add the supported pms for the device
+        yield asleep(0.05)
+        try:
+            log.info("Setting p")
+            p = PmsConfig(
+                default_freq=150,
+                grouped=False,
+                freq_override=False)
+            p.metrics.extend([PmConfig(name='tx_64',type=PmConfig.COUNTER,
+                                       enabled=True)])
+            p.metrics.extend([PmConfig(name='tx_65_127',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='tx_128_255',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='tx_256_511',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='tx_512_1023',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='tx_1024_1518',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='tx_1519_9k',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='rx_64',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='rx_65_127',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='rx_128_255',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='rx_256_511',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='rx_512_1023',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='rx_1024_1518',
+                                       type=PmConfig.COUNTER,enabled=True)])
+            p.metrics.extend([PmConfig(name='rx_1519_9k',
+                                       type=PmConfig.COUNTER,enabled=True)])
+
+
+            #TODO Call the adapter agend to update the pm config
+            #self.adapter_agent.update_pms_config(device.id,p)
+        except:
+            e = sys.exec_info()
+            log.error("error", error=e)
+
         # then shortly after we create the logical device with one port
         # that will correspond to the NNI port
         yield asleep(0.05)
@@ -414,6 +460,12 @@
         vlan_id = seq + 100
         return vlan_id
 
+    #def update_pm_collection(self, device, pm_collection_config):
+        # This is where the metrics to be collected are configured and where
+        # the sampling frequency is set.
+        #TODO: Here.
+    #    pass
+
     def update_flows_bulk(self, device, flows, groups):
         log.debug('bulk-flow-update', device_id=device.id,
                   flows=flows, groups=groups)