Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e01052c4
authored
May 28, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: save new vlans
parent
bc2a90c8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
5 deletions
+30
-5
cloud/urls.py
+1
-1
firewall_gui/views.py
+29
-4
No files found.
cloud/urls.py
View file @
e01052c4
...
@@ -119,7 +119,7 @@ urlpatterns = patterns('',
...
@@ -119,7 +119,7 @@ urlpatterns = patterns('',
url
(
r'^firewall/rules/new/$'
,
'firewall_gui.views.show_rule'
),
url
(
r'^firewall/rules/new/$'
,
'firewall_gui.views.show_rule'
),
url
(
r'^firewall/hosts/new/$'
,
'firewall_gui.views.show_host'
),
url
(
r'^firewall/hosts/new/$'
,
'firewall_gui.views.show_host'
),
# url(r'^firewall/vlans/save/$', 'firewall_gui.views.save
_vlan'),
url
(
r'^firewall/vlans/new/$'
,
'firewall_gui.views.show
_vlan'
),
# url(r'^firewall/vlangroups/save/$', 'firewall_gui.views.save_vlangroup'),
# url(r'^firewall/vlangroups/save/$', 'firewall_gui.views.save_vlangroup'),
# url(r'^firewall/hostgroups/save/$', 'firewall_gui.views.save_hostgroup'),
# url(r'^firewall/hostgroups/save/$', 'firewall_gui.views.save_hostgroup'),
# url(r'^firewall/domains/save/$', 'firewall_gui.views.save_domain'),
# url(r'^firewall/domains/save/$', 'firewall_gui.views.save_domain'),
...
...
firewall_gui/views.py
View file @
e01052c4
...
@@ -320,8 +320,9 @@ def show_host(request, id=None):
...
@@ -320,8 +320,9 @@ def show_host(request, id=None):
return
HttpResponse
(
json
.
dumps
(
host
),
content_type
=
'application/json'
)
return
HttpResponse
(
json
.
dumps
(
host
),
content_type
=
'application/json'
)
def
show_vlan
(
request
,
id
):
def
show_vlan
(
request
,
id
=
None
):
vlan
=
get_object_or_404
(
Vlan
,
id
=
id
)
try
:
vlan
=
Vlan
.
objects
.
get
(
id
=
id
)
vlan
=
{
vlan
=
{
'id'
:
vlan
.
id
,
'id'
:
vlan
.
id
,
'vid'
:
vlan
.
vid
,
'vid'
:
vlan
.
vid
,
...
@@ -360,6 +361,30 @@ def show_vlan(request, id):
...
@@ -360,6 +361,30 @@ def show_vlan(request, id):
'name'
:
vlan
.
name
,
'name'
:
vlan
.
name
,
}
for
vlan
in
vlan
.
snat_to
.
all
()]
}
for
vlan
in
vlan
.
snat_to
.
all
()]
}
}
except
:
vlan
=
{
'id'
:
None
,
'vid'
:
None
,
'name'
:
None
,
'ipv4'
:
None
,
'ipv6'
:
None
,
'nat'
:
''
,
'description'
:
''
,
'comment'
:
''
,
'reverse_domain'
:
''
,
'dhcp_pool'
:
''
,
'interface'
:
''
,
'created_at'
:
None
,
'modified_at'
:
None
,
'owner'
:
{
'name'
:
None
,
},
'domain'
:
{
'name'
:
None
,
},
'rules'
:
[],
'vlans'
:
[]
}
return
HttpResponse
(
json
.
dumps
(
vlan
),
content_type
=
'application/json'
)
return
HttpResponse
(
json
.
dumps
(
vlan
),
content_type
=
'application/json'
)
...
@@ -589,9 +614,9 @@ def save_vlan(request):
...
@@ -589,9 +614,9 @@ def save_vlan(request):
errors
=
{}
errors
=
{}
vlan
.
vid
=
data
[
'vid'
]
vlan
.
vid
=
data
[
'vid'
]
vlan
.
name
=
data
[
'name'
]
vlan
.
name
=
data
[
'name'
]
vlan
.
ipv4
=
data
[
'ipv4'
]
.
split
(
'/'
)[
0
]
vlan
.
ipv4
=
vlan
.
net4
=
data
[
'ipv4'
]
.
split
(
'/'
)[
0
]
vlan
.
prefix4
=
data
[
'ipv4'
]
.
split
(
'/'
)[
1
]
vlan
.
prefix4
=
data
[
'ipv4'
]
.
split
(
'/'
)[
1
]
vlan
.
ipv6
=
data
[
'ipv6'
]
.
split
(
'/'
)[
0
]
vlan
.
ipv6
=
vlan
.
net6
=
data
[
'ipv6'
]
.
split
(
'/'
)[
0
]
vlan
.
prefix6
=
data
[
'ipv6'
]
.
split
(
'/'
)[
1
]
vlan
.
prefix6
=
data
[
'ipv6'
]
.
split
(
'/'
)[
1
]
vlan
.
snat_ip
=
data
[
'nat'
]
vlan
.
snat_ip
=
data
[
'nat'
]
vlan
.
description
=
data
[
'description'
]
vlan
.
description
=
data
[
'description'
]
...
...
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