# HG changeset patch # User igor # Date 1190417118 -10800 # Node ID c68d804c30172e7b0fea99ee5baaa39d9c8eb2b1 # Parent bf2d7c5bb340cce17d205dc125579d92ce395041 * Trying to add classes (bridge class) * Configuration templates * Function save() --- dumps network topology diff -r bf2d7c5bb340 -r c68d804c3017 xentaur.py --- a/xentaur.py Sat Sep 22 01:35:51 2007 +0300 +++ b/xentaur.py Sat Sep 22 02:25:18 2007 +0300 @@ -6,7 +6,7 @@ xenomips_vars.N='1' sys.path.append('/etc/xen') -xen_config_name='fabergeN' +xen_config_name='four_quaggasN' try: exec 'from '+xen_config_name+' import bridges,vbridges_table, hidden_bridges, domains, broken_links, temporary_links, domain_types' except: @@ -57,7 +57,6 @@ print "sudo /usr/sbin/xm shutdown "+domains[N] def create_screens_script(): - N=1 screens=[] for domain in domains: @@ -205,6 +204,33 @@ xentaur {start|stop|start-bridges|start-domains|stop-domains|screen|graph} """ +def save(): + print "network =", xen_config_name + print "domains =", domains + print "domain_types =", domain_types + print "bridges =", bridges + print "vbridges_table =", vbridges_table + print "hidden_bridges =", hidden_bridges + print "broken_links =", broken_links + print "temporary_links =", temporary_links + print "bridges_turned_down =", bridges_turned_down + +#----------------------------------------------------------------------- +# CLASSES + +class Bridge: + def __init__ (self,name): + self.name=name + def up(self): + bridge_up(self.name) + def down(self): + bridge_down(self.name) + def show(self): + show_bridge(self.name) + def dump_start(self,filter=""): + dump_start(self.name,filter) + + #----------------------------------------------------------------------- # DOMAINS @@ -308,7 +334,21 @@ def dump_stop(): return 0 - + + +#----------------------------------------------------------------------- +# CONFIGURATION TEMPLATES + + +def configure_ip_addresses(doms=domains): + return 0 + +def configure_ospf(doms=domains): + return 0 + +def configure_save(doms=domains): + write_to(doms,"\nwr\n") + #----------------------------------------------------------------------- @@ -376,7 +416,7 @@ exit """ -#----------------------------------------------------------------------- + nodes=domains