Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
circlestack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cb15e6e4
authored
Mar 07, 2018
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement advanced network creation
parent
400534b4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
9 deletions
+15
-9
.idea/workspace.xml
+0
-0
circle/network/templates/network/vxlan-create.html
+1
-1
circle/network/views.py
+14
-8
No files found.
.idea/workspace.xml
View file @
cb15e6e4
This diff is collapsed.
Click to expand it.
circle/network/templates/network/vxlan-create.html
View file @
cb15e6e4
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
<div
v-cloak
v-if=
"isAdvancedConfig"
>
<div
v-cloak
v-if=
"isAdvancedConfig"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
for=
"id_network_address"
>
Network address
<i
class=
"asteriskField"
>
*
</i></label>
<label
for=
"id_network_address"
>
Network address
<i
class=
"asteriskField"
>
*
</i></label>
<input
type=
"text"
name=
"n
ame
"
required
class=
"form-control textinput textInput form-control"
id=
"id_network_address"
>
<input
type=
"text"
name=
"n
etworkAddress
"
required
class=
"form-control textinput textInput form-control"
id=
"id_network_address"
>
<input
name=
"isDhcpEnabled"
type=
"checkbox"
v-model=
"isDhcpEnabled"
>
Enable DHCP
<input
name=
"isDhcpEnabled"
type=
"checkbox"
v-model=
"isDhcpEnabled"
>
Enable DHCP
</div>
</div>
...
...
circle/network/views.py
View file @
cb15e6e4
...
@@ -999,10 +999,16 @@ class VxlanCreate(LoginRequiredMixin, FormView):
...
@@ -999,10 +999,16 @@ class VxlanCreate(LoginRequiredMixin, FormView):
def
form_valid
(
self
,
form
):
def
form_valid
(
self
,
form
):
network_created
=
openstack_api
.
neutron
.
network_create
(
self
.
request
,
name
=
form
.
cleaned_data
[
'name'
])
network_created
=
openstack_api
.
neutron
.
network_create
(
self
.
request
,
name
=
form
.
cleaned_data
[
'name'
])
if
form
.
cleaned_data
[
'isAdvancedConfig'
]:
try
:
pass
if
form
.
cleaned_data
[
'isAdvancedConfig'
]:
else
:
openstack_api
.
neutron
.
subnet_create
(
try
:
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
:
# TODO: default ip version should read from SETTINGS
# TODO: default ip version should read from SETTINGS
openstack_api
.
neutron
.
subnet_create
(
openstack_api
.
neutron
.
subnet_create
(
self
.
request
,
self
.
request
,
...
@@ -1010,10 +1016,10 @@ class VxlanCreate(LoginRequiredMixin, FormView):
...
@@ -1010,10 +1016,10 @@ class VxlanCreate(LoginRequiredMixin, FormView):
ip_version
=
4
,
ip_version
=
4
,
subnetpool_id
=
SubnetPool
.
get_id
(
self
.
request
)
subnetpool_id
=
SubnetPool
.
get_id
(
self
.
request
)
)
)
except
:
except
:
openstack_api
.
neutron
.
network_delete
(
self
.
request
,
network_created
.
id
)
openstack_api
.
neutron
.
network_delete
(
self
.
request
,
network_created
.
id
)
#TODO: user friendly error handling
#TODO: user friendly error handling
raise
Exception
(
"Could not create subnet for network, deleted network."
)
raise
Exception
(
"Could not create subnet for network, deleted network."
)
return
redirect
(
reverse_lazy
(
'network.vxlan'
,
kwargs
=
{
'pk'
:
network_created
.
id
}))
return
redirect
(
reverse_lazy
(
'network.vxlan'
,
kwargs
=
{
'pk'
:
network_created
.
id
}))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment