vkosuri/robotframework-ncclient

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

Closed this issue · 1 comments

<get> and <get-config> 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 <interfaces> (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 .

Thank you @jrebiffe