diff options
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'], |