summaryrefslogtreecommitdiffhomepage
path: root/test/lib/gobgp.py
diff options
context:
space:
mode:
authorWataru Ishida <ishida.wataru@lab.ntt.co.jp>2016-11-12 09:01:33 +0000
committerWataru Ishida <ishida.wataru@lab.ntt.co.jp>2016-11-14 00:58:25 +0000
commitb77dc6aa54d0d2ebe4858ab688a10a44ef4cf773 (patch)
treeb17eabc69fee61dde9d26dca39060970f4033c9c /test/lib/gobgp.py
parentb68491f62cff983d360753130aa4ff77ae753602 (diff)
policy: fix bug of policy with multiple statements
policy can have multiple statements. In each statement, when condition is matched, route-action is finally evaluated after actions with mods. When route-action is 'none', we contine to next statement if it exists. When route-action is 'accept' or 'reject', we stop proceeding. This patch fixes a bug that route-action can't be set to 'none' which means route-action always be set to 'accept' or 'reject' and can't proceed to the next statement. Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'test/lib/gobgp.py')
-rw-r--r--test/lib/gobgp.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lib/gobgp.py b/test/lib/gobgp.py
index 29a116a8..9d2b4237 100644
--- a/test/lib/gobgp.py
+++ b/test/lib/gobgp.py
@@ -100,6 +100,12 @@ class GoBGPContainer(BGPContainer):
return p['value']
return None
+ def _get_med(self, path):
+ for p in path['attrs']:
+ if p['type'] == BGP_ATTR_TYPE_MULTI_EXIT_DISC:
+ return p['metric']
+ return None
+
def _trigger_peer_cmd(self, cmd, peer):
if peer not in self.peers:
raise Exception('not found peer {0}'.format(peer.router_id))
@@ -132,6 +138,7 @@ class GoBGPContainer(BGPContainer):
p["nexthop"] = self._get_nexthop(p)
p["aspath"] = self._get_as_path(p)
p["local-pref"] = self._get_local_pref(p)
+ p["med"] = self._get_med(p)
p["prefix"] = k
dsts.append({'paths': v, 'prefix': k})
return dsts
@@ -146,6 +153,7 @@ class GoBGPContainer(BGPContainer):
p["nexthop"] = self._get_nexthop(p)
p["aspath"] = self._get_as_path(p)
p["local-pref"] = self._get_local_pref(p)
+ p["med"] = self._get_med(p)
p["prefix"] = k
dsts.append({'paths': v, 'prefix': k})
return dsts
@@ -165,6 +173,7 @@ class GoBGPContainer(BGPContainer):
p["nexthop"] = self._get_nexthop(p)
p["aspath"] = self._get_as_path(p)
p["local-pref"] = self._get_local_pref(p)
+ p["med"] = self._get_med(p)
queue.put(p)
t = Thread(target=monitor)
@@ -185,6 +194,7 @@ class GoBGPContainer(BGPContainer):
p["aspath"] = self._get_as_path(p)
p["prefix"] = p['nlri']['prefix']
p["local-pref"] = self._get_local_pref(p)
+ p["med"] = self._get_med(p)
return ret
def get_adj_rib_in(self, peer, prefix='', rf='ipv4'):