summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test/lib/quagga.py
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-08-22 02:58:34 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-08-22 16:23:02 +0900
commit119137f4fdf4123fcba808d5f736eed4bb1e1968 (patch)
treeee8a25d35c015439a100482a84c8022143ea8320 /test/scenario_test/lib/quagga.py
parent0b021a22b8a8c5e7e9f9cb840c5268a77eaa6417 (diff)
test: enable parallel execution of policy test
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test/scenario_test/lib/quagga.py')
-rw-r--r--test/scenario_test/lib/quagga.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/test/scenario_test/lib/quagga.py b/test/scenario_test/lib/quagga.py
index e4de3ef1..8f2ba9a2 100644
--- a/test/scenario_test/lib/quagga.py
+++ b/test/scenario_test/lib/quagga.py
@@ -61,6 +61,7 @@ class QuaggaBGPContainer(BGPContainer):
tn.write('show bgp {0} unicast\n'.format(rf))
tn.read_until(' Network Next Hop Metric '
'LocPrf Weight Path')
+ read_next = False
for line in tn.read_until('bgpd#').split('\n'):
if line[:2] == '*>':
line = line[2:]
@@ -68,9 +69,24 @@ class QuaggaBGPContainer(BGPContainer):
if line[0] == 'i':
line = line[1:]
ibgp = True
- elems = line.split()
- rib.append({'prefix': elems[0], 'nexthop': elems[1],
- 'ibgp': ibgp})
+ elif not read_next:
+ continue
+
+ elems = line.split()
+
+ if len(elems) == 1:
+ read_next = True
+ prefix = elems[0]
+ continue
+ elif read_next:
+ nexthop = elems[0]
+ else:
+ prefix = elems[0]
+ nexthop = elems[1]
+ read_next = False
+
+ rib.append({'prefix': prefix, 'nexthop': nexthop,
+ 'ibgp': ibgp})
return rib
@@ -149,12 +165,11 @@ class QuaggaBGPContainer(BGPContainer):
c << 'no bgp default ipv4-unicast'
c << 'neighbor {0} remote-as {1}'.format(n_addr, peer.asn)
- for policy in info['policies']:
- name = policy['name']
+ for name, policy in info['policies'].iteritems():
direction = policy['direction']
c << 'neighbor {0} route-map {1} {2}'.format(n_addr, name,
direction)
- if info['passwd'] != '':
+ if info['passwd']:
c << 'neighbor {0} password {1}'.format(n_addr, info['passwd'])
if version == 6:
c << 'address-family ipv6 unicast'