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

parse_xpath_to_gnmi_path as classmethod #63

Merged
merged 3 commits into from
Jul 17, 2020

Conversation

remingtonc
Copy link
Contributor

@remingtonc remingtonc commented Jun 17, 2020

Makes it simpler to derive XPaths for OSes without having a built Client.

e.g.

(cisco-gnmi-python) [cisco-gnmi-python] python3
Type "help", "copyright", "credits" or "license" for more information.
>>> from cisco_gnmi import XRClient
>>> XRClient.parse_xpath_to_gnmi_path("/openconfig-interfaces:interfaces/interface/state/openconfig-vlan:tpid")
origin: "openconfig-interfaces"
elem {
  name: "interfaces"
}
elem {
  name: "interface"
}
elem {
  name: "state"
}
elem {
  name: "openconfig-vlan:tpid"
}

Fixes #61

@remingtonc remingtonc added enhancement New feature or request ergonomics labels Jun 17, 2020
@remingtonc remingtonc requested a review from a team June 17, 2020 22:15
@remingtonc remingtonc self-assigned this Jun 17, 2020
@remingtonc remingtonc requested review from skkumaravel and anushramsurat1 and removed request for a team June 17, 2020 22:15
Copy link
Collaborator

@miott miott left a comment

Choose a reason for hiding this comment

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

Would be a good idea to add sanity tests for a variety of xpath formats. An xpath with one key, another with 2 keys, another with prefixes embedded, another with half the path prefixed, another with a key that has a value that is prefixed.

@remingtonc
Copy link
Contributor Author

Added an issue to track the unit tests. Does this look acceptable otherwise?

@remingtonc remingtonc changed the base branch from master to rel-v1.0.12 July 17, 2020 20:42
@remingtonc remingtonc merged commit 3152983 into rel-v1.0.12 Jul 17, 2020
@remingtonc remingtonc deleted the xpath-parse-classmethod branch July 17, 2020 20:45
@remingtonc remingtonc mentioned this pull request Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ergonomics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make parse_xpath_to_gnmi_path a classmethod
2 participants