IOS-XR get_route_to fix pyIOSXR.exceptions.XMLCLIError for some versions #1267
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See #958
On some versions of IOS-XR,
get_route_to
fails because the XML path (not sure what else to call it) had an element renamed fromIP_RIBRoute
toIP_RIBRouteTableName
.This PR fixes issue #958 and maintains backwards-compatibility using option B from my comment in the same issue.
Global variable
IP_RIBRoute
is used to store the default name 'IP_RIBRoute' and if the RPC call fails, it will suppress the exception (something still pops up and I don't know how to stop it), change the value of varIP_RIBRoute
to 'IP_RIBRouteTableName' and try the RPC call again. Doing it this way means that we only need to fail once within the lifetime of a Napalm instance.In the above Python output, the
Original call was:...
will appear on the first get_route_to call if IP_RIBRoute doesn't work. I couldn't figure out how to silence it.