diff options
Diffstat (limited to 'test/scenario_test/lib')
-rw-r--r-- | test/scenario_test/lib/base.py | 3 | ||||
-rw-r--r-- | test/scenario_test/lib/exabgp.py | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/test/scenario_test/lib/base.py b/test/scenario_test/lib/base.py index d8ab74d5..7922bbdf 100644 --- a/test/scenario_test/lib/base.py +++ b/test/scenario_test/lib/base.py @@ -272,10 +272,11 @@ class BGPContainer(Container): def add_route(self, route, rf='ipv4', attribute=None, aspath=None, community=None, med=None, extendedcommunity=None, - matchs=None, thens=None): + nexthop=None, matchs=None, thens=None): self.routes[route] = {'prefix': route, 'rf': rf, 'attr': attribute, + 'next-hop': nexthop, 'as-path': aspath, 'community': community, 'med': med, diff --git a/test/scenario_test/lib/exabgp.py b/test/scenario_test/lib/exabgp.py index f5cdd313..cf5fbc1a 100644 --- a/test/scenario_test/lib/exabgp.py +++ b/test/scenario_test/lib/exabgp.py @@ -82,7 +82,10 @@ class ExaBGPContainer(BGPContainer): cmd << ' static {' for route in routes: r = CmdBuffer(' ') - r << ' route {0} next-hop {1}'.format(route['prefix'], local_addr) + nexthop = local_addr + if route['next-hop']: + nexthop = route['next-hop'] + r << ' route {0} next-hop {1}'.format(route['prefix'], nexthop) if route['as-path']: r << 'as-path [{0}]'.format(' '.join(str(i) for i in route['as-path'])) if route['community']: @@ -92,7 +95,7 @@ class ExaBGPContainer(BGPContainer): if route['extended-community']: r << 'extended-community [{0}]'.format(route['extended-community']) if route['attr']: - r << 'attribute {0}'.format(route['attr']) + r << 'attribute [ {0} ]'.format(route['attr']) cmd << '{0};'.format(str(r)) cmd << ' }' |