Changeset 6239
- Timestamp:
- Sep 3, 2008, 8:23:06 AM (16 years ago)
- Location:
- exodus
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
exodus/templates/addinterlink.html
r6206 r6239 4 4 5 5 <h1> add an interlink </h1> 6 {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} 6 7 7 8 <form method="post" action="."> -
exodus/views.py
r6237 r6239 76 76 # check if we have two different ifaces from two different nodes 77 77 # Should add a error message if they are from the same node 78 compatibleInterfaces = False 79 differentNodes = True 80 errorMessage = "" 78 81 79 if instance.iface1.node.id != instance.iface2.node.id: 80 print 'Iface 1 and 2 are on a different node' 81 # check if they have the same mode 82 if instance.iface1.type == instance.iface2.type: 83 print '''these ifaces are of the same type''' 84 instance.same=True 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 97 #if wifi: check master and managed states for existings NICs/Interlinks 98 #Generate SSID 82 # check if they have the same mode 83 if instance.iface1.node.id == instance.iface2.node.id: 84 differentNodes = False 85 86 # Interface check 87 # XXX: Make sure interfaces type is defined as beeing a certain type instead of hardcoding 88 if instance.iface1.type == instance.iface2.type: 89 compatibleInterfaces = True 90 if str(instance.iface1.type) == '11b' and str(instance.iface2.type) == '11g': 91 compatibleInterfaces = True 92 if str(instance.iface1.type) == '11g' and str(instance.iface2.type) == '11b': 93 compatibleInterfaces = True 94 95 if compatibleInterfaces and differentNodes: 96 instance.save() 97 return HttpResponseRedirect("/exodus/") 98 else: 99 form = addInterlinkForm(instance = instance) 100 if compatibleInterfaces == False: 101 errorMessage = "Please use compatible interfaces" 102 elif differentNodes == False: 103 errorMessage = "No interlink possible between interfaces on the same node" 104 105 return render_to_response('addinterlink.html',{'form': form, 'error_message' : errorMessage }) 106 #XXX :if wifi: check master and managed states for existings NICs/Interlinks 107 #Generate SSID 99 108 # add descriptions 100 109 #Generate ips and netmask 101 110 #Save form 102 #return HttpResponseRedirect("/exodus/")103 else:111 else: 112 #XXX: Autofetch new IP numbers 104 113 newForm = Interlink(ip1='172.16.0.0', ip2='172.16.0.0') 105 114 form = addInterlinkForm(instance = newForm) 106 115 return render_to_response('addinterlink.html',{'form': form}) 107 108 109 def addinterlink_old(request):110 if request.POST:111 form = addInterlinkForm(request.POST)112 if form.is_valid():113 instance = form.save(commit=False)114 if str(instance.iface1.type) != "eth":115 print instance.iface.name116 instance.ssid = newSSIDName(instance.node,117 instance.iface,'il')118 instance.channel = '1'119 instance.mode = Mode(pk=1) # set to master120 instance.save()121 return HttpResponseRedirect("/exodus/")122 else:123 newForm = Interlink(ip1='172.16.0.0',ip2='172.16.0.0')124 form = addInterlinkForm(instance=newForm)125 return render_to_response('addinterlink.html', {'form': form })126 116 127 117 class addOmniForm(forms.ModelForm):
Note:
See TracChangeset
for help on using the changeset viewer.