VOL-931 Adding statistics collection trigger
Change-Id: Ic3cf2876209a839584d8cd2658ab0cd7124b3bc8
diff --git a/voltha/adapters/openolt/openolt.py b/voltha/adapters/openolt/openolt.py
index 219d5d4..6dde34a 100644
--- a/voltha/adapters/openolt/openolt.py
+++ b/voltha/adapters/openolt/openolt.py
@@ -352,3 +352,14 @@
log.error('Could not find matching handler',
looking_for_device_id =parent_device_id,
available_handlers=self.devices.keys())
+
+ # This is currently not part of the Iadapter interface
+ def collect_stats(self, device_id):
+ log.info('collect_stats', device_id=device_id)
+ handler= self.devices[device_id]
+ if handler is not None:
+ handler.trigger_statistics_collection()
+ else:
+ log.error('Could not find matching handler',
+ looking_for_device_id=device_id,
+ available_handlers=self.devices.keys())
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index d607b70..8bcf59a 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -1078,3 +1078,12 @@
else:
self.log.info('device rebooted')
+ def trigger_statistics_collection(self):
+ try:
+ self.stub.CollectStatistics(openolt_pb2.Empty())
+ except Exception as e:
+ self.log.error('Error while triggering statistics collection',
+ error=e)
+ else:
+ self.log.info('statistics requested')
+
diff --git a/voltha/adapters/openolt/protos/openolt.proto b/voltha/adapters/openolt/protos/openolt.proto
index 8187faf..45ca664 100644
--- a/voltha/adapters/openolt/protos/openolt.proto
+++ b/voltha/adapters/openolt/protos/openolt.proto
@@ -123,6 +123,13 @@
};
}
+ rpc CollectStatistics(Empty) returns (Empty) {
+ option (google.api.http) = {
+ post: "/v1/CollectStatistics"
+ body: "*"
+ };
+ }
+
rpc EnableIndication(Empty) returns (stream Indication) {}
}