diff options
Diffstat (limited to 'test/lib')
-rw-r--r-- | test/lib/base.py | 14 | ||||
-rw-r--r-- | test/lib/exabgp.py | 10 | ||||
-rw-r--r-- | test/lib/gobgp.py | 7 | ||||
-rw-r--r-- | test/lib/quagga.py | 3 |
4 files changed, 25 insertions, 9 deletions
diff --git a/test/lib/base.py b/test/lib/base.py index 0421e9d7..6306ccf6 100644 --- a/test/lib/base.py +++ b/test/lib/base.py @@ -311,7 +311,7 @@ class BGPContainer(Container): flowspec=False, bridge='', reload_config=True, as2=False, graceful_restart=None, local_as=None, prefix_limit=None, v6=False, llgr=None, vrf='', interface='', allow_as_in=0, - remove_private_as=None, replace_peer_as=False): + remove_private_as=None, replace_peer_as=False, addpath=False): neigh_addr = '' local_addr = '' it = itertools.product(self.ip_addrs, peer.ip_addrs) @@ -355,7 +355,8 @@ class BGPContainer(Container): 'vrf': vrf, 'allow_as_in': allow_as_in, 'remove_private_as': remove_private_as, - 'replace_peer_as': replace_peer_as} + 'replace_peer_as': replace_peer_as, + 'addpath': addpath} if self.is_running and reload_config: self.create_config() self.reload_config() @@ -378,8 +379,10 @@ class BGPContainer(Container): def add_route(self, route, rf='ipv4', attribute=None, aspath=None, community=None, med=None, extendedcommunity=None, nexthop=None, matchs=None, thens=None, - local_pref=None, reload_config=True): - self.routes[route] = {'prefix': route, + local_pref=None, identifier=None, reload_config=True): + if route not in self.routes: + self.routes[route] = [] + self.routes[route].append({'prefix': route, 'rf': rf, 'attr': attribute, 'next-hop': nexthop, @@ -388,8 +391,9 @@ class BGPContainer(Container): 'med': med, 'local-pref': local_pref, 'extended-community': extendedcommunity, + 'identifier': identifier, 'matchs': matchs, - 'thens': thens} + 'thens': thens}) if self.is_running and reload_config: self.create_config() self.reload_config() diff --git a/test/lib/exabgp.py b/test/lib/exabgp.py index dbf8f023..efc39ac1 100644 --- a/test/lib/exabgp.py +++ b/test/lib/exabgp.py @@ -19,6 +19,7 @@ import time from fabric import colors from fabric.api import local +from itertools import chain from lib.base import ( BGPContainer, @@ -92,7 +93,10 @@ class ExaBGPContainer(BGPContainer): if info['passive']: cmd << ' passive;' - routes = [r for r in self.routes.values() if r['rf'] == 'ipv4' or r['rf'] == 'ipv6'] + if info['addpath']: + cmd << ' add-path send/receive;' + + routes = [r for r in chain.from_iterable(self.routes.itervalues()) if r['rf'] == 'ipv4' or r['rf'] == 'ipv6'] if len(routes) > 0: cmd << ' static {' @@ -114,11 +118,13 @@ class ExaBGPContainer(BGPContainer): r << 'extended-community [{0}]'.format(route['extended-community']) if route['attr']: r << 'attribute [ {0} ]'.format(route['attr']) + if route['identifier']: + r << 'path-information {0}'.format(route['identifier']) cmd << '{0};'.format(str(r)) cmd << ' }' - routes = [r for r in self.routes.itervalues() if 'flowspec' in r['rf']] + routes = [r for r in chain.from_iterable(self.routes.itervalues()) if 'flowspec' in r['rf']] if len(routes) > 0: cmd << ' flow {' for route in routes: diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py index 26847c77..a54428e3 100644 --- a/test/lib/gobgp.py +++ b/test/lib/gobgp.py @@ -398,6 +398,11 @@ class GoBGPContainer(BGPContainer): n['route-reflector'] = {'config': {'route-reflector-client': True, 'route-reflector-cluster-id': cluster_id}} + if info['addpath']: + n['add-paths'] = {'config' : {'receive': True, + 'send-max': 16}} + + if len(info.get('default-policy', [])) + len(info.get('policies', [])) > 0: n['apply-policy'] = {'config': {}} @@ -495,7 +500,7 @@ class GoBGPContainer(BGPContainer): for d in daemon: cmd = '/usr/bin/pkill {0} -SIGHUP'.format(d) self.local(cmd) - for v in self.routes.itervalues(): + for v in chain.from_iterable(self.routes.itervalues()): if v['rf'] == 'ipv4' or v['rf'] == 'ipv6': r = CmdBuffer(' ') r << 'gobgp global -a {0}'.format(v['rf']) diff --git a/test/lib/quagga.py b/test/lib/quagga.py index e7b9f9bf..d37c2dbc 100644 --- a/test/lib/quagga.py +++ b/test/lib/quagga.py @@ -17,6 +17,7 @@ from __future__ import absolute_import from fabric import colors from fabric.utils import indent +from itertools import chain import netaddr from lib.base import ( @@ -191,7 +192,7 @@ class QuaggaBGPContainer(BGPContainer): c << 'neighbor {0} activate'.format(n_addr) c << 'exit-address-family' - for route in self.routes.itervalues(): + for route in chain.from_iterable(self.routes.itervalues()): if route['rf'] == 'ipv4': c << 'network {0}'.format(route['prefix']) elif route['rf'] == 'ipv6': |