8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 07:23:46 +00:00

Gestion igmp et mld par vlan

This commit is contained in:
Gabriel Detraz 2018-07-08 20:32:47 +02:00 committed by grizzly
parent 30bb38d75f
commit d2d6f7e5e4
5 changed files with 52 additions and 3 deletions

View file

@ -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):

View file

@ -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(

View file

@ -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'),
),
]

View file

@ -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")),

View file

@ -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 %}