diff --git a/api/serializers.py b/api/serializers.py index 58de859b..c72c03de 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -153,7 +153,8 @@ class VlanSerializer(NamespacedHMSerializer): """ class Meta: model = machines.Vlan - fields = ('vlan_id', 'name', 'comment', 'arp_protect', 'dhcp_snooping', 'dhcpv6_snooping', 'api_url') + fields = ('vlan_id', 'name', 'comment', 'arp_protect', 'dhcp_snooping', + 'dhcpv6_snooping', 'igmp', 'mld', 'api_url') class NasSerializer(NamespacedHMSerializer): diff --git a/machines/forms.py b/machines/forms.py index eda62c7c..6be9b2a2 100644 --- a/machines/forms.py +++ b/machines/forms.py @@ -580,13 +580,24 @@ class VlanForm(FormRevMixin, ModelForm): """Ajout d'un vlan : id, nom""" class Meta: model = Vlan - fields = '__all__' + fields = ['vlan_id', 'name', 'comment'] def __init__(self, *args, **kwargs): prefix = kwargs.pop('prefix', self.Meta.model.__name__) super(VlanForm, self).__init__(*args, prefix=prefix, **kwargs) +class EditOptionVlanForm(FormRevMixin, ModelForm): + """Ajout d'un vlan : id, nom""" + class Meta: + model = Vlan + fields = ['dhcp_snooping', 'dhcpv6_snooping', 'arp_protect', 'igmp', 'mld'] + + def __init__(self, *args, **kwargs): + prefix = kwargs.pop('prefix', self.Meta.model.__name__) + super(EditOptionVlanForm, self).__init__(*args, prefix=prefix, **kwargs) + + class DelVlanForm(FormRevMixin, Form): """Suppression d'un ou plusieurs vlans""" vlan = forms.ModelMultipleChoiceField( diff --git a/machines/migrations/0092_auto_20180708_2018.py b/machines/migrations/0092_auto_20180708_2018.py new file mode 100644 index 00000000..b4f41c14 --- /dev/null +++ b/machines/migrations/0092_auto_20180708_2018.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2018-07-08 18:18 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('machines', '0091_auto_20180707_2040'), + ] + + operations = [ + migrations.AddField( + model_name='vlan', + name='igmp', + field=models.BooleanField(default=False, help_text='Gestion multicast v4'), + ), + migrations.AddField( + model_name='vlan', + name='mld', + field=models.BooleanField(default=False, help_text='Gestion multicast v6'), + ), + ] diff --git a/machines/models.py b/machines/models.py index 7e5062c0..b33693d9 100644 --- a/machines/models.py +++ b/machines/models.py @@ -502,7 +502,15 @@ class Vlan(RevMixin, AclMixin, models.Model): arp_protect = models.BooleanField(default=False) dhcp_snooping = models.BooleanField(default=False) dhcpv6_snooping = models.BooleanField(default=False) - + igmp = models.BooleanField( + default=False, + help_text="Gestion multicast v4" + ) + mld = models.BooleanField( + default=False, + help_text="Gestion multicast v6" + ) + class Meta: permissions = ( ("view_vlan", "Peut voir un objet vlan"), diff --git a/topologie/templates/topologie/aff_vlanoptions.html b/topologie/templates/topologie/aff_vlanoptions.html index d9e6f117..7684e951 100644 --- a/topologie/templates/topologie/aff_vlanoptions.html +++ b/topologie/templates/topologie/aff_vlanoptions.html @@ -33,6 +33,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,