Exemple #1
0
 def dump(self):
     bridges, intfBridges = bigtest.bridgeInfo()
     config = self.config()
     s = StringIO.StringIO()
     s.write("host: %s\n" % config.get("host"))
     s.write("topology: %s\n" % config.get("topology"))
     pid = self.pid()
     if not os.path.exists("/proc/%s/cmdline" % pid):
         pid = "(not running)"
     s.write("pid: %s\n" % pid)
     bridge = intfBridges.get("%s.%s" % (self.name_, config.get("control_vlan")))
     s.write("control:\n")
     s.write("  ipaddr: %s\n" % config.get("control_ipaddr"))
     s.write("  interface: %s.%s\n" % (self.name_, config.get("control_vlan")))
     s.write("  bridge: %s\n" % bridge)
     sw = 0
     for vlans in config.get("switch_intf_vlans"):
         s.write("switch s%d:\n" % sw)
         s.write("  dpid: %s\n" % config.get("switch_dpids")[sw])
         s.write("  ipaddr: %s\n" % config.get("switch_ipaddrs")[sw])
         intf = 0
         for v in vlans:
             bridge = intfBridges.get("%s.%s" % (self.name_, v))
             s.write("  port p%d:\n" % intf)
             s.write("    interface: %s.%s\n" % (self.name_, v))
             s.write("    bridge: %s\n" % bridge)
             intf += 1
         sw += 1
     return s
Exemple #2
0
 def dump(self):
     bridges, intfBridges = bigtest.bridgeInfo()
     s = StringIO.StringIO()
     bridge = intfBridges.get(self.name_)
     if bridge:
         s.write("bridge: %s\n" % bridge)
     s.write("ipaddr: %s\n" % self.ipAddress())
     s.write("image type: %s\n" % self.imageType())
     return s
Exemple #3
0
 def stop(self):
     bigtest.tryToStopProcess(bigtest.readPidFile(os.path.join(self.statedir_, "pid")))
     bridges, intfBridges = bigtest.bridgeInfo()
     config = self.config()
     sw = 0
     for vlans in config.get("switch_intf_vlans"):
         intf = 0
         for v in vlans:
             bridge = intfBridges.get("%s.%s" % (self.name_, v))
             if os.path.exists("/sys/class/net/%s" % bridge):
                 bigtest.sudo(["ifconfig", bridge, "down"])
                 bigtest.sudo(["brctl", "delbr", bridge])
             intf += 1
         sw += 1
     bigtest.run(["rm", "-rf", self.statedir_])
Exemple #4
0
 def switchIntfBridges(self):
     bridges, intfBridges = bigtest.bridgeInfo()
     config = self.config()
     return [[intfBridges.get("%s.%s" % (self.name_, v)) for v in vlans]
             for vlans in config.get("switch_intf_vlans")]
Exemple #5
0
 def switchIntfBridges(self):
     bridges, intfBridges = bigtest.bridgeInfo()
     config = self.config()
     return [[intfBridges.get("%s.%s" % (self.name_, v)) for v in vlans]
             for vlans in config.get("switch_intf_vlans")]