This commit is contained in:
Michaël Paulon 2020-09-30 00:01:52 +02:00
parent 9464de9c5b
commit 058451c41d

View file

@ -3,8 +3,6 @@ import difflib
import getpass import getpass
import logging import logging
from pprint import pprint
import colorlog import colorlog
import requests import requests
import termcolor import termcolor
@ -181,7 +179,6 @@ def gen_conf_re2o(re2o_config, header):
mgmt_utils = re2o_config.get("switchs_management_utils") mgmt_utils = re2o_config.get("switchs_management_utils")
ipv4_managers = dict() ipv4_managers = dict()
for m in mgmt_utils.get("subnet"): for m in mgmt_utils.get("subnet"):
print(m)
ipv4_managers[m.get("network")] = { "ip": m.get("network"), "subnet": m.get("netmask")} ipv4_managers[m.get("network")] = { "ip": m.get("network"), "subnet": m.get("netmask")}
ipv6_managers = dict() ipv6_managers = dict()
# FUCK YOU ! subnet6 c'est pas une liste de subnets mais un seul subnet # FUCK YOU ! subnet6 c'est pas une liste de subnets mais un seul subnet
@ -200,7 +197,6 @@ def gen_conf_re2o(re2o_config, header):
for port in re2o_config.get("ports"): for port in re2o_config.get("ports"):
port_profile = port["get_port_profile"] port_profile = port["get_port_profile"]
for v in port_profile["vlan_tagged"]: for v in port_profile["vlan_tagged"]:
print(v)
if v["vlan_id"] == vlan_id: if v["vlan_id"] == vlan_id:
range_tagged.append(port["port"]) range_tagged.append(port["port"])
# i n'y a qu'un seul vlan untagged # i n'y a qu'un seul vlan untagged
@ -284,12 +280,7 @@ def gen_conf_re2o(re2o_config, header):
"loop_protect": loop_protect, "loop_protect": loop_protect,
"arp_protect": arp_protect, "arp_protect": arp_protect,
"interfaces": interfaces, "interfaces": interfaces,
"FUCK": ['interfaces_subnet', 'ports', 'ipv6', 'ipv4', 'get_radius_key_value', 'interfaces6_subnet', 'list_modules']
} }
pprint(re2o_config)
# pprint(re2o_config.get("interfaces_subnet"))
# pprint(re2o_config.get("list_modules"))
# raise RuntimeError()
return conf_from_dict(config_dict) return conf_from_dict(config_dict)
@ -331,7 +322,6 @@ def get_switch_from_re2o(re2o_instance, switch_name, re2o_user):
sw_config.update(r.json()) sw_config.update(r.json())
# on récupère la liste des vlans # on récupère la liste des vlans
r = requests.get(base_url + "machines/vlan", headers=headers) r = requests.get(base_url + "machines/vlan", headers=headers)
pprint(r.json().get("results"))
sw_config.update({"vlans": r.json().get("results")}) sw_config.update({"vlans": r.json().get("results")})
return sw_config return sw_config