Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix #373 the get() operation not accepting multiple subtree filters #397

Merged
merged 3 commits into from Jun 30, 2020

Conversation

fredgan
Copy link
Contributor

@fredgan fredgan commented Jun 17, 2020

Hi,
This PR fixes issue #373, It allows the build_filter()'s spec parameter to be a list of filters

my testcase is like that:

# a list of subtree filters is valid for subtree filters
FILTER=[
      "<cont xmlns=\"urn:mod1\"> \
            <le1/> \
            <le2/> \
       </cont>",
      "<cont xmlns=\"urn:mod2\">"
]
  
def connect(host, port, user, password, source):
    conn = manager.connect(host=host,
                           port=port,
                           username=user,
                           password = password,
                           device_params={'name': 'iosxr'}
                           )

    rpc_reply = conn.get(filter=FILTER).xml
    print(rpc_reply)

if __name__ == "__main__":
    connect(host, port, user, password)

The output is that:

<nc:rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:1ebdec8f-4aba-4ceb-b076-20f45cb7fde5"><data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><cont xmlns="urn:mod1"><le1>this is mod1</le1><le2>111</le2></cont><cont xmlns="urn:mod2"><le1>this is mod2</le1><le2>222</le2><lst><le3>222222222</le3></lst></cont></data></nc:rpc-reply>

@coveralls
Copy link

coveralls commented Jun 17, 2020

Coverage Status

Coverage increased (+0.05%) to 68.339% when pulling 8fc380c on fredgan:multiple_subtree_filters into 790c1e9 on ncclient:master.

Copy link
Contributor

@einarnn einarnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! And sorry for the slow review!

@einarnn einarnn merged commit dac36ac into ncclient:master Jun 30, 2020
@fredgan fredgan deleted the multiple_subtree_filters branch August 1, 2020 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants