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

how to obtain user-defined config for a device

nisheeth
Level 1
Level 1

I am able to obtain configuration for a device by giving this query and it gives me output in XML

curl -u <user:password> http://localhost:8080/restconf/data/tailf-ncs:devices/device=device0/config

<config xmlns="http://tail-f.com/ns/ncs" xmlns:ncs="http://tail-f.com/ns/ncs">

<fex>

<fex xmlns="http://tail-f.com/ned/cisco-nx">
<id>101</id>
<pinning>
<max-links>1</max-links>
</pinning>
</fex>

<vlan xmlns="http://tail-f.com/ned/cisco-nx">
<vlan-list>
<id>1</id>
<name>Test</name>
<state>active</state>
</vlan-list>
<vlan-list>
<id>380</id>
</vlan-list>
<vlan-list>
<id>400</id>
</vlan-list>
</vlan>
<interface xmlns="http://tail-f.com/ned/cisco-nx">
<Ethernet>
<name>1/0</name>
</Ethernet>

</interface>

</config>

The intention is to get user defined conifg information and then update the configuration using post

So send two curl request mentioned below and it failed need to know what is wrong

curl -u <user:password> http://localhost:8080/restconf/data/tailf-ncs:devices/device=device0/config/vlan

<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<error>
<error-type>application</error-type>
<error-tag>invalid-value</error-tag>
<error-message>uri keypath not found</error-message>
</error>
</errors>

curl -u <user:password> http://localhost:8080/restconf/data/tailf-ncs:devices/device=device0/config/interface

<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<error>
<error-type>application</error-type>
<error-tag>invalid-value</error-tag>
<error-message>uri keypath not found</error-message>
</error>
</errors>

I also tried the following and got same error thereroe I think I am missing something in URL or I have to define a payload

curl -u <user:password> http://localhost:8080/restconf/data/tailf-ncs:devices/device=device0/config/ned/cisco-nx/vlan

<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<error>
<error-type>application</error-type>
<error-tag>invalid-value</error-tag>
<error-message>uri keypath not found</error-message>
</error>
</errors>
 curl -u <user:password> http://localhost:8080/restconf/data/tailf-ncs:devices/device=device0/config/vlan/ned/cisco-nx

<errors xmlns="urn:ietf:params:xml:ns:yang:ietf-restconf">
<error>
<error-type>application</error-type>
<error-tag>invalid-value</error-tag>
<error-message>uri keypath not found</error-message>
</error>
</errors>

 

1 Reply 1

huayyang
Cisco Employee
Cisco Employee

The part in resource uri after "config" is not in tailf-ncs module, you should prefix that part with the actual module name.

Refer to description in ncs.conf:

/ncs-config/restconf/require-module-name/enabled (boolean) [true]
When set to 'true', the client must explicitly provide the module name of the node if it is defined in a module other than its parent node or its parent node is the datastore. When set to 'false', this configuration parameter allows the client to bypass above requirements. Refer to RFC 8040, section3.5.3 for detailed information.