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

Ask about the support of <get-data> and how to use "with_defaults" #538

Open
fourwilling opened this issue May 26, 2022 · 3 comments
Open

Comments

@fourwilling
Copy link

fourwilling commented May 26, 2022

  1. Will ncclient support the operation? This pull request has not been merged:
    Initial support for RFC8526: NETCONF Extensions for NMDA #450

  2. Need know the right way to use "with_defaults".

Below is the way I used "with_defaults". It works but is a little slow. Not sure if this is the right way use this XML-encoded parameter.

conn = manager.connect(
    host=***,
    username=***,
    password=***,
    hostkey_verify=False,
)

SYS_sub = """<filter xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
                            <packs xmlns="http://***"></packs>
                       </filter>"""
conn.get(filter=SYS_sub, with_defaults="report-all")

And I would like to know why this does not work (cannot access the default values):

SYS_sub = """<packs xmlns="http://***"></packs>"""
conn.get(filter=("subtree", SYS_sub), with_defaults="report-all")

Thank you!

@einarnn
Copy link
Contributor

einarnn commented May 26, 2022

@fourwilling:

  1. If the author of the PR brings it up to date with the main line it will likely be adopted. This is why the tag "Waiting" has been applied.
  2. ncclient adds the <filter> tag,and so you should not have it as part of your filter definition.
  3. The performance of with-defaults typically depends on the device being queried.

@fourwilling
Copy link
Author

fourwilling commented May 26, 2022

@einarnn

Do you mean I should not have <filter> in SYS_sub? This is actually the only way that works for me thus far.

 SYS_sub = """<filter xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
                             <packs xmlns="http://***"></packs>
                        </filter>"""
 conn.get(filter=SYS_sub, with_defaults="report-all")

@einarnn
Copy link
Contributor

einarnn commented Oct 23, 2022

@fourwilling, I mixed some things up before, my apologies. ncclient adds the <filter> tag when using the filter=("subtree", SYS_sub) variant, and I see now that you used that correctly.

In the last example you give, does your device honour the with_defaults setting?

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

No branches or pull requests

2 participants