Example #1
0
 def __init__(self, *hosts, **kwargs):
     n_ports = len(hosts) if hosts else 3
     name = kwargs.get('name', None)
     super(Hub, self).__init__(name, n_ports)
     self.links = []
     for host, port in zip(hosts, self.ports):
         self.links.append(mint.link(host, port))
Example #2
0
 def __init__(self, *hosts, **kwargs):
     n_ports = len(hosts) if hosts else 3
     name = kwargs.get('name', None)
     super(Hub, self).__init__(name, n_ports)
     self.links = []
     for host, port in zip(hosts, self.ports):
         self.links.append(mint.link(host, port))
Example #3
0
 def __init__(self, *hosts, **kwargs):
     super(Switch, self).__init__(kwargs.get('name', None))
     self.routes = {}
     n_ports = len(hosts) if hosts else 3
     self.nics = mint.gen(n_ports, NIC, self)
     self.ports = tuple(Switch.Port(self, nic) for nic in self.nics)
     [p.setup_siblings() for p in self.ports]
     self.links = []
     for host, nic in zip(hosts, self.nics):
         self.links.append(mint.link(host, nic.port))
Example #4
0
 def __init__(self, *hosts, **kwargs):
     super(Switch, self).__init__(kwargs.get('name', None))
     self.routes = {}
     n_ports = len(hosts) if hosts else 3
     self.nics = mint.gen(n_ports, NIC, self)
     self.ports = tuple(Switch.Port(self, nic) for nic in self.nics)
     [p.setup_siblings() for p in self.ports]
     self.links = []
     for host, nic in zip(hosts, self.nics):
         self.links.append(mint.link(host, nic.port))