diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-07-03 11:40:02 +0900 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-07-03 11:40:02 +0900 |
commit | b02f24e01213a19b92ebd96b703e0240fdf8d3ff (patch) | |
tree | a591d3d8eaa1fc437f4a0b11f5705c9e8eeb589b /test/scenario_test/lib/base.py | |
parent | c922dd575ac2c35afe3c6fb3ffea66e9b621c23e (diff) |
server: bug fix of extra as-path prepending
When gobgp originates a route, the generated route had incorrect
as-path. this patch fix this bug.
Scenario test is also added to check this.
[before]
$ gobgp neighbor global rib
Network Next Hop AS_PATH Age Attrs
*> 10.0.1.0/24 192.168.10.3 65001 00:03:20 [{Origin: IGP} {Med: 0}]
*> 10.0.2.0/24 192.168.10.4 65002 00:03:36 [{Origin: IGP} {Med: 200}]
*> 10.10.0.0/24 0.0.0.0 65000 00:03:37 [{Origin: IGP}]
$ gobgp neighbor 192.168.10.5 adj-out
Network Next Hop AS_PATH Attrs
10.0.1.0/24 192.168.10.2 65000 65001 [{Origin: IGP}]
10.0.2.0/24 192.168.10.2 65000 65002 [{Origin: IGP}]
10.10.0.0/24 192.168.10.2 65000 65000 [{Origin: IGP}]
[after]
$ gobgp neighbor global rib
Network Next Hop AS_PATH Age Attrs
*> 10.0.1.0/24 192.168.10.3 65001 00:03:20 [{Origin: IGP} {Med: 0}]
*> 10.0.2.0/24 192.168.10.4 65002 00:03:36 [{Origin: IGP} {Med: 200}]
*> 10.10.0.0/24 0.0.0.0 00:03:37 [{Origin: IGP}]
$ gobgp neighbor 192.168.10.5 adj-out
Network Next Hop AS_PATH Attrs
10.0.1.0/24 192.168.10.2 65000 65001 [{Origin: IGP}]
10.0.2.0/24 192.168.10.2 65000 65002 [{Origin: IGP}]
10.10.0.0/24 192.168.10.2 65000 [{Origin: IGP}]
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test/scenario_test/lib/base.py')
-rw-r--r-- | test/scenario_test/lib/base.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/test/scenario_test/lib/base.py b/test/scenario_test/lib/base.py index 119e188c..5dec078f 100644 --- a/test/scenario_test/lib/base.py +++ b/test/scenario_test/lib/base.py @@ -35,6 +35,7 @@ BGP_ATTR_TYPE_NEXT_HOP = 3 BGP_ATTR_TYPE_MULTI_EXIT_DISC = 4 BGP_ATTR_TYPE_LOCAL_PREF = 5 + def get_bridges(): return local("brctl show | awk 'NR > 1{print $1}'", capture=True).split('\n') @@ -196,9 +197,11 @@ class BGPContainer(Container): policies=None, passive=False, is_rr_client=False, cluster_id=''): neigh_addr = '' + local_addr = '' for me, you in itertools.product(self.ip_addrs, peer.ip_addrs): if me[2] == you[2]: neigh_addr = you[1] + local_addr = me[1] if neigh_addr == '': raise Exception('peer {0} seems not ip reachable'.format(peer)) @@ -213,7 +216,8 @@ class BGPContainer(Container): 'is_rr_client': is_rr_client, 'cluster_id': cluster_id, 'policies': policies, - 'passive': passive} + 'passive': passive, + 'local_addr': local_addr} if self.is_running: self.create_config() self.reload_config() @@ -224,8 +228,16 @@ class BGPContainer(Container): self.create_config() self.reload_config() - def add_route(self, route, attribute=''): - self.routes[route] = attribute + def disable_peer(self, peer): + raise Exception('implement disable_peer() method') + + def enable_peer(self, peer): + raise Exception('implement enable_peer() method') + + def add_route(self, route, rf='ipv4', attribute=''): + self.routes[route] = {'prefix': route, + 'rf': rf, + 'attr': attribute} if self.is_running: self.create_config() self.reload_config() |