show port-security
show port-security
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 port-security",
"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 port-security",
"msg": "Success",
"code": "200",
"body": {
"total_addr": [
"4",
"4"
],
"max_sys_limit": "8188",
"TABLE_eth_port_sec_interfaces": {
"ROW_eth_port_sec_interfaces": [
{
"num_elems": "1",
"cmdid_show_index": "0"
},
{
"secure_port": "Ethernet1/2",
"port_state": "1",
"max_secure_addr": "789",
"security_violation": "0",
"security_action": "shutdown",
"current_addr": "5",
"num_val": "1",
"num_elems": "1",
"cmdid_show_index": "1"
}
]
}
}
}
}
}
}
The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show port-security command, see the CLI command reference:
Note: This example was added in Cisco NX-OS Release 9.2(1).
CLI Output |
---|
|
show port-security address
show port-security address
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 port-security address",
"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 port-security address",
"msg": "Success",
"code": "200",
"body": {
"total_addr": "5",
"max_sys_limit": "8187",
"TABLE_eth_port_sec_mac_addrs": {
"ROW_eth_port_sec_mac_addrs": [
{
"if_index": "Ethernet1/2",
"vlan_id": "1",
"type": "Static_Mac",
"mac_addr": "0000.1111.1115",
"remain_age": "0",
"remote_learnt": "0",
"remote_aged": "0",
"num_elems": "6",
"cmd_addr_index": "0"
},
{
"if_index": "Ethernet1/2",
"vlan_id": "1",
"type": "Static_Mac",
"mac_addr": "0000.1111.1111",
"remain_age": "0",
"remote_learnt": "0",
"remote_aged": "0",
"num_elems": "6",
"cmd_addr_index": "1"
},
{
"if_index": "Ethernet1/2",
"vlan_id": "1",
"type": "Static_Mac",
"mac_addr": "0000.1111.1112",
"remain_age": "0",
"remote_learnt": "0",
"remote_aged": "0",
"num_elems": "6",
"cmd_addr_index": "2"
},
{
"if_index": "Ethernet1/2",
"vlan_id": "1",
"type": "Static_Mac",
"mac_addr": "0000.1111.1113",
"remain_age": "0",
"remote_learnt": "0",
"remote_aged": "0",
"num_elems": "6",
"cmd_addr_index": "3"
},
{
"if_index": "Ethernet1/2",
"vlan_id": "1",
"type": "Static_Mac",
"mac_addr": "0000.1111.1114",
"remain_age": "0",
"remote_learnt": "0",
"remote_aged": "0",
"num_elems": "6",
"cmd_addr_index": "4"
},
{
"if_index": "Ethernet1/2",
"vlan_id": "1",
"type": "Sticky_Mac",
"mac_addr": "88F0.31F9.A341",
"remain_age": "0",
"remote_learnt": "0",
"remote_aged": "0",
"num_elems": [
"6",
"6"
],
"cmd_addr_index": [
"5",
"6"
]
}
]
}
}
}
}
}
}
The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show port-security address command, see the CLI command reference:
Note: This example was added in Cisco NX-OS Release 9.2(1).
CLI Output |
---|
|
show port-security interface port-channel 1141
show port-security interface port-channel 1141
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 port-security interface port-channel 1141 ",
"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)
{
"port_status": "secure-down",
"config_port_security": "disabled",
"oper_port_security": "disabled",
"violation_mode": "shutdown",
"aging_time": "30",
"aging_type": "absolute",
"max_mac_addr": "2516582400",
"total_sec_addrs": "150",
"conf_num_addrs": "0",
"num_sticky_addrs": "0",
"trap_count": "0"
}
The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show port-security interface port-channel 1141 command, see the CLI command reference:
Note: This example was added in Cisco NX-OS Release 9.2(1).
CLI Output |
---|
|