From 4e60ce00cb27ad27f07ec29d652cddb8407124ad Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Wed, 26 Feb 2014 16:26:13 +0900 Subject: [PATCH] of14: Add port stats optical property Signed-off-by: Simon Horman Signed-off-by: FUJITA Tomonori --- ryu/ofproto/ofproto_v1_4_parser.py | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/ryu/ofproto/ofproto_v1_4_parser.py b/ryu/ofproto/ofproto_v1_4_parser.py index 2ce65fbd..641c013d 100644 --- a/ryu/ofproto/ofproto_v1_4_parser.py +++ b/ryu/ofproto/ofproto_v1_4_parser.py @@ -3871,6 +3871,39 @@ class OFPPortStatsPropEthernet(StringifyMixin): return ether +@OFPPortStatsProp.register_type(ofproto.OFPPSPT_OPTICAL) +class OFPPortStatsPropOptical(StringifyMixin): + def __init__(self, type_=None, length=None, flags=None, + tx_freq_lmda=None, tx_offset=None, tx_grid_span=None, + rx_freq_lmda=None, rx_offset=None, rx_grid_span=None, + tx_pwr=None, rx_pwr=None, bias_current=None, + temperature=None): + self.type = type_ + self.length = length + self.flags = flags + self.tx_freq_lmda = tx_freq_lmda + self.tx_offset = tx_offset + self.tx_grid_span = tx_grid_span + self.rx_freq_lmda = rx_freq_lmda + self.rx_offset = rx_offset + self.rx_grid_span = rx_grid_span + self.tx_pwr = tx_pwr + self.rx_pwr = rx_pwr + self.bias_current = bias_current + self.temperature = temperature + + @classmethod + def parser(cls, buf): + optical = cls() + (optical.type, optical.length, optical.flags, + optical.tx_freq_lmda, optical.tx_offset, optical.tx_grid_span, + optical.rx_freq_lmda, optical.rx_offset, optical.rx_grid_span, + optical.tx_pwr, optical.rx_pwr, optical.bias_current, + optical.temperature) = struct.unpack_from( + ofproto.OFP_PORT_STATS_PROP_OPTICAL_PACK_STR, buf, 0) + return optical + + class OFPPortStats(StringifyMixin): def __init__(self, length=None, port_no=None, duration_sec=None, duration_nsec=None, rx_packets=None, tx_packets=None,