diff --git a/topologie/migrations/0061_portprofile.py b/topologie/migrations/0061_portprofile.py index 7b6af2ed..2b326f28 100644 --- a/topologie/migrations/0061_portprofile.py +++ b/topologie/migrations/0061_portprofile.py @@ -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), ), ] diff --git a/topologie/migrations/0062_auto_20180609_1151.py b/topologie/migrations/0062_auto_20180609_1151.py deleted file mode 100644 index 3f074f7c..00000000 --- a/topologie/migrations/0062_auto_20180609_1151.py +++ /dev/null @@ -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'), - ), - ] diff --git a/topologie/migrations/0063_auto_20180609_1158.py b/topologie/migrations/0063_auto_20180609_1158.py deleted file mode 100644 index 59ea8732..00000000 --- a/topologie/migrations/0063_auto_20180609_1158.py +++ /dev/null @@ -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'), - ), - ] diff --git a/topologie/migrations/0064_auto_20180609_1220.py b/topologie/migrations/0064_auto_20180609_1220.py deleted file mode 100644 index f657a612..00000000 --- a/topologie/migrations/0064_auto_20180609_1220.py +++ /dev/null @@ -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'), - ), - ] diff --git a/topologie/models.py b/topologie/models.py index c43f8fc1..944eeaa5 100644 --- a/topologie/models.py +++ b/topologie/models.py @@ -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 = ( diff --git a/topologie/templates/topologie/aff_port_profile.html b/topologie/templates/topologie/aff_port_profile.html index b4b936c5..0c1ca622 100644 --- a/topologie/templates/topologie/aff_port_profile.html +++ b/topologie/templates/topologie/aff_port_profile.html @@ -8,13 +8,43 @@ {% endif %}
{% trans "Name" %} | +{% trans "VLAN untagged" %} | +{% trans "VLAN(s) tagged" %} | +|||
---|---|---|---|---|---|
{% trans "RADIUS type" %} | +{% trans "RADIUS mode" %} | ++ | {% trans "RADIUS type" %} | ++ | |
{% trans "speed" %} | ++ | {% trans "Mac limit" %} | ++ | {% trans "Flow control" %} | ++ |
{% trans "dhcp snooping" %} | ++ | {% trans "dhcpv6 snooping" %} | ++ | {% trans "arp protect" %} | ++ |
{% trans "ra guard" %} | ++ | {% trans "loop protect" %} | +