Skip to content
Snippets Groups Projects
Commit f8dc5360 authored by Erik Reid's avatar Erik Reid
Browse files

cleanup

parent 0a3f6377
No related branches found
No related tags found
No related merge requests found
import ipaddress
import jsonschema
import pytest
from inventory_provider import juniper
......@@ -35,7 +36,7 @@ def test_interface_list(netconf_doc):
jsonschema.validate(interfaces, schema)
assert interfaces # at least shouldn't be empty
from lxml import etree
def test_bgp_peering_data(netconf_doc):
active_peers = set()
......@@ -47,10 +48,15 @@ def test_bgp_peering_data(netconf_doc):
if inactive == 'inactive':
inactive_peers.add(address)
else:
if address == '62.40.99.50':
print('here')
active_peers.add(address)
# a peering config might be present, but an old
# version could be present but inactive
# (a bit of a testing gap, but definitely not nothing)
inactive_peers = inactive_peers - active_peers
if not active_peers:
pytest.skip('no peerings configured for this router')
peerings = list(juniper.all_bgp_peers(netconf_doc))
jsonschema.validate(peerings, juniper.PEERING_LIST_SCHEMA)
assert peerings # there's always at least one
......@@ -65,10 +71,15 @@ def test_bgp_peering_data(netconf_doc):
missing = active_peers - returned_addresses
if missing:
print('here')
assert returned_addresses == active_peers
assert returned_addresses == active_peers, (
'these active peerings weren''t returned: '
f'{active_peers - returned_addresses}')
# confirm that none of the inactive peerings were returned
assert not inactive_peers & returned_addresses
assert not inactive_peers & returned_addresses, (
'these inactive peerings were returned: '
f'{inactive_peers & returned_addresses}')
def test_snmp_community_string(mocked_netifaces, netconf_doc):
assert juniper.snmp_community_string(netconf_doc) == '0pBiFbD'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment