Skip to content

Commit

Permalink
Fixing parsing error when there is no BGP configured on Junos (#1887)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers committed Mar 28, 2023
1 parent 8ecc4de commit 322f208
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions napalm/junos/junos.py
Original file line number Diff line number Diff line change
Expand Up @@ -1253,11 +1253,10 @@ def build_prefix_limit(**args):
routing_options = junos_views.junos_routing_config_table(self.device)
routing_options.get(options=self.junos_config_options)

bgp_asn = int(
routing_options.xml.find(
"./routing-options/autonomous-system/as-number"
).text
bgp_asn_obj = routing_options.xml.find(
"./routing-options/autonomous-system/as-number"
)
bgp_asn = int(bgp_asn_obj.text) if bgp_asn_obj is not None else 0

bgp_config["_"] = {
"apply_groups": [],
Expand Down

0 comments on commit 322f208

Please sign in to comment.