- Timestamp:
- Dec 22, 2008, 12:33:35 PM (16 years ago)
- Location:
- trunk/exodus
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/exodus/tests.py
r6469 r6475 52 52 '172.16.0.6', '172.16.0.7']) 53 53 used_list = self.ipcalc(30)._get_used_ips() 54 self.failUnlessEqual( list, used_list) 54 self.failUnlessEqual(list, used_list) 55 56 def test_ipcalc_get_used_ips_with_link(self): 57 from exodus.models import Interface 58 link_id = Interface.objects.get(pk=1).id 59 list = set(['172.16.0.1', '172.16.0.2']) 60 from exodus.wlipcalc import IPCalc 61 used_list = IPCalc(self.node, 30, link_id)._get_used_ips() 62 self.failUnlessEqual(list, used_list) 55 63 56 64 def test_ipcalc_get_free_network_addr(self): -
trunk/exodus/wlipcalc.py
r6472 r6475 9 9 """ 10 10 11 def __init__(self, node, free_netmask, link = None):11 def __init__(self, node, free_netmask, link_id = None): 12 12 if free_netmask <= MASTERIP_NETMASK or free_netmask > 32: 13 13 raise ValueError, 'Netmask out of bounds.' … … 17 17 master_netmask = MASTERIP_NETMASK 18 18 self.master_network = wl.get_network(self.master_ip, master_netmask) 19 self.link = link19 self.link_id = link_id 20 20 21 21 # calculate the number of ipaddresses in the subnetmask … … 57 57 for i in self.node.interface_set.all(): 58 58 #XXX: rewrite to if i.ip in masterip?? 59 # not i.id == self.link .id, don't populate used_list59 # not i.id == self.link_id, don't populate used_list 60 60 # with ips from it's own netmask 61 if self.link:62 if i.id == i.link_id and not i.id == self.link .id:61 #if self.link: 62 if i.id == i.link_id and not i.id == self.link_id: 63 63 ip_size = self._ip_size(i.netmask) 64 64 network_addr = wl.network(i.ip, i.netmask)
Note:
See TracChangeset
for help on using the changeset viewer.