diff options
Diffstat (limited to 'tests/topotests/lib/topotest.py')
| -rw-r--r-- | tests/topotests/lib/topotest.py | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index e34d1cf0be..a187971e41 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -628,7 +628,7 @@ def ip4_route_zebra(node, vrf_name=None): lines = output.splitlines() header_found = False while lines and (not lines[0].strip() or not header_found): - if "> - selected route" in lines[0]: + if "o - offload failure" in lines[0]: header_found = True lines = lines[1:] return "\n".join(lines) @@ -654,7 +654,7 @@ def ip6_route_zebra(node, vrf_name=None): lines = output.splitlines() header_found = False while lines and (not lines[0].strip() or not header_found): - if "> - selected route" in lines[0]: + if "o - offload failure" in lines[0]: header_found = True lines = lines[1:] @@ -947,13 +947,11 @@ def checkAddressSanitizerError(output, router, component): def addRouter(topo, name): - "Adding a FRRouter (or Quagga) to Topology" + "Adding a FRRouter to Topology" MyPrivateDirs = [ "/etc/frr", - "/etc/quagga", "/var/run/frr", - "/var/run/quagga", "/var/log", ] if sys.platform.startswith("linux"): @@ -985,7 +983,7 @@ def assert_sysctl(node, sysctl, value): class Router(Node): - "A Node with IPv4/IPv6 forwarding enabled and Quagga as Routing Engine" + "A Node with IPv4/IPv6 forwarding enabled" def __init__(self, name, **params): super(Router, self).__init__(name, **params) @@ -994,12 +992,11 @@ class Router(Node): # Backward compatibility: # Load configuration defaults like topogen. self.config_defaults = configparser.ConfigParser( - { + defaults = { "verbosity": "info", "frrdir": "/usr/lib/frr", - "quaggadir": "/usr/lib/quagga", "routertype": "frr", - "memleak_path": None, + "memleak_path": "", } ) self.config_defaults.read( @@ -1055,18 +1052,6 @@ class Router(Node): if not os.path.isfile(zebra_path): raise Exception("FRR zebra binary doesn't exist at {}".format(zebra_path)) - def _config_quagga(self, **params): - "Configure Quagga binaries" - self.daemondir = params.get("quaggadir") - if self.daemondir is None: - self.daemondir = self.config_defaults.get("topogen", "quaggadir") - - zebra_path = os.path.join(self.daemondir, "zebra") - if not os.path.isfile(zebra_path): - raise Exception( - "Quagga zebra binary doesn't exist at {}".format(zebra_path) - ) - # pylint: disable=W0221 # Some params are only meaningful for the parent class. def config(self, **params): @@ -1078,10 +1063,7 @@ class Router(Node): self.routertype = params.get( "routertype", self.config_defaults.get("topogen", "routertype") ) - if self.routertype == "quagga": - self._config_quagga(**params) - else: - self._config_frr(**params) + self._config_frr(**params) else: # Test the provided path zpath = os.path.join(self.daemondir, "zebra") @@ -1340,7 +1322,9 @@ class Router(Node): # If `daemons` was specified then some upper API called us with # specific daemons, otherwise just use our own configuration. daemons_list = [] - if daemons is None: + if daemons != None: + daemons_list = daemons + else: # Append all daemons configured. for daemon in self.daemons: if self.daemons[daemon] == 1: @@ -1406,7 +1390,7 @@ class Router(Node): def killRouterDaemons( self, daemons, wait=True, assertOnError=True, minErrorVersion="5.1" ): - # Kill Running Quagga or FRR specific + # Kill Running FRR # Daemons(user specified daemon only) using SIGKILL rundaemons = self.cmd("ls -1 /var/run/%s/*.pid" % self.routertype) errors = "" @@ -1541,7 +1525,7 @@ class Router(Node): for daemon in self.daemons: if (self.daemons[daemon] == 1) and not (daemon in daemonsRunning): sys.stderr.write("%s: Daemon %s not running\n" % (self.name, daemon)) - if daemon is "staticd": + if daemon == "staticd": sys.stderr.write( "You may have a copy of staticd installed but are attempting to test against\n" ) @@ -1607,7 +1591,7 @@ class Router(Node): logger.info("{}: running version: {}".format(self.name, self.version)) rversion = self.version - if rversion is None: + if rversion == None: return False result = version_cmp(rversion, version) @@ -1668,7 +1652,7 @@ class Router(Node): return True def get_routertype(self): - "Return the type of Router (frr or quagga)" + "Return the type of Router (frr)" return self.routertype @@ -1753,3 +1737,10 @@ class LegacySwitch(OVSSwitch): def __init__(self, name, **params): OVSSwitch.__init__(self, name, failMode="standalone", **params) self.switchIP = None + +def frr_unicode(s): + '''Convert string to unicode, depending on python version''' + if sys.version_info[0] > 2: + return s + else: + return unicode(s) |
