summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2014-02-26 16:26:13 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-02-27 13:59:40 +0900
commit4e60ce00cb27ad27f07ec29d652cddb8407124ad (patch)
treec35b9faf64a2f9cde59c945098a92bed666e47fe
parent808a1bfdf78e6582f2fa1097ba71c637042583cf (diff)
of14: Add port stats optical property
Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/ofproto/ofproto_v1_4_parser.py33
1 files changed, 33 insertions, 0 deletions
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,