Gestion du mode SFTP de provision
This commit is contained in:
parent
fae56e6fa6
commit
6dd130a962
2 changed files with 26 additions and 12 deletions
16
main.py
16
main.py
|
@ -118,6 +118,8 @@ class Switch:
|
||||||
def apply_conf_hp(self):
|
def apply_conf_hp(self):
|
||||||
"""Apply config restore via rest"""
|
"""Apply config restore via rest"""
|
||||||
url_restore = "http://" + self.switch["ipv4"] + "/rest/v4/system/config/cfg_restore"
|
url_restore = "http://" + self.switch["ipv4"] + "/rest/v4/system/config/cfg_restore"
|
||||||
|
provision_mode = self.settings["switchs_provision"]
|
||||||
|
if provision_mode == "tftp":
|
||||||
data = {
|
data = {
|
||||||
"server_type": "ST_TFTP",
|
"server_type": "ST_TFTP",
|
||||||
"file_name": self.get_conf_file_name(),
|
"file_name": self.get_conf_file_name(),
|
||||||
|
@ -128,6 +130,20 @@ class Switch:
|
||||||
"octets":self.settings["switchs_management_interface_ip"]}}},
|
"octets":self.settings["switchs_management_interface_ip"]}}},
|
||||||
"is_forced_reboot_enabled": True,
|
"is_forced_reboot_enabled": True,
|
||||||
}
|
}
|
||||||
|
elif provision_mode == "sftp":
|
||||||
|
data = {
|
||||||
|
"server_type": "ST_SFTP",
|
||||||
|
"file_name": self.get_conf_file_name(),
|
||||||
|
"tftp_server_address": {
|
||||||
|
"server_address": {
|
||||||
|
"ip_address": {
|
||||||
|
"version":"IAV_IP_V4",
|
||||||
|
"octets":self.settings["switchs_management_interface_ip"]}},
|
||||||
|
"user_name": self.settings["switchs_management_sftp_creds"]["login"],
|
||||||
|
"password": self.settings["switchs_management_sftp_creds"]["pass"],
|
||||||
|
},
|
||||||
|
"is_forced_reboot_enabled": True,
|
||||||
|
}
|
||||||
# Nous lançons la requête de type POST.
|
# Nous lançons la requête de type POST.
|
||||||
post_restore = requests.post(url_restore, data=json.dumps(data), headers=self.headers)
|
post_restore = requests.post(url_restore, data=json.dumps(data), headers=self.headers)
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,6 @@ vlan {{ id }}
|
||||||
{%- for ipv6, subnet6 in vlan.ipv6.items() %}
|
{%- for ipv6, subnet6 in vlan.ipv6.items() %}
|
||||||
ipv6 address {{ ipv6 }}/{{ subnet6.netmask_cidr }}
|
ipv6 address {{ ipv6 }}/{{ subnet6.netmask_cidr }}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
{%- else %}
|
|
||||||
no ipv6 address
|
|
||||||
{%- if id in additionals.igmp_vlans %}
|
{%- if id in additionals.igmp_vlans %}
|
||||||
no ip igmp querier
|
no ip igmp querier
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
Loading…
Reference in a new issue