Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
 ryu/lib/packet/bgp.py             | 28 +++++++++++++++++++---------
 ryu/tests/unit/packet/test_bgp.py |  5 +++--
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py
index 8d8f241..1f8d539 100644
--- a/ryu/lib/packet/bgp.py
+++ b/ryu/lib/packet/bgp.py
@@ -1,5 +1,5 @@
-# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
-# Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
+# Copyright (C) 2013,2014 Nippon Telegraph and Telephone Corporation.
+# Copyright (C) 2013,2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -56,6 +56,7 @@ BGP_OPT_CAPABILITY = 2  # RFC 5492
 
 BGP_CAP_MULTIPROTOCOL = 1  # RFC 4760
 BGP_CAP_ROUTE_REFRESH = 2  # RFC 2918
+BGP_CAP_CARRYING_LABEL_INFO = 4  # RFC 3107
 BGP_CAP_FOUR_OCTET_AS_NUMBER = 65  # RFC 4893
 BGP_CAP_ENHANCED_ROUTE_REFRESH = 70  # https://tools.ietf.org/html/\
                                # draft-ietf-idr-bgp-enhanced-route-refresh-05
@@ -317,6 +318,15 @@ class _OptParamCapability(_OptParam, _TypeDisp):
         return buf + cap_value
 
 
+class _OptParamEmptyCapability(_OptParamCapability):
+    @classmethod
+    def parse_cap_value(cls, buf):
+        return {}
+
+    def serialize_cap_value(self):
+        return bytearray()
+
+
 @_OptParamCapability.register_unknown_type()
 class BGPOptParamCapabilityUnknown(_OptParamCapability):
     @classmethod
@@ -328,13 +338,8 @@ class BGPOptParamCapabilityUnknown(_OptParamCapability):
 
 
 @_OptParamCapability.register_type(BGP_CAP_ROUTE_REFRESH)
-class BGPOptParamCapabilityRouteRefresh(_OptParamCapability):
-    @classmethod
-    def parse_cap_value(cls, buf):
-        return {}
-
-    def serialize_cap_value(self):
-        return bytearray()
+class BGPOptParamCapabilityRouteRefresh(_OptParamEmptyCapability):
+    pass
 
 
 @_OptParamCapability.register_type(BGP_CAP_FOUR_OCTET_AS_NUMBER)
@@ -386,6 +391,11 @@ class 
BGPOptParamCapabilityMultiprotocol(_OptParamCapability):
         return buf
 
 
+@_OptParamCapability.register_type(BGP_CAP_CARRYING_LABEL_INFO)
+class BGPOptParamCapabilityCarryingLabelInfo(_OptParamEmptyCapability):
+    pass
+
+
 class BGPWithdrawnRoute(_IPAddrPrefix):
     pass
 
diff --git a/ryu/tests/unit/packet/test_bgp.py 
b/ryu/tests/unit/packet/test_bgp.py
index 1652ad3..0f2975d 100644
--- a/ryu/tests/unit/packet/test_bgp.py
+++ b/ryu/tests/unit/packet/test_bgp.py
@@ -1,5 +1,5 @@
-# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
-# Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
+# Copyright (C) 2013,2014 Nippon Telegraph and Telephone Corporation.
+# Copyright (C) 2013,2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -47,6 +47,7 @@ class Test_bgp(unittest.TestCase):
                      bgp.BGPOptParamCapabilityRouteRefresh(),
                      bgp.BGPOptParamCapabilityMultiprotocol(
                          afi=afi.IP, safi=safi.MPLS_VPN),
+                     bgp.BGPOptParamCapabilityCarryingLabelInfo(),
                      bgp.BGPOptParamCapabilityFourOctetAsNumber(
                          as_number=1234567),
                      bgp.BGPOptParamUnknown(type_=99, value='fuga')]
-- 
1.8.3.1


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to