Revision f82dfec6 snf-cyclades-app/synnefo/db/pools/__init__.py
b/snf-cyclades-app/synnefo/db/pools/__init__.py | ||
---|---|---|
282 | 282 |
|
283 | 283 |
def value_to_index(self, value): |
284 | 284 |
addr = ipaddr.IPAddress(value) |
285 |
return int(addr) - int(self.net.network) |
|
285 |
return int(addr) - int(self.net.network) - int(self.offset)
|
|
286 | 286 |
|
287 | 287 |
def index_to_value(self, index): |
288 |
return str(self.net[index]) |
|
288 |
return str(self.net[index + int(self.offset)])
|
|
289 | 289 |
|
290 | 290 |
def contains(self, address): |
291 | 291 |
addr = ipaddr.IPAddress(address) |
292 |
return addr in self.net |
|
292 |
return addr in self.net and super(IPPool, self).contains(address)
|
|
293 | 293 |
|
294 | 294 |
def return_start(self): |
295 | 295 |
return str(ipaddr.IPAddress(self.base) + self.offset) |
Also available in: Unified diff