Commit cb15e6e4 by Szabolcs Gelencser

Implement advanced network creation

parent 400534b4
......@@ -23,7 +23,7 @@
<div v-cloak v-if="isAdvancedConfig">
<div class="form-group">
<label for="id_network_address"> Network address <i class="asteriskField">*</i></label>
<input type="text" name="name" required class="form-control textinput textInput form-control" id="id_network_address">
<input type="text" name="networkAddress" required class="form-control textinput textInput form-control" id="id_network_address">
<input name="isDhcpEnabled" type="checkbox" v-model="isDhcpEnabled"> Enable DHCP
</div>
......
......@@ -999,10 +999,16 @@ class VxlanCreate(LoginRequiredMixin, FormView):
def form_valid(self, form):
network_created = openstack_api.neutron.network_create(self.request, name=form.cleaned_data['name'])
try:
if form.cleaned_data['isAdvancedConfig']:
pass
openstack_api.neutron.subnet_create(
self.request,
network_created.id,
ip_version=4, #TODO: there should be a radio button for protocol
cidr=form.cleaned_data['networkAddress'],
enable_dhcp=form.cleaned_data['isDhcpEnabled'],
)
else:
try:
# TODO: default ip version should read from SETTINGS
openstack_api.neutron.subnet_create(
self.request,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment