Problem using deleteconfig operation

65 views
Skip to first unread message

delucchi...@gmail.com

unread,
Apr 16, 2015, 7:14:16 AM4/16/15
to libne...@googlegroups.com
Hi,

I'm currently working with libnetconf trying to build a client/server couple. My problem concerns the function

"nc_rpc* nc_rpc_deleteconfig(NC_DATASTORE target, ...);"

As a matter of fact this function generates an RPC message which delete the whole target datastore.

There are any methods to delete only some parts of the datastore?

It is possible to define and apply some filters on the datastore structure for this purpose?

Thank you in advance for your precious support.

Regards,


Stefano

Michal Vasko

unread,
Apr 17, 2015, 3:12:21 AM4/17/15
to libne...@googlegroups.com, delucchi...@gmail.com
Hi Stefano,

a short answer is yes, there is a method to delete parts of a datastore and you do not need to use filters. Rather use <edit-config> with "delete" or "remove" operation.

For a long answer I would reference you to RFC 6241.

Regards,
Michal

delucchi...@gmail.com

unread,
Apr 17, 2015, 3:38:58 AM4/17/15
to libne...@googlegroups.com, delucchi...@gmail.com
Hi Micheal,

thank you for your answer. Unfortunately my explanation was a little incomplete. My problem is slightly different. I attach two files to better explain it.

The first file (datastore.xml) contains the configuration that I want to change. The second one (datastore_1.xml) contains the final result that I would like to obtain.

As you can see the modification is quite simple. I would like to remove the lines which define a port referred to a logical switch.

I would like to know if it is possible, using libnetconf, to modify the datastore.xml to obtain datastore_1.xml.

Regards,

Stefano.

delucchi...@gmail.com

unread,
Apr 17, 2015, 3:54:11 AM4/17/15
to libne...@googlegroups.com, delucchi...@gmail.com
Here are the files

datastore.xml
datastore_1.xml

Michal Vasko

unread,
Apr 17, 2015, 4:53:19 AM4/17/15
to libne...@googlegroups.com, delucchi...@gmail.com
Hi Stefano,

I'm not sure I see the problem. Just use this config in an <edit-config> operation RPC and you're good to go, except you didn't include a namespace in your files, so neither did I although there should be some (for the "capable-switch" node to be in).

<capable-switch xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
   
<id>openvswitch</id>
   
<logical-switches>
       
<switch>
           
<id>sv-w</id>
           
<port nc:operation="delete">
               
<name>sv-w_2</name>
           
</port>
       
</switch>
   
</logical-switches>
</capable-switch>

Regards,
Michal

delucchi...@gmail.com

unread,
May 7, 2015, 5:03:18 AM5/7/15
to libne...@googlegroups.com, delucchi...@gmail.com
Hi Michal,

I have been busy for a long time, but now I'm working again on libnetconf. Unfortunately I'm not able to solve my problem. I follow your precious advises, but nothing happens. The configuration in the datastore is the same after the edit-config message.

It is possible that my problem is related to the edit-config parameters not properly set?

Below there is my code:

nc_rpc_editconfig(NC_DATASTORE_CANDIDATE, NC_DATASTORE_CONFIG, NC_EDIT_DEFOP_MERGE, NC_EDIT_ERROPT_CONT, NC_EDIT_TESTOPT_SET, s.c_str());

in this case nothing happens.

Instead in this case (changing NC_EDIT_DEFOP_MERGE to NC_EDIT_DEFOP_REPLACE)

nc_rpc_editconfig(NC_DATASTORE_CANDIDATE, NC_DATASTORE_CONFIG, NC_EDIT_DEFOP_REPLACE, NC_EDIT_ERROPT_CONT, NC_EDIT_TESTOPT_SET, s.c_str());

All the candidate database is overwritten.

Any other advises?

Thank you again,

Stefano

delucchi...@gmail.com

unread,
May 7, 2015, 2:50:48 PM5/7/15
to libne...@googlegroups.com, delucchi...@gmail.com
Hi Michal,

I fix this problem. It was a very trivial error on the xml message that I create. Thank you again for your support.

Stefano

Reply all
Reply to author
Forward
0 new messages