diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-11-07 19:44:59 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-11-08 05:05:36 -0800 |
commit | 2f6db55c6743cdd568f1555b91017a6f2c09695d (patch) | |
tree | f022bb9bae68b89d3a682edeb2bfcdac7005eedb /test/scenario_test/lib/quagga.py | |
parent | d53a5d11d9f3b0ee762a0510ff6608e69ed595ff (diff) |
scenario_test: test local-pref and med handling
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.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/test/scenario_test/lib/quagga.py b/test/scenario_test/lib/quagga.py index 6001d9a3..17f855a9 100644 --- a/test/scenario_test/lib/quagga.py +++ b/test/scenario_test/lib/quagga.py @@ -108,10 +108,19 @@ class QuaggaBGPContainer(BGPContainer): lines = lines[2:] # other useless lines else: raise Exception('unknown output format {0}'.format(lines)) - nexthop = lines[1].split()[0].strip() aspath = [int(asn) for asn in lines[0].split()] + nexthop = lines[1].split()[0].strip() + info = [s.strip(',') for s in lines[2].split()] + attrs = [] + if 'metric' in info: + med = info[info.index('metric') + 1] + attrs.append({'type': BGP_ATTR_TYPE_MULTI_EXIT_DISC, 'metric': int(med)}) + if 'localpref' in info: + localpref = info[info.index('localpref') + 1] + attrs.append({'type': BGP_ATTR_TYPE_LOCAL_PREF, 'value': int(localpref)}) + rib.append({'prefix': prefix, 'nexthop': nexthop, - 'aspath': aspath}) + 'aspath': aspath, 'attrs': attrs}) return rib def get_neighbor_state(self, peer): |