show cdp global
show cdp global
import requests
import json
"""
Modify these please
"""
url='http://<ip_address>:<port_number>/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 cdp global",
"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)
json_output = json.loads(output)["ins_api"]["outputs"]["output"]["body"]
print(json.dumps(json_output, indent=4, sort_keys=True))
{
"cdp_global_enabled": "enabled",
"deviceid_format": "DeviceID TLV in System-Name(Default) Format",
"refresh_time": 60,
"ttl": 180,
"v2_advertisement": "enabled"
}
<cdp_global_enabled>enabled</cdp_global_enabled>
<refresh_time>60</refresh_time>
<ttl>180</ttl>
<v2_advertisement>enabled</v2_advertisement>
<deviceid_format>DeviceID TLV in System-Name(Default) Format</deviceid_format>
The show cdp global command displays the global Cisco Discovery Protocol ( CDP ) Parameters.
For command descriptions, see the Cisco MDS 9000 Series Switches Command References.
Note: This sample output is generated for Cisco MDS 9000 Series NX-OS Release 8.4(2a) or later.
| CLI Output |
|---|
|
| Parameter | Description | Type | Sample Values |
|---|---|---|---|
| refresh_time | Cisco Discovery Protocol ( CDP ) refresh time interval (in seconds). Specifies how often the Cisco software sends Cisco Discovery Protocol updates | Integer | ['5-254'] |
| ttl | CDP hold time advertisement. The amount of time until it retains the data (in seconds) | Integer | ['10-255'] |
| cdp_global_enabled | CDP global status for all interfaces | String | ['enabled', 'disabled'] |
| v2_advertisement | CDP version 2 advertisement status | String | ['enabled', 'disabled'] |
| deviceid_format | Device ID format for CDP | String |
show cdp neighbors
show cdp neighbors
import requests
import json
"""
Modify these please
"""
url='http://<ip_address>:<port_number>/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 cdp neighbors",
"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)
json_output = json.loads(output)["ins_api"]["outputs"]["output"]["body"]
print(json.dumps(json_output, indent=4, sort_keys=True))
{
"TABLE_cdp_neighbor_brief_info": {
"ROW_cdp_neighbor_brief_info": {
"capability": [
"switch",
"IGMP_cnd_filtering"
],
"device_id": "SW-JWALA-ECBU-JJ22",
"interface": "mgmt0",
"platform_id": "cisco WS-C2960S-48TS-L",
"port_id": "GigabitEthernet1/0/29",
"ttl": 124
}
},
"neigh_count": 1
}
<TABLE_cdp_neighbor_brief_info>
<ROW_cdp_neighbor_brief_info>
<device_id>SW-JWALA-ECBU-JJ22</device_id>
<interface>mgmt0</interface>
<ttl>123</ttl>
<capability>switch</capability>
<capability>IGMP_cnd_filtering</capability>
<platform_id>cisco WS-C2960S-48TS-L</platform_id>
<port_id>GigabitEthernet1/0/29</port_id>
</ROW_cdp_neighbor_brief_info>
</TABLE_cdp_neighbor_brief_info>
<neigh_count>1</neigh_count>
The show cdp neighbors command displays all the Cisco Discovery Protocol ( CDP ) neighbours.
For command descriptions, see the Cisco MDS 9000 Series Switches Command References.
Note: This sample output is generated for Cisco MDS 9000 Series NX-OS Release 8.4(2a) or later.
| CLI Output |
|---|
|
| Parameter | Description | Type | Sample Values |
|---|---|---|---|
| ttl | CDP hold time advertised. The amount of time until it retains the data (in seconds) | Integer | ['10-255'] |
| capability | Type of the device listed in the CDP neighbors table | String List | ['R - Router', ' T - Trans-Bridge', ' B - Source-Route-Bridge S - Switch', ' H - Host', ' I - IGMP', ' r - Repeater', ' V - VoIP-Phone', ' D - Remotely-Managed-Device', ' s - Supports-STP-Dispute'] |
| interface | Local interface ID through which this neighbor is connected | String | |
| device_id | Name of the neighboring device, or the MAC address, or the serial number of the device | String | |
| port_id | The interface and port number of the neighboring device | String | |
| platform_id | Identifies the hardware platform for the transmitting device | String | |
| neigh_count | Number of neighboring devices | Integer |