Nexus Dashboard (ND)

The following services are supported by the REST connector for Nexus Dashboard (ND).

get

API to send GET command to the device.

GET arguments

Argument

Description

Default

api_url (string)

API url (subdirectory part of the url) string

Mandatory

expected_status_code (int)

Expected result

200

timeout (int)

Maximum time it can take to disconnect to the device

30 seconds

retries (int)

Number of retries in case of transmission error

3 times

retry_wait (int)

Seconds to wait between retries

10 seconds

# Assuming the device is already connected
url = '/api/config/class/localusers/'
output = device.get(url)

post

API to send POST command to the device.

POST arguments

Argument

Description

Default

api_url (string)

API url (subdirectory part of the url) string

Mandatory

payload (dict)

Dictionary containing the information to send via the post

Mandatory

expected_status_code (int)

Expected result

200

content_type

(json / xml / form) Information about the type of request

json

timeout (int)

Maximum time it can take to disconnect to the device

30 seconds

retries (int)

Number of retries in case of transmission error

3 times

retry_wait (int)

Seconds to wait between retries

10 seconds

# Assuming the device is already connected
payload = """
{
  "loginID": "test",
  "loginPasswd: "cisco!123"
}
"""

url = 'api/config/localusers/test'
device.rest.post(url, payload)

put

API to send PUT command to the device.

PUT arguments

Argument

Description

Default

api_url (string)

API url (subdirectory part of the url) string

Mandatory

payload (dict)

Dictionary containing the information to send via the post

None

expected_status_code (int)

Expected result

200

content_type

(json / xml / form) Information about the type of request

json

timeout (int)

Maximum time it can take to disconnect to the device

30 seconds

retries (int)

Number of retries in case of transmission error

3 times

retry_wait (int)

Seconds to wait between retries

10 seconds

delete

API to send DELETE command to the device.

DELETE arguments

Argument

Description

Default

api_url (string)

API url (subdirectory part of the url) string

Mandatory

expected_status_code (int)

Expected result

200

timeout (int)

Maximum time it can take to disconnect to the device

30 seconds

retries (int)

Number of retries in case of transmission error

3 times

retry_wait (int)

Seconds to wait between retries

10 seconds

# Assuming the device is already connected
url = 'api/config/localusers/test'
device.delete(url)

Section author: Romel Tolos <rtolos@cisco.com>