From: Rafael Zalamena Date: Mon, 10 Jul 2017 20:01:23 +0000 (-0300) Subject: topogen: implement start/stop methods for TopoGear X-Git-Tag: frr-7.1-dev~151^2~283 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=4cfdff1a861184e8b643372cb0da0fcd8452c501;p=matthieu%2Ffrr.git topogen: implement start/stop methods for TopoGear Having a generic start/stop methods for TopoGear allows TopoGen to call start/stop for all equipments. This allows us to reduce the teardown code by removing the necessity of having to always remember to call each equipment clean up function. --- diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index 1fb3679d7e..cc139bc83c 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -250,8 +250,16 @@ class Topogen(object): router.start() def stop_topology(self): - "Stops the network topology" + """ + Stops the network topology. This function will call the stop() function + of all gears before calling the mininet stop function, so they can have + their oportunity to do a graceful shutdown. + """ logger.info('stopping topology: {}'.format(self.modname)) + + for gear in self.gears.values(): + gear.stop() + self.net.stop() def mininet_cli(self): @@ -310,6 +318,14 @@ class TopoGear(object): return 'TopoGear'.format(self.name, links) + def start(self): + "Basic start function that just reports equipment start" + logger.info('starting "{}"'.format(self.name)) + + def stop(self): + "Basic start function that just reports equipment stop" + logger.info('stopping "{}"'.format(self.name)) + def run(self, command): """ Runs the provided command string in the router and returns a string