07-03-2017 11:19 PM - edited 03-01-2019 03:54 AM
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.
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"
}
}'
{
"tailf-ned-cisco-nx:output": {
"result": "\r\r\n\r"
}
}
>> 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">>}]
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"
}
}'
{"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"}]}}
>> 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
07-06-2017 02:37 AM
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.
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