From 92c1a102e41c26cd6adcdcb6cd266da3a22b79d1 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Thu, 23 Nov 2023 15:38:19 +0100 Subject: [PATCH 01/19] topotests: require exabgp version >= 4.2.11 Require exabgp >= 4.2.11 to allow to newer version to run exabgp topotests. Next commits will adapt the exabgp topotests when needed. Signed-off-by: Louis Scalbert --- tests/topotests/lib/topogen.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index 48caf6f03a54..c77a98711770 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -81,20 +81,20 @@ def is_string(value): def get_exabgp_cmd(commander=None): - """Return the command to use for ExaBGP version < 4.""" + """Return the command to use for ExaBGP version >= 4.2.11""" if commander is None: commander = Commander("exabgp", logger=logging.getLogger("exabgp")) def exacmd_version_ok(exacmd): - logger.debug("checking %s for exabgp < version 4", exacmd) + logger.debug("checking %s for exabgp version >= 4.2.11", exacmd) _, stdout, _ = commander.cmd_status(exacmd + " -v", warn=False) m = re.search(r"ExaBGP\s*:\s*((\d+)\.(\d+)(?:\.(\d+))?)", stdout) if not m: return False version = m.group(1) - if topotest.version_cmp(version, "4") >= 0: - logging.debug("found exabgp version >= 4 in %s will keep looking", exacmd) + if topotest.version_cmp(version, "4.2.11") < 0: + logging.debug("found exabgp version < 4.2.11 in %s will keep looking", exacmd) return False logger.info("Using ExaBGP version %s in %s", version, exacmd) return True @@ -1198,7 +1198,7 @@ def start(self, peer_dir, env_file=None): * Run ExaBGP with env file `env_file` and configuration peer*/exabgp.cfg """ exacmd = self.tgen.get_exabgp_cmd() - assert exacmd, "Can't find a usabel ExaBGP (must be < version 4)" + assert exacmd, "Can't find a usable ExaBGP (must be version >= 4.2.11)" self.run("mkdir -p /etc/exabgp") self.run("chmod 755 /etc/exabgp") @@ -1371,7 +1371,7 @@ def diagnose_env_linux(rundir): logger.info("LDPd tests will not run (missing mpls-iptunnel kernel module)") if not get_exabgp_cmd(): - logger.warning("Failed to find exabgp < 4") + logger.warning("Failed to find exabgp >= 4.2.11") logger.removeHandler(fhandler) fhandler.close() From 9589fb300d1a58059347b4565fb85a070c689b70 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 28 Nov 2023 12:44:13 +0100 Subject: [PATCH 02/19] topotests: look for python3 exabgp Look for python3 exabgp instead of python2. Signed-off-by: Louis Scalbert --- tests/topotests/lib/topogen.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index c77a98711770..f58a6668b659 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -102,14 +102,14 @@ def exacmd_version_ok(exacmd): exacmd = commander.get_exec_path("exabgp") if exacmd and exacmd_version_ok(exacmd): return exacmd - py2_path = commander.get_exec_path("python2") - if py2_path: - exacmd = py2_path + " -m exabgp" + py3_path = commander.get_exec_path("python3") + if py3_path: + exacmd = py3_path + " -m exabgp" if exacmd_version_ok(exacmd): return exacmd - py2_path = commander.get_exec_path("python") - if py2_path: - exacmd = py2_path + " -m exabgp" + py3_path = commander.get_exec_path("python") + if py3_path: + exacmd = py3_path + " -m exabgp" if exacmd_version_ok(exacmd): return exacmd return None From c040637e9785c723a811aea596b551b20ac4ad17 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 28 Nov 2023 17:04:32 +0100 Subject: [PATCH 03/19] topotests: use exabgp 4.2.11 in ci Use exabgp 4.2.11 in CI instead. Signed-off-by: Louis Scalbert --- tests/topotests/pytest.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/topotests/pytest.ini b/tests/topotests/pytest.ini index 6c2d42ef40ab..d61a0a1ee115 100644 --- a/tests/topotests/pytest.ini +++ b/tests/topotests/pytest.ini @@ -1,6 +1,8 @@ # Skip pytests example directory [pytest] +# NEEDS_EXABGP_4_2_11_FRR + # asyncio_mode = auto # We always turn this on inside conftest.py, default shown From a1b8727ccd40f78481100d2bfe3d60f53b8d4029 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Wed, 14 Jun 2023 15:19:15 +0200 Subject: [PATCH 04/19] topotests: log exabgp by default Log exabgp by default in /tmp/topotests///exabgp.log Level is INFO. Note that in case the configuration syntax is invalid, exabgp does not log into the file and exits at startup. You can check a configuration syntax by running: > exabgp Signed-off-by: Louis Scalbert --- tests/topotests/lib/topogen.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index f58a6668b659..a0ef752f916a 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -1210,7 +1210,17 @@ def start(self, peer_dir, env_file=None): self.run("chmod a+x /etc/exabgp/*.py") self.run("chown -R exabgp:exabgp /etc/exabgp") - output = self.run(exacmd + " -e /etc/exabgp/exabgp.env /etc/exabgp/exabgp.cfg") + log_dir = os.path.join(self.logdir, self.name) + self.run("chmod 777 {}".format(log_dir)) + + log_file = os.path.join(log_dir, "exabgp.log") + + env_cmd = "env exabgp.log.level=INFO " + env_cmd += "exabgp.log.destination={} ".format(log_file) + + output = self.run( + env_cmd + exacmd + " -e /etc/exabgp/exabgp.env /etc/exabgp/exabgp.cfg " + ) if output is None or len(output) == 0: output = "" From c7e73e9087d6ffc4e3b8e5f56ae5d096df315913 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 27 Nov 2023 16:18:13 +0100 Subject: [PATCH 05/19] topotests: create exabgp cli fifo Create reate exabgp cli fifo even it is not used in topotests to avoid this error message: > 16:21:42 | 2290205 | cli | could not find the named pipes (exabgp.in and exabgp.out) required for the cli > 16:21:42 | 2290205 | cli | we scanned the following folders (the number is your PID): > 16:21:42 | 2290205 | cli control | - /run/exabgp/ > 16:21:42 | 2290205 | cli control | - /run/0/ > 16:21:42 | 2290205 | cli control | - /run/ > 16:21:42 | 2290205 | cli control | - /var/run/exabgp/ > 16:21:42 | 2290205 | cli control | - /var/run/0/ > 16:21:42 | 2290205 | cli control | - /var/run/ > 16:21:42 | 2290205 | cli control | - /usr/local/run/exabgp/ > 16:21:42 | 2290205 | cli control | - /usr/local/run/0/ > 16:21:42 | 2290205 | cli control | - /usr/local/run/ > 16:21:42 | 2290205 | cli control | - /usr/local/var/run/exabgp/ > 16:21:42 | 2290205 | cli control | - /usr/local/var/run/0/ > 16:21:42 | 2290205 | cli control | - /usr/local/var/run/ > 16:21:42 | 2290205 | cli control | please make them in one of the folder with the following commands: > 16:21:42 | 2290205 | cli control | > mkfifo //run/exabgp.{in,out} > 16:21:42 | 2290205 | cli control | > chmod 600 //run/exabgp.{in,out} Signed-off-by: Louis Scalbert --- tests/topotests/lib/topogen.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index a0ef752f916a..7b06f3d127ed 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -1209,6 +1209,10 @@ def start(self, peer_dir, env_file=None): self.run("chmod 644 /etc/exabgp/*") self.run("chmod a+x /etc/exabgp/*.py") self.run("chown -R exabgp:exabgp /etc/exabgp") + self.run("[ -p /var/run/exabgp.in ] || mkfifo /var/run/exabgp.in") + self.run("[ -p /var/run/exabgp.out ] || mkfifo /var/run/exabgp.out") + self.run("chown exabgp:exabgp /var/run/exabgp.{in,out}") + self.run("chmod 600 /var/run/exabgp.{in,out}") log_dir = os.path.join(self.logdir, self.name) self.run("chmod 777 {}".format(log_dir)) From bc149fee3d8f074c9af173c7b9942eef74a70382 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 27 Nov 2023 15:20:54 +0100 Subject: [PATCH 06/19] topotests: convert bgp_ecmp_topo1 to exabgp 4 Convert bgp_ecmp_topo1 to exabgp 4 Signed-off-by: Louis Scalbert --- tests/topotests/bgp_ecmp_topo1/exabgp.env | 1 + .../topotests/bgp_ecmp_topo1/peer1/exabgp.cfg | 33 +++++++++---------- .../bgp_ecmp_topo1/peer10/exabgp.cfg | 33 +++++++++---------- .../bgp_ecmp_topo1/peer11/exabgp.cfg | 33 +++++++++---------- .../bgp_ecmp_topo1/peer12/exabgp.cfg | 33 +++++++++---------- .../bgp_ecmp_topo1/peer13/exabgp.cfg | 33 +++++++++---------- .../bgp_ecmp_topo1/peer14/exabgp.cfg | 33 +++++++++---------- .../bgp_ecmp_topo1/peer15/exabgp.cfg | 33 +++++++++---------- .../bgp_ecmp_topo1/peer16/exabgp.cfg | 33 +++++++++---------- .../bgp_ecmp_topo1/peer17/exabgp.cfg | 33 +++++++++---------- .../bgp_ecmp_topo1/peer18/exabgp.cfg | 33 +++++++++---------- .../bgp_ecmp_topo1/peer19/exabgp.cfg | 33 +++++++++---------- .../topotests/bgp_ecmp_topo1/peer2/exabgp.cfg | 33 +++++++++---------- .../bgp_ecmp_topo1/peer20/exabgp.cfg | 33 +++++++++---------- .../topotests/bgp_ecmp_topo1/peer3/exabgp.cfg | 33 +++++++++---------- .../topotests/bgp_ecmp_topo1/peer4/exabgp.cfg | 33 +++++++++---------- .../topotests/bgp_ecmp_topo1/peer5/exabgp.cfg | 33 +++++++++---------- .../topotests/bgp_ecmp_topo1/peer6/exabgp.cfg | 33 +++++++++---------- .../topotests/bgp_ecmp_topo1/peer7/exabgp.cfg | 33 +++++++++---------- .../topotests/bgp_ecmp_topo1/peer8/exabgp.cfg | 33 +++++++++---------- .../topotests/bgp_ecmp_topo1/peer9/exabgp.cfg | 33 +++++++++---------- 21 files changed, 301 insertions(+), 360 deletions(-) diff --git a/tests/topotests/bgp_ecmp_topo1/exabgp.env b/tests/topotests/bgp_ecmp_topo1/exabgp.env index a328e0496289..ec978c66e76e 100644 --- a/tests/topotests/bgp_ecmp_topo1/exabgp.env +++ b/tests/topotests/bgp_ecmp_topo1/exabgp.env @@ -1,5 +1,6 @@ [exabgp.api] +ack = false encoder = text highres = false respawn = false diff --git a/tests/topotests/bgp_ecmp_topo1/peer1/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer1/exabgp.cfg index 2d0ca89f0fad..97a024ce9620 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer1/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer1/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 1 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 1"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 1 10; + encoder text; +} - neighbor 10.0.1.1 { - router-id 10.0.1.101; - local-address 10.0.1.101; - local-as 99; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 1; + encoder text; +} +neighbor 10.0.1.1 { + router-id 10.0.1.101; + local-address 10.0.1.101; + local-as 99; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer10/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer10/exabgp.cfg index 0c842a0e7fbe..e318162a1faf 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer10/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer10/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 10 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 10"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 10 10; + encoder text; +} - neighbor 10.0.2.1 { - router-id 10.0.2.110; - local-address 10.0.2.110; - local-as 99; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 10; + encoder text; +} +neighbor 10.0.2.1 { + router-id 10.0.2.110; + local-address 10.0.2.110; + local-as 99; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer11/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer11/exabgp.cfg index 936dc572bdf6..ea5bdcce804a 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer11/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer11/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 11 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 11"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 11 10; + encoder text; +} - neighbor 10.0.3.1 { - router-id 10.0.3.111; - local-address 10.0.3.111; - local-as 111; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 11; + encoder text; +} +neighbor 10.0.3.1 { + router-id 10.0.3.111; + local-address 10.0.3.111; + local-as 111; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer12/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer12/exabgp.cfg index 56b33eae8ebf..81fb5035f756 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer12/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer12/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 12 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 12"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 12 10; + encoder text; +} - neighbor 10.0.3.1 { - router-id 10.0.3.112; - local-address 10.0.3.112; - local-as 112; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 12; + encoder text; +} +neighbor 10.0.3.1 { + router-id 10.0.3.112; + local-address 10.0.3.112; + local-as 112; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer13/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer13/exabgp.cfg index b933ffb5cfa1..40078411ec10 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer13/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer13/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 13 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 13"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 13 10; + encoder text; +} - neighbor 10.0.3.1 { - router-id 10.0.3.113; - local-address 10.0.3.113; - local-as 113; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 13; + encoder text; +} +neighbor 10.0.3.1 { + router-id 10.0.3.113; + local-address 10.0.3.113; + local-as 113; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer14/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer14/exabgp.cfg index bcfa41eb2e62..afb8741636d1 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer14/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer14/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 14 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 14"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 14 10; + encoder text; +} - neighbor 10.0.3.1 { - router-id 10.0.3.114; - local-address 10.0.3.114; - local-as 114; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 14; + encoder text; +} +neighbor 10.0.3.1 { + router-id 10.0.3.114; + local-address 10.0.3.114; + local-as 114; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer15/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer15/exabgp.cfg index 022e8357980d..9a4ca7f695b8 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer15/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer15/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 15 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 15"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 15 10; + encoder text; +} - neighbor 10.0.3.1 { - router-id 10.0.3.115; - local-address 10.0.3.115; - local-as 115; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 15; + encoder text; +} +neighbor 10.0.3.1 { + router-id 10.0.3.115; + local-address 10.0.3.115; + local-as 115; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer16/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer16/exabgp.cfg index 0649202f1ffc..a0bb88a3f3a3 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer16/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer16/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 16 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 16"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 16 10; + encoder text; +} - neighbor 10.0.4.1 { - router-id 10.0.4.116; - local-address 10.0.4.116; - local-as 116; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 16; + encoder text; +} +neighbor 10.0.4.1 { + router-id 10.0.4.116; + local-address 10.0.4.116; + local-as 116; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer17/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer17/exabgp.cfg index 0aeeed9d952d..870d33d45599 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer17/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer17/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 17 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 17"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 17 10; + encoder text; +} - neighbor 10.0.4.1 { - router-id 10.0.4.117; - local-address 10.0.4.117; - local-as 117; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 17; + encoder text; +} +neighbor 10.0.4.1 { + router-id 10.0.4.117; + local-address 10.0.4.117; + local-as 117; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer18/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer18/exabgp.cfg index 352c030eda7b..c5a1ca62e416 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer18/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer18/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 18 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 18"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 18 10; + encoder text; +} - neighbor 10.0.4.1 { - router-id 10.0.4.118; - local-address 10.0.4.118; - local-as 118; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 18; + encoder text; +} +neighbor 10.0.4.1 { + router-id 10.0.4.118; + local-address 10.0.4.118; + local-as 118; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer19/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer19/exabgp.cfg index 9913c226f671..f662ccf93e2b 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer19/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer19/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 19 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 19"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 19 10; + encoder text; +} - neighbor 10.0.4.1 { - router-id 10.0.4.119; - local-address 10.0.4.119; - local-as 119; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 19; + encoder text; +} +neighbor 10.0.4.1 { + router-id 10.0.4.119; + local-address 10.0.4.119; + local-as 119; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer2/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer2/exabgp.cfg index 46b436d2af05..673d6ec0eef9 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer2/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer2/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 2 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 2"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 2 10; + encoder text; +} - neighbor 10.0.1.1 { - router-id 10.0.1.102; - local-address 10.0.1.102; - local-as 99; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 2; + encoder text; +} +neighbor 10.0.1.1 { + router-id 10.0.1.102; + local-address 10.0.1.102; + local-as 99; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer20/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer20/exabgp.cfg index 17fb816a75f8..5ea2c91de142 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer20/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer20/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 20 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 20"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 20 10; + encoder text; +} - neighbor 10.0.4.1 { - router-id 10.0.4.120; - local-address 10.0.4.120; - local-as 120; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 20; + encoder text; +} +neighbor 10.0.4.1 { + router-id 10.0.4.120; + local-address 10.0.4.120; + local-as 120; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer3/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer3/exabgp.cfg index acd57756b9df..47a25cab223c 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer3/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer3/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 3 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 3"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 3 10; + encoder text; +} - neighbor 10.0.1.1 { - router-id 10.0.1.103; - local-address 10.0.1.103; - local-as 99; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 3; + encoder text; +} +neighbor 10.0.1.1 { + router-id 10.0.1.103; + local-address 10.0.1.103; + local-as 99; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer4/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer4/exabgp.cfg index 4c9a989b5ad7..376ac5f37dca 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer4/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer4/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 4 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 4"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 4 10; + encoder text; +} - neighbor 10.0.1.1 { - router-id 10.0.1.104; - local-address 10.0.1.104; - local-as 99; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 4; + encoder text; +} +neighbor 10.0.1.1 { + router-id 10.0.1.104; + local-address 10.0.1.104; + local-as 99; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer5/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer5/exabgp.cfg index eba2aae3784f..878d728de645 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer5/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer5/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 5 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 5"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 5 10; + encoder text; +} - neighbor 10.0.1.1 { - router-id 10.0.1.105; - local-address 10.0.1.105; - local-as 99; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 5; + encoder text; +} +neighbor 10.0.1.1 { + router-id 10.0.1.105; + local-address 10.0.1.105; + local-as 99; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer6/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer6/exabgp.cfg index 38b6af0e8589..fc702674cf48 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer6/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer6/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 6 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 6"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 6 10; + encoder text; +} - neighbor 10.0.2.1 { - router-id 10.0.2.106; - local-address 10.0.2.106; - local-as 99; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 6; + encoder text; +} +neighbor 10.0.2.1 { + router-id 10.0.2.106; + local-address 10.0.2.106; + local-as 99; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer7/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer7/exabgp.cfg index 7631e43750ab..09827a89024b 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer7/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer7/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 7 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 7"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 7 10; + encoder text; +} - neighbor 10.0.2.1 { - router-id 10.0.2.107; - local-address 10.0.2.107; - local-as 99; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 7; + encoder text; +} +neighbor 10.0.2.1 { + router-id 10.0.2.107; + local-address 10.0.2.107; + local-as 99; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer8/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer8/exabgp.cfg index 1cd1cd902410..37c01dabb790 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer8/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer8/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 8 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 8"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 8 10; + encoder text; +} - neighbor 10.0.2.1 { - router-id 10.0.2.108; - local-address 10.0.2.108; - local-as 99; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 8; + encoder text; +} +neighbor 10.0.2.1 { + router-id 10.0.2.108; + local-address 10.0.2.108; + local-as 99; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_ecmp_topo1/peer9/exabgp.cfg b/tests/topotests/bgp_ecmp_topo1/peer9/exabgp.cfg index 5771553962ce..8fb5c58b6b97 100644 --- a/tests/topotests/bgp_ecmp_topo1/peer9/exabgp.cfg +++ b/tests/topotests/bgp_ecmp_topo1/peer9/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 9 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 9"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 9 10; + encoder text; +} - neighbor 10.0.2.1 { - router-id 10.0.2.109; - local-address 10.0.2.109; - local-as 99; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 9; + encoder text; +} +neighbor 10.0.2.1 { + router-id 10.0.2.109; + local-address 10.0.2.109; + local-as 99; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } From d228f6a564173681dd6c8acdd32ca05fd5f83d8c Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 27 Nov 2023 17:02:33 +0100 Subject: [PATCH 07/19] topotests: convert bgp_multiview_topo1 to exabgp 4 Convert bgp_multiview_topo1 to exabgp 4 Signed-off-by: Louis Scalbert --- .../topotests/bgp_multiview_topo1/exabgp.env | 1 + .../bgp_multiview_topo1/peer1/exabgp.cfg | 33 +++++++++---------- .../bgp_multiview_topo1/peer2/exabgp.cfg | 33 +++++++++---------- .../bgp_multiview_topo1/peer3/exabgp.cfg | 33 +++++++++---------- .../bgp_multiview_topo1/peer4/exabgp.cfg | 33 +++++++++---------- .../bgp_multiview_topo1/peer5/exabgp.cfg | 33 +++++++++---------- .../bgp_multiview_topo1/peer6/exabgp.cfg | 33 +++++++++---------- .../bgp_multiview_topo1/peer7/exabgp.cfg | 33 +++++++++---------- .../bgp_multiview_topo1/peer8/exabgp.cfg | 33 +++++++++---------- 9 files changed, 121 insertions(+), 144 deletions(-) diff --git a/tests/topotests/bgp_multiview_topo1/exabgp.env b/tests/topotests/bgp_multiview_topo1/exabgp.env index a328e0496289..ec978c66e76e 100644 --- a/tests/topotests/bgp_multiview_topo1/exabgp.env +++ b/tests/topotests/bgp_multiview_topo1/exabgp.env @@ -1,5 +1,6 @@ [exabgp.api] +ack = false encoder = text highres = false respawn = false diff --git a/tests/topotests/bgp_multiview_topo1/peer1/exabgp.cfg b/tests/topotests/bgp_multiview_topo1/peer1/exabgp.cfg index 20e71c84203c..0303230b5651 100644 --- a/tests/topotests/bgp_multiview_topo1/peer1/exabgp.cfg +++ b/tests/topotests/bgp_multiview_topo1/peer1/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 1 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 1"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 1 10; + encoder text; +} - neighbor 172.16.1.254 { - router-id 172.16.1.1; - local-address 172.16.1.1; - local-as 65001; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 1; + encoder text; +} +neighbor 172.16.1.254 { + router-id 172.16.1.1; + local-address 172.16.1.1; + local-as 65001; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_multiview_topo1/peer2/exabgp.cfg b/tests/topotests/bgp_multiview_topo1/peer2/exabgp.cfg index 1e8eef186fad..13670c3b52fc 100644 --- a/tests/topotests/bgp_multiview_topo1/peer2/exabgp.cfg +++ b/tests/topotests/bgp_multiview_topo1/peer2/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 2 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 2"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 2 10; + encoder text; +} - neighbor 172.16.1.254 { - router-id 172.16.1.2; - local-address 172.16.1.2; - local-as 65002; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 2; + encoder text; +} +neighbor 172.16.1.254 { + router-id 172.16.1.2; + local-address 172.16.1.2; + local-as 65002; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_multiview_topo1/peer3/exabgp.cfg b/tests/topotests/bgp_multiview_topo1/peer3/exabgp.cfg index ef1b249aebba..0afc484c69ac 100644 --- a/tests/topotests/bgp_multiview_topo1/peer3/exabgp.cfg +++ b/tests/topotests/bgp_multiview_topo1/peer3/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 3 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 3"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 3 10; + encoder text; +} - neighbor 172.16.1.254 { - router-id 172.16.1.3; - local-address 172.16.1.3; - local-as 65003; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 3; + encoder text; +} +neighbor 172.16.1.254 { + router-id 172.16.1.3; + local-address 172.16.1.3; + local-as 65003; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_multiview_topo1/peer4/exabgp.cfg b/tests/topotests/bgp_multiview_topo1/peer4/exabgp.cfg index 7c50f73b260b..0f5b536d9a41 100644 --- a/tests/topotests/bgp_multiview_topo1/peer4/exabgp.cfg +++ b/tests/topotests/bgp_multiview_topo1/peer4/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 4 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 4"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 4 10; + encoder text; +} - neighbor 172.16.1.254 { - router-id 172.16.1.4; - local-address 172.16.1.4; - local-as 65004; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 4; + encoder text; +} +neighbor 172.16.1.254 { + router-id 172.16.1.4; + local-address 172.16.1.4; + local-as 65004; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_multiview_topo1/peer5/exabgp.cfg b/tests/topotests/bgp_multiview_topo1/peer5/exabgp.cfg index 22163c7fb18a..365aa6b8f229 100644 --- a/tests/topotests/bgp_multiview_topo1/peer5/exabgp.cfg +++ b/tests/topotests/bgp_multiview_topo1/peer5/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 5 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 5"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 5 10; + encoder text; +} - neighbor 172.16.1.254 { - router-id 172.16.1.5; - local-address 172.16.1.5; - local-as 65005; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 5; + encoder text; +} +neighbor 172.16.1.254 { + router-id 172.16.1.5; + local-address 172.16.1.5; + local-as 65005; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_multiview_topo1/peer6/exabgp.cfg b/tests/topotests/bgp_multiview_topo1/peer6/exabgp.cfg index 40b54c33c584..10380334b8b6 100644 --- a/tests/topotests/bgp_multiview_topo1/peer6/exabgp.cfg +++ b/tests/topotests/bgp_multiview_topo1/peer6/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 6 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 6"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 6 10; + encoder text; +} - neighbor 172.16.1.254 { - router-id 172.16.1.6; - local-address 172.16.1.6; - local-as 65006; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 6; + encoder text; +} +neighbor 172.16.1.254 { + router-id 172.16.1.6; + local-address 172.16.1.6; + local-as 65006; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_multiview_topo1/peer7/exabgp.cfg b/tests/topotests/bgp_multiview_topo1/peer7/exabgp.cfg index 33312d052f2a..7411338abd66 100644 --- a/tests/topotests/bgp_multiview_topo1/peer7/exabgp.cfg +++ b/tests/topotests/bgp_multiview_topo1/peer7/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 7 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 7"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 7 10; + encoder text; +} - neighbor 172.16.1.254 { - router-id 172.16.1.7; - local-address 172.16.1.7; - local-as 65007; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 7; + encoder text; +} +neighbor 172.16.1.254 { + router-id 172.16.1.7; + local-address 172.16.1.7; + local-as 65007; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_multiview_topo1/peer8/exabgp.cfg b/tests/topotests/bgp_multiview_topo1/peer8/exabgp.cfg index 173ccb980e7f..17a4e497e1a6 100644 --- a/tests/topotests/bgp_multiview_topo1/peer8/exabgp.cfg +++ b/tests/topotests/bgp_multiview_topo1/peer8/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 8 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 8"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 8 10; + encoder text; +} - neighbor 172.16.1.254 { - router-id 172.16.1.8; - local-address 172.16.1.8; - local-as 65008; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 8; + encoder text; +} +neighbor 172.16.1.254 { + router-id 172.16.1.8; + local-address 172.16.1.8; + local-as 65008; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } From 9598967a0d25fbb4f6233dae1b0bfc74d7c4516a Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 27 Nov 2023 17:07:54 +0100 Subject: [PATCH 08/19] topotests: convert bgp_vrf_md5_peering to exabgp 4 Convert bgp_vrf_md5_peering to exabgp 4 Signed-off-by: Louis Scalbert --- tests/topotests/bgp_vrf_md5_peering/peer1/exabgp.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/topotests/bgp_vrf_md5_peering/peer1/exabgp.cfg b/tests/topotests/bgp_vrf_md5_peering/peer1/exabgp.cfg index 326051390311..11a827a90478 100644 --- a/tests/topotests/bgp_vrf_md5_peering/peer1/exabgp.cfg +++ b/tests/topotests/bgp_vrf_md5_peering/peer1/exabgp.cfg @@ -3,7 +3,7 @@ neighbor 10.0.0.1 { local-address 10.0.0.2; local-as 65001; peer-as 65534; - md5 test123; + md5-password test123; static { route 192.168.100.1/32 { From cfcad6fd9909e32fe33bcb520bc8fba0ccd25239 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 27 Nov 2023 17:09:56 +0100 Subject: [PATCH 09/19] topotests: convert bgp_vrf_netns to exabgp 4 Convert bgp_vrf_netns to exabgp 4 Signed-off-by: Louis Scalbert --- tests/topotests/bgp_vrf_netns/exabgp.env | 1 + .../topotests/bgp_vrf_netns/peer1/exabgp.cfg | 33 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/tests/topotests/bgp_vrf_netns/exabgp.env b/tests/topotests/bgp_vrf_netns/exabgp.env index a328e0496289..ec978c66e76e 100644 --- a/tests/topotests/bgp_vrf_netns/exabgp.env +++ b/tests/topotests/bgp_vrf_netns/exabgp.env @@ -1,5 +1,6 @@ [exabgp.api] +ack = false encoder = text highres = false respawn = false diff --git a/tests/topotests/bgp_vrf_netns/peer1/exabgp.cfg b/tests/topotests/bgp_vrf_netns/peer1/exabgp.cfg index 2d0ca89f0fad..97a024ce9620 100644 --- a/tests/topotests/bgp_vrf_netns/peer1/exabgp.cfg +++ b/tests/topotests/bgp_vrf_netns/peer1/exabgp.cfg @@ -1,21 +1,18 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa-send.py 1 10"; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 1"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa-send.py 1 10; + encoder text; +} - neighbor 10.0.1.1 { - router-id 10.0.1.101; - local-address 10.0.1.101; - local-as 99; - peer-as 100; - graceful-restart; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 1; + encoder text; +} +neighbor 10.0.1.1 { + router-id 10.0.1.101; + local-address 10.0.1.101; + local-as 99; + peer-as 100; + capability {graceful-restart;} + api {processes [ announce-routes, receive-routes ];} } From 811ad11a7e58e33200ee980919a5c52fb37136be Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 27 Nov 2023 16:33:56 +0100 Subject: [PATCH 10/19] topotests: convert bgp_prefix_sid to exabgp 4 Convert bgp_prefix_sid to exabgp 4 Signed-off-by: Louis Scalbert --- tests/topotests/bgp_prefix_sid/exabgp.env | 1 + .../topotests/bgp_prefix_sid/peer1/exabgp.cfg | 190 +++++++++--------- .../topotests/bgp_prefix_sid/peer2/exabgp.cfg | 31 +-- .../bgp_prefix_sid/test_bgp_prefix_sid.py | 34 ++-- 4 files changed, 130 insertions(+), 126 deletions(-) diff --git a/tests/topotests/bgp_prefix_sid/exabgp.env b/tests/topotests/bgp_prefix_sid/exabgp.env index 6c554f5fa8af..bb36af522ab8 100644 --- a/tests/topotests/bgp_prefix_sid/exabgp.env +++ b/tests/topotests/bgp_prefix_sid/exabgp.env @@ -1,5 +1,6 @@ [exabgp.api] +ack = false encoder = text highres = false respawn = false diff --git a/tests/topotests/bgp_prefix_sid/peer1/exabgp.cfg b/tests/topotests/bgp_prefix_sid/peer1/exabgp.cfg index 5b55366a0e87..a5108ff0daa3 100644 --- a/tests/topotests/bgp_prefix_sid/peer1/exabgp.cfg +++ b/tests/topotests/bgp_prefix_sid/peer1/exabgp.cfg @@ -1,103 +1,101 @@ -group controller { - neighbor 10.0.0.1 { - router-id 10.0.0.101; - local-address 10.0.0.101; - local-as 2; - peer-as 1; +neighbor 10.0.0.1 { + router-id 10.0.0.101; + local-address 10.0.0.101; + local-as 2; + peer-as 1; - family { - ipv4 nlri-mpls; - } + family { + ipv4 nlri-mpls; + } - static { - # ref: draft-ietf-idr-bgp-prefix-sid-27 - # - # IANA temporarily assigned the following: - # attribute code type (suggested value: 40) to - # the BGP Prefix-SID attribute - # - # 0 1 2 3 - # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # | Type | Length | RESERVED | - # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # | Flags | Label Index | - # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # | Label Index | - # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # Figure. Label-Index TLV (Prefix-SID type-1) - # - # 0 1 2 3 - # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # | Type | Length | Flags | - # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # | Flags | - # +-+-+-+-+-+-+-+-+ - # - # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # | SRGB 1 (6 octets) | - # | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # | | - # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # - # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # | SRGB n (6 octets) | - # | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # | | - # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - # Figure. Originator SRGB TLV (Prefix-SID type-3) + static { + # ref: draft-ietf-idr-bgp-prefix-sid-27 + # + # IANA temporarily assigned the following: + # attribute code type (suggested value: 40) to + # the BGP Prefix-SID attribute + # + # 0 1 2 3 + # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # | Type | Length | RESERVED | + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # | Flags | Label Index | + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # | Label Index | + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # Figure. Label-Index TLV (Prefix-SID type-1) + # + # 0 1 2 3 + # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # | Type | Length | Flags | + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # | Flags | + # +-+-+-+-+-+-+-+-+ + # + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # | SRGB 1 (6 octets) | + # | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # | | + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # | SRGB n (6 octets) | + # | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # | | + # +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + # Figure. Originator SRGB TLV (Prefix-SID type-3) - # ExaBGP generic-attribute binary pattern: - # Attribute-type: 0x28 (40:BGP_PREFIX_SID) - # Attribute-flag: 0xc0 (Option, Transitive) - # Attribute-body: Label-Index TLV and Originator SRGB TLV - # Label-Index TLV: 0x01000700000000000001 - # Type (08bit): 0x01 - # Length (16bit): 0x0007 - # RESERVED (08bit): 0x00 - # Flags (16bit): 0x0000 - # Label Index (32bit): 0x00000001 - # Originator SRGB TLV: 0x03000800000c350000000a - # Type (08bit): 0x03 - # Length (16bit): 0x0008 (nb-SRGB is 1) - # Flags (16bit): 0x0000 - # SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1) - route 3.0.0.1/32 next-hop 10.0.0.101 label [800001] attribute [0x28 0xc0 0x0100070000000000000103000800000c350000000a]; + # ExaBGP generic-attribute binary pattern: + # Attribute-type: 0x28 (40:BGP_PREFIX_SID) + # Attribute-flag: 0xc0 (Option, Transitive) + # Attribute-body: Label-Index TLV and Originator SRGB TLV + # Label-Index TLV: 0x01000700000000000001 + # Type (08bit): 0x01 + # Length (16bit): 0x0007 + # RESERVED (08bit): 0x00 + # Flags (16bit): 0x0000 + # Label Index (32bit): 0x00000001 + # Originator SRGB TLV: 0x03000800000c350000000a + # Type (08bit): 0x03 + # Length (16bit): 0x0008 (nb-SRGB is 1) + # Flags (16bit): 0x0000 + # SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1) + route 3.0.0.1/32 next-hop 10.0.0.101 label [800001] attribute [0x28 0xc0 0x0100070000000000000103000800000c350000000a]; - # ExaBGP generic-attribute binary pattern: - # Attribute-type: 0x28 (40:BGP_PREFIX_SID) - # Attribute-flag: 0xc0 (Option, Transitive) - # Attribute-body: Label-Index TLV and Originator SRGB TLV - # Label-Index TLV: 0x01000700000000000001 - # Type (08bit): 0x01 - # Length (16bit): 0x0007 - # RESERVED (08bit): 0x00 - # Flags (16bit): 0x0000 - # Label Index (32bit): 0x00000002 - # Originator SRGB TLV: 0x03000800000c350000000a - # Type (08bit): 0x03 - # Length (16bit): 0x0008 (nb-SRGB is 1) - # Flags (16bit): 0x0000 - # SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1) - route 3.0.0.2/32 next-hop 10.0.0.101 label [800002] attribute [0x28 0xc0 0x0100070000000000000203000800000c350000000a]; + # ExaBGP generic-attribute binary pattern: + # Attribute-type: 0x28 (40:BGP_PREFIX_SID) + # Attribute-flag: 0xc0 (Option, Transitive) + # Attribute-body: Label-Index TLV and Originator SRGB TLV + # Label-Index TLV: 0x01000700000000000001 + # Type (08bit): 0x01 + # Length (16bit): 0x0007 + # RESERVED (08bit): 0x00 + # Flags (16bit): 0x0000 + # Label Index (32bit): 0x00000002 + # Originator SRGB TLV: 0x03000800000c350000000a + # Type (08bit): 0x03 + # Length (16bit): 0x0008 (nb-SRGB is 1) + # Flags (16bit): 0x0000 + # SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1) + route 3.0.0.2/32 next-hop 10.0.0.101 label [800002] attribute [0x28 0xc0 0x0100070000000000000203000800000c350000000a]; - # ExaBGP generic-attribute binary pattern: - # Attribute-type: 0x28 (40:BGP_PREFIX_SID) - # Attribute-flag: 0xc0 (Option, Transitive) - # Attribute-body: Label-Index TLV and Originator SRGB TLV - # Label-Index TLV: 0x01000700000000000001 - # Type (08bit): 0x01 - # Length (16bit): 0x0007 - # RESERVED (08bit): 0x00 - # Flags (16bit): 0x0000 - # Label Index (32bit): 0x00000003 - # Originator SRGB TLV: 0x03000800000c350000000a - # Type (08bit): 0x03 - # Length (16bit): 0x0008 (nb-SRGB is 1) - # Flags (16bit): 0x0000 - # SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1) - route 3.0.0.3/32 next-hop 10.0.0.101 label [800003] attribute [0x28 0xc0 0x0100070000000000000303000800000c350000000a]; - } + # ExaBGP generic-attribute binary pattern: + # Attribute-type: 0x28 (40:BGP_PREFIX_SID) + # Attribute-flag: 0xc0 (Option, Transitive) + # Attribute-body: Label-Index TLV and Originator SRGB TLV + # Label-Index TLV: 0x01000700000000000001 + # Type (08bit): 0x01 + # Length (16bit): 0x0007 + # RESERVED (08bit): 0x00 + # Flags (16bit): 0x0000 + # Label Index (32bit): 0x00000003 + # Originator SRGB TLV: 0x03000800000c350000000a + # Type (08bit): 0x03 + # Length (16bit): 0x0008 (nb-SRGB is 1) + # Flags (16bit): 0x0000 + # SRGB1 (48bit): 0x0c3500:0x00000a (800000-800010 is SRGB1) + route 3.0.0.3/32 next-hop 10.0.0.101 label [800003] attribute [0x28 0xc0 0x0100070000000000000303000800000c350000000a]; } } diff --git a/tests/topotests/bgp_prefix_sid/peer2/exabgp.cfg b/tests/topotests/bgp_prefix_sid/peer2/exabgp.cfg index 379d0a3f4312..50ebdc2319c3 100644 --- a/tests/topotests/bgp_prefix_sid/peer2/exabgp.cfg +++ b/tests/topotests/bgp_prefix_sid/peer2/exabgp.cfg @@ -1,19 +1,22 @@ -group controller { - - process receive-routes { - run "/etc/exabgp/exa-receive.py --no-timestamp 2"; - receive-routes; - encoder json; - } +process receive-routes { + run /etc/exabgp/exa-receive.py --no-timestamp 2; + encoder json; +} - neighbor 10.0.0.1 { - router-id 10.0.0.102; - local-address 10.0.0.102; - local-as 3; - peer-as 1; +neighbor 10.0.0.1 { + router-id 10.0.0.102; + local-address 10.0.0.102; + local-as 3; + peer-as 1; - family { - ipv4 nlri-mpls; + family { + ipv4 nlri-mpls; + } + api { + processes [ receive-routes ]; + receive { + parsed; + update; } } } diff --git a/tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py b/tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py index bfc083b50640..1e6e731a1872 100644 --- a/tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py +++ b/tests/topotests/bgp_prefix_sid/test_bgp_prefix_sid.py @@ -120,13 +120,9 @@ def exabgp_get_update_prefix(filename, afi, nexthop, prefix): ret = ret.get(afi) if ret is None: continue - ret = ret.get(nexthop) - if ret is None: - continue - ret = ret.get(prefix) - if ret is None: - continue - return output + for nh in ret.get(nexthop, []): + if nh.get("nlri") == prefix: + return output return "Not found" @@ -135,33 +131,39 @@ def test_peer2_receive_prefix_sid_type1(): peer2 = tgen.gears["peer2"] logfile = "{}/{}-received.log".format(peer2.gearlogdir, peer2.name) - def _check_type1_peer2(prefix, labelindex): + def _check_type1_peer2(prefix, label): output = exabgp_get_update_prefix( logfile, "ipv4 nlri-mpls", "10.0.0.101", prefix ) expected = { "type": "update", "neighbor": { - "ip": "10.0.0.1", + "address": { + "peer": "10.0.0.1", + }, "message": { "update": { - "attribute": { - "attribute-0x28-0xE0": "0x010007000000{:08x}".format( - labelindex - ) + "announce": { + "ipv4 nlri-mpls": { + "10.0.0.101": [ + { + "nlri": prefix, + "label": [[label]], + } + ] + } }, - "announce": {"ipv4 nlri-mpls": {"10.0.0.101": {}}}, } }, }, } return topotest.json_cmp(output, expected) - test_func = functools.partial(_check_type1_peer2, "3.0.0.1/32", labelindex=1) + test_func = functools.partial(_check_type1_peer2, "3.0.0.1/32", label=8001) success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5) assert result is None, 'Failed _check_type1_peer2 in "{}"'.format("peer2") - test_func = functools.partial(_check_type1_peer2, "3.0.0.2/32", labelindex=2) + test_func = functools.partial(_check_type1_peer2, "3.0.0.2/32", label=8002) success, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5) assert result is None, 'Failed _check_type1_peer2 in "{}"'.format("peer2") From 5533f18dc6b8fe91c33cfd9e222aca17bab3df33 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 27 Nov 2023 17:04:32 +0100 Subject: [PATCH 11/19] topotests: convert bgp_prefix_sid2 to exabgp 4 Convert bgp_prefix_sid2 to exabgp 4 Do not advertise prefixes to exabgp to avoid an issue where exabgp resets the bgp session with the following notification: > invalid ipv6 mpls-vpn next-hop length 48 expected 24 or 40 Signed-off-by: Louis Scalbert --- .../bgp_prefix_sid2/peer1/exabgp.cfg | 46 +++++++++---------- tests/topotests/bgp_prefix_sid2/r1/bgpd.conf | 2 + .../bgp_prefix_sid2/r1/vpnv6_rib_entry1.json | 4 -- .../bgp_prefix_sid2/r1/vpnv6_rib_entry2.json | 4 -- 4 files changed, 24 insertions(+), 32 deletions(-) diff --git a/tests/topotests/bgp_prefix_sid2/peer1/exabgp.cfg b/tests/topotests/bgp_prefix_sid2/peer1/exabgp.cfg index 381917957035..7a291a3421d1 100644 --- a/tests/topotests/bgp_prefix_sid2/peer1/exabgp.cfg +++ b/tests/topotests/bgp_prefix_sid2/peer1/exabgp.cfg @@ -1,29 +1,27 @@ -group controller { - neighbor 10.0.0.1 { - router-id 10.0.0.101; - local-address 10.0.0.101; - local-as 2; - peer-as 1; +neighbor 10.0.0.1 { + router-id 10.0.0.101; + local-address 10.0.0.101; + local-as 2; + peer-as 1; - family { - ipv6 mpls-vpn; - } + family { + ipv6 mpls-vpn; + } - static { - route 2001:1::/64 { - rd 2:10; - next-hop 2001::2; - extended-community [ target:2:10 ]; - label 3; - attribute [0x28 0xc0 0x050019000100150020010db800010001000000000000000100ffff00 ]; - } - route 2001:2::/64 { - rd 2:10; - next-hop 2001::2; - extended-community [ target:2:10 ]; - label 3; - attribute [0x28 0xc0 0x050019000100150020010db800010001000000000000000100ffff00 ]; - } + static { + route 2001:1::/64 { + rd 2:10; + next-hop 2001::2; + extended-community [ target:2:10 ]; + label 3; + attribute [0x28 0xc0 0x050019000100150020010db800010001000000000000000100ffff00 ]; + } + route 2001:2::/64 { + rd 2:10; + next-hop 2001::2; + extended-community [ target:2:10 ]; + label 3; + attribute [0x28 0xc0 0x050019000100150020010db800010001000000000000000100ffff00 ]; } } } diff --git a/tests/topotests/bgp_prefix_sid2/r1/bgpd.conf b/tests/topotests/bgp_prefix_sid2/r1/bgpd.conf index 55b8f5536ca1..b3ca0e114d17 100644 --- a/tests/topotests/bgp_prefix_sid2/r1/bgpd.conf +++ b/tests/topotests/bgp_prefix_sid2/r1/bgpd.conf @@ -21,5 +21,7 @@ router bgp 1 ! address-family ipv6 vpn neighbor 10.0.0.101 activate + neighbor 10.0.0.101 route-map DENY_ALL out exit-address-family ! +route-map DENY_ALL deny 10 diff --git a/tests/topotests/bgp_prefix_sid2/r1/vpnv6_rib_entry1.json b/tests/topotests/bgp_prefix_sid2/r1/vpnv6_rib_entry1.json index 42293b1fc749..65c51f1c8cfa 100644 --- a/tests/topotests/bgp_prefix_sid2/r1/vpnv6_rib_entry1.json +++ b/tests/topotests/bgp_prefix_sid2/r1/vpnv6_rib_entry1.json @@ -1,10 +1,6 @@ { "2:10":{ "prefix":"2001:1::\/64", - "advertisedTo":{ - "10.0.0.101":{ - } - }, "paths":[ { "aspath":{ diff --git a/tests/topotests/bgp_prefix_sid2/r1/vpnv6_rib_entry2.json b/tests/topotests/bgp_prefix_sid2/r1/vpnv6_rib_entry2.json index c9ad8714c136..4a12c2a88049 100644 --- a/tests/topotests/bgp_prefix_sid2/r1/vpnv6_rib_entry2.json +++ b/tests/topotests/bgp_prefix_sid2/r1/vpnv6_rib_entry2.json @@ -1,10 +1,6 @@ { "2:10":{ "prefix":"2001:2::\/64", - "advertisedTo":{ - "10.0.0.101":{ - } - }, "paths":[ { "aspath":{ From da8333d9bb5a504fab70587784268c48831d9d8b Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 27 Nov 2023 16:49:53 +0100 Subject: [PATCH 12/19] topotests: convert bgp_peer_type_multipath_relax to exabgp 4 Convert bgp_peer_type_multipath_relax to exabgp 4 Signed-off-by: Louis Scalbert --- .../bgp_peer_type_multipath_relax/exabgp.env | 1 + .../peer1/exabgp.cfg | 32 ++++++++----------- .../peer2/exabgp.cfg | 32 ++++++++----------- .../peer3/exabgp.cfg | 32 ++++++++----------- .../peer4/exabgp.cfg | 32 ++++++++----------- 5 files changed, 57 insertions(+), 72 deletions(-) diff --git a/tests/topotests/bgp_peer_type_multipath_relax/exabgp.env b/tests/topotests/bgp_peer_type_multipath_relax/exabgp.env index 6c554f5fa8af..bb36af522ab8 100644 --- a/tests/topotests/bgp_peer_type_multipath_relax/exabgp.env +++ b/tests/topotests/bgp_peer_type_multipath_relax/exabgp.env @@ -1,5 +1,6 @@ [exabgp.api] +ack = false encoder = text highres = false respawn = false diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer1/exabgp.cfg b/tests/topotests/bgp_peer_type_multipath_relax/peer1/exabgp.cfg index 4a7dc481261e..e6606d22ff23 100644 --- a/tests/topotests/bgp_peer_type_multipath_relax/peer1/exabgp.cfg +++ b/tests/topotests/bgp_peer_type_multipath_relax/peer1/exabgp.cfg @@ -1,21 +1,17 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa_readpipe.py /var/run/exabgp_peer1.in"; - encoder text; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 1"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa_readpipe.py /var/run/exabgp_peer1.in; + encoder text; +} - neighbor 10.0.1.1 { - router-id 10.0.1.2; - local-address 10.0.1.2; - local-as 64510; - peer-as 64510; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 1; + encoder text; +} +neighbor 10.0.1.1 { + router-id 10.0.1.2; + local-address 10.0.1.2; + local-as 64510; + peer-as 64510; + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer2/exabgp.cfg b/tests/topotests/bgp_peer_type_multipath_relax/peer2/exabgp.cfg index b53b0545509a..6a6ba0bb78e6 100644 --- a/tests/topotests/bgp_peer_type_multipath_relax/peer2/exabgp.cfg +++ b/tests/topotests/bgp_peer_type_multipath_relax/peer2/exabgp.cfg @@ -1,21 +1,17 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa_readpipe.py /var/run/exabgp_peer2.in"; - encoder text; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 2"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa_readpipe.py /var/run/exabgp_peer2.in; + encoder text; +} - neighbor 10.0.2.1 { - router-id 10.0.2.2; - local-address 10.0.2.2; - local-as 64511; - peer-as 64511; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 2; + encoder text; +} +neighbor 10.0.2.1 { + router-id 10.0.2.2; + local-address 10.0.2.2; + local-as 64511; + peer-as 64511; + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer3/exabgp.cfg b/tests/topotests/bgp_peer_type_multipath_relax/peer3/exabgp.cfg index 6a1cc2fb3fd1..9714b1f3b556 100644 --- a/tests/topotests/bgp_peer_type_multipath_relax/peer3/exabgp.cfg +++ b/tests/topotests/bgp_peer_type_multipath_relax/peer3/exabgp.cfg @@ -1,21 +1,17 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa_readpipe.py /var/run/exabgp_peer3.in"; - encoder text; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 3"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa_readpipe.py /var/run/exabgp_peer3.in; + encoder text; +} - neighbor 10.0.3.1 { - router-id 10.0.3.2; - local-address 10.0.3.2; - local-as 64502; - peer-as 64501; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 3; + encoder text; +} +neighbor 10.0.3.1 { + router-id 10.0.3.2; + local-address 10.0.3.2; + local-as 64502; + peer-as 64501; + api {processes [ announce-routes, receive-routes ];} } diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer4/exabgp.cfg b/tests/topotests/bgp_peer_type_multipath_relax/peer4/exabgp.cfg index 2cc26cb80ff4..8c38a881cee0 100644 --- a/tests/topotests/bgp_peer_type_multipath_relax/peer4/exabgp.cfg +++ b/tests/topotests/bgp_peer_type_multipath_relax/peer4/exabgp.cfg @@ -1,21 +1,17 @@ -group controller { - - process announce-routes { - run "/etc/exabgp/exa_readpipe.py /var/run/exabgp_peer4.in"; - encoder text; - } - - process receive-routes { - run "/etc/exabgp/exa-receive.py 4"; - receive-routes; - encoder text; - } +process announce-routes { + run /etc/exabgp/exa_readpipe.py /var/run/exabgp_peer4.in; + encoder text; +} - neighbor 10.0.4.1 { - router-id 10.0.4.2; - local-address 10.0.4.2; - local-as 64503; - peer-as 64501; - } +process receive-routes { + run /etc/exabgp/exa-receive.py 4; + encoder text; +} +neighbor 10.0.4.1 { + router-id 10.0.4.2; + local-address 10.0.4.2; + local-as 64503; + peer-as 64501; + api {processes [ announce-routes, receive-routes ];} } From 5383945609aeaac7395ed79f55b5f2d115194ede Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 28 Nov 2023 11:35:23 +0100 Subject: [PATCH 13/19] topotests: cleanup bgp_peer_type_multipath_relax Cleanup bgp_peer_type_multipath_relax to make it more readable. Signed-off-by: Louis Scalbert --- .../test_bgp_peer-type_multipath-relax.py | 161 ++++++++++++++---- 1 file changed, 126 insertions(+), 35 deletions(-) diff --git a/tests/topotests/bgp_peer_type_multipath_relax/test_bgp_peer-type_multipath-relax.py b/tests/topotests/bgp_peer_type_multipath_relax/test_bgp_peer-type_multipath-relax.py index ad6674c52469..9239be9221a6 100755 --- a/tests/topotests/bgp_peer_type_multipath_relax/test_bgp_peer-type_multipath-relax.py +++ b/tests/topotests/bgp_peer_type_multipath_relax/test_bgp_peer-type_multipath-relax.py @@ -62,6 +62,19 @@ pytestmark = [pytest.mark.bgpd, pytest.mark.staticd] +# Prefixes used in the test +prefix1 = "203.0.113.0/30" +prefix2 = "203.0.113.4/30" +prefix3 = "203.0.113.8/30" +# Next hops used for iBGP/confed routes +resolved_nh1 = "198.51.100.1" +resolved_nh2 = "198.51.100.2" +# BGP route used for recursive resolution +bgp_resolving_prefix = "198.51.100.0/24" +# Next hop that will require non-connected recursive resolution +ebgp_resolved_nh = "198.51.100.10" + + def build_topo(tgen): "Build function" @@ -125,36 +138,26 @@ def teardown_module(mod): tgen.stop_topology() -def test_bgp_peer_type_multipath_relax(): +def exabgp_cmd(peer, cmd): + pipe = open("/run/exabgp_{}.in".format(peer), "w") + with pipe: + pipe.write(cmd) + pipe.close() + + +def test_bgp_peer_type_multipath_relax_test1(): tgen = get_topogen() # Don't run this test if we have any failure. if tgen.routers_have_failure(): pytest.skip(tgen.errors) - def exabgp_cmd(peer, cmd): - pipe = open("/run/exabgp_{}.in".format(peer), "w") - with pipe: - pipe.write(cmd) - pipe.close() - - # Prefixes used in the test - prefix1 = "203.0.113.0/30" - prefix2 = "203.0.113.4/30" - prefix3 = "203.0.113.8/30" - # Next hops used for iBGP/confed routes - resolved_nh1 = "198.51.100.1" - resolved_nh2 = "198.51.100.2" - # BGP route used for recursive resolution - bgp_resolving_prefix = "198.51.100.0/24" - # Next hop that will require non-connected recursive resolution - ebgp_resolved_nh = "198.51.100.10" + r1 = tgen.gears["r1"] # Send a non-connected route to resolve others exabgp_cmd( "peer3", "announce route {} next-hop self\n".format(bgp_resolving_prefix) ) - router = tgen.gears["r1"] # It seems that if you write to the exabgp socket too quickly in # succession, requests get lost. So verify prefix1 now instead of @@ -177,7 +180,7 @@ def exabgp_cmd(peer, cmd): expected = json.loads(open(reffile).read()) test_func = functools.partial( topotest.router_json_cmp, - router, + r1, "show ip bgp {} json".format(prefix1), expected, ) @@ -185,6 +188,16 @@ def exabgp_cmd(peer, cmd): assertMsg = "Mixed-type multipath not found" assert res is None, assertMsg + +def test_bgp_peer_type_multipath_relax_test2(): + tgen = get_topogen() + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r1 = tgen.gears["r1"] + logger.info("Create and verify eBGP and iBGP+confed multipaths") exabgp_cmd( "peer1", @@ -203,38 +216,66 @@ def exabgp_cmd(peer, cmd): reffile = os.path.join(CWD, "r1/multipath.json") expected = json.loads(open(reffile).read()) test_func = functools.partial( - topotest.router_json_cmp, router, "show ip bgp json", expected + topotest.router_json_cmp, r1, "show ip bgp json", expected ) _, res = topotest.run_and_expect(test_func, None, count=10, wait=1) assertMsg = "Not all expected multipaths found" assert res is None, assertMsg + +def test_bgp_peer_type_multipath_relax_test3(): + tgen = get_topogen() + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r1 = tgen.gears["r1"] + logger.info("Toggle peer-type multipath-relax and verify the changes") - router.vtysh_cmd( + r1.vtysh_cmd( "conf\n router bgp 64510\n no bgp bestpath peer-type multipath-relax\n" ) # This file verifies "multipath" is not set reffile = os.path.join(CWD, "r1/not-multipath.json") expected = json.loads(open(reffile).read()) test_func = functools.partial( - topotest.router_json_cmp, router, "show ip bgp json", expected + topotest.router_json_cmp, r1, "show ip bgp json", expected ) _, res = topotest.run_and_expect(test_func, None, count=10, wait=1) assertMsg = "Disabling peer-type multipath-relax did not take effect" assert res is None, assertMsg - router.vtysh_cmd( - "conf\n router bgp 64510\n bgp bestpath peer-type multipath-relax\n" - ) + +def test_bgp_peer_type_multipath_relax_test4(): + tgen = get_topogen() + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r1 = tgen.gears["r1"] + + r1.vtysh_cmd("conf\n router bgp 64510\n bgp bestpath peer-type multipath-relax\n") reffile = os.path.join(CWD, "r1/multipath.json") expected = json.loads(open(reffile).read()) test_func = functools.partial( - topotest.router_json_cmp, router, "show ip bgp json", expected + topotest.router_json_cmp, r1, "show ip bgp json", expected ) _, res = topotest.run_and_expect(test_func, None, count=10, wait=1) assertMsg = "Reenabling peer-type multipath-relax did not take effect" assert res is None, assertMsg + +def test_bgp_peer_type_multipath_relax_test5(): + tgen = get_topogen() + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r1 = tgen.gears["r1"] + logger.info("Check recursive resolution of eBGP next hops is not affected") # eBGP next hop resolution rejects recursively resolved next hops by # default, even with peer-type multipath-relax @@ -245,7 +286,7 @@ def exabgp_cmd(peer, cmd): expected = json.loads(open(reffile).read()) test_func = functools.partial( topotest.router_json_cmp, - router, + r1, "show ip bgp {} json".format(prefix3), expected, ) @@ -253,6 +294,16 @@ def exabgp_cmd(peer, cmd): assertMsg = "Recursive eBGP next hop not as expected for {}".format(prefix3) assert res is None, assertMsg + +def test_bgp_peer_type_multipath_relax_test6(): + tgen = get_topogen() + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r1 = tgen.gears["r1"] + exabgp_cmd( "peer4", "announce route {} next-hop {}\n".format(prefix1, ebgp_resolved_nh) ) @@ -260,7 +311,7 @@ def exabgp_cmd(peer, cmd): expected = json.loads(open(reffile).read()) test_func = functools.partial( topotest.router_json_cmp, - router, + r1, "show ip bgp {} json".format(prefix1), expected, ) @@ -268,14 +319,24 @@ def exabgp_cmd(peer, cmd): assertMsg = "Recursive eBGP next hop not as expected for {}".format(prefix1) assert res is None, assertMsg + +def test_bgp_peer_type_multipath_relax_test7(): + tgen = get_topogen() + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r1 = tgen.gears["r1"] + # When other config allows recursively resolved eBGP next hops, # such next hops in all-eBGP multipaths should be valid - router.vtysh_cmd("conf\n router bgp 64510\n neighbor 10.0.4.2 ebgp-multihop\n") + r1.vtysh_cmd("conf\n router bgp 64510\n neighbor 10.0.4.2 ebgp-multihop\n") reffile = os.path.join(CWD, "r1/prefix3-recursive.json") expected = json.loads(open(reffile).read()) test_func = functools.partial( topotest.router_json_cmp, - router, + r1, "show ip bgp {} json".format(prefix3), expected, ) @@ -287,7 +348,7 @@ def exabgp_cmd(peer, cmd): expected = json.loads(open(reffile).read()) test_func = functools.partial( topotest.router_json_cmp, - router, + r1, "show ip bgp {} json".format(prefix1), expected, ) @@ -295,6 +356,16 @@ def exabgp_cmd(peer, cmd): assertMsg = "Recursive eBGP next hop not as expected for {}".format(prefix1) assert res is None, assertMsg + +def test_bgp_peer_type_multipath_relax_test8(): + tgen = get_topogen() + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r1 = tgen.gears["r1"] + logger.info("Check mixed-type multipath next hop recursive resolution in FIB") # There are now two eBGP-learned routes with a recursively resolved next; # hop; one is all-eBGP multipath, and the other is iBGP/eBGP/ @@ -305,7 +376,7 @@ def exabgp_cmd(peer, cmd): expected = json.loads(open(reffile).read()) test_func = functools.partial( topotest.router_json_cmp, - router, + r1, "show ip route {} json".format(prefix3), expected, ) @@ -313,6 +384,16 @@ def exabgp_cmd(peer, cmd): assertMsg = "FIB next hops mismatch for all-eBGP multipath" assert res is None, assertMsg + +def test_bgp_peer_type_multipath_relax_test9(): + tgen = get_topogen() + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r1 = tgen.gears["r1"] + # check confed-external enables recursively resolved next hops by itself exabgp_cmd( "peer1", @@ -324,7 +405,7 @@ def exabgp_cmd(peer, cmd): expected = json.loads(open(reffile).read()) test_func = functools.partial( topotest.router_json_cmp, - router, + r1, "show ip route {} json".format(prefix1), expected, ) @@ -332,6 +413,16 @@ def exabgp_cmd(peer, cmd): assertMsg = "FIB next hops mismatch for eBGP+confed-external multipath" assert res is None, assertMsg + +def test_bgp_peer_type_multipath_relax_test10(): + tgen = get_topogen() + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r1 = tgen.gears["r1"] + # check iBGP by itself exabgp_cmd( "peer1", @@ -349,7 +440,7 @@ def exabgp_cmd(peer, cmd): expected = json.loads(open(reffile).read()) test_func = functools.partial( topotest.router_json_cmp, - router, + r1, "show ip route {} json".format(prefix1), expected, ) From 75a849fc0ddfb1785f83fcdfc126693d573d4625 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 28 Nov 2023 11:45:45 +0100 Subject: [PATCH 14/19] topotests: convert exabgp scripts to python3 Convert exabgp scripts to python3 Signed-off-by: Louis Scalbert --- tests/topotests/bgp_ecmp_topo1/peer1/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer10/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer11/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer12/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer13/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer14/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer15/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer16/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer17/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer18/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer19/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer2/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer20/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer3/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer4/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer5/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer6/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer7/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer8/exa-send.py | 2 +- tests/topotests/bgp_ecmp_topo1/peer9/exa-send.py | 2 +- tests/topotests/bgp_multiview_topo1/peer1/exa-send.py | 2 +- tests/topotests/bgp_multiview_topo1/peer2/exa-send.py | 2 +- tests/topotests/bgp_multiview_topo1/peer3/exa-send.py | 2 +- tests/topotests/bgp_multiview_topo1/peer4/exa-send.py | 2 +- tests/topotests/bgp_multiview_topo1/peer5/exa-send.py | 2 +- tests/topotests/bgp_multiview_topo1/peer6/exa-send.py | 2 +- tests/topotests/bgp_multiview_topo1/peer7/exa-send.py | 2 +- tests/topotests/bgp_multiview_topo1/peer8/exa-send.py | 2 +- .../bgp_peer_type_multipath_relax/peer1/exa_readpipe.py | 2 +- .../bgp_peer_type_multipath_relax/peer2/exa_readpipe.py | 2 +- .../bgp_peer_type_multipath_relax/peer3/exa_readpipe.py | 2 +- .../bgp_peer_type_multipath_relax/peer4/exa_readpipe.py | 2 +- tests/topotests/bgp_vrf_netns/peer1/exa-send.py | 2 +- 33 files changed, 33 insertions(+), 33 deletions(-) diff --git a/tests/topotests/bgp_ecmp_topo1/peer1/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer1/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer1/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer1/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer10/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer10/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer10/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer10/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer11/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer11/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer11/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer11/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer12/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer12/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer12/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer12/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer13/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer13/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer13/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer13/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer14/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer14/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer14/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer14/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer15/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer15/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer15/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer15/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer16/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer16/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer16/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer16/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer17/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer17/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer17/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer17/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer18/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer18/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer18/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer18/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer19/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer19/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer19/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer19/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer2/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer2/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer2/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer2/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer20/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer20/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer20/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer20/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer3/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer3/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer3/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer3/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer4/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer4/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer4/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer4/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer5/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer5/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer5/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer5/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer6/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer6/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer6/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer6/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer7/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer7/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer7/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer7/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer8/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer8/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer8/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer8/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_ecmp_topo1/peer9/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer9/exa-send.py index 6bef35508f9b..1a8e6bfe2ffd 100755 --- a/tests/topotests/bgp_ecmp_topo1/peer9/exa-send.py +++ b/tests/topotests/bgp_ecmp_topo1/peer9/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_multiview_topo1/peer1/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer1/exa-send.py index 09f6ea59e5fb..0e50d46041e7 100755 --- a/tests/topotests/bgp_multiview_topo1/peer1/exa-send.py +++ b/tests/topotests/bgp_multiview_topo1/peer1/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_multiview_topo1/peer2/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer2/exa-send.py index 09f6ea59e5fb..0e50d46041e7 100755 --- a/tests/topotests/bgp_multiview_topo1/peer2/exa-send.py +++ b/tests/topotests/bgp_multiview_topo1/peer2/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_multiview_topo1/peer3/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer3/exa-send.py index 09f6ea59e5fb..0e50d46041e7 100755 --- a/tests/topotests/bgp_multiview_topo1/peer3/exa-send.py +++ b/tests/topotests/bgp_multiview_topo1/peer3/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_multiview_topo1/peer4/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer4/exa-send.py index 09f6ea59e5fb..0e50d46041e7 100755 --- a/tests/topotests/bgp_multiview_topo1/peer4/exa-send.py +++ b/tests/topotests/bgp_multiview_topo1/peer4/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_multiview_topo1/peer5/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer5/exa-send.py index 09f6ea59e5fb..0e50d46041e7 100755 --- a/tests/topotests/bgp_multiview_topo1/peer5/exa-send.py +++ b/tests/topotests/bgp_multiview_topo1/peer5/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_multiview_topo1/peer6/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer6/exa-send.py index 09f6ea59e5fb..0e50d46041e7 100755 --- a/tests/topotests/bgp_multiview_topo1/peer6/exa-send.py +++ b/tests/topotests/bgp_multiview_topo1/peer6/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_multiview_topo1/peer7/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer7/exa-send.py index 09f6ea59e5fb..0e50d46041e7 100755 --- a/tests/topotests/bgp_multiview_topo1/peer7/exa-send.py +++ b/tests/topotests/bgp_multiview_topo1/peer7/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_multiview_topo1/peer8/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer8/exa-send.py index 09f6ea59e5fb..0e50d46041e7 100755 --- a/tests/topotests/bgp_multiview_topo1/peer8/exa-send.py +++ b/tests/topotests/bgp_multiview_topo1/peer8/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer1/exa_readpipe.py b/tests/topotests/bgp_peer_type_multipath_relax/peer1/exa_readpipe.py index 0f998c16131c..6c1f8b092fad 100644 --- a/tests/topotests/bgp_peer_type_multipath_relax/peer1/exa_readpipe.py +++ b/tests/topotests/bgp_peer_type_multipath_relax/peer1/exa_readpipe.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 "Helper script to read api commands from a pipe and feed them to ExaBGP" import sys diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer2/exa_readpipe.py b/tests/topotests/bgp_peer_type_multipath_relax/peer2/exa_readpipe.py index 0f998c16131c..6c1f8b092fad 100644 --- a/tests/topotests/bgp_peer_type_multipath_relax/peer2/exa_readpipe.py +++ b/tests/topotests/bgp_peer_type_multipath_relax/peer2/exa_readpipe.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 "Helper script to read api commands from a pipe and feed them to ExaBGP" import sys diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer3/exa_readpipe.py b/tests/topotests/bgp_peer_type_multipath_relax/peer3/exa_readpipe.py index 0f998c16131c..6c1f8b092fad 100644 --- a/tests/topotests/bgp_peer_type_multipath_relax/peer3/exa_readpipe.py +++ b/tests/topotests/bgp_peer_type_multipath_relax/peer3/exa_readpipe.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 "Helper script to read api commands from a pipe and feed them to ExaBGP" import sys diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer4/exa_readpipe.py b/tests/topotests/bgp_peer_type_multipath_relax/peer4/exa_readpipe.py index 0f998c16131c..6c1f8b092fad 100644 --- a/tests/topotests/bgp_peer_type_multipath_relax/peer4/exa_readpipe.py +++ b/tests/topotests/bgp_peer_type_multipath_relax/peer4/exa_readpipe.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 "Helper script to read api commands from a pipe and feed them to ExaBGP" import sys diff --git a/tests/topotests/bgp_vrf_netns/peer1/exa-send.py b/tests/topotests/bgp_vrf_netns/peer1/exa-send.py index ab0eb8ce8f96..c6a4499bd347 100755 --- a/tests/topotests/bgp_vrf_netns/peer1/exa-send.py +++ b/tests/topotests/bgp_vrf_netns/peer1/exa-send.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ exa-send.py: Send a few testroutes with ExaBGP From 5d1d44d18a9f122b4a34bc47562b98923cf80072 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 28 Nov 2023 12:36:52 +0100 Subject: [PATCH 15/19] topotests: convert bgp_ecmp_topo1 to python3 Convert bgp_ecmp_topo1 to python3 Signed-off-by: Louis Scalbert --- tests/topotests/bgp_ecmp_topo1/test_bgp_ecmp_topo1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/topotests/bgp_ecmp_topo1/test_bgp_ecmp_topo1.py b/tests/topotests/bgp_ecmp_topo1/test_bgp_ecmp_topo1.py index 97751ec8cfbe..7af3f48ff643 100644 --- a/tests/topotests/bgp_ecmp_topo1/test_bgp_ecmp_topo1.py +++ b/tests/topotests/bgp_ecmp_topo1/test_bgp_ecmp_topo1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # SPDX-License-Identifier: ISC # From a54d18cb1c4686f6ec5db2087f6ce6a8cd5377e9 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 28 Nov 2023 12:37:36 +0100 Subject: [PATCH 16/19] topotests: remove python2 support Remove python2 support Signed-off-by: Louis Scalbert --- tests/topotests/lib/common_config.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py index e19d96f918ec..598db84e636b 100644 --- a/tests/topotests/lib/common_config.py +++ b/tests/topotests/lib/common_config.py @@ -14,6 +14,7 @@ import subprocess import sys import traceback +import configparser from collections import OrderedDict from copy import deepcopy from datetime import datetime, timedelta @@ -21,12 +22,6 @@ from re import search as re_search from time import sleep -try: - # Imports from python2 - import ConfigParser as configparser -except ImportError: - # Imports from python3 - import configparser from lib.micronet import comm_error from lib.topogen import TopoRouter, get_topogen From aee4afcc1002e7e0084aad05ee416c2bd2ac237d Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 28 Nov 2023 12:35:41 +0100 Subject: [PATCH 17/19] docker: update ubuntu template for exabgp 4 Update ubuntu template for exabgp 4 Signed-off-by: Louis Scalbert --- docker/ubuntu-ci/Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docker/ubuntu-ci/Dockerfile b/docker/ubuntu-ci/Dockerfile index 1b3deb275065..f228fe808e49 100644 --- a/docker/ubuntu-ci/Dockerfile +++ b/docker/ubuntu-ci/Dockerfile @@ -52,7 +52,7 @@ RUN apt update && apt upgrade -y && \ libssl-dev \ lua5.3 \ net-tools \ - python2 \ + python3 \ python3-pip \ snmp \ snmp-mibs-downloader \ @@ -67,9 +67,6 @@ RUN apt update && apt upgrade -y && \ wget https://raw.githubusercontent.com/FRRouting/frr-mibs/main/iana/IANA-IPPM-METRICS-REGISTRY-MIB -O /usr/share/snmp/mibs/iana/IANA-IPPM-METRICS-REGISTRY-MIB && \ wget https://raw.githubusercontent.com/FRRouting/frr-mibs/main/ietf/SNMPv2-PDU -O /usr/share/snmp/mibs/ietf/SNMPv2-PDU && \ wget https://raw.githubusercontent.com/FRRouting/frr-mibs/main/ietf/IPATM-IPMC-MIB -O /usr/share/snmp/mibs/ietf/IPATM-IPMC-MIB && \ - curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output /tmp/get-pip.py && \ - python2 /tmp/get-pip.py && \ - rm -f /tmp/get-pip.py && \ python3 -m pip install wheel && \ python3 -m pip install pytest && \ python3 -m pip install pytest-sugar && \ @@ -77,7 +74,7 @@ RUN apt update && apt upgrade -y && \ python3 -m pip install "scapy>=2.4.2" && \ python3 -m pip install xmltodict && \ python3 -m pip install grpcio grpcio-tools && \ - python2 -m pip install 'exabgp<4.0.0' + python3 -m pip install git+https://github.com/Exa-Networks/exabgp@0659057837cd6c6351579e9f0fa47e9fb7de7311 RUN groupadd -r -g 92 frr && \ groupadd -r -g 85 frrvty && \ From 3dc8b2c1f5b88a5d878d7060671c72b9817d3c78 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 28 Nov 2023 12:33:42 +0100 Subject: [PATCH 18/19] doc: update for exabgp 4 Update the documentation to require exabgp 4 Signed-off-by: Louis Scalbert --- doc/developer/building-frr-for-ubuntu2004.rst | 14 +------------- doc/developer/building-frr-for-ubuntu2204.rst | 14 +------------- doc/developer/topotests.rst | 11 ++++------- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/doc/developer/building-frr-for-ubuntu2004.rst b/doc/developer/building-frr-for-ubuntu2004.rst index fdfc25da9df0..a37b5140bae0 100644 --- a/doc/developer/building-frr-for-ubuntu2004.rst +++ b/doc/developer/building-frr-for-ubuntu2004.rst @@ -15,7 +15,7 @@ Installing Dependencies pkg-config libpam0g-dev libjson-c-dev bison flex \ libc-ares-dev python3-dev python3-sphinx \ install-info build-essential libsnmp-dev perl \ - libcap-dev python2 libelf-dev libunwind-dev + libcap-dev libelf-dev libunwind-dev .. include:: building-libunwind-note.rst @@ -23,18 +23,6 @@ Note that Ubuntu 20 no longer installs python 2.x, so it must be installed explicitly. Ensure that your system has a symlink named ``/usr/bin/python`` pointing at ``/usr/bin/python3``. -In addition, ``pip`` for python2 must be installed if you wish to run -the FRR topotests. That version of ``pip`` is not available from the -ubuntu apt repositories; in order to install it: - -.. code-block:: shell - - curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py - sudo python2 ./get-pip.py - - # And verify the installation - pip2 --version - .. include:: building-libyang.rst Protobuf diff --git a/doc/developer/building-frr-for-ubuntu2204.rst b/doc/developer/building-frr-for-ubuntu2204.rst index 97bdf8806bef..f7c30498eca9 100644 --- a/doc/developer/building-frr-for-ubuntu2204.rst +++ b/doc/developer/building-frr-for-ubuntu2204.rst @@ -15,7 +15,7 @@ Installing Dependencies pkg-config libpam0g-dev libjson-c-dev bison flex \ libc-ares-dev python3-dev python3-sphinx \ install-info build-essential libsnmp-dev perl \ - libcap-dev python2 libelf-dev libunwind-dev \ + libcap-dev libelf-dev libunwind-dev \ libyang2 libyang2-dev .. include:: building-libunwind-note.rst @@ -29,18 +29,6 @@ installed explicitly. Ensure that your system has a symlink named sudo ln -s /usr/bin/python3 /usr/bin/python python --version -In addition, ``pip`` for python2 must be installed if you wish to run -the FRR topotests. That version of ``pip`` is not available from the -ubuntu apt repositories; in order to install it: - -.. code-block:: shell - - curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py - sudo python2 ./get-pip.py - - # And verify the installation - pip2 --version - Protobuf ^^^^^^^^ diff --git a/doc/developer/topotests.rst b/doc/developer/topotests.rst index c9857963bd9b..b50ec486ecc9 100644 --- a/doc/developer/topotests.rst +++ b/doc/developer/topotests.rst @@ -8,14 +8,12 @@ Topotests is a suite of topology tests for FRR built on top of micronet. Installation and Setup ---------------------- -Topotests run under python3. Additionally, for ExaBGP (which is used -in some of the BGP tests) an older python2 version (and the python2 -version of ``pip``) must be installed. +Topotests run under python3. Tested with Ubuntu 20.04,Ubuntu 18.04, and Debian 11. -Instructions are the same for all setups (i.e. ExaBGP is only used for -BGP tests). +Instructions are the same for all setups. However, ExaBGP is only used for +BGP tests. Tshark is only required if you enable any packet captures on test runs. @@ -39,8 +37,7 @@ Installing Topotest Requirements python3 -m pip install 'pytest-xdist>=2.3.0' python3 -m pip install 'scapy>=2.4.5' python3 -m pip install xmltodict - # Use python2 pip to install older ExaBGP - python2 -m pip install 'exabgp<4.0.0' + python3 -m pip install git+https://github.com/Exa-Networks/exabgp@0659057837cd6c6351579e9f0fa47e9fb7de7311 useradd -d /var/run/exabgp/ -s /bin/false exabgp # To enable the gRPC topotest install: From 73ce39c443b0942537f7357cd64dcc8294b61d85 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 28 Nov 2023 16:18:30 +0100 Subject: [PATCH 19/19] topotests: tmp fix delay in bgp_peer_type_multipath_relax Workaround an issue in bgp_peer_type_multipath_relax. Link: https://github.com/FRRouting/frr/issues/14895 Signed-off-by: Louis Scalbert --- tests/topotests/bgp_peer_type_multipath_relax/exabgp.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/topotests/bgp_peer_type_multipath_relax/exabgp.env b/tests/topotests/bgp_peer_type_multipath_relax/exabgp.env index bb36af522ab8..989228a29327 100644 --- a/tests/topotests/bgp_peer_type_multipath_relax/exabgp.env +++ b/tests/topotests/bgp_peer_type_multipath_relax/exabgp.env @@ -44,7 +44,7 @@ enable = false file = '' [exabgp.reactor] -speed = 1.0 +speed = 5.0 [exabgp.tcp] acl = false