diff --git a/inventory_provider/juniper.py b/inventory_provider/juniper.py index ea98adb8b8f97e7f1400e6a7ea7f392a0e937cba..4742147eea537efbcba196b1bad5e91d8d13cfa0 100644 --- a/inventory_provider/juniper.py +++ b/inventory_provider/juniper.py @@ -281,11 +281,13 @@ def vpn_rr_peers(netconf_config): '/protocols/bgp/' 'group[name/text()="VPN-RR" or name/text()="VPN-RR-INTERNAL"]/' 'neighbor'): - name = r.find('name') + peer_as = r.find('peer-as') + if peer_as is not None: + peer_as = int(r.find('peer-as').text) yield { - 'name': ipaddress.ip_address(name.text).exploded, + 'name': ipaddress.ip_address(r.find('name').text).exploded, 'description': r.find('description').text, - 'peer-as': int(r.find('peer-as').text) + 'peer-as': peer_as }