Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o-firewall
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o-firewall
Commits
6dd130a9
Commit
6dd130a9
authored
Jul 12, 2018
by
chirac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gestion du mode SFTP de provision
parent
fae56e6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
12 deletions
+26
-12
main.py
main.py
+26
-10
templates/hp.tpl
templates/hp.tpl
+0
-2
No files found.
main.py
View file @
6dd130a9
...
...
@@ -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
)
...
...
templates/hp.tpl
View file @
6dd130a9
...
...
@@ -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 %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment