04-30-2018 03:08 AM - edited 03-01-2019 04:09 AM
I am trying to use below syntax to execute multiple show commands on the device using NSO API. But it doesn't seem to work, though it works for one command.
"args" should ideally accept a list of show commands, but it doesn't work, any clues on how to get it work? It seems to concat the commands and execute and hence fails.
{
"jsonrpc":"2.0",
"id":1,
"method":"run_action",
"params":{
"path": "/ncs:devices/device{ios_xe_122}/live-status/cisco-ios-xr-stats:exec/any",
"th": 1,
"format":"normal",
"params":{"args": ["show inventory", "show hardware"]}
}
}
Response:
{
"jsonrpc": "2.0",
"result": [
{
"name": "result",
"value": "\n> show inventory show hardware\r\nshow inventory show hardware\r\n ^\r\n% Invalid input detected at '^' marker.\r\n\r\nCSRv#"
}
],
"id": 1
}
05-01-2018 10:39 AM
One more try. Let me know if someone has faced this and knows the root cause for this.
Apart from above show command, I have tried executing config commands too on NSO using live-status api. Though the config seems to be pushed to the device successfully, but response always return some error or the other.
e.g.
Request:
{
"jsonrpc":"2.0",
"id":1,
"method":"run_action",
"params":{
"path": "/ncs:devices/device{ios_xe_122}/live-status/ios-stats:exec/any",
"th": 1,
"format":"normal",
"params":{"args": ["config t \n interface port-channel 6 \n end"]}
}
}
Response (Error):
{
"jsonrpc": "2.0",
"error": {
"type": "rpc.method.failed",
"code": -32000,
"message": "Method failed",
"data": {
"reason": "External error in the NED implementation for device ios_xe_122: read timeout"
},
"internal": "jsonrpc_schema1867"
},
"id": 1
}
05-05-2018 12:01 PM
Hi,
Why on earth will you send config commands via live-status?
Please don't!
Roque
05-08-2018 08:41 PM
Hi Umesh,
You can't execute multiple commands at one time using that API.
-Dan
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide