diff options
author | Naoto Hanaue <hanaue.naoto@po.ntts.co.jp> | 2015-09-17 20:45:24 +0900 |
---|---|---|
committer | Naoto Hanaue <hanaue.naoto@po.ntts.co.jp> | 2015-09-18 19:47:41 +0900 |
commit | c47286abeef75bd6c46db11060d9ba5bf185ad01 (patch) | |
tree | 8c5f9c34d7d8e160c89f02c27154a15cf7edda4b /test/scenario_test/lib | |
parent | d53614ec889547db37573cef336a062895605047 (diff) |
scenario_test: fix bug of bgp_zebra_test
container was wrong to check whether the reachable in the test.
thus, modified to check the reachability between the correct container
and implemented modifications of the logic associated with the above.
Diffstat (limited to 'test/scenario_test/lib')
-rw-r--r-- | test/scenario_test/lib/base.py | 9 | ||||
-rw-r--r-- | test/scenario_test/lib/quagga.py | 9 |
2 files changed, 15 insertions, 3 deletions
diff --git a/test/scenario_test/lib/base.py b/test/scenario_test/lib/base.py index 79e97521..8a81c245 100644 --- a/test/scenario_test/lib/base.py +++ b/test/scenario_test/lib/base.py @@ -327,14 +327,13 @@ class BGPContainer(Container): ping_cmd = 'ping6' else: raise Exception('unsupported route family: {0}'.format(version)) - cmd = '/bin/{0} -c 1 -w 1 {1}'.format(ping_cmd, addr) - + cmd = '/bin/bash -c "/bin/{0} -c 1 -w 1 {1} | xargs echo"'.format(ping_cmd, addr) interval = 1 count = 0 while True: res = self.local(cmd, capture=True) print colors.yellow(res) - if '0% packet loss' in res: + if '1 packets received' in res and '0% packet loss': break time.sleep(interval) count += interval @@ -363,6 +362,10 @@ class BGPContainer(Container): cmd = '/sbin/ip route add {0} via {1}'.format(network, next_hop) self.local(cmd) + def set_ipv6_forward(self): + cmd = 'sysctl -w net.ipv6.conf.all.forwarding=1' + self.local(cmd) + def create_config(self): raise Exception('implement create_config() method') diff --git a/test/scenario_test/lib/quagga.py b/test/scenario_test/lib/quagga.py index b881f6ed..3cd29618 100644 --- a/test/scenario_test/lib/quagga.py +++ b/test/scenario_test/lib/quagga.py @@ -158,12 +158,14 @@ class QuaggaBGPContainer(BGPContainer): self._create_config_zebra() def _create_config_bgp(self): + c = CmdBuffer() c << 'hostname bgpd' c << 'password zebra' c << 'router bgp {0}'.format(self.asn) c << 'bgp router-id {0}'.format(self.router_id) + version = 4 for peer, info in self.peers.iteritems(): version = netaddr.IPNetwork(info['neigh_addr']).version n_addr = info['neigh_addr'].split('/')[0] @@ -192,6 +194,13 @@ class QuaggaBGPContainer(BGPContainer): else: raise Exception('unsupported route faily: {0}'.format(route['rf'])) + if self.zebra: + if version == 6: + c << 'address-family ipv6 unicast' + c << 'redistribute connected' + c << 'exit-address-family' + else: + c << 'redistribute connected' for name, policy in self.policies.iteritems(): c << 'access-list {0} {1} {2}'.format(name, policy['type'], |