From d0d3a74510819191e9a821c95fcb1251a7f4cde5 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Mon, 19 Nov 2012 17:14:18 +0100 Subject: [PATCH] [switch] generation auto du dhcp-snooping et retrait de l'ip de sable de celui-ci. Ignore-this: 1af64676a16ddbe8a08d95621a3a09ba darcs-hash:20121119161418-3a55a-5244914f13a02d08eac52203275c5d83d259f7b4.gz --- gestion/gen_confs/switchs.py | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/gestion/gen_confs/switchs.py b/gestion/gen_confs/switchs.py index 7b23eecf..3775dd1d 100644 --- a/gestion/gen_confs/switchs.py +++ b/gestion/gen_confs/switchs.py @@ -144,18 +144,28 @@ no cdp run no stack """ + # Serveur DHCP des différent vlans + dhcp_servers = { + '1':'138.231.136.34', + '3':'138.231.148.34', + '6':'10.42.0.34', + '7':'10.51.0.34', + '9':'10.52.0.34', + '21':'10.2.9.34' + } + dhcp_snooping_template = """;------------------------------------------------------- DHCP Snooping -dhcp-snooping vlan %(vlan_adherent)s %(vlan_wifi)s %(vlan_accueil)s %(vlan_gratuit)s %(vlan_isolement)s %(vlan_appts)s +dhcp-snooping vlan""" + for vlan in dhcp_servers.keys(): + dhcp_snooping_template +=""" %s""" % vlan + dhcp_snooping_template +=""" dhcp-snooping trust %(uplinks)s no dhcp-snooping trust %(non_uplinks)s -dhcp-snooping authorized-server %(dhcp)s -dhcp-snooping authorized-server %(dhcp-1)s -dhcp-snooping authorized-server %(dhcp-3)s -dhcp-snooping authorized-server %(dhcp-6)s -dhcp-snooping authorized-server %(dhcp-7)s -dhcp-snooping authorized-server %(dhcp-9)s -dhcp-snooping authorized-server %(dhcp-21)s -; Activation +""" + for vlan in dhcp_servers.keys(): + dhcp_snooping_template +="""dhcp-snooping authorized-server %%(dhcp-%s)s +""" % vlan + dhcp_snooping_template +="""; Activation dhcp-snooping""" interface_template = """interface %(prise)i @@ -169,16 +179,6 @@ exit # Serveurs radius rad_servs = [ '10.231.136.72', '10.231.136.9' ] rad_template = "radius-server host %s\n" - - # Serveur DHCP du vlan par défaut - dhcp_servers = { '0':'138.231.136.9', - '1':'138.231.136.34', - '3':'138.231.148.34', - '6':'10.42.0.34', - '7':'10.51.0.34', - '9':'10.52.0.34', - '21':'10.2.9.34' - } def __init__(self,truc): @@ -311,7 +311,7 @@ exit params = { 'switch' : switch, 'bat' : bat.upper() , 'radius_key' : radius_key , 'radius-serveurs' : rad[:-1] % tuple(self.rad_servs), - 'dhcp': dhcp_servers['0']} + } for i in dhcp_servers.keys(): params['dhcp-%s' % i]=dhcp_servers[i]