Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
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
5f05e808
authored
Nov 13, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall: fix tests
parent
059593b1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
circle/firewall/models.py
+2
-1
circle/firewall/tests/test_firewall.py
+4
-6
circle/vm/tests/test_models.py
+1
-0
No files found.
circle/firewall/models.py
View file @
5f05e808
...
...
@@ -405,7 +405,8 @@ class Vlan(AclBase, models.Model):
_
(
"
%(ip6)
s (translated from
%(ip4)
s) is outside of "
"the IPv6 network."
)
%
{
"ip4"
:
i
,
"ip6"
:
i6
})
if
not
self
.
ipv6_template
and
self
.
network6
:
self
.
ipv6_template
=
self
.
_magic_ipv6_template
()
self
.
ipv6_template
=
self
.
_magic_ipv6_template
(
self
.
network4
,
self
.
network6
)
host4_bytes
=
self
.
_host_bytes
(
self
.
network4
.
prefixlen
,
4
)
host6_bytes
=
self
.
_host_bytes
(
self
.
network6
.
prefixlen
,
16
)
if
host4_bytes
>
host6_bytes
:
...
...
circle/firewall/tests/test_firewall.py
View file @
5f05e808
...
...
@@ -78,6 +78,7 @@ class GetNewAddressTestCase(TestCase):
self
.
vlan
=
Vlan
(
vid
=
1
,
name
=
'test'
,
network4
=
'10.0.0.0/29'
,
network6
=
'2001:738:2001:4031::/80'
,
domain
=
d
,
owner
=
self
.
u1
)
self
.
vlan
.
clean
()
self
.
vlan
.
save
()
self
.
vlan
.
host_set
.
all
()
.
delete
()
for
i
in
[
1
]
+
range
(
3
,
6
):
...
...
@@ -85,6 +86,9 @@ class GetNewAddressTestCase(TestCase):
ipv4
=
'10.0.0.
%
d'
%
i
,
vlan
=
self
.
vlan
,
owner
=
self
.
u1
)
.
save
()
def
tearDown
(
self
):
self
.
vlan
.
delete
()
def
test_new_addr_w_empty_vlan
(
self
):
self
.
vlan
.
host_set
.
all
()
.
delete
()
self
.
vlan
.
get_new_address
()
...
...
@@ -96,12 +100,6 @@ class GetNewAddressTestCase(TestCase):
owner
=
self
.
u1
)
.
save
()
self
.
assertRaises
(
ValidationError
,
self
.
vlan
.
get_new_address
)
def
test_all_addr_in_use_w_ipv6
(
self
):
Host
(
hostname
=
'h-x'
,
mac
=
'01:02:03:04:05:06'
,
ipv4
=
'10.0.0.6'
,
ipv6
=
'2001:738:2001:4031:0:0:2:0'
,
vlan
=
self
.
vlan
,
owner
=
self
.
u1
)
.
save
()
self
.
assertRaises
(
ValidationError
,
self
.
vlan
.
get_new_address
)
def
test_new_addr
(
self
):
used_v4
=
IPSet
(
self
.
vlan
.
host_set
.
values_list
(
'ipv4'
,
flat
=
True
))
assert
self
.
vlan
.
get_new_address
()[
'ipv4'
]
not
in
used_v4
...
...
circle/vm/tests/test_models.py
View file @
5f05e808
...
...
@@ -177,6 +177,7 @@ class InterfaceTestCase(TestCase):
d
.
save
()
v
=
Vlan
(
vid
=
55
,
network4
=
'127.0.0.1/8'
,
network6
=
'2001::1/32'
,
domain
=
d
)
v
.
clean
()
v
.
save
()
Interface
.
create
(
i
,
v
,
managed
=
True
,
owner
=
owner
)
...
...
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