cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
316
Views
0
Helpful
3
Replies

How to obtain specific data from staros using curl

nisheeth
Level 1
Level 1

Hi

I am working with NSO automation team and I am new

If I run generic query for config i get all the data I need to pull specific data using curl

My query using curl is success full and it returns tons of data

curl --location 'http://localhost:8080/restconf/data/tailf-ncs:devices/device=ORUD0407/config/tailf-ned-cisco-staros:context/' \
--header 'Accept: application/yang-data+json' \
--header 'Authorization: Basic ###############################'

{
"name": "up",
"bgp": "extended-asn-cap",
"bfd-protocol": {
"slow-timers": 1000
},
"ip": {
"igmp": [ { "profile": "default" } ],
"prefix-list": [ {"name": "up", "seq": "10", "action": "permit", "addresses": "10.193.124.144/28", "le": 32},
{"name": "up", "seq": "15", "action": "permit", "addresses": "10.193.126.0/28", "le": 32 },
{"name": "up","seq": "20","action": "permit", "addresses": "10.193.126.16/28","le": 32 },
{"name": "up", "seq": "25", "action": "permit", "addresses": "10.193.124.128/28", "le": 32 },
{"name": "up", "seq": "30", "action": "permit", "addresses": "172.30.137.80/28", "le": 32} ]
},
"interface": [],
"gtpp": { "group": [ { "name": "default", "gtpp": { "limit-secondary-rat-usage-conf": { "limit-secondary-rat-usage": 32 } } } ]
},
"gtpu-service": [],
"sx-service": [],
"user-plane-service": [ { "name": "upf_up3", "associate": {
"gtpu-service": [],
"sx-service": "sxc_up3",
"fast-path": {"service": [null]},
"control-plane-group": "cp-group-1"
}
}
],
"aaa": {},
"router": {},
"subscriber": {},
"route-map": [{ }]
},

I more interested in getting control plane group using curl and my this query fails

curl --location 'http://localhost:8080/restconf/data/tailf-ncs:devices/device=ORUD0407/config/tailf-ned-cisco-staros:context/user-service-plane' \
--header 'Accept: application/yang-data+json' \
--header 'Authorization: Basic ###############################'

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

I can get same information from CLI 

show running-config devices device ORUD0407 config control-plane-group
devices device ORUD0407
config
control-plane-group cp-group-1
peer-node-id ipv4-address 1.3.1.6
peer-node-id ipv4-address 1.3.1.7
peer-node-id ipv4-address 1.3.1.3 interface n4
peer-node-id ipv4-address 1.3.1.9 interface n4
exit
!
!

Thanks and Regards

Nisheeth

1 Accepted Solution

Accepted Solutions

cohult
Cisco Employee
Cisco Employee

Hi,
Quick tip. A simple way to figure out the correct RESTCONF path to access data in NSO CDB from a CLI show command is to pipe the show command to display restconf. Example:

show running-config devices device ORUD0407 config control-plane-group devices device ORUD0407 | display restconf


Regards

View solution in original post

3 Replies 3

ygorelik
Cisco Employee
Cisco Employee

You have typo in the URL Try this:

curl --location 'http://localhost:8080/restconf/data/tailf-ncs:devices/device=ORUD0407/config/tailf-ned-cisco-staros:context/user-plane-service' \
--header 'Accept: application/yang-data+json' \
--header 'Authorization: Basic ###############################'

snovello
Cisco Employee
Cisco Employee
Ithink its a typo, you have a URI with user-service-plane, but the data conains user-plane-service

cohult
Cisco Employee
Cisco Employee

Hi,
Quick tip. A simple way to figure out the correct RESTCONF path to access data in NSO CDB from a CLI show command is to pipe the show command to display restconf. Example:

show running-config devices device ORUD0407 config control-plane-group devices device ORUD0407 | display restconf


Regards