summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWataru Ishida <ishida.wataru@lab.ntt.co.jp>2016-10-04 05:12:09 +0000
committerWataru Ishida <ishida.wataru@lab.ntt.co.jp>2016-10-04 05:46:26 +0000
commitebd7306fd6d996cdc95cf3f73cc728477f63d780 (patch)
treeb85ebe54f98bef2380d4ff81453c74e1ec01dea3
parent7c8b1973e724f36ca17dd35826d0a62989635200 (diff)
test: add test for vrf route injecting
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
-rw-r--r--test/lib/gobgp.py2
-rw-r--r--test/scenario_test/zapi_v3_test.py22
2 files changed, 21 insertions, 3 deletions
diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py
index 77cd765e..b8e669dd 100644
--- a/test/lib/gobgp.py
+++ b/test/lib/gobgp.py
@@ -248,7 +248,7 @@ class GoBGPContainer(BGPContainer):
},
}}
- if self.zebra:
+ if self.zebra and self.zapi_version == 2:
config['global']['use-multiple-paths'] = {'config': {'enabled': True}}
for peer, info in self.peers.iteritems():
diff --git a/test/scenario_test/zapi_v3_test.py b/test/scenario_test/zapi_v3_test.py
index 6e6f9b86..28834cfb 100644
--- a/test/scenario_test/zapi_v3_test.py
+++ b/test/scenario_test/zapi_v3_test.py
@@ -46,8 +46,8 @@ class GoBGPTestBase(unittest.TestCase):
time.sleep(initial_wait_time)
- g1.add_peer(g2)
- g2.add_peer(g1)
+ g1.add_peer(g2, vpn=True)
+ g2.add_peer(g1, vpn=True)
cls.g1 = g1
cls.g2 = g2
@@ -71,6 +71,24 @@ class GoBGPTestBase(unittest.TestCase):
self.g2.local("vtysh -c 'en' -c 'conf t' -c 'vrf 1 netns ns01'")
self.g2.local("vtysh -c 'en' -c 'conf t' -c 'vrf 2 netns ns02'")
+ self.g1.local("gobgp vrf add vrf01 id 1 rd 1:1 rt both 1:1")
+ self.g1.local("gobgp vrf add vrf02 id 2 rd 2:2 rt both 2:2")
+ self.g2.local("gobgp vrf add vrf01 id 1 rd 1:1 rt both 1:1")
+ self.g2.local("gobgp vrf add vrf02 id 2 rd 2:2 rt both 2:2")
+
+ self.g1.local("gobgp vrf vrf01 rib add 10.0.0.0/24 nexthop 127.0.0.1")
+ self.g1.local("gobgp vrf vrf02 rib add 20.0.0.0/24 nexthop 127.0.0.1")
+
+ time.sleep(2)
+
+ lines = self.g2.local("ip netns exec ns01 ip r", capture=True).split('\n')
+ self.assertTrue(len(lines) == 1)
+ self.assertTrue(lines[0].split(' ')[0] == '10.0.0.0/24')
+
+ lines = self.g2.local("ip netns exec ns02 ip r", capture=True).split('\n')
+ self.assertTrue(len(lines) == 1)
+ self.assertTrue(lines[0].split(' ')[0] == '20.0.0.0/24')
+
if __name__ == '__main__':
if os.geteuid() is not 0: