Changeset 6231
- Timestamp:
- Aug 23, 2008, 12:44:18 PM (16 years ago)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TODO
r6230 r6231 14 14 views.py and the templates. See: 15 15 http://www.djangoproject.com/documentation/url_dispatch/#reverse 16 * remove hardcoding in wllogic.py for 172.17 and higher as master ip 16 17 * Interface cleanups: 17 18 ** option to edit/delete fields -
exodus/views.py
r6230 r6231 9 9 10 10 from exodus.models import * 11 from exodus.wllogic import freemasterip, newSSIDName 11 from exodus.wllogic import freemasterip, newSSIDName, freeinterlinkip 12 12 13 13 class AddLocationForm(forms.ModelForm): … … 83 83 print '''these ifaces are of the same type''' 84 84 instance.same=True 85 print instance.same 86 87 if str(instance.iface1.type) == '11b' or str(instance.iface1.type) == '11g': 88 print '''it's 11b or g''' 89 90 #if (instance.iface1.type == '11b' | instance.iface2.type == '11b' ) & 91 # (instance.iface1.type == '11g' || instance.iface2.type == '11g'): 92 # print '''11b and 11g are compatible''' 85 if str(instance.iface1.type) == '11b' and str(instance.iface2.type) == '11g': 86 instance.same=True 87 print '11b + 11g' 88 if str(instance.iface1.type) == '11g' and str(instance.iface2.type) == '11b': 89 instance.same=True 90 print '11g + 11b' 91 #Generate IP addresses 92 if instance.same == True: 93 instance.ip1,instance.ip2 = freeinterlinkip() 94 netmask = '30' 95 instance.save() 96 93 97 #if wifi: check master and managed states for existings NICs/Interlinks 94 98 #Generate SSID 99 # add descriptions 95 100 #Generate ips and netmask 96 101 #Save form -
exodus/wllogic.py
r6229 r6231 1 1 # (c) Roland van Laar 2 2 3 from exodus.models import Node, Network 3 from exodus.models import Node, Network, Interlink 4 4 5 5 def newSSIDName(node, nic, desc): … … 39 39 40 40 return showaddr(i) 41 42 def freeinterlinkip(): 43 taken = {} 44 45 #add all interlink ipaddresses in taken[] 46 for link in Interlink.objects.all(): 47 addr = parseaddr(link.ip1) 48 taken[addr] = 1 49 addr = parseaddr(link.ip2) 50 taken[addr] = 1 51 52 size = 30 53 numaddrs = 1 << (32 -size) 54 i = 0xAC100001L 55 while taken.has_key(i): 56 print showaddr(i) 57 i = i + numaddrs 58 ips = [showaddr(i), showaddr(i+1)] 59 return ips
Note:
See TracChangeset
for help on using the changeset viewer.