[NETCONF-52] Using restconf rpc to edit the configuration of netconf enabled device, controller will remove the attribute of content Created: 02/Jul/15  Updated: 13/Aug/19

Status: Confirmed
Project: netconf
Component/s: restconf-nb
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: dacheng wu Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: PC


External issue ID: 3930

 Description   

ODL Version: Release/Helium-SR3
Netconf enabled device: OF-CONFIG server for Open vSwitch (https://github.com/openvswitch/of-config)

I mount a netconf enabled device (name:netconf-device-1), and use edit-config rpc by postman.
URL: http://controller_ip:8181/restconf/operations/opendaylight-inventory:nodes/node/netconf-device-1/yang-ext:mount/ietf-netconf:edit-config
Method: POST
Accept: application/xml
Content-Type: application/xml

<edit-config>
<target>
<candidate/>
</target>
<default-operation>none</default-operation>
<error-option>rollback-on-error</error-option>
<config>
<capable-switch xmlns="urn:onf:config:yang">
<logical-switches>
<switch>
<id>ofc-bridge</id>
<controllers xmlns:a="urn:ietf:params:xml:ns:netconf:base:1.0" a:operation="replace">
<controller>
<id>controller-1</id>
<ip-address>172.19.66.176</ip-address>
<protocol>tcp</protocol>
<port>6633</port>
<local-ip-address>0.0.0.0</local-ip-address>
</controller>
</controllers>
</switch>
</logical-switches>
</capable-switch>
</config>
</edit-config>

But the controller removes all attributes of the xml and sends it to the entconf server.
The netconf server does not know how to process this operation.
The xml received by netconf server list as below:

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="m-76">
<edit-config>
<target>
<candidate/>
</target>
<default-operation>none</default-operation>
<error-option>rollback-on-error</error-option>
<config>
<capable-switch>
<logical-switches>
<switch>
<id>ofc-bridge</id>
<controllers>
<controller>
<id>controller-1</id>
<ip-address>172.19.66.176</ip-address>
<protocol>tcp</protocol>
<port>6633</port>
<local-ip-address>0.0.0.0</local-ip-address>
</controller>
</controllers>
</switch>
</logical-switches>
</capable-switch>
</config>
</edit-config>
</rpc>

And ODL responses
"error-type": "application",
"error-tag": "operation-failed",
"error-message": "Request is not applicable to the data managed by the server"

There is other operation to use for editing controller configuration:

http://controller_ip:8181/restconf/config/opendaylight-inventory:nodes/node/netconf-device-1/yang-ext:mount/of-config:capable-switch/logical-switches/switch/ofc-bridge/controllers
Method: PUT
Accept: application/xml
Content-Type: application/xml
<controllers>
<controller>
<id>controller-1</id>
<ip-address>172.19.66.176</ip-address>
<protocol>tcp</protocol>
<port>6633</port>
<local-ip-address>0.0.0.0</local-ip-address>
</controller>
</controllers>

Yes, it can edit the controller ip for the entconf enabled switch.
But this approach will trigger the controller to do two actions continually, edit candidate configuration and then commit from candidate to running.

If we want to operate the configuration step by step, not continuous actions. Like as
1. Edit candidate configuration
2. Verify candidate configuration
3. Commit

For the first step, it should operate netconf rpc directly, the restconf api should like as below
POST http://controller_ip:8181/restconf/operations/opendaylight-inventory:nodes/node/netconf-device-1/yang-ext:mount/ietf-netconf:edit-config

If we want to modify running configuration directly not edit candidate first, it will also encounter the same issue.

Best Regards



 Comments   
Comment by Maros Marsalek [ 27/Jul/15 ]

Thanks for the report.

When editing configuration on a mounted Netconf device over Restconf, ODL hides the edit+commit rpcs to make Restconf behave as expected (you alse cannot choose which datastore to edit). And I dont think we should change that.

You should be able to achieve what you need by invoking edit-config manually. But as you say, the attributes are gone. This is the behavior on Helium and we should test this also with Lithium.

I think the best approach would be implementing a small handler in ODL (1 or more RPCs) that would change the configuration of the device step by step and commit when requested.

Generated at Wed Feb 07 20:14:02 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.