summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2017-09-05 10:13:34 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-09-17 13:36:26 +0900
commitc860675a5f87a5c88cffe2b31563b358b5b34d93 (patch)
tree72396e52b80d8aa3761d9e20bdc92808bdcc5215
parent8e851711a7156f9d9565c1500551e0f619900e96 (diff)
packet/zebra: Missing bw_cls_num in InterfaceLinkParams
This patch fixes to parse the missing field of the number of unreserved bandwidth classes in Interface Link Parameters structure. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/lib/packet/zebra.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/ryu/lib/packet/zebra.py b/ryu/lib/packet/zebra.py
index 52d06059..698dd359 100644
--- a/ryu/lib/packet/zebra.py
+++ b/ryu/lib/packet/zebra.py
@@ -263,7 +263,10 @@ class InterfaceLinkParams(stringify.StringifyMixin):
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | (float) Maximum Reservable Bandwidth |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- # | (float) Unreserved Bandwidth per Class Type * MAX_CLASS_TYPE |
+ # | Number of Unreserved Bandwidth Classes (max is MAX_CLASS_TYPE)|
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | (float) Unreserved Bandwidth per Class Type |
+ # | ... repeats Number of Unreserved Bandwidth Classes times |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | Administrative group |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@@ -287,10 +290,14 @@ class InterfaceLinkParams(stringify.StringifyMixin):
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# | (float) Utilized Bandwidth |
# +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- _HEADER_FMT = '!IIff'
+ # lp_status, te_metric, max_bw, max_reserved_bw, bw_cls_num
+ _HEADER_FMT = '!IIffI'
HEADER_SIZE = struct.calcsize(_HEADER_FMT)
_REPEATED_FMT = '!f'
REPEATED_SIZE = struct.calcsize(_REPEATED_FMT)
+ # admin_group, remote_as, remote_ip,
+ # average_delay, min_delay, max_delay, delay_var,
+ # pkt_loss, residual_bw, average_bw, utilized_bw
_FOOTER_FMT = '!II4sIIIIffff'
FOOTER_SIZE = struct.calcsize(_FOOTER_FMT)
@@ -321,12 +328,14 @@ class InterfaceLinkParams(stringify.StringifyMixin):
@classmethod
def parse(cls, buf):
- (lp_status, te_metric, max_bw,
- max_reserved_bw) = struct.unpack_from(cls._HEADER_FMT, buf)
+ (lp_status, te_metric, max_bw, max_reserved_bw,
+ bw_cls_num) = struct.unpack_from(cls._HEADER_FMT, buf)
+ if MAX_CLASS_TYPE < bw_cls_num:
+ bw_cls_num = MAX_CLASS_TYPE
offset = cls.HEADER_SIZE
unreserved_bw = []
- for _ in range(MAX_CLASS_TYPE):
+ for _ in range(bw_cls_num):
(u_bw,) = struct.unpack_from(cls._REPEATED_FMT, buf, offset)
unreserved_bw.append(u_bw)
offset += cls.REPEATED_SIZE
@@ -347,7 +356,7 @@ class InterfaceLinkParams(stringify.StringifyMixin):
def serialize(self):
buf = struct.pack(
self._HEADER_FMT, self.lp_status, self.te_metric, self.max_bw,
- self.max_reserved_bw)
+ self.max_reserved_bw, len(self.unreserved_bw))
for u_bw in self.unreserved_bw:
buf += struct.pack(self._REPEATED_FMT, u_bw)