cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
367
Views
1
Helpful
1
Replies

Help with raw config change

mahekuma
Cisco Employee
Cisco Employee

Need help with raw configuration write to a Nexus device.

It works if the args is one line and API returns. If there are multiple lines in args the configuration change is done successfully on the device but the API returns read timeout. Tried increasing read timeout/ write timeout and it is not helping. Can do 2 API calls for global config but my need is to push an interface block as well.

Using the following API to write a change to the device.


Success case

curl -X POST \

http://10.126.78.221:8080/api/running/devices/device/nexus50000/config/nx:EXEC/_operations/exec \

-H 'Authorization: Basic YWRtaW46YWRtaW4=' \

-H 'Content-Type: application/vnd.yang.data+json' \

-H 'Cache-Control: no-cache' \

-H 'Postman-Token: e536c3a9-f84c-5d23-334c-88f949321851' \

-d '{

"input": {

"args" :

"snmp-server community public1"

}

}'

Success case response

{

  "tailf-ned-cisco-nx:output": {

    "result": "\r\r\n\r"

  }

}

Success case Nexus ned trace log

>> 4-Jul-2017::00:51:35.157 IS_ALIVE 0

<< 4-Jul-2017::00:51:35.159 IS_ALIVE true

>> 4-Jul-2017::00:51:35.159 RECONNECT 0

<< 4-Jul-2017::00:51:35.159 CONNECTED 0

>> 4-Jul-2017::00:51:35.161 COMMAND exec([{['http://tail-f.com/ned/cisco-nx'|

                                            args],

                                           [<<"snmp-server community public1">>]}])

  *** output 4-Jul-2017::00:51:35.162 ***

config t

  *** input 4-Jul-2017::00:51:35.162 ***

nexus5000(config)#

  *** output 4-Jul-2017::00:51:35.162 ***

snmp-server community public1

  *** input 4-Jul-2017::00:51:35.171 ***

config t

nexus5000(config)# snmp-server community public1

nexus5000(config)#

  *** output 4-Jul-2017::00:51:35.181 ***

exit

  *** input 4-Jul-2017::00:51:35.184 ***

exit

nexus5000#

<< 4-Jul-2017::00:51:35.186 COMMAND

[{['http://tail-f.com/ned/cisco-nx'|result],<<"\r\r\n\r">>}]

Failed case

curl -X POST \

http://10.126.78.221:8080/api/running/devices/device/nexus50000/config/nx:EXEC/_operations/exec \

-H 'Authorization: Basic YWRtaW46YWRtaW4=' \

-H 'Content-Type: application/vnd.yang.data+json' \

-H 'Cache-Control: no-cache' \

-H 'Postman-Token: e536c3a9-f84c-5d23-334c-88f949321851' \

-d '{

"input": {

"args" :

"snmp-server community public1

snmp-server community public2"

}

}'

Failed case response

{"errors": {"error": [{"error-message": "External error in the NED implementation for device nexus50000: read timeout", "error-urlpath": "/api/running/devices/device/nexus50000/config/nx:EXEC/exec", "error-tag": "operation-failed"}]}}

Failed case NED trace log

>> 4-Jul-2017::00:59:23.357 IS_ALIVE 1

<< 4-Jul-2017::00:59:23.359 IS_ALIVE true

>> 4-Jul-2017::00:59:23.359 RECONNECT 1

<< 4-Jul-2017::00:59:23.359 CONNECTED 1

>> 4-Jul-2017::00:59:23.361 COMMAND exec([{['http://tail-f.com/ned/cisco-nx'|

                                            args],

                                           [<<"snmp-server community public1\nsnmp-server community public2">>]}])

  *** output 4-Jul-2017::00:59:23.362 ***

config t

  *** input 4-Jul-2017::00:59:23.362 ***

nexus5000(config)#

  *** output 4-Jul-2017::00:59:23.362 ***

snmp-server community public1

snmp-server community public2

  *** input 4-Jul-2017::01:00:23.383 ***

config t

nexus5000(config)# snmp-server community public1

nexus5000(config)# snmp-server community public2

<< 4-Jul-2017::01:00:23.384 ERROR: External error in the NED implementation for device nexus50000: read timeout

1 Reply 1

Akira Iwamoto
Cisco Employee
Cisco Employee

cisco-nx NED has exec action for executing a command in config mode, however it's not intended to configure the device.

This exec is for executing the below, for example.

(config)#crypto key generate

(config)#default interface EThernet 1/1

So one line is an expected argument.

Also, if you configure using this, it won't be in CDB, so you should use configure devices in normal way.

For using REST, let me introduce this document.

https://communities.cisco.com/docs/DOC-74493