We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When trying to filter in some xpath for a "get" in IOS-XR... for instance:
'Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface[interface-name="MgmtEth0/RP0/CPU0/0"]/generic-counters'
This will create a grpc path:
elem { name: "infra-statistics" } elem { name: "interfaces" } elem { name: "interface" key { key: "interface-name" value: "MgmtEth0/RP0/CPU0/0" } } elem { name: "generic-counters" }
But this will fail due to CSCvk26949 as IOS-XR expects key values to be inserted in double quotes like this:
elem { name: "infra-statistics" } elem { name: "interfaces" } elem { name: "interface" key { key: "interface-name" value: "\"MgmtEth0/RP0/CPU0/0\"" } } elem { name: "generic-counters" }
The returned error message will mention something like 'lexical error: invalid char in json text.'.
These diffs seem to make it work for me:
diff --git a/src/cisco_gnmi/xr.py b/src/cisco_gnmi/xr.py index c55d6e4..50f4240 100644 --- a/src/cisco_gnmi/xr.py +++ b/src/cisco_gnmi/xr.py @@ -352,7 +352,13 @@ class XRClient(Client): # module name origin, xpath = xpath.split(":", 1) origin = origin.strip("/") - return super(XRClient, cls).parse_xpath_to_gnmi_path(xpath, origin) + path = super(XRClient, cls).parse_xpath_to_gnmi_path(xpath, origin) + # Need to have double quotes around key value in IOS-XR (CSCvk26949) + for elem in path.elem: + if elem.key: + for key in list(elem.key.keys()): + elem.key[key] = '"{}"'.format(elem.key[key]) + return path @classmethod def parse_cli_to_gnmi_path(cls, command):
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When trying to filter in some xpath for a "get" in IOS-XR... for instance:
'Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface[interface-name="MgmtEth0/RP0/CPU0/0"]/generic-counters'
This will create a grpc path:
But this will fail due to CSCvk26949 as IOS-XR expects key values to be inserted in double quotes like this:
The returned error message will mention something like 'lexical error: invalid char in json text.'.
These diffs seem to make it work for me:
The text was updated successfully, but these errors were encountered: