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

Fixed xpath duplicate origin in XR client #21

Merged
merged 2 commits into from
Oct 23, 2019

Conversation

marcsello
Copy link
Contributor

Using a custom origin in the sensor path wasn't split up properly causing the origin to be appended to the first element of the path which led to the following error in the subscribe call:

error {
  code: 3
  message: "Cisco-IOS-XR-infra-statsd-oper:Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/latest/generic-counters:Invalid sensor path\000"
}

With xpath and origin separated properly the SubscribeRequest succeeds.

Tested on on Cisco IOS-XRv 6.5.3 and IOS-XRv 6.6.2.

Using a custom origin in the sensor path wasn't split up properly causing the origin to be appended to the first element of the path which led to invalid sensor paths
@remingtonc remingtonc self-requested a review October 21, 2019 14:27
@remingtonc remingtonc added bug Something isn't working feature labels Oct 21, 2019
@remingtonc
Copy link
Contributor

@marcsello thank you for the contribution. I am traveling until tomorrow afternoon and cannot debug properly until then, will be tested and merged soon! 👍
To clarify - your use case is specifying the XPath as well as an origin?

xpath = 'Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/latest/generic-counter'
origin = 'Cisco-IOS-XR-infra-statsd-oper' # Or another custom origin?
client.parse_xpath_to_gnmi_path(xpath, origin)

Or only specifying the XPath:

xpath = 'Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/latest/generic-counter'
client.parse_xpath_to_gnmi_path(xpath)

This simply clarifies in your experience whether the PathElems are expected to not be namespaced, and deserves some more testing where augmentations, etc. exist.

@marcsello
Copy link
Contributor Author

My use case is specifying only the the XPath, prepended with the origin separated by a colon.

Here is the original code snippet I was using to test the results:

[builder setup]
client = builder.construct()

path = "Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/latest/generic-counters"
inflight = client.subscribe_xpaths(path)

for a in inflight:
    print(a)

The subscribe_xpaths calls client.parse_xpath_to_gnmi_path at some point with the same argument passed to it.

Copy link
Contributor

@remingtonc remingtonc left a comment

Choose a reason for hiding this comment

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

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants