summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2017-09-05 10:13:43 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-09-17 13:37:22 +0900
commite423a1f0bc98b7a798e6d59d43a3129316037b93 (patch)
treefdd8f8c01170e19afc362713b7715a24afbc1232
parent6b48da6729870dfba7fc6dbb6c388c387696ddda (diff)
packet/zebra: Support Interface Router Advertisement messages
This patch implements the following messages on FRRouting: - FRR_ZEBRA_INTERFACE_ENABLE_RADV - FRR_ZEBRA_INTERFACE_DISABLE_RADV 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.py46
1 files changed, 44 insertions, 2 deletions
diff --git a/ryu/lib/packet/zebra.py b/ryu/lib/packet/zebra.py
index 8b84a155..d19f2035 100644
--- a/ryu/lib/packet/zebra.py
+++ b/ryu/lib/packet/zebra.py
@@ -3122,10 +3122,52 @@ class ZebraBfdClientRegister(_ZebraBfdClient):
"""
+class _ZebraInterfaceRadv(_ZebraMessageBody):
+ """
+ Base class for FRR_ZEBRA_INTERFACE_*_RADV message body.
+ """
+ # Zebra interface Router Advertisement message body:
+ # 0 1 2 3
+ # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | Interface Index |
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ # | RA Interval |
+ # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ _HEADER_FMT = '!II' # ifindex, interval
+ HEADER_SIZE = struct.calcsize(_HEADER_FMT)
+
+ def __init__(self, ifindex, interval):
+ super(_ZebraInterfaceRadv, self).__init__()
+ self.ifindex = ifindex
+ self.interval = interval
+
+ @classmethod
+ def parse(cls, buf, version=_DEFAULT_FRR_VERSION):
+ (ifindex, interval,) = struct.unpack_from(cls._HEADER_FMT, buf)
+
+ return cls(ifindex, interval)
+
+ def serialize(self, version=_DEFAULT_FRR_VERSION):
+ return struct.pack(self._HEADER_FMT, self.ifindex, self.interval)
+
+
+@_FrrZebraMessageBody.register_type(FRR_ZEBRA_INTERFACE_ENABLE_RADV)
+class ZebraInterfaceEnableRadv(_ZebraInterfaceRadv):
+ """
+ Message body class for FRR_ZEBRA_INTERFACE_ENABLE_RADV.
+ """
+
+
+@_FrrZebraMessageBody.register_type(FRR_ZEBRA_INTERFACE_DISABLE_RADV)
+class ZebraInterfaceDisableRadv(_ZebraInterfaceRadv):
+ """
+ Message body class for FRR_ZEBRA_INTERFACE_DISABLE_RADV.
+ """
+
+
# TODO:
# Implement the following messages:
-# - FRR_ZEBRA_INTERFACE_ENABLE_RADV
-# - FRR_ZEBRA_INTERFACE_DISABLE_RADV
# - FRR_ZEBRA_MPLS_LABELS_ADD
# - FRR_ZEBRA_MPLS_LABELS_DELETE