diff options
author | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2017-05-05 12:30:32 -0400 |
---|---|---|
committer | Wataru Ishida <ishida.wataru@lab.ntt.co.jp> | 2017-05-10 08:15:00 +0000 |
commit | 9b9a65d410bbf35730f4970932c7688203e096b1 (patch) | |
tree | 5a539d40d6190c20341ae7e5c4827e2c0bd532e2 /test | |
parent | 1f053c25c423c79471fbe1d5fb6c618bb67409df (diff) |
*: support replace-peer-as (aka as-override)
we use the term replace-peer-as instead of as-override
since openconfig is using it.
cli
```
$ gobgp n add <neighbor-addr> as <asn> replace-peer-as
```
config
```
neighbor:
config:
peer-as: <asn>
neighbor-address: <neighbor-addr>
as-path-options:
config:
replace-peer-as: true
```
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/base.py | 5 | ||||
-rw-r--r-- | test/lib/gobgp.py | 2 | ||||
-rw-r--r-- | test/scenario_test/aspath_test.py | 15 |
3 files changed, 20 insertions, 2 deletions
diff --git a/test/lib/base.py b/test/lib/base.py index 86a339c7..907050bc 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): + remove_private_as=None, replace_peer_as=False): neigh_addr = '' local_addr = '' it = itertools.product(self.ip_addrs, peer.ip_addrs) @@ -354,7 +354,8 @@ class BGPContainer(Container): 'llgr': llgr, 'vrf': vrf, 'allow_as_in': allow_as_in, - 'remove_private_as': remove_private_as} + 'remove_private_as': remove_private_as, + 'replace_peer_as': replace_peer_as} if self.is_running and reload_config: self.create_config() self.reload_config() diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py index 92e19f07..26847c77 100644 --- a/test/lib/gobgp.py +++ b/test/lib/gobgp.py @@ -361,6 +361,8 @@ class GoBGPContainer(BGPContainer): n['as-path-options'] = {'config': {}} if info['allow_as_in'] > 0: n['as-path-options']['config']['allow-own-as'] = info['allow_as_in'] + if info['replace_peer_as']: + n['as-path-options']['config']['replace-peer-as'] = info['replace_peer_as'] if ':' in info['local_addr']: n['transport']['config']['local-address'] = info['local_addr'].split('/')[0] diff --git a/test/scenario_test/aspath_test.py b/test/scenario_test/aspath_test.py index 5539cfde..f6087c46 100644 --- a/test/scenario_test/aspath_test.py +++ b/test/scenario_test/aspath_test.py @@ -115,6 +115,21 @@ class GoBGPTestBase(unittest.TestCase): time.sleep(1) self.assertTrue(g4.get_global_rib()[0]['paths'][0]['aspath'] == [100, 100, 100, 100]) + def test_07_check_replace_peer_as(self): + g5 = GoBGPContainer(name='g5', asn=100, router_id='192.168.0.6', + ctn_image_name=parser_option.gobgp_image, + log_level=parser_option.gobgp_log_level) + time.sleep(g5.run()) + + g4 = self.ctns['g4'] + g4.add_peer(g5, replace_peer_as=True) + g5.add_peer(g4) + + g4.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=g5) + + time.sleep(1) + self.assertTrue(g5.get_global_rib()[0]['paths'][0]['aspath'] == [200, 200, 200, 200, 200]) + if __name__ == '__main__': output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True) |