Exemplo n.º 1
0
 def __init__(self, name, *args, **kwargs):
     # dirs = [PRIVDIR]
     OVSBridge.__init__(self, name, *args, **kwargs)
     self.dir = "/tmp/%s" % name
     self.nets = []
     if not os.path.exists(self.dir):
         os.makedirs(self.dir)
Exemplo n.º 2
0
    def cleanup(self):
        # def remove_if_exists(filename):
        #     if os.path.exists(filename):
        #         os.remove(filename)

        OVSBridge.cleanup(self)
        # Rm dir
        if os.path.exists(self.dir):
            shutil.rmtree(self.dir)
Exemplo n.º 3
0
 def config(self, **kwargs):
     # Init steps
     OVSBridge.config(self, **kwargs)
     # Iterate over the interfaces
     for intf in self.intfs.itervalues():
         # Remove any configured address
         self.cmd('ifconfig %s 0' % intf.name)
         # # For the first one, let's configure the mgmt address
         # if first:
         #   first = False
         #   self.cmd('ip a a %s dev %s' %(kwargs['mgmtip'], intf.name))
     #let's write the hostname in /var/mininet/hostname
     self.cmd("echo '" + self.name + "' > " + PRIVDIR + "/hostname")
     if os.path.isfile(BASEDIR + self.name + "/start.sh"):
         self.cmd('source %s' % BASEDIR + self.name + "/start.sh")
Exemplo n.º 4
0
 def __init__(self, *args, **kwargs):
     kwargs.update(stp='True')
     OVSBridge.__init__(self, *args, **kwargs)