Configuring the VSH Roles and Rules

This section contains payload examples to demonstrate how to use the NX-API REST API to configure VSH roles and rules on the Cisco Nexus 3000 and 9000 Series switches.

Configuring Role

This section contains payload examples and CLIs to demonstrate how the NX-API REST APIs correspond to the CLI commands and to demonstrate how to configure roles.

Creating and Configuring a Role

Creating and Configuring a Role
POST http://<IP_Address>/api/node/mo/sys/userext/role-test.json
{
  "aaaRole": {
    "attributes": {
      "descr": "test description",
      "denyVRF": "yes",
      "denyVLAN": "yes",
      "denyIntf": "yes"
}}}
{
  "imdata": []
}

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

Creating and configuring a Rule in a Role

Creating and configuring a Rule in a Role
POST http://<IP_Address>/api/node/mo/sys/userext/role-test/rule-1.json
{
  "aaaRoleRule": {
    "attributes": {
      "ruleNumber": "1",
      "permission": "permit",
      "ruleAccess": "command",
      "cmdStr": "show version"
}}}
Creating and configuring a Rule in a Role
POST http://<IP_Address>/api/mo/sys/userext/role-test/rule-<number>.json
{
  "aaaRoleRule": {
    "attributes": {
      "ruleNumber": "2",
      "permission": "permit",
      "ruleAccess": "read",
      "ruleScope": "feature",
      "scopeEntity": "config"
}}}

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

Configuring Terminal Log-All

Terminal Log-All enables the logging of all commands, including the show commands, to the accounting log.

Enabling Terminal Log-All

Enabling Terminal Log-All
POST http://<IP_Address>/api/api/mo/sys/termlog.json
{
  "terminalTerminalLog": {
    "attributes": {
      "logShowCommand": "1"
}}}


CLI Command

The CLI command below is the equivalent of the payload example 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 or the YANG tab to view the XML payload.

terminal log-all

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 Terminal Log-All

Disabling Terminal Log-All
POST http://<IP_Address>/api/api/mo/sys/termlog.json
{
  "terminalTerminalLog": {
    "attributes": {
      "logShowCommand": "0"
}}}
{
  "imdata": []
}


CLI Command

The CLI command below is the equivalent of the payload example 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 or the YANG tab to view the XML payload..

no terminal log-all

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