VOL-804 ports and flows statistics hooks
Change-Id: Ieb4989d46e0966b966459e0fbfbeb91d0b8f72d3
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index 5082552..4244063 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -149,6 +149,14 @@
reactor.callFromThread(self.omci_indication, ind.omci_ind)
elif ind.HasField('pkt_ind'):
reactor.callFromThread(self.packet_indication, ind.pkt_ind)
+ elif ind.HasField('port_stats'):
+ reactor.callFromThread(self.port_statistics_indication,
+ ind.port_stats)
+ elif ind.HasField('flow_stats'):
+ reactor.callFromThread(self.flow_statistics_indication,
+ ind.flow_stats)
+ else:
+ self.log.warn('unknown indication type')
self.log.debug('stopping-indications-thread', device_id=self.device_id)
@@ -655,6 +663,16 @@
self.log.debug('stopping-heartbeat-thread', device_id=self.device_id)
+ def port_statistics_indication(self, port_stats):
+ # TODO: send to kafka
+ # TODO : update ONOS counters
+ self.log.info('port-stats-collected', stats=port_stats)
+
+ def flow_statistics_indication(self, flow_stats):
+ # TODO: send to kafka
+ # TODO : update ONOS counters
+ self.log.info('flow-stats-collected', stats=flow_stats)
+
def packet_out(self, egress_port, msg):
pkt = Ether(msg)
self.log.info('packet out', egress_port=egress_port,
diff --git a/voltha/adapters/openolt/protos/openolt.proto b/voltha/adapters/openolt/protos/openolt.proto
index 069a7bc..515bd51 100644
--- a/voltha/adapters/openolt/protos/openolt.proto
+++ b/voltha/adapters/openolt/protos/openolt.proto
@@ -72,6 +72,8 @@
OnuIndication onu_ind = 5;
OmciIndication omci_ind = 6;
PacketIndication pkt_ind = 7;
+ PortStatistics port_stats = 8;
+ FlowStatistics flow_stats = 9;
}
}
@@ -193,4 +195,32 @@
bytes vendor_specific = 2;
}
+message PortStatistics {
+ fixed32 intf_id = 1;
+ fixed64 rx_bytes = 2;
+ fixed64 rx_packets = 3;
+ fixed64 rx_ucast_packets = 4;
+ fixed64 rx_mcast_packets = 5;
+ fixed64 rx_bcast_packets = 6;
+ fixed64 rx_error_packets = 7;
+ fixed64 tx_bytes = 8;
+ fixed64 tx_packets = 9;
+ fixed64 tx_ucast_packets = 10;
+ fixed64 tx_mcast_packets = 11;
+ fixed64 tx_bcast_packets = 12;
+ fixed64 tx_error_packets = 13;
+ fixed64 rx_crc_errors = 14;
+ fixed64 bip_errors = 15;
+ fixed32 timestamp = 16;
+}
+
+message FlowStatistics {
+ fixed32 flow_id = 1;
+ fixed64 rx_bytes = 2;
+ fixed64 rx_packets = 3;
+ fixed64 tx_bytes = 8;
+ fixed64 tx_packets = 9;
+ fixed32 timestamp = 16;
+}
+
message Empty {}