Commit d2d6f7e5 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by grizzly

Gestion igmp et mld par vlan

parent 30bb38d7
......@@ -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):
......
......@@ -576,13 +576,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(
......
# -*- 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'),
),
]
......@@ -519,7 +519,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", _("Can view a VLAN object")),
......
......@@ -33,6 +33,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<th>Arp Protect</th>
<th>Dhcp Snooping</th>
<th>Dhcpv6 Snooping</th>
<th>Igmp</th>
<th>Mld</th>
<th></th>
</tr>
</thead>
......@@ -43,6 +45,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<td>{{ vlan.arp_protect }}</td>
<td>{{ vlan.dhcp_snooping }}</td>
<td>{{ vlan.dhcpv6_snooping }}</td>
<td>{{ vlan.igmp }}</td>
<td>{{ vlan.mld }}</td>
<td class="text-right">
{% can_edit vlan %}
{% include 'buttons/edit.html' with href='topologie:edit-vlanoptions' id=vlan.id %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment