Cisco Nexus 9K installation and API setup for NXAPI-CLI Automation Python Scripts:json-rpc CLI:Part1

Описание к видео Cisco Nexus 9K installation and API setup for NXAPI-CLI Automation Python Scripts:json-rpc CLI:Part1

‪@NetworkEvolution‬
#nxapi-cli #nexus9k #nxapi-python
This video demonstrates how to download and install nexus 9000v (Cisco Nexus 9k) image in to eve-ng environment, enable api using feature nxap and connect to api using basic python script
how to initiate api to cisco nxapi-cli and configure the device
nxapi-cli tutorial
nexus 9k api tutorial. Nexus API beginner tutorial
Nexus API automation using Python.
download nexus9000v.9.3.qcow2 image from cisco.com and install in to eve-ng environment
how to verify the md5 of downloaded image. Verify file is not corrupted
EVE-NG nexus image name nxodv9k sataa.qcow2

Cisco image download location:
https://software.cisco.com/download/h...)

EVE nexus 9k installation document:
https://www.eve-ng.net/index.php/docu...

cd /opt/unetlab/addons/qemu/nxosv9k-7.0.3.I7.4/
nxosv9k-9.3.10 sataa.qcow2

/opt/unetlab/wrappers/unl_wrapper -a fixpermissions

switch(config)# boot nxos bootflash:nxos.7.0.3.I7.4.bin


int m0
ip add 192.168.0.200/24
vrf context management
ip route 0/0 192.168.0.254
boot nxos bootflash:nxos.9.3.10.bin
copy run to flash
how to copy and paste files in to eve-ng. Directory of the device image files in eve-ng
cisco nxos v 9k
feature nxapi

nxapi-cli nxapi rest and retconf in cisco nexus 9000v 9k, 7k or 5k
json-rpc json xml
cli cli_ascii and cli_array
how to parse the show command outfrom cisco nexus cli nxapi-cli output.
Get nxos ouput in json or xml format
initiate nexus api connection from python. nexus os https: /ins
jsonrpc v2.0, methods:cli and api payload details
how to use python requests for initiating nexus api connection and getout
cisco nexus requests.exceptions.SSLError : HTTPSConnection pools SSL certificate verification errorPython
Python requests: How to handle: Insecure requests warining: Unverified HTTPS request is being made to host. Adding cert verification is strongly advised error:
nxpai cli automation example
nxapi cli initial script tutorial
nxapi cli configuration example
###################################
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
client_cert_auth=False
switchuser='admin'
switchpassword='admin'
client_cert='PATH_TO_CLIENT_CERT_FILE'
client_private_key='PATH_TO_CLIENT_PRIVATE_KEY_FILE'
ca_cert='PATH_TO_CA_CERT_THAT_SIGNED_NXAPI_SERVER_CERT'

url='https://192.168.0.200/ins'
myheaders={'content-type':'application/json-rpc'}
payload=[
{
"jsonrpc": "2.0",
"method": "cli",
"params": {
"cmd": "show version",
"version": 1
},
"id": 1
}
]

if client_cert_auth is False:
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword), verify=False).json()
else:
url='https://192.168.0.200/ins'
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword),cert=(client_cert,client_private_key),verify=ca_cert).json()

pprint(response)

Комментарии

Информация по комментариям в разработке