ultimos cambios
This commit is contained in:
0
m02_files/__init__.py
Normal file
0
m02_files/__init__.py
Normal file
0
m02_files/csv_example.py
Normal file
0
m02_files/csv_example.py
Normal file
1
m02_files/l_00_inventory.json
Normal file
1
m02_files/l_00_inventory.json
Normal file
@ -0,0 +1 @@
|
||||
[{"name": "devnet-csr-always-on-sandbox", "ssh-info": {"hostname": "ios-xe-mgmt-latest.cisco.com", "port": 8181, "credentials": {"username": "developer", "password": "C1sco12345"}, "device_type": "cisco_ios"}, "netconf-info": {"port": 10000}, "restconf-info": {"port": 9443}}, {"name": "devnet-csr-always-on-sandbox", "ssh-info": {"hostname": "sbx-nxos-mgmt.cisco.com", "port": 8181, "credentials": {"username": "admin", "password": "Admin_1234!"}, "device_type": "cisco_nxos"}}]
|
||||
30
m02_files/l_00_inventory.py
Normal file
30
m02_files/l_00_inventory.py
Normal file
@ -0,0 +1,30 @@
|
||||
inventory = [
|
||||
{
|
||||
"name": "devnet-csr-always-on-sandbox",
|
||||
"ssh-info": {
|
||||
"hostname": "ios-xe-mgmt-latest.cisco.com",
|
||||
"port": 8181,
|
||||
"credentials": {"username": "developer", "password": "C1sco12345"},
|
||||
"device_type": "cisco_ios",
|
||||
},
|
||||
"netconf-info": {
|
||||
"port": 10000
|
||||
},
|
||||
"restconf-info": {
|
||||
"port": 9443
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "devnet-csr-always-on-sandbox",
|
||||
"ssh-info": {
|
||||
"hostname": "sbx-nxos-mgmt.cisco.com",
|
||||
"port": 8181,
|
||||
"credentials": {"username": "admin", "password": "Admin_1234!"},
|
||||
"device_type": "cisco_nxos"
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def get_inventory():
|
||||
return inventory
|
||||
20
m02_files/l_00_inventory.yaml
Normal file
20
m02_files/l_00_inventory.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
- name: devnet-csr-always-on-sandbox
|
||||
netconf-info:
|
||||
port: 10000
|
||||
restconf-info:
|
||||
port: 9443
|
||||
ssh-info:
|
||||
credentials:
|
||||
password: C1sco12345
|
||||
username: developer
|
||||
device_type: cisco_ios
|
||||
hostname: ios-xe-mgmt-latest.cisco.com
|
||||
port: 8181
|
||||
- name: devnet-csr-always-on-sandbox
|
||||
ssh-info:
|
||||
credentials:
|
||||
password: Admin_1234!
|
||||
username: admin
|
||||
device_type: cisco_nxos
|
||||
hostname: sbx-nxos-mgmt.cisco.com
|
||||
port: 8181
|
||||
13
m02_files/l_01_json_example.py
Normal file
13
m02_files/l_01_json_example.py
Normal file
@ -0,0 +1,13 @@
|
||||
from l_00_inventory import inventory
|
||||
import json
|
||||
|
||||
with open("l_00_inventory.json", "w") as json_out:
|
||||
json_out.write(json.dumps(inventory))
|
||||
|
||||
with open("l_00_inventory.json", "r") as json_in:
|
||||
json_inventory = json_in.read()
|
||||
|
||||
print("l_00_inventory.json file:", json_inventory)
|
||||
|
||||
print("\njson pretty version:")
|
||||
print(json.dumps(json.loads(json_inventory), indent=4))
|
||||
13
m02_files/l_02_yaml_example.py
Normal file
13
m02_files/l_02_yaml_example.py
Normal file
@ -0,0 +1,13 @@
|
||||
from l_00_inventory import inventory
|
||||
import yaml
|
||||
|
||||
with open("l_00_inventory.yaml", "w") as yaml_out:
|
||||
yaml_out.write(yaml.dump(inventory))
|
||||
|
||||
with open("l_00_inventory.yaml", "r") as yaml_in:
|
||||
yaml_inventory = yaml_in.read()
|
||||
|
||||
print("l_00_inventory.yaml file:\n", yaml_inventory)
|
||||
|
||||
print("\nyaml pretty version:")
|
||||
print(yaml.dump(yaml.safe_load(yaml_inventory), indent=4))
|
||||
0
m02_files/xml_example.py
Normal file
0
m02_files/xml_example.py
Normal file
Reference in New Issue
Block a user