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
132b5fe8
authored
7 years ago
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: minimal modifications on Vxlan model
parent
cd848582
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
circle/network/migrations/0002_auto_20171110_0041.py
+31
-0
circle/network/models.py
+7
-2
No files found.
circle/network/migrations/0002_auto_20171110_0041.py
0 → 100644
View file @
132b5fe8
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-10 00:41
from
__future__
import
unicode_literals
import
django.core.validators
from
django.db
import
migrations
,
models
import
firewall.fields
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'network'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterModelOptions
(
name
=
'vxlan'
,
options
=
{
'ordering'
:
(
'vni'
,),
'permissions'
:
((
'create_vxlan'
,
'Can create a Vxlan network.'
),),
'verbose_name'
:
'vxlan'
,
'verbose_name_plural'
:
'vxlans'
},
),
migrations
.
AlterField
(
model_name
=
'vxlan'
,
name
=
'name'
,
field
=
models
.
CharField
(
help_text
=
'The short name of the virtual network.'
,
max_length
=
20
,
validators
=
[
firewall
.
fields
.
val_alfanum
],
verbose_name
=
'Name'
),
),
migrations
.
AlterField
(
model_name
=
'vxlan'
,
name
=
'vni'
,
field
=
models
.
IntegerField
(
help_text
=
'VXLAN Network Identifier.'
,
unique
=
True
,
validators
=
[
django
.
core
.
validators
.
MinValueValidator
(
0
),
django
.
core
.
validators
.
MaxValueValidator
(
4095
)],
verbose_name
=
'VNI'
),
),
]
This diff is collapsed.
Click to expand it.
circle/network/models.py
View file @
132b5fe8
...
...
@@ -42,17 +42,19 @@ class Vxlan(AclBase, models.Model):
ACL_LEVELS
=
(
(
'user'
,
_
(
'user'
)),
(
'operator'
,
_
(
'operator'
)),
(
'owner'
,
_
(
'owner'
)),
)
# NOTE: VXLAN VNI's maximal value is 2^24-1, but MAC address generator
# only supports 2^12-1 maximal value.
vni
=
models
.
IntegerField
(
unique
=
True
,
verbose_name
=
_
(
'VNI'
),
help_text
=
_
(
'VXLAN Network Identifier.'
),
validators
=
[
MinValueValidator
(
0
),
MaxValueValidator
(
2
**
24
-
1
)])
MaxValueValidator
(
2
**
12
-
1
)])
vlan
=
models
.
ForeignKey
(
Vlan
,
verbose_name
=
_
(
'vlan'
),
help_text
=
_
(
'The server vlan.'
))
name
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
,
verbose_name
=
_
(
'Name'
),
help_text
=
_
(
'The short name of the '
'virtual network.'
),
...
...
@@ -77,6 +79,9 @@ class Vxlan(AclBase, models.Model):
verbose_name
=
_
(
"vxlan"
)
verbose_name_plural
=
_
(
"vxlans"
)
ordering
=
(
'vni'
,
)
permissions
=
(
(
'create_vxlan'
,
_
(
'Can create a Vxlan network.'
)),
)
def
__unicode__
(
self
):
return
self
.
name
...
...
This diff is collapsed.
Click to expand it.
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