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
31f1acaa
authored
Jun 06, 2016
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: repair the Vlan's get_new_address() method. Issue:
#425
parent
f5902b8f
Pipeline
#91
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
+7
-1
circle/firewall/models.py
+7
-1
No files found.
circle/firewall/models.py
View file @
31f1acaa
...
@@ -36,6 +36,7 @@ from django.core.validators import MinValueValidator, MaxValueValidator
...
@@ -36,6 +36,7 @@ from django.core.validators import MinValueValidator, MaxValueValidator
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
import
django.conf
import
django.conf
from
django.db.models.signals
import
post_save
,
post_delete
from
django.db.models.signals
import
post_save
,
post_delete
from
django.db.models
import
Q
from
celery.exceptions
import
TimeoutError
from
celery.exceptions
import
TimeoutError
from
netaddr
import
IPSet
,
EUI
,
IPNetwork
,
IPAddress
,
ipv6_full
from
netaddr
import
IPSet
,
EUI
,
IPNetwork
,
IPAddress
,
ipv6_full
...
@@ -499,7 +500,12 @@ class Vlan(AclBase, models.Model):
...
@@ -499,7 +500,12 @@ class Vlan(AclBase, models.Model):
def
get_new_address
(
self
):
def
get_new_address
(
self
):
hosts
=
self
.
host_set
hosts
=
self
.
host_set
used_v4
=
IPSet
(
hosts
.
values_list
(
'ipv4'
,
flat
=
True
))
query
=
Q
(
shared_ip
=
False
)
\
|
Q
(
external_ipv4__isnull
=
False
)
\
|
Q
(
vlan
=
self
)
ipv4_hosts
=
Host
.
objects
.
filter
(
query
)
used_v4
=
IPSet
(
ipv4_hosts
.
values_list
(
'ipv4'
,
flat
=
True
))
used_v6
=
IPSet
(
hosts
.
exclude
(
ipv6__isnull
=
True
)
used_v6
=
IPSet
(
hosts
.
exclude
(
ipv6__isnull
=
True
)
.
values_list
(
'ipv6'
,
flat
=
True
))
.
values_list
(
'ipv6'
,
flat
=
True
))
...
...
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