vkosuri / robotframework-ncclient

Robotframework library for NETCONF clients
https://vkosuri.github.io/robotframework-ncclient/
MIT License
10 stars 6 forks source link

<get> and <get-config> operations ignore filter_criteria #13

Closed jrebiffe closed 1 year ago

jrebiffe commented 1 year ago

\ and \ operations ignore filter_criteria, when it contains a empty XML element. In instance, the following filter is ignored:

${filter} =    Parse XML    <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" />
${data} =    Get    alias=NE1    filter_criteria=${filter}

It should be possible to filter on a container element at the top in order to retreive the subtree. In instance: it should be possible to filter on \ (RFC8343) to retreive the /interfaces subtree). Additionaly, empty filter is not an error, according to section 6.4.2. Empty Filter of RFC 6241.

Reproduction Robot File

Workaround

To retreive the subtree, it's possible to include the (singular). ${filter} = Parse XML <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface /></interfaces> This is possible since the container element containts a list of elements. This is not possible with ietf-system, where the container contains several leaf elements.

Patch suggestion

Line 190 for the def get_config() method and line 380 for def get() method. I suggest to change if filter_criteria: to if filter_criteria is not None:.

See Pull request #14 .

vkosuri commented 1 year ago

Thank you @jrebiffe