VOL-804 basic performance metrics

Collect port and flow stats and update the object in Voltha and the OpenFlow equivalent

Change-Id: Ib7c724a5f845ab4fad0147e8b189790ff111ff3d
diff --git a/voltha/core/device_agent.py b/voltha/core/device_agent.py
index 5ed9115..885a139 100644
--- a/voltha/core/device_agent.py
+++ b/voltha/core/device_agent.py
@@ -466,13 +466,15 @@
         self.log.debug('flow-table-updated',
                        logical_device_id=self.last_data.id, flows=flows)
 
-        # if device accepts non-bulk flow update, lets just call that first
-        if self.device_type.accepts_add_remove_flow_updates:
-            if (len(self.flow_changes.to_remove.items) == 0) and (len(
-                    self.flow_changes.to_add.items) == 0):
-                self.log.debug('no-flow-update-required',
-                               logical_device_id=self.last_data.id)
-            else:
+        if (len(self.flow_changes.to_remove.items) == 0) and (len(
+                self.flow_changes.to_add.items) == 0):
+            self.log.debug('no-flow-update-required',
+                           logical_device_id=self.last_data.id)
+        else:
+
+            # if device accepts non-bulk flow update, lets just call that first
+            if self.device_type.accepts_add_remove_flow_updates:
+
                 try:
                     yield self.adapter_agent.update_flows_incrementally(
                         device=self.last_data,
@@ -482,18 +484,18 @@
                 except Exception as e:
                     self.log.exception("Failure-updating-flows", e=e)
 
-        # if device accepts bulk flow update, lets just call that
-        elif self.device_type.accepts_bulk_flow_update:
-            self.log.debug('invoking bulk')
-            groups = self.groups_proxy.get('/')  # gather flow groups
-            yield self.adapter_agent.update_flows_bulk(
-                device=self.last_data,
-                flows=flows,
-                groups=groups)
-            # add ability to notify called when an flow update completes
-            # see https://jira.opencord.org/browse/CORD-839
-        else:
-            raise NotImplementedError()
+            # if device accepts bulk flow update, lets just call that
+            elif self.device_type.accepts_bulk_flow_update:
+                self.log.debug('invoking bulk')
+                groups = self.groups_proxy.get('/')  # gather flow groups
+                yield self.adapter_agent.update_flows_bulk(
+                    device=self.last_data,
+                    flows=flows,
+                    groups=groups)
+                # add ability to notify called when an flow update completes
+                # see https://jira.opencord.org/browse/CORD-839
+            else:
+                raise NotImplementedError()
 
     ## <======================= GROUP TABLE UPDATE HANDLING ===================