Commit 827220a5 authored by chirac's avatar chirac

Formatage , et gestion des igmp querier

parent 4bac7c64
...@@ -70,6 +70,13 @@ class Switch: ...@@ -70,6 +70,13 @@ class Switch:
for vlan in port['get_port_profil']['vlan_tagged']: for vlan in port['get_port_profil']['vlan_tagged']:
add_to_vlans(vlans, vlan, port) add_to_vlans(vlans, vlan, port)
for ip, subnet in self.switch["interfaces_subnet"].items():
vlans[subnet[0]["vlan_id"]].setdefault("ipv4", {})
vlans[subnet[0]["vlan_id"]]["ipv4"][ip] = subnet
for ipv6, subnet in self.switch["interfaces6_subnet"].items():
vlans[subnet["vlan_id"]].setdefault("ipv6", {})
vlans[subnet["vlan_id"]]["ipv6"][ipv6] = subnet
arp_protect_vlans = [vlan["vlan_id"] for vlan in self.all_vlans if vlan["arp_protect"]] arp_protect_vlans = [vlan["vlan_id"] for vlan in self.all_vlans if vlan["arp_protect"]]
dhcp_snooping_vlans = [vlan["vlan_id"] for vlan in self.all_vlans if vlan["dhcp_snooping"]] dhcp_snooping_vlans = [vlan["vlan_id"] for vlan in self.all_vlans if vlan["dhcp_snooping"]]
dhcpv6_snooping_vlans = [vlan["vlan_id"] for vlan in self.all_vlans if vlan["dhcpv6_snooping"]] dhcpv6_snooping_vlans = [vlan["vlan_id"] for vlan in self.all_vlans if vlan["dhcpv6_snooping"]]
...@@ -112,10 +119,11 @@ class Switch: ...@@ -112,10 +119,11 @@ class Switch:
data = { data = {
"server_type": "ST_TFTP", "server_type": "ST_TFTP",
"file_name": self.get_conf_file_name(), "file_name": self.get_conf_file_name(),
"tftp_server_address": {"server_address": "tftp_server_address": {
{"ip_address": "server_address": {
{"version":"IAV_IP_V4", "ip_address": {
"octets":self.settings["switchs_management_interface_ip"]}}}, "version":"IAV_IP_V4",
"octets":self.settings["switchs_management_interface_ip"]}}},
"is_forced_reboot_enabled": True, "is_forced_reboot_enabled": True,
} }
# Nous lançons la requête de type POST. # Nous lançons la requête de type POST.
......
...@@ -44,25 +44,33 @@ vlan {{ id }} ...@@ -44,25 +44,33 @@ vlan {{ id }}
{%- if vlan["ports_untagged"] %} {%- if vlan["ports_untagged"] %}
untagged {{ vlan["ports_untagged"]|join(',') }} untagged {{ vlan["ports_untagged"]|join(',') }}
{%- endif %} {%- endif %}
{%- for ipv4, subnet in switch.interfaces_subnet.items() %} {%- if id in additionals.igmp_vlans %}
{%- if subnet.0.vlan_id == id %} ip igmp
ip address {{ ipv4 }}/{{ subnet.0.netmask_cidr }} {%- endif %}
{%- if id in additionals.mld_vlans %}
ipv6 mld version 1
ipv6 mld enable
{%- endif %} {%- endif %}
{%- if vlan.ipv4 %}
{%- for ipv4, subnet in vlan.ipv4.items() %}
ip address {{ ipv4 }}/{{ subnet.0.netmask_cidr }}
{%- endfor %} {%- endfor %}
{%- for ipv6, subnet6 in switch.interfaces6_subnet.items() %} {%- else %}
{%- if subnet6.vlan_id == id %} no ip address
{%- endif %}
{%- if vlan.ipv6 %}
{%- for ipv6, subnet6 in vlan.ipv6.items() %}
ipv6 address {{ ipv6 }}/{{ subnet6.netmask_cidr }} ipv6 address {{ ipv6 }}/{{ subnet6.netmask_cidr }}
{%- endif %}
{%- endfor %} {%- endfor %}
{%- else %}
no ipv6 address
{%- if id in additionals.igmp_vlans %} {%- if id in additionals.igmp_vlans %}
ip igmp
no ip igmp querier no ip igmp querier
{%- endif %} {%- endif %}
{%- if id in additionals.mld_vlans %} {%- if id in additionals.mld_vlans %}
no ipv6 mld querier no ipv6 mld querier
ipv6 mld version 1 {%- endif %}
ipv6 mld enable {%- endif %}
{%- endif %}
exit exit
{%- endfor %} {%- endfor %}
;--- Accès d'administration --- ;--- Accès d'administration ---
......
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