mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-05 02:46:37 +00:00
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.
This commit is contained in:
parent
f6899d4dd4
commit
4cfdff1a86
@ -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<name="{}",links=[{}]>'.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
|
||||
|
Loading…
Reference in New Issue
Block a user