mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Refactor port_profil
This commit is contained in:
parent
0ed68194d7
commit
4c3f9f6540
6 changed files with 137 additions and 142 deletions
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2018-05-26 22:26
|
||||
# Generated by Django 1.10.7 on 2018-06-26 16:37
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
@ -10,7 +10,7 @@ import re2o.mixins
|
|||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('machines', '0081_auto_20180521_1413'),
|
||||
('machines', '0082_auto_20180525_2209'),
|
||||
('topologie', '0060_server'),
|
||||
]
|
||||
|
||||
|
@ -19,18 +19,26 @@ class Migration(migrations.Migration):
|
|||
name='PortProfile',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('room_default', models.BooleanField()),
|
||||
('hotspot_default', models.BooleanField()),
|
||||
('uplink_default', models.BooleanField()),
|
||||
('orga_machine_default', models.BooleanField()),
|
||||
('radius_type', models.CharField(choices=[('NO', 'NO'), ('802.1X', '802.1X'), ('MAC-radius', 'MAC-radius')], max_length=32)),
|
||||
('radius_mode', models.CharField(choices=[('STRICT', 'STRICT'), ('COMMON', 'COMMON')], max_length=32)),
|
||||
('vlan_tagged', models.ManyToManyField(related_name='vlan_tagged', to='machines.Vlan')),
|
||||
('vlan_untagged', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='vlan_untagged', to='machines.Vlan')),
|
||||
('name', models.CharField(max_length=255, verbose_name='Name')),
|
||||
('profil_default', models.CharField(blank=True, choices=[('room', 'room'), ('accespoint', 'accesspoint'), ('uplink', 'uplink'), ('asso_machine', 'asso_machine')], max_length=32, null=True, unique=True, verbose_name='profil default')),
|
||||
('radius_type', models.CharField(choices=[('NO', 'NO'), ('802.1X', '802.1X'), ('MAC-radius', 'MAC-radius')], max_length=32, verbose_name='RADIUS type')),
|
||||
('radius_mode', models.CharField(choices=[('STRICT', 'STRICT'), ('COMMON', 'COMMON')], default='COMMON', max_length=32, verbose_name='RADIUS mode')),
|
||||
('speed', models.CharField(choices=[('10-half', '10-half'), ('100-half', '100-half'), ('10-full', '10-full'), ('100-full', '100-full'), ('1000-full', '1000-full'), ('auto', 'auto'), ('auto-10', 'auto-10'), ('auto-100', 'auto-100')], default='auto', help_text='Mode de transmission et vitesse du port', max_length=32, verbose_name='Speed')),
|
||||
('mac_limit', models.IntegerField(blank=True, help_text='Limit du nombre de mac sur le port', null=True, verbose_name='Mac limit')),
|
||||
('flow_control', models.BooleanField(default=False, help_text='Gestion des débits', verbose_name='Flow control')),
|
||||
('dhcp_snooping', models.BooleanField(default=False, help_text='Protection dhcp pirate', verbose_name='Dhcp snooping')),
|
||||
('dhcpv6_snooping', models.BooleanField(default=False, help_text='Protection dhcpv6 pirate', verbose_name='Dhcpv6 snooping')),
|
||||
('arp_protect', models.BooleanField(default=False, help_text="Verification assignation de l'IP par dhcp", verbose_name='Arp protect')),
|
||||
('ra_guard', models.BooleanField(default=False, help_text='Protection contre ra pirate', verbose_name='Ra guard')),
|
||||
('loop_protect', models.BooleanField(default=False, help_text='Protection contre les boucles', verbose_name='Loop Protect')),
|
||||
('vlan_tagged', models.ManyToManyField(blank=True, null=True, related_name='vlan_tagged', to='machines.Vlan', verbose_name='VLAN(s) tagged')),
|
||||
('vlan_untagged', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='vlan_untagged', to='machines.Vlan', verbose_name='VLAN untagged')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Port profile',
|
||||
'permissions': (('view_port_profile', 'Can view a port profile object'),),
|
||||
'verbose_name_plural': 'Port profiles',
|
||||
},
|
||||
bases=(re2o.mixins.AclMixin, models.Model),
|
||||
bases=(re2o.mixins.AclMixin, re2o.mixins.RevMixin, models.Model),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2018-06-09 16:51
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('topologie', '0061_portprofile'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='portprofile',
|
||||
options={'permissions': (('view_port_profile', 'Can view a port profile object'),), 'verbose_name': 'Port profile', 'verbose_name_plural': 'Port profiles'},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='portprofile',
|
||||
name='name',
|
||||
field=models.CharField(default='Sans nom', max_length=255, verbose_name='Name'),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='portprofile',
|
||||
name='hotspot_default',
|
||||
field=models.BooleanField(verbose_name='Hotspot default'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='portprofile',
|
||||
name='orga_machine_default',
|
||||
field=models.BooleanField(verbose_name='Organisation machine default'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='portprofile',
|
||||
name='radius_mode',
|
||||
field=models.CharField(choices=[('STRICT', 'STRICT'), ('COMMON', 'COMMON')], max_length=32, verbose_name='RADIUS mode'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='portprofile',
|
||||
name='radius_type',
|
||||
field=models.CharField(choices=[('NO', 'NO'), ('802.1X', '802.1X'), ('MAC-radius', 'MAC-radius')], max_length=32, verbose_name='RADIUS type'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='portprofile',
|
||||
name='room_default',
|
||||
field=models.BooleanField(verbose_name='Room default'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='portprofile',
|
||||
name='uplink_default',
|
||||
field=models.BooleanField(verbose_name='Uplink default'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='portprofile',
|
||||
name='vlan_tagged',
|
||||
field=models.ManyToManyField(related_name='vlan_tagged', to='machines.Vlan', verbose_name='VLAN(s) tagged'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='portprofile',
|
||||
name='vlan_untagged',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='vlan_untagged', to='machines.Vlan', verbose_name='VLAN untagged'),
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2018-06-09 16:58
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('topologie', '0062_auto_20180609_1151'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='portprofile',
|
||||
name='vlan_tagged',
|
||||
field=models.ManyToManyField(blank=True, related_name='vlan_tagged', to='machines.Vlan', verbose_name='VLAN(s) tagged'),
|
||||
),
|
||||
]
|
|
@ -1,20 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2018-06-09 17:20
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('topologie', '0063_auto_20180609_1158'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='portprofile',
|
||||
name='radius_mode',
|
||||
field=models.CharField(blank=True, choices=[('STRICT', 'STRICT'), ('COMMON', 'COMMON')], max_length=32, null=True, verbose_name='RADIUS mode'),
|
||||
),
|
||||
]
|
|
@ -493,7 +493,7 @@ class Room(AclMixin, RevMixin, models.Model):
|
|||
return self.name
|
||||
|
||||
|
||||
class PortProfile(AclMixin, models.Model):
|
||||
class PortProfile(AclMixin, RevMixin, models.Model):
|
||||
"""Contains the information of the ports' configuration for a switch"""
|
||||
TYPES = (
|
||||
('NO', 'NO'),
|
||||
|
@ -504,37 +504,100 @@ class PortProfile(AclMixin, models.Model):
|
|||
('STRICT', 'STRICT'),
|
||||
('COMMON', 'COMMON'),
|
||||
)
|
||||
SPEED = (
|
||||
('10-half', '10-half'),
|
||||
('100-half', '100-half'),
|
||||
('10-full', '10-full'),
|
||||
('100-full', '100-full'),
|
||||
('1000-full', '1000-full'),
|
||||
('auto', 'auto'),
|
||||
('auto-10', 'auto-10'),
|
||||
('auto-100', 'auto-100'),
|
||||
)
|
||||
PROFIL_DEFAULT= (
|
||||
('room', 'room'),
|
||||
('accespoint', 'accesspoint'),
|
||||
('uplink', 'uplink'),
|
||||
('asso_machine', 'asso_machine'),
|
||||
)
|
||||
name = models.CharField(max_length=255, verbose_name=_("Name"))
|
||||
room_default = models.BooleanField(verbose_name=_("Room default"))
|
||||
hotspot_default = models.BooleanField(_("Hotspot default"))
|
||||
uplink_default = models.BooleanField(_("Uplink default"))
|
||||
orga_machine_default = models.BooleanField(_("Organisation machine"
|
||||
" default"))
|
||||
profil_default = models.CharField(
|
||||
max_length=32,
|
||||
choices=PROFIL_DEFAULT,
|
||||
blank=True,
|
||||
null=True,
|
||||
unique=True,
|
||||
verbose_name=_("profil default")
|
||||
)
|
||||
vlan_untagged = models.ForeignKey(
|
||||
'machines.Vlan',
|
||||
related_name='vlan_untagged',
|
||||
on_delete=models.SET_NULL,
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name=_("VLAN untagged")
|
||||
'machines.Vlan',
|
||||
related_name='vlan_untagged',
|
||||
on_delete=models.SET_NULL,
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name=_("VLAN untagged")
|
||||
)
|
||||
vlan_tagged = models.ManyToManyField(
|
||||
'machines.Vlan',
|
||||
related_name='vlan_tagged',
|
||||
blank=True,
|
||||
verbose_name=_("VLAN(s) tagged"))
|
||||
'machines.Vlan',
|
||||
related_name='vlan_tagged',
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name=_("VLAN(s) tagged")
|
||||
)
|
||||
radius_type = models.CharField(
|
||||
max_length=32,
|
||||
choices=TYPES,
|
||||
verbose_name=_("RADIUS type")
|
||||
max_length=32,
|
||||
choices=TYPES,
|
||||
verbose_name=_("RADIUS type")
|
||||
)
|
||||
radius_mode = models.CharField(
|
||||
max_length=32,
|
||||
choices=MODES,
|
||||
blank=True,
|
||||
null=True,
|
||||
verbose_name=_("RADIUS mode")
|
||||
max_length=32,
|
||||
choices=MODES,
|
||||
default='COMMON',
|
||||
verbose_name=_("RADIUS mode")
|
||||
)
|
||||
speed = models.CharField(
|
||||
max_length=32,
|
||||
choices=SPEED,
|
||||
default='auto',
|
||||
help_text='Mode de transmission et vitesse du port',
|
||||
verbose_name=_("Speed")
|
||||
)
|
||||
mac_limit = models.IntegerField(
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text='Limit du nombre de mac sur le port',
|
||||
verbose_name=_("Mac limit")
|
||||
)
|
||||
flow_control = models.BooleanField(
|
||||
default=False,
|
||||
help_text='Gestion des débits',
|
||||
verbose_name=_("Flow control")
|
||||
)
|
||||
dhcp_snooping = models.BooleanField(
|
||||
default=False,
|
||||
help_text='Protection dhcp pirate',
|
||||
verbose_name=_("Dhcp snooping")
|
||||
)
|
||||
dhcpv6_snooping = models.BooleanField(
|
||||
default=False,
|
||||
help_text='Protection dhcpv6 pirate',
|
||||
verbose_name=_("Dhcpv6 snooping")
|
||||
)
|
||||
arp_protect = models.BooleanField(
|
||||
default=False,
|
||||
help_text='Verification assignation de l\'IP par dhcp',
|
||||
verbose_name=_("Arp protect")
|
||||
)
|
||||
ra_guard = models.BooleanField(
|
||||
default=False,
|
||||
help_text='Protection contre ra pirate',
|
||||
verbose_name=_("Ra guard")
|
||||
)
|
||||
loop_protect = models.BooleanField(
|
||||
default=False,
|
||||
help_text='Protection contre les boucles',
|
||||
verbose_name=_("Loop Protect")
|
||||
)
|
||||
|
||||
class Meta:
|
||||
permissions = (
|
||||
|
|
|
@ -8,13 +8,43 @@
|
|||
{% endif %}
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "Name" %}</th>
|
||||
<th></td>
|
||||
<th>{% trans "VLAN untagged" %}</th>
|
||||
<td></td>
|
||||
<th>{% trans "VLAN(s) tagged" %}</th>
|
||||
<tr></tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans "RADIUS type" %}</th>
|
||||
<td></td>
|
||||
<th>{% trans "RADIUS mode" %}</th>
|
||||
<th></th>
|
||||
<th>{% trans "RADIUS type" %}</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans "speed" %}</th>
|
||||
<td></td>
|
||||
<th>{% trans "Mac limit" %}</th>
|
||||
<th></th>
|
||||
<th>{% trans "Flow control" %}</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans "dhcp snooping" %}</th>
|
||||
<td></td>
|
||||
<th>{% trans "dhcpv6 snooping" %}</th>
|
||||
<th></th>
|
||||
<th>{% trans "arp protect" %}</th>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans "ra guard" %}</th>
|
||||
<td></td>
|
||||
<th>{% trans "loop protect" %}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% for port_profile in port_profile_list %}
|
||||
|
|
Loading…
Reference in a new issue