libyang icon indicating copy to clipboard operation
libyang copied to clipboard

opaque node parsing

Open siprab opened this issue 8 months ago • 7 comments

Hi,

When any node parsed with invalid value libyang parses it as an opaque node and on netopeer2-cli the edit-config operation does not throws any error.

Now we have a scenario where we want to send error to netopeer-cli client if the value is parsed is not valid. Could you pls suggest how to do that.

siprab avatar Apr 28 '25 07:04 siprab

Opaque nodes are accepted only in a few specific cases, otherwise an error from netopeer2 is returned. It is not clear what exactly you want to do but if to change the behavior of netopeer2, you cannot do that without changing its code.

michalvasko avatar Apr 28 '25 08:04 michalvasko

Hi Michal,

We have a leaf-list node of type string which we have deviated to accept only specific string as its value using pattern. So when doing edit-config for that node with a value other than specified strings, on netopeer-cli the edit-config operation getting return as OK but in netopeer log we have log like below:

netopeer2-server|INFO "netopeer2-server-log" [INF]: LY: Parsing opaque term node "notificationTypes" with invalid value "xyz".
netopeer2-server|INFO "netopeer2-server-log" [INF]: SR: Published event "rpc" "/ietf-netconf:edit-config" with ID 7 priority 0 for 1 subscribers.
netopeer2-server|INFO "netopeer2-server-log" [INF]: SR: Processing "/ietf-netconf:edit-config" "rpc" event with ID 7 priority 0 (remaining 1 subscribers).
netopeer2-server|INFO "netopeer2-server-log" [INF]: NP: edit-config error-option "stop-on-error" not supported, rollback-on-error will be performed.
netopeer2-server|INFO "netopeer2-server-log" [INF]: SR: No datastore changes to apply.
netopeer2-server|INFO "netopeer2-server-log" [INF]: SR: Successful processing of "rpc" event with ID 7 priority 0 (remaining 0 subscribers).
netopeer2-server|INFO "netopeer2-server-log" [INF]: SR: Event "rpc" with ID 7 priority 0 succeeded.
netopeer2-server|INFO "netopeer2-server-log" [INF]: NP: Session 17: thread 3 event new RPC.

siprab avatar Apr 28 '25 09:04 siprab

The server should respond with an error but for some reason it detects no changes. Can you post the YANG data you have on the server and the exact edit-config you are sending?

michalvasko avatar Apr 28 '25 12:04 michalvasko

Hi Michal, attached the yang files, deviation statement is present in "deviation_du_modify.yang" and the edit-config data is as below:

<ManagedElement xmlns="urn:3gpp:sa5:_3gpp-common-managed-element"> <id>1</id> <NtfSubscriptionControl> <id>1_cm</id> <attributes> <notificationRecipientAddress>https://10.20.30.40:9993/eventListener/v7/</notificationRecipientAddress> <notificationTypes>xyz</notificationTypes> </attributes> </NtfSubscriptionControl> </ManagedElement>

yang_files.zip

Thanks

siprab avatar Apr 28 '25 12:04 siprab

I also need the "current" data you have stored of _3gpp-common-managed-element on the server.

michalvasko avatar Apr 28 '25 12:04 michalvasko

Hi Michal,

below is the current data on the server:

> get --filter-xpath /_3gpp-common-managed-element:ManagedElement[id]/NtfSubscriptionControl[id]
DATA
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<ManagedElement xmlns="urn:3gpp:sa5:_3gpp-common-managed-element">
<id>1</id>
<NtfSubscriptionControl>
<id>1_cm</id>
<attributes>
<notificationRecipientAddress>[https://10.20.30.40:9993/eventListener/v7/</notificationRecipientAddress>](https://10.20.30.40:9993/eventListener/v7/%3C/notificationRecipientAddress%3E)
<notificationTypes>notifyMOIChanges</notificationTypes>
</attributes>
<HeartbeatControl>
<id>1</id>
<attributes>
<heartbeatNtfPeriod>600</heartbeatNtfPeriod>
</attributes>
</HeartbeatControl>
</NtfSubscriptionControl>
</ManagedElement>

Thanks

siprab avatar Apr 28 '25 13:04 siprab

You are missing an instance of a mandatory node priorityLabel in /_3gpp-common-managed-element:ManagedElement[id='1']/attributes so I do not know how you can have that data on the server, it does not allow setting invalid data. So I am not able to help you if you do not accurately describe your use-case. Also, what version of netopeer2 are you using?

michalvasko avatar Apr 29 '25 06:04 michalvasko