cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
554
Views
1
Helpful
3
Replies
uwankhed
Cisco Employee

How to execute multiple commands on NSO

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

}

3 REPLIES 3
uwankhed
Cisco Employee

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

}

Hi,

Why on earth will you send config commands via live-status?

Please don't!

Roque

Hi Umesh,

You can't execute multiple commands at one time using that API.

-Dan