Revision 1f1d3bf2 lib/network.py
b/lib/network.py | ||
---|---|---|
173 | 173 |
return address |
174 | 174 |
|
175 | 175 |
def GenerateFree(self): |
176 |
"""A generator for free addresses.""" |
|
177 |
def _iter_free(): |
|
178 |
for idx in self.all_reservations.search("0", 64): |
|
179 |
yield str(self.network[idx]) |
|
180 |
# pylint: disable=E1101 |
|
181 |
return _iter_free().next |
|
176 |
"""Returns the first free address of the network if any or |
|
177 |
raises an error if it is full. |
|
178 |
|
|
179 |
""" |
|
180 |
if self.IsFull(): |
|
181 |
raise errors.AddressPoolError("%s is full" % self.network) |
|
182 |
idx = self.all_reservations.search("0", 1) |
|
183 |
return str(self.network[idx]) |
|
182 | 184 |
|
183 | 185 |
def GetExternalReservations(self): |
184 | 186 |
"""Returns a list of all externally reserved addresses""" |
Also available in: Unified diff