Пример #1
0
 def alloc_addrs(self, subnet):
     hosts = subnet.hosts()
     interfaces = {}
     for elem, proxy in sorted(self._addrs.items()):
         intf = ip_interface("%s/%s" % (next(hosts), subnet.prefixlen))
         interfaces[elem] = intf
         proxy.set_intf(intf)
     return interfaces
Пример #2
0
 def alloc_addrs(self, subnet):
     hosts = subnet.hosts()
     interfaces = {}
     # With the docker backend, docker itself claims the first ip of every network
     if self.docker:
         next(hosts)
     for elem, proxy in sorted(self._addrs.items()):
         intf = ip_interface("%s/%s" % (next(hosts), subnet.prefixlen))
         interfaces[elem] = intf
         proxy.set_intf(intf)
     return interfaces