Configuring Port Security

This section contains payload examples and CLIs to demonstrate how to use the NX-API REST API to configure port security on Cisco Nexus 3000 and 9000 Series switches and to show how the REST APIs correspond to the CLI commands. For more information about security features, see the Cisco Nexus 9000 Series NX-OS Security Configuration Guide.

https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-installation-and-configuration-guides-list.html/

Enabling Port Security

Enabling Port Security
POST http://<mgmt0_IP>/api/mo/sys/fm.json
{
  "fmEntity": {
    "children": [
      {
        "fmPortSec": {
          "attributes": {
            "adminSt": "enabled"
}}}]}}
{
  "imdata": [
    {
      "warning": {
        "attributes": {
          "text": "Please apply the same port-security config on the peer device also, if VPC is configured\n"
        }
      }
    }
  ]
}
<System>
  <fm-items>
    <portsec-items>
      <adminSt>enabled</adminSt>
    </portsec-items>
  </fm-items>
</System>


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

feature port-security

Note: The property information for this example was added in Release 9.3(3).


Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.

MODN
fmEntity sys/fm
fmPortSec sys/fm/portsec


fmPortSec Properties

The following table contains information about the fmPortSec properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.

Property NameData TypeDescriptionValues
adminStfm:AdminState
(scalar:Enum8)
Admin statusSELECTION:
1 - enabled
2 - disabled
DEFAULT: disabled


Related Documentation

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:

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

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:

https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:

https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Disabling Port Security

Disabling Port Security
POST http://<mgmt0_IP>/api/mo/sys/fm.json
{
  "fmEntity": {
    "children": [
      {
        "fmPortSec": {
          "attributes": {
            "adminSt": "disabled"
}}}]}}
{
    "imdata": []
}
<System>
  <fm-items>
    <portsec-items>
      <adminSt>disabled</adminSt>
    </portsec-items>
  </fm-items>
</System>


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

no feature port-security

Note: The property information for this example was added in Release 9.3(3).


Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.

MODN
fmEntity sys/fm
fmPortSec sys/fm/portsec


fmPortSec Properties

The following table contains information about the fmPortSec properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.

Property NameData TypeDescriptionValues
adminStfm:AdminState
(scalar:Enum8)
Admin statusSELECTION:
1 - enabled
2 - disabled
DEFAULT: disabled


Related Documentation

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:

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

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:

https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:

https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html