summaryrefslogtreecommitdiffhomepage
path: root/ryu/tests/unit/packet/test_bgp.py
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2016-11-22 11:20:22 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-12-10 14:57:49 +0900
commit9e5f9d9d378772679da1e7e01cce3a8e1dcbbf40 (patch)
treef7960077700ba36c3065db57c80f092f176f2225 /ryu/tests/unit/packet/test_bgp.py
parentad5ce12e706193c93c2c8acaafeaa5b1c64f0f17 (diff)
packet/bgp: Support multiple next_hop in BGPPathAttributeMpReachNLRI
In case of the IPv6 address family in MP-BGP, NLRI might has multipule next_hop addresses (e.g., one is global unicast address and the other is link local unicast address). This patch fixes to support multipule next_hop addresses in MP-BGP NLRIs. For the backward compatibility, this patch make it to stor the first next_hop address as next_hop attribute and all next_hop addresses as next_hop_list. Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'ryu/tests/unit/packet/test_bgp.py')
-rw-r--r--ryu/tests/unit/packet/test_bgp.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/ryu/tests/unit/packet/test_bgp.py b/ryu/tests/unit/packet/test_bgp.py
index 760e01b7..6c764b67 100644
--- a/ryu/tests/unit/packet/test_bgp.py
+++ b/ryu/tests/unit/packet/test_bgp.py
@@ -115,6 +115,17 @@ class Test_bgp(unittest.TestCase):
mp_nlri2 = [
bgp.LabelledIPAddrPrefix(24, '192.168.0.0', labels=[1, 2, 3])
]
+ mp_nlri_v6 = [
+ bgp.LabelledVPNIP6AddrPrefix(64, '2001:db8:1111::',
+ route_dist='200:200',
+ labels=[1, 2, 3]),
+ bgp.LabelledVPNIP6AddrPrefix(64, '2001:db8:2222::',
+ route_dist='10.0.0.1:10000',
+ labels=[5, 6, 7, 8]),
+ ]
+ mp_nlri2_v6 = [
+ bgp.LabelledIP6AddrPrefix(64, '2001:db8:3333::', labels=[1, 2, 3])
+ ]
communities = [
bgp.BGP_COMMUNITY_NO_EXPORT,
bgp.BGP_COMMUNITY_NO_ADVERTISE,
@@ -191,6 +202,13 @@ class Test_bgp(unittest.TestCase):
bgp.BGPPathAttributeMpReachNLRI(afi=afi.IP, safi=safi.MPLS_LABEL,
next_hop='1.1.1.1',
nlri=mp_nlri2),
+ bgp.BGPPathAttributeMpReachNLRI(afi=afi.IP6, safi=safi.MPLS_VPN,
+ next_hop=['2001:db8::1'],
+ nlri=mp_nlri_v6),
+ bgp.BGPPathAttributeMpReachNLRI(afi=afi.IP6, safi=safi.MPLS_LABEL,
+ next_hop=['2001:db8::1',
+ 'fe80::1'],
+ nlri=mp_nlri2_v6),
bgp.BGPPathAttributeMpUnreachNLRI(afi=afi.IP, safi=safi.MPLS_VPN,
withdrawn_routes=mp_nlri),
bgp.BGPPathAttributeUnknown(flags=0, type_=100, value=300 * b'bar')
@@ -315,6 +333,20 @@ class Test_bgp(unittest.TestCase):
route_dist='10.0.0.1:10000',
labels=[5, 6, 7, 8]),
]
+ mp_nlri2 = [
+ bgp.LabelledIPAddrPrefix(24, '192.168.0.0', labels=[1, 2, 3])
+ ]
+ mp_nlri_v6 = [
+ bgp.LabelledVPNIP6AddrPrefix(64, '2001:db8:1111::',
+ route_dist='200:200',
+ labels=[1, 2, 3]),
+ bgp.LabelledVPNIP6AddrPrefix(64, '2001:db8:2222::',
+ route_dist='10.0.0.1:10000',
+ labels=[5, 6, 7, 8]),
+ ]
+ mp_nlri2_v6 = [
+ bgp.LabelledIP6AddrPrefix(64, '2001:db8:3333::', labels=[1, 2, 3])
+ ]
communities = [
bgp.BGP_COMMUNITY_NO_EXPORT,
bgp.BGP_COMMUNITY_NO_ADVERTISE,
@@ -386,6 +418,16 @@ class Test_bgp(unittest.TestCase):
bgp.BGPPathAttributeMpReachNLRI(afi=afi.IP, safi=safi.MPLS_VPN,
next_hop='1.1.1.1',
nlri=mp_nlri),
+ bgp.BGPPathAttributeMpReachNLRI(afi=afi.IP, safi=safi.MPLS_LABEL,
+ next_hop='1.1.1.1',
+ nlri=mp_nlri2),
+ bgp.BGPPathAttributeMpReachNLRI(afi=afi.IP6, safi=safi.MPLS_VPN,
+ next_hop=['2001:db8::1'],
+ nlri=mp_nlri_v6),
+ bgp.BGPPathAttributeMpReachNLRI(afi=afi.IP6, safi=safi.MPLS_LABEL,
+ next_hop=['2001:db8::1',
+ 'fe80::1'],
+ nlri=mp_nlri2_v6),
bgp.BGPPathAttributeMpUnreachNLRI(afi=afi.IP, safi=safi.MPLS_VPN,
withdrawn_routes=mp_nlri),
bgp.BGPPathAttributeUnknown(flags=0, type_=100, value=300 * b'bar')