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 <louis.scalbert@6wind.com>
This commit is contained in:
Louis Scalbert 2023-11-23 15:38:19 +01:00
parent 5e87eae543
commit 92c1a102e4

View File

@ -81,20 +81,20 @@ def is_string(value):
def get_exabgp_cmd(commander=None): 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: if commander is None:
commander = Commander("exabgp", logger=logging.getLogger("exabgp")) commander = Commander("exabgp", logger=logging.getLogger("exabgp"))
def exacmd_version_ok(exacmd): 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) _, stdout, _ = commander.cmd_status(exacmd + " -v", warn=False)
m = re.search(r"ExaBGP\s*:\s*((\d+)\.(\d+)(?:\.(\d+))?)", stdout) m = re.search(r"ExaBGP\s*:\s*((\d+)\.(\d+)(?:\.(\d+))?)", stdout)
if not m: if not m:
return False return False
version = m.group(1) version = m.group(1)
if topotest.version_cmp(version, "4") >= 0: if topotest.version_cmp(version, "4.2.11") < 0:
logging.debug("found exabgp version >= 4 in %s will keep looking", exacmd) logging.debug("found exabgp version < 4.2.11 in %s will keep looking", exacmd)
return False return False
logger.info("Using ExaBGP version %s in %s", version, exacmd) logger.info("Using ExaBGP version %s in %s", version, exacmd)
return True return True
@ -1198,7 +1198,7 @@ class TopoExaBGP(TopoHost):
* Run ExaBGP with env file `env_file` and configuration peer*/exabgp.cfg * Run ExaBGP with env file `env_file` and configuration peer*/exabgp.cfg
""" """
exacmd = self.tgen.get_exabgp_cmd() 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("mkdir -p /etc/exabgp")
self.run("chmod 755 /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)") logger.info("LDPd tests will not run (missing mpls-iptunnel kernel module)")
if not get_exabgp_cmd(): if not get_exabgp_cmd():
logger.warning("Failed to find exabgp < 4") logger.warning("Failed to find exabgp >= 4.2.11")
logger.removeHandler(fhandler) logger.removeHandler(fhandler)
fhandler.close() fhandler.close()