show cdp global

show cdp global

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 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)


{

  "ins_api": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show cdp global",
        "msg": "Success",
        "code": "200",
        "body": {
          "cdp_global_enabled": "enabled",
          "refresh_time": "60",
          "ttl": 180,
          "v2_advertisement": "enabled",
          "deviceid_format": "DeviceID TLV in System-Name(Default) Format"
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show cdp global command, see the CLI command reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show cdp global 
Global CDP information:
    CDP enabled globally
    Refresh time is 60 seconds
    Hold time is 180 seconds
    CDPv2 advertisements is enabled
    DeviceID TLV in System-Name(Default) Format

show cdp neighbors interface e7/2

show cdp neighbors interface e7/2

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 cdp neighbors interface e7/2",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show cdp neighbors interface e7/2",
        "msg": "Success",
        "code": "200",
        "body": {
          "neigh_count": 1,
          "TABLE_cdp_neighbor_brief_info": {
            "ROW_cdp_neighbor_brief_info": {
              "ifindex": 439353856,
              "device_id": "EOR-2(FGE18330EZZ)",
              "intf_id": "Ethernet7/2",
              "ttl": 171,
              "capability": [
                "router",
                "switch",
                "IGMP_cnd_filtering",
                "Supports-STP-Dispute"
              ],
              "platform_id": "N9K-C9508",
              "port_id": "Ethernet1/36"
            }
          }
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show cdp neighbors interface e7/2 command, see the CLI command reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show cdp neighbors interface e7/2
Capability Codes: 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

Device-ID          Local Intrfce  Hldtme Capability  Platform      Port ID
EOR-2(FGE18330EZZ)
                    Eth7/2         129    R S I s   N9K-C9508     Eth1/36
Total entries displayed: 1

show cdp neighbors interface e7/2 detail

show cdp neighbors interface e7/2 detail

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 cdp neighbors interface e7/2 detail",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show cdp neighbors interface e7/2 detail",
        "msg": "Success",
        "code": "200",
        "body": {
          "TABLE_cdp_neighbor_detail_info": {
            "ROW_cdp_neighbor_detail_info": {
              "ifindex": 439353856,
              "device_id": "EOR-2(FGE18330EZZ)",
              "sysname": "EOR-2",
              "numaddr": 1,
              "v4addr": "6.6.8.2",
              "platform_id": "N9K-C9508",
              "capability": [
                "router",
                "switch",
                "IGMP_cnd_filtering",
                "Supports-STP-Dispute"
              ],
              "intf_id": "Ethernet7/2",
              "port_id": "Ethernet1/36",
              "ttl": 133,
              "version": "Cisco Nexus Operating System (NX-OS) Software, Version 9.2(2)",
              "version_no": "v2",
              "nativevlan": 1,
              "duplexmode": "full",
              "mtu": 1500,
              "syslocation": "Bldg14-CCC09",
              "num_mgmtaddr": 1,
              "v4mgmtaddr": "172.31.145.253"
            }
          }
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show cdp neighbors interface e7/2 detail command, see the CLI command reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show cdp neighbors interface e7/2 detail 
----------------------------------------
Device ID:EOR-2(FGE18330EZZ)
System Name: EOR-2

Interface address(es):
    IPv4 Address: 6.6.8.2
Platform: N9K-C9508, Capabilities: Router Switch IGMP Filtering Supports-STP-Dispute
Interface: Ethernet7/2, Port ID (outgoing port): Ethernet1/36
Holdtime: 137 sec

Version:
Cisco Nexus Operating System (NX-OS) Software, Version 9.2(2)

Advertisement Version: 2

Native VLAN: 1
Duplex: full

MTU: 1500
Physical Location: Bldg14-CCC09
Mgmt address(es):
    IPv4 Address: 172.31.145.253


show cdp traffic interface ethernet 7/2

show cdp traffic interface ethernet 7/2

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 cdp traffic interface ethernet 7/2 ",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show cdp traffic interface ethernet 7/2 ",
        "msg": "Success",
        "code": "200",
        "body": {
          "intf_id": "Ethernet7/2",
          "total_input_packets": "385",
          "valid_cdp_packets": "385",
          "input_v1_packets": "0",
          "input_v2_packets": "385",
          "invalid_cdp_packets": "0",
          "unsupported_version": "0",
          "checksum_errors": "0",
          "malformed_packets": "0",
          "total_output_packets": "386",
          "output_v1_packets": "0",
          "output_v2_packets": "386",
          "send_errors": "0"
        }
      }
    }
  }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show cdp traffic interface ethernet 7/2 command, see the CLI command reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
Switch# show cdp traffic interface ethernet 7/2 
----------------------------------------
Traffic statistics for Ethernet7/2
Input Statistics:
    Total Packets: 385
    Valid CDP Packets: 385
        CDP v1 Packets: 0
        CDP v2 Packets: 385
    Invalid CDP Packets: 0
        Unsupported Version: 0
        Checksum Errors: 0
        Malformed Packets: 0

Output Statistics:
    Total Packets: 386
        CDP v1 Packets: 0
        CDP v2 Packets: 386
    Send Errors: 0