summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorNasato Goto <7310510@gmail.com>2018-08-27 19:44:15 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-08-28 08:49:11 +0900
commite7929016918bb27263a3cb7548e9c45bb109a308 (patch)
tree620badd7e31fcb50a81bb160bcbe90f542c36a5e /test
parentacfc9ad7f9853ccd7b8a1c442f644e71434d5f9c (diff)
test: Fix bridge methos and relative scenario test
This patch fix the logic of addif methos of Bridge class. IP address information will be registerd according to the IP version of bridge. This change lead the fixing of one of scenario test, "bgp_zebra_test.py".
Diffstat (limited to 'test')
-rw-r--r--test/lib/base.py5
-rw-r--r--test/scenario_test/bgp_zebra_test.py10
2 files changed, 9 insertions, 6 deletions
diff --git a/test/lib/base.py b/test/lib/base.py
index 6fe1a50c..22ffcdee 100644
--- a/test/lib/base.py
+++ b/test/lib/base.py
@@ -232,10 +232,13 @@ class Bridge(object):
local("docker network connect {0} {1}".format(self.name, ctn.docker_name()))
i = [x for x in Client(timeout=60, version='auto').inspect_network(self.id)['Containers'].values() if x['Name'] == ctn.docker_name()][0]
if self.subnet.version == 4:
+ eth = 'eth{0}'.format(len(ctn.ip_addrs))
addr = i['IPv4Address']
+ ctn.ip_addrs.append((eth, addr, self.name))
else:
+ eth = 'eth{0}'.format(len(ctn.ip6_addrs))
addr = i['IPv6Address']
- ctn.ip_addrs.append(('eth1', addr, self.name))
+ ctn.ip6_addrs.append((eth, addr, self.name))
def delete(self):
try_several_times(lambda: local("docker network rm {0}".format(self.name)))
diff --git a/test/scenario_test/bgp_zebra_test.py b/test/scenario_test/bgp_zebra_test.py
index ae22866d..5b40c109 100644
--- a/test/scenario_test/bgp_zebra_test.py
+++ b/test/scenario_test/bgp_zebra_test.py
@@ -173,8 +173,8 @@ class GoBGPTestBase(unittest.TestCase):
[self.bridges['br02_v6'].addif(ctn) for ctn in [g1, q1]]
[self.bridges['br03_v6'].addif(ctn) for ctn in [q1, o2]]
- g1.add_peer(q1, bridge=self.bridges['br02_v6'].name)
- q1.add_peer(g1, bridge=self.bridges['br02_v6'].name)
+ g1.add_peer(q1, bridge=self.bridges['br02_v6'].name, v6=True)
+ q1.add_peer(g1, bridge=self.bridges['br02_v6'].name, v6=True)
g1.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=q1)
@@ -190,15 +190,15 @@ class GoBGPTestBase(unittest.TestCase):
o2 = self.others['ipv6'][1]
# set o1's default gateway as g1
- g1_addr = g1.ip_addrs[1][1].split('/')[0]
+ g1_addr = [a for a in g1.ip6_addrs if a[2] == self.bridges['br01_v6'].name][0][1].split('/')[0]
o1.add_static_route(self.bridges['br03_v6'].subnet, g1_addr)
# set o2's default gateway as q1
- q1_addr = q1.ip_addrs[2][1].split('/')[0]
+ q1_addr = [a for a in q1.ip6_addrs if a[2] == self.bridges['br03_v6'].name][0][1].split('/')[0]
o2.add_static_route(self.bridges['br01_v6'].subnet, q1_addr)
# test reachability between o1 and o2
- addrs = [e[1] for e in o2.ip_addrs if 'br03_v6' in e[2]]
+ addrs = [e[1] for e in o2.ip6_addrs if 'br03_v6' in e[2]]
self.assertTrue(len(addrs) == 1)
o2_addr = addrs[0]
o1.get_reachability(o2_addr)