diff options
author | Louis Scalbert <louis.scalbert@6wind.com> | 2022-05-12 14:54:32 +0200 |
---|---|---|
committer | Louis Scalbert <louis.scalbert@6wind.com> | 2022-12-16 15:07:54 +0100 |
commit | a7e794215c379f975be34179a034d0c2765cbbbb (patch) | |
tree | 401f8f87a88b9c5e0d89c443745d0168099cccd4 /tests/topotests/lib | |
parent | bgpd: resend routes deleted by kernel after interface addresses deletion (diff) | |
download | frr-a7e794215c379f975be34179a034d0c2765cbbbb.tar.xz frr-a7e794215c379f975be34179a034d0c2765cbbbb.zip |
topotests: add ability to check that a prefix is not in BGP RIB
Add an "exist" key to check the existence of a prefix in the BGP RIB.
Useful to check that a prefix has not leaked by error.
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'tests/topotests/lib')
-rw-r--r-- | tests/topotests/lib/bgprib.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/topotests/lib/bgprib.py b/tests/topotests/lib/bgprib.py index 35a57d0a9..ced6dd7de 100644 --- a/tests/topotests/lib/bgprib.py +++ b/tests/topotests/lib/bgprib.py @@ -48,7 +48,15 @@ class BgpRib: for pfx in pfxtbl.keys(): if debug: self.log("trying pfx %s" % pfx) - if pfx != want["p"]: + if "exist" in want and want["exist"] == False: + if pfx == want["p"]: + if debug: + self.log("unexpected route: pfx=" + want["p"]) + return 0 + if debug: + self.log("unwant pfx=" + want["p"] + ", not " + pfx) + continue + elif pfx != want["p"]: if debug: self.log("want pfx=" + want["p"] + ", not " + pfx) continue @@ -75,6 +83,9 @@ class BgpRib: if debug: self.log("missing route: pfx=" + want["p"] + ", nh=" + want["n"]) return 0 + if "exist" in want and want["exist"] == False: + return 1 + return 0 def RequireVpnRoutes(self, target, title, wantroutes, debug=0): import json |