diff --git a/inventory_provider/routes/poller.py b/inventory_provider/routes/poller.py index 0344dbacaf4fad3aa3982bb7e39bb80a190ac500..199047fd717cc022d9989914fe6d3c7a21a47328 100644 --- a/inventory_provider/routes/poller.py +++ b/inventory_provider/routes/poller.py @@ -99,6 +99,9 @@ class BRIAN_DASHBOARDS(Enum): LHCONE = auto() CAE1 = auto() + # NREN customer + NREN = auto() + # only used in INTERFACE_LIST_SCHEMA and sphinx docs _DASHBOARD_IDS = [d.name for d in list(BRIAN_DASHBOARDS)] @@ -397,6 +400,9 @@ def _get_dashboards(interface): yield BRIAN_DASHBOARDS.CAE1 if re.match('^PHY UPSTREAM', description): yield BRIAN_DASHBOARDS.GWS_PHY_UPSTREAM + regex = r'(PHY|LAG|(SRV_(GLOBAL|LHCONE|MDVPN|IAS|CLS|L3VPN))) CUSTOMER' + if re.match(regex, description): + yield BRIAN_DASHBOARDS.NREN def _add_dashboards(interfaces): @@ -778,9 +784,9 @@ def eumetsat_multicast(hostname=None): MX1_FRA = 'mx1.fra.de.geant.net' SUBSCRIPTIONS = [{ - 'subscription': f'232.223.222.{idx}', - 'endpoint': '193.17.9.3', - } for idx in range(1, 73)] + 'subscription': f'232.223.222.{idx}', + 'endpoint': '193.17.9.3', + } for idx in range(1, 73)] SUBSCRIPTIONS.append( {'subscription': '232.223.223.1', 'endpoint': '193.17.9.7'}) diff --git a/test/test_general_poller_routes.py b/test/test_general_poller_routes.py index 8774542b32677408d5b039cf03d8fd71cf9be39a..4e5e922621b916f86fd6057e2670daf551f234cc 100644 --- a/test/test_general_poller_routes.py +++ b/test/test_general_poller_routes.py @@ -55,7 +55,7 @@ def test_eumetsat_multicast(mocker, client): # routers don't have snmp acl's for us mocker.patch('inventory_provider.juniper.snmp_community_string') \ - .return_value = 'blah' + .return_value = 'blah' rv = client.get( '/poller/eumetsat-multicast', @@ -219,9 +219,31 @@ def test_fw_counter_bytes_oid_values(customer, interface_name, expected_oid): @pytest.mark.parametrize('description,expected_dashboards', [ ('SRV_IAS CUSTOMER JISC #JISC-AP1-IAS IASPS | ASN786', - ['IAS_CUSTOMER']), + ['IAS_CUSTOMER', 'NREN']), ('SRV_L2CIRCUIT CUSTOMER JISC JISC #DUB-LON-NRENBBEXT-JANET-13015 | backup for niran ', # noqa: E501 - ['L2_CIRCUIT']) + ['L2_CIRCUIT']), + ('SRV_L3VPN CUSTOMER EENET #EENET-AP2-LHCONE | ASN3221', + ['LHCONE', 'LHCONE_CUST', 'NREN']), + ('SRV_IAS PRIVATE OPTIMA-TELEKOM #HR-EduZone | For Eduzone', + ['IAS_PEERS', 'IAS_PRIVATE']), + ('SRV_CLS PRIVATE AWS #AT-AWS-CLS|ASN16509 | ', + ['CLS', 'CLS_PEERS']), + ('SRV_IAS PUBLIC MIX #IX_Peerings_in_MIX |', + ['IAS_PEERS', 'IAS_PUBLIC']), + ('LAG INFRASTRUCTURE BACKBONE SRF0000001 | bil-por', + ['INFRASTRUCTURE_BACKBONE']), + ('SRV_GCS CUSTOMER FCCN MICROSOFT #FCCN_NoveSBE_ExpressRoute_Vlan1945 | UNIT CONFIGURATION HAS BEEN SYSTEM GENERATED', # noqa: E501 + ['GCS']), + ('PHY UPSTREAM TELIA SRF9940473 | Telia ID: IC-326863', + ['GWS_PHY_UPSTREAM']), + ('SRV_IAS UPSTREAM COGENT #COGENT_GWS_VIE | ASN174', + ['IAS_UPSTREAM']), + ('SRV_L3VPN RE_INTERCONNECT CLARA #REDCLARA-LIS-LHCONE | ASN27750', + ['LHCONE', 'LHCONE_PEER']), + ('SRV_MDVPN CUSTOMER REDIRIS #RedIRIS_AP1_BGP_LU_CoC_1 | MD VPN CoC-REDIRIS - ', # noqa: E501 + ['MDVPN_CUSTOMERS', 'NREN']), + ('SRV_L2CIRCUIT CUSTOMER TENET PSNC #lon-lon-GEANTOPEN-PSNC-TENET-18067 |', # noqa: E501 + ['GEANTOPEN', 'L2_CIRCUIT']) ]) def test_interface_dashboard_mapping(description, expected_dashboards): interface = {