forked from mirrors/thatmattlove-hyperglass
Improve handling of Junos XML errors
This commit is contained in:
parent
eea833ed44
commit
49808acb6f
1 changed files with 5 additions and 0 deletions
|
|
@ -65,6 +65,11 @@ def parse_juniper(output: Sequence) -> Dict: # noqa: C901
|
|||
log.debug("Initially Parsed Response: \n{}", parsed)
|
||||
|
||||
if "rpc-reply" in parsed.keys():
|
||||
if "xnm:error" in parsed["rpc-reply"]:
|
||||
if "message" in parsed["rpc-reply"]["xnm:error"]:
|
||||
err = parsed["rpc-reply"]["xnm:error"]["message"]
|
||||
raise ParsingError('Error from device: "{}"', err)
|
||||
|
||||
parsed_base = parsed["rpc-reply"]["route-information"]
|
||||
elif "route-information" in parsed.keys():
|
||||
parsed_base = parsed["route-information"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue