Cisco Nexus 9000 Series NX-API CLI Reference, Release 7(x)
NX-OS 7(x)
- Cisco Nexus 9000 Series NX-API CLI Reference, Release 7.x
- About NX-API CLI
- Access-List Commands
- BFD Commands
- BGP Commands
- CDP Commands
- DHCP Commands
- Diagnostic Commands
- Environment Commands
- Flow Commands
- Hardware Commands
- Interface Commands
- Inventory Commands
- LLDP Commands
- Module Commands
- NVE Commands
- RADIUS Commands
- SNMP Commands
- System Commands
- TACACS Commands
- Version Commands
show inventory
Python
Copy
import json
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
"version": "1.0",
"type": "cli_show",
"chunk": "0",
"sid": "1",
"input": "show inventory",
"output_format": "json"
}
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
"ins_api": {
"outputs": {
"output": {
"body": {
"TABLE_inv": {
"ROW_inv": [
{
"desc": "\"Nexus9000 C9508 (8 Slot) Chassis\"",
"name": "\"Chassis\"",
"productid": "N9K-C9508",
"serialnum": "FGE20330LWZ",
"vendorid": "V03"
},
{
"desc": "\"32x100G Ethernet Module\"",
"name": "\"Slot 1\"",
"productid": "N9K-X9732C-EX",
"serialnum": "SAL2039VA2U",
"vendorid": "V01"
},
{
"desc": "\"32x100G Ethernet Module\"",
"name": "\"Slot 2\"",
"productid": "N9K-X9732C-EXM",
"serialnum": "FOC20444YD2",
"vendorid": "V01"
},
{
"desc": "\"48x10G + 4x40/100G Ethernet Module\"",
"name": "\"Slot 3\"",
"productid": "N9K-X9788TC-FX",
"serialnum": "FOC21240U8B",
"vendorid": "V01"
},
{
"desc": "\"36x40/100G Ethernet Module\"",
"name": "\"Slot 4\"",
"productid": "N9K-X9736C-FX",
"serialnum": "FOC210707HG",
"vendorid": "V01"
},
{
"desc": "\"8-slot Fabric Module\"",
"name": "\"Slot 22\"",
"productid": "N9K-C9508-FM-E",
"serialnum": "SAL2035URFY",
"vendorid": "V01"
},
{
"desc": "\"8-slot Fabric Module\"",
"name": "\"Slot 23\"",
"productid": "N9K-C9508-FM-E",
"serialnum": "SAL2035UUN3",
"vendorid": "V01"
},
{
"desc": "\"8-slot Fabric Module\"",
"name": "\"Slot 24\"",
"productid": "N9K-C9508-FM-E",
"serialnum": "SAL2035URF2",
"vendorid": "V01"
},
{
"desc": "\"8-slot Fabric Module\"",
"name": "\"Slot 26\"",
"productid": "N9K-C9508-FM-E",
"serialnum": "SAL2035URFP",
"vendorid": "V01"
},
{
"desc": "\"Supervisor Module\"",
"name": "\"Slot 27\"",
"productid": "N9K-SUP-A",
"serialnum": "SAL2015NQ3H",
"vendorid": "V03"
},
{
"desc": "\"System Controller\"",
"name": "\"Slot 29\"",
"productid": "N9K-SC-A",
"serialnum": "SAL2035UTLL",
"vendorid": "V01"
},
{
"desc": "\"System Controller\"",
"name": "\"Slot 30\"",
"productid": "N9K-SC-A",
"serialnum": "SAL2035UTK8",
"vendorid": "V01"
},
{
"desc": "\"Nexus9000 C9508 (8 Slot) Chassis Power Supply\"",
"name": "\"Power Supply 1\"",
"productid": "N9K-PAC-3000W-B",
"serialnum": "DTM190203NX",
"vendorid": "V02"
},
{
"desc": "\"Nexus9000 C9508 (8 Slot) Chassis Power Supply\"",
"name": "\"Power Supply 2\"",
"productid": "N9K-PAC-3000W-B",
"serialnum": "ART2031F6NX",
"vendorid": "V02"
},
{
"desc": "\"Nexus9000 C9508 (8 Slot) Chassis Power Supply\"",
"name": "\"Power Supply 3\"",
"productid": "N9K-PAC-3000W-B",
"serialnum": "ART2031F6NV",
"vendorid": "V02"
},
{
"desc": "\"Nexus9000 C9508 (8 Slot) Chassis Fan Module\"",
"name": "\"Fan 1\"",
"productid": "N9K-C9508-FAN",
"serialnum": "FGE201909AE",
"vendorid": "V01"
},
{
"desc": "\"Nexus9000 C9508 (8 Slot) Chassis Fan Module\"",
"name": "\"Fan 2\"",
"productid": "N9K-C9508-FAN",
"serialnum": "FGE20190980",
"vendorid": "V01"
},
{
"desc": "\"Nexus9000 C9508 (8 Slot) Chassis Fan Module\"",
"name": "\"Fan 3\"",
"productid": "N9K-C9508-FAN",
"serialnum": "FGE201909AJ",
"vendorid": "V01"
}
]
}
},
"code": "200",
"input": "show inventory",
"msg": "Success"
}
},
"sid": "eoc",
"type": "cli_show",
"version": "1.0"
}
}