cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
752
Views
0
Helpful
6
Replies

how to get upf status from nso cli rcm info using rest api

nisheeth
Level 1
Level 1

Hi

I am able to get the the rcm info from the nso cli using the command

adm_nsrivas37@ncs# devices device ORUD0403 live-status exec show rcm info

result

Redundancy Configuration Module:

-------------------------------------------------------------------------------

Context:                         rcm

Bind Address:                    10.193.124.179

Chassis State:                   Active

Session State:                   SockActive

Route-Modifier:                  30

RCM Controller Address:          10.193.125.3

RCM Controller Port:             9200

RCM Controller Connection State: Connected

Ready To Connect:                Yes

Management IP Address:           10.147.13.173

Host ID:                         ORUD0403

SSH IP Address:                  10.147.13.174 (Activated)

SSH IP Installation:             Enabled

I am unable to get the same info using rest api it gives me error

curl --location --request POST 'http://localhost:8080/restconf/data/tailf-ncs:devices/device=ORUD0407/live-status/exec:rcm/_operations/show' \
--header 'Accept: application/yang-data+json' \
--header 'Authorization: Basic ########################'

Response

{
"ietf-restconf:errors": {
"error": [
{
"error-type": "application",
"error-tag": "invalid-value",
"error-message": "uri keypath not found"
}
]
}
}

I believe the issue is exec:rcm in the URI .

please let me know what will be the correct uri

Thanks and regards

Nisheeth

 

1 Accepted Solution

Accepted Solutions

nisheeth
Level 1
Level 1

I did went thru the recommended examples and found the solution. 

The URI had issues it was missing tailf-ned type and a payload. I added that and it worked below is the example.

curl --location --globoff 'http://localhost:8080/restconf/operations/tailf-ncs:devices/device=UPFd0407/live-status/tailf-ned-cisco-staros-stats:exec/any' \
--header 'Accept: application/yang-data+json' \
--header 'Authorization: Basic ##############################' \
--header 'Content-Type: application/yang-data+json' \
--data '{
"input":
{
"args": "show rcm info"
}
}'

Response

{
"tailf-ned-cisco-staros-stats:output": {
"result": "\nRedundancy Configuration Module:\r\n-------------------------------------------------------------------------------\r\nContext: rcm \r\nBind Address: #.#.#.#\r\nChassis State: Standby \r\nSession State: SockStandby \r\nRoute-Modifier: 50 \r\nRCM Controller Address: #.#.#.#\r\nRCM Controller Port: 9200 \r\nRCM Controller Connection State: Connected \r\nReady To Connect: Yes \r\nManagement IP Address: #.#.#.#\r\nHost ID: \r\nSSH IP Address: #.#.#.# (Activated)\r\nSSH IP Installation: Enabled"
}
}

View solution in original post

6 Replies 6

huayyang
Cisco Employee
Cisco Employee

uri of actions under /devices/device/live-status/exec/ are encoded like RESTCONF/operations/tailf-ncs:devices/device=DEV_NAME/live-status/exec/ACTION

 

nisheeth
Level 1
Level 1

I am getting the error I dont know how to put show rcm info after exec

Request

curl --location --request POST 'http://localhost:8080/restconf/data/tailf-ncs:devices/device=ORUD0407/live-status/exec/"show rcm info"' \
--header 'Accept: application/yang-data+json' \
--header 'Authorization: Basic ##################'

Response

{
"ietf-restconf:errors": {
"error": [
{
"error-type": "application",
"error-tag": "invalid-value",
"error-message": "uri keypath not found"
}
]
}
}

 

 

nisheeth
Level 1
Level 1

Earlier i was making the mistake and i corrected that still having error same issue how to put show rcm info because I am getting error invalid path

curl --location --request POST 'http://localhost:8080/restconf/operations/tailf-ncs:devices/device=ORUD0407/live-status/exec/"show rcm info"' \
--header 'Accept: application/yang-data+json' \
--header 'Authorization: Basic ############################'

Response

{
"ietf-restconf:errors": {
"error": [
{
"error-type": "application",
"error-tag": "malformed-message",
"error-message": "invalid path"
}
]
}
}

 

huayyang
Cisco Employee
Cisco Employee

I don't know how the action "show" is modeled, but probably the input parameter to "show" should be in a payload, check your ned model.

 

huayyang
Cisco Employee
Cisco Employee

there's some examples how to encode uri and action input parameters: https://datatracker.ietf.org/doc/html/rfc8040#section-3.6

 

 

nisheeth
Level 1
Level 1

I did went thru the recommended examples and found the solution. 

The URI had issues it was missing tailf-ned type and a payload. I added that and it worked below is the example.

curl --location --globoff 'http://localhost:8080/restconf/operations/tailf-ncs:devices/device=UPFd0407/live-status/tailf-ned-cisco-staros-stats:exec/any' \
--header 'Accept: application/yang-data+json' \
--header 'Authorization: Basic ##############################' \
--header 'Content-Type: application/yang-data+json' \
--data '{
"input":
{
"args": "show rcm info"
}
}'

Response

{
"tailf-ned-cisco-staros-stats:output": {
"result": "\nRedundancy Configuration Module:\r\n-------------------------------------------------------------------------------\r\nContext: rcm \r\nBind Address: #.#.#.#\r\nChassis State: Standby \r\nSession State: SockStandby \r\nRoute-Modifier: 50 \r\nRCM Controller Address: #.#.#.#\r\nRCM Controller Port: 9200 \r\nRCM Controller Connection State: Connected \r\nReady To Connect: Yes \r\nManagement IP Address: #.#.#.#\r\nHost ID: \r\nSSH IP Address: #.#.#.# (Activated)\r\nSSH IP Installation: Enabled"
}
}