Gestion du mode SFTP de provision
This commit is contained in:
parent
fae56e6fa6
commit
6dd130a962
2 changed files with 26 additions and 12 deletions
36
main.py
36
main.py
|
@ -118,16 +118,32 @@ class Switch:
|
|||
def apply_conf_hp(self):
|
||||
"""Apply config restore via rest"""
|
||||
url_restore = "http://" + self.switch["ipv4"] + "/rest/v4/system/config/cfg_restore"
|
||||
data = {
|
||||
"server_type": "ST_TFTP",
|
||||
"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"]}}},
|
||||
"is_forced_reboot_enabled": True,
|
||||
}
|
||||
provision_mode = self.settings["switchs_provision"]
|
||||
if provision_mode == "tftp":
|
||||
data = {
|
||||
"server_type": "ST_TFTP",
|
||||
"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"]}}},
|
||||
"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.
|
||||
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() %}
|
||||
ipv6 address {{ ipv6 }}/{{ subnet6.netmask_cidr }}
|
||||
{%- endfor %}
|
||||
{%- else %}
|
||||
no ipv6 address
|
||||
{%- if id in additionals.igmp_vlans %}
|
||||
no ip igmp querier
|
||||
{%- endif %}
|
||||
|
|
Loading…
Reference in a new issue