cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2131
Views
10
Helpful
3
Replies

NSO RESTCONF create node fail

Hi, Team

 

Trying to create NSO new device via restconf query, but recieve error.  

 

[admin@servername ~]$ curl -u admin -X POST -H "Accept: application/yang-data+xml" -H "Content-type: application/yang-data+xml" http://192.168.0.100:8080/restconf/data/tailf-ncs:devices \
> -d '{
> <devices xmlns="http://tail-f.com/ns/ncs">
> <device>
> <name>LAB-vXR-2</name>
> <address>10.21.90.69</address>
> <port>22</port>
> <description>Cisco__ASR</description>
> <authgroup>authgroup1</authgroup>
> <device-type>
> <cli>
> <ned-id xmlns:cisco-iosxr-cli-7.33="http://tail-f.com/ns/ned-id/cisco-iosxr-cli-7.33">cisco-iosxr-cli-7.33:cisco-iosxr-cli-7.33</ned-id>
> <protocol>ssh</protocol>
> </cli>
> </device-type>
> <state>
> <admin-state>unlocked</admin-state>
> </state>
> </device>
> </devices>
> }'

 

Enter host password for user 'admin ':

 

Error:

 

<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<error>
<error-type>application</error-type>
<error-tag>malformed-message</error-tag>
<error-path xmlns:ncs="http://tail-f.com/ns/ncs">/ncs:devices</error-path>
</error>
</errors>

 

May anyone show what am i doing wrong ?? 

1 Accepted Solution

Accepted Solutions

There are a few options. You can add the "-v" or "--verbose" flag to the curl command to show the response header you received.

 

If all you are interested in is the status code, you can try adding the following flags to the curl command, which print the status code value received from the NSO server:

-s -o /dev/null -w "\n%{http_code}\n"

Alternatively, you could do a RESTCONF GET request for the object you just created and verify that it is present and correctly configured.

View solution in original post

3 Replies 3

tcragg1
Cisco Employee
Cisco Employee

I think the opening and closing {} characters are causing it to be rejected as malformed XML. Try removing them and re-sending.

Thanks, it works now, device is crated correctly! But i don`t recive any message from curl about success, how may i fix it?

 

[admin@servername ~]$ curl -u admin -X POST -H "Accept: application/yang-data+xml" -H "Content-type: application/yang-data+xml" http://192.168.0.100:8080/restconf/data/tailf-ncs:devices \
> -d '<device>
> <name>LAB-vXR-2</name>
> <address>10.21.90.69</address>
> <port>22</port>
> <description>Cisco__ASR</description>
> <authgroup>authgroup1</authgroup>
> <device-type>
> <cli>
> <ned-id xmlns:cisco-iosxr-cli-7.33="http://tail-f.com/ns/ned-id/cisco-iosxr-cli-7.33">cisco-iosxr-cli-7.33:cisco-iosxr-cli-7.33</ned-id>
> <protocol>ssh</protocol>
> </cli>
> </device-type>
> <state>
> <admin-state>unlocked</admin-state>
> </state>
> </device>'

Enter host password for user 'admin ':

[admin@servername ~]$

There are a few options. You can add the "-v" or "--verbose" flag to the curl command to show the response header you received.

 

If all you are interested in is the status code, you can try adding the following flags to the curl command, which print the status code value received from the NSO server:

-s -o /dev/null -w "\n%{http_code}\n"

Alternatively, you could do a RESTCONF GET request for the object you just created and verify that it is present and correctly configured.