From 9e9bad69850829802ee5c7171b1061d91ee971e0 Mon Sep 17 00:00:00 2001 From: Bjarke Madsen <bjarke@nordu.net> Date: Thu, 30 Jan 2025 10:04:52 +0100 Subject: [PATCH] Fix test due to threading --- test/test_update.py | 187 +++++++++++++++++++------------------------- 1 file changed, 80 insertions(+), 107 deletions(-) diff --git a/test/test_update.py b/test/test_update.py index f6a955b..688afe2 100644 --- a/test/test_update.py +++ b/test/test_update.py @@ -1,3 +1,4 @@ +# flake8: noqa import pytest import responses from concurrent.futures import ThreadPoolExecutor @@ -12,7 +13,6 @@ TEST_INTERFACES = [ "bundle": [], "bundle-parents": [], "description": "PHY CUSTOMER GEANT CORPORATE SRF000001 | GEANT Corporate to MX1.LON - Via Vodafone", - # noqa: E501 "circuits": [ { "id": 679232, @@ -43,7 +43,6 @@ TEST_INTERFACES = [ "bundle": [], "bundle-parents": [], "description": "SRV_GLOBAL CUSTOMER GEANT #GEANT_CORPORATE-ViaVodafone | GEANT Corporate to mx1.lon - Via Vodafone ", - # noqa: E501 "circuits": [ { "id": 679360, @@ -78,7 +77,6 @@ TEST_INTERFACES = [ "bundle": [], "bundle-parents": [], "description": "SRV_GLOBAL CUSTOMER GEANT #GEANT_CORPORATE_ViaVodafone-VRF | GEANT Corporate to mx1.lon - Via Vodafone - for VRF", - # noqa: E501 "circuits": [ { "id": 712144, @@ -111,11 +109,10 @@ TEST_INTERFACES = [ "bundle": [], "bundle-parents": [], "description": "SRV_GLOBAL CUSTOMER GEANT #GEANT_CORPORATE_ViaVodafone-VRF-TEST | GEANT Corporate to mx1.lon - Via Vodafone - DASHBOARD BGP TEST VLAN", - # noqa: E501 "circuits": [ { "id": 678920, - "name": "GEANT_CORPORATE_VIAVODAFONE-VRF-TEST (DO NOT OPEN A TICKET)", # noqa: E501 + "name": "GEANT_CORPORATE_VIAVODAFONE-VRF-TEST (DO NOT OPEN A TICKET)", "type": "GEANT IP", "status": "non-monitored" } @@ -144,7 +141,6 @@ TEST_INTERFACES = [ "bundle": [], "bundle-parents": [], "description": "SRV_GLOBAL CUSTOMER GEANT #GEANT_OPERATIONS_LabConnectivity | GEANT MX1.LON Infinera VRF to Operations Lab", - # noqa: E501 "circuits": [ { "id": 678999, @@ -226,7 +222,7 @@ TEST_INTERFACES = [ "name": "ge-0/2/1.0", "bundle": [], "bundle-parents": [], - "description": "SRV_L2CIRCUIT INFRASTRUCTURE GEANT GEANT #AMS-ZAG OPENFLOW |", # noqa: E501 + "description": "SRV_L2CIRCUIT INFRASTRUCTURE GEANT GEANT #AMS-ZAG OPENFLOW |", "circuits": [], "snmp-index": 687, "dashboards": [ @@ -248,7 +244,7 @@ TEST_INTERFACES = [ "name": "ge-0/2/2.0", "bundle": [], "bundle-parents": [], - "description": "SRV_L2CIRCUIT INFRASTRUCTURE GEANT GEANT #AMS-VIE OPENFLOW |", # noqa: E501 + "description": "SRV_L2CIRCUIT INFRASTRUCTURE GEANT GEANT #AMS-VIE OPENFLOW |", "circuits": [], "snmp-index": 711, "dashboards": [ @@ -270,7 +266,7 @@ TEST_INTERFACES = [ "name": "ge-0/2/4.0", "bundle": [], "bundle-parents": [], - "description": "SRV_L2CIRCUIT INFRASTRUCTURE GEANT GEANT #AMS-FRA OPENFLOW |", # noqa: E501 + "description": "SRV_L2CIRCUIT INFRASTRUCTURE GEANT GEANT #AMS-FRA OPENFLOW |", "circuits": [], "snmp-index": 718, "dashboards": [ @@ -288,7 +284,6 @@ TEST_INTERFACES = [ "ipv6": [] }, { - "router": "rt1.fra.de.geant.net", "name": "xe-11/2/5.300", "bundle": [], @@ -331,7 +326,7 @@ NREN_INTERFACES = [ "ae10" ], "bundle-parents": [], - "description": "PHY CUSTOMER HEANET P_AE10 SRF9948758 | HEANET-AP2-LL3", # noqa: E501 + "description": "PHY CUSTOMER HEANET P_AE10 SRF9948758 | HEANET-AP2-LL3", "circuits": [], "snmp-index": 554, "dashboards": [ @@ -356,7 +351,7 @@ NREN_INTERFACES = [ "ae10" ], "bundle-parents": [], - "description": "PHY CUSTOMER HEANET P_AE10 SRF0000001 | HEANET-AP2-LL2", # noqa: E501 + "description": "PHY CUSTOMER HEANET P_AE10 SRF0000001 | HEANET-AP2-LL2", "circuits": [], "snmp-index": 527, "dashboards": [ @@ -381,7 +376,7 @@ NREN_INTERFACES = [ "ae10" ], "bundle-parents": [], - "description": "PHY CUSTOMER HEANET P_AE10 SRF9925903 | HEANET-AP2-LL1", # noqa: E501 + "description": "PHY CUSTOMER HEANET P_AE10 SRF9925903 | HEANET-AP2-LL1", "circuits": [], "snmp-index": 528, "dashboards": [ @@ -473,7 +468,7 @@ NREN_INTERFACES = [ "xe-1/0/1", "xe-1/1/0" ], - "description": "SRV_MDVPN CUSTOMER HEANET AP2 #HEANET-BGP-LU-CoC-1 |", # noqa: E501 + "description": "SRV_MDVPN CUSTOMER HEANET AP2 #HEANET-BGP-LU-CoC-1 |", "circuits": [ { "id": 663160, @@ -509,7 +504,7 @@ NREN_INTERFACES = [ "xe-1/0/1", "xe-1/1/0" ], - "description": "SRV_IAS CUSTOMER HEANET #HEANET-AP2-IAS IASPS | ASN1213 ", # noqa: E501 + "description": "SRV_IAS CUSTOMER HEANET #HEANET-AP2-IAS IASPS | ASN1213 ", "circuits": [ { "id": 663214, @@ -547,7 +542,7 @@ NREN_INTERFACES = [ "xe-1/0/1", "xe-1/1/0" ], - "description": "SRV_L2CIRCUIT CUSTOMER HEANET GEANT #ams-dub2-HEANET-RARE-21061 |", # noqa: E501 + "description": "SRV_L2CIRCUIT CUSTOMER HEANET GEANT #ams-dub2-HEANET-RARE-21061 |", "circuits": [ { "id": 713335, @@ -574,9 +569,7 @@ NREN_INTERFACES = [ "ipv4": [], "ipv6": [] }, - { - - "router": "rt1.fra.de.geant.net", + {"router": "rt1.fra.de.geant.net", "name": "xe-11/2/5.300", "bundle": [], "bundle-parents": [], @@ -607,48 +600,48 @@ NREN_INTERFACES = [ "port_type": "SERVICE", "ipv4": [], "ipv6": [] - } + } ] EUMETSAT_MULTICAST = [ { 'router': 'mx1.ams.nl.geant.net', - 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.1.193.17.9.3.255.255.255.255', # noqa: E501 + 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.1.193.17.9.3.255.255.255.255', 'community': '0pBiFbD', 'subscription': '232.223.222.1', 'endpoint': '193.17.9.3' }, { 'router': 'mx1.ams.nl.geant.net', - 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.2.193.17.9.3.255.255.255.255', # noqa: E501 + 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.2.193.17.9.3.255.255.255.255', 'community': '0pBiFbD', 'subscription': '232.223.222.2', 'endpoint': '193.17.9.3' }, { 'router': 'mx1.lon.uk.geant.net', - 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.1.193.17.9.3.255.255.255.255', # noqa: E501 + 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.1.193.17.9.3.255.255.255.255', 'community': '0pBiFbD', 'subscription': '232.223.222.1', 'endpoint': '193.17.9.3' }, { 'router': 'mx1.lon.uk.geant.net', - 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.2.193.17.9.3.255.255.255.255', # noqa: E501 + 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.2.193.17.9.3.255.255.255.255', 'community': '0pBiFbD', 'subscription': '232.223.222.2', 'endpoint': '193.17.9.3' }, { 'router': 'mx1.fra.de.geant.net', - 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.1.193.17.9.3.255.255.255.255', # noqa: E501 + 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.1.193.17.9.3.255.255.255.255', 'community': '0pBiFbD', 'subscription': '232.223.222.1', 'endpoint': '193.17.9.3' }, { 'router': 'mx1.fra.de.geant.net', - 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.2.193.17.9.3.255.255.255.255', # noqa: E501 + 'oid': '1.3.6.1.2.1.83.1.1.2.1.16.232.223.222.2.193.17.9.3.255.255.255.255', 'community': '0pBiFbD', 'subscription': '232.223.222.2', 'endpoint': '193.17.9.3' @@ -730,14 +723,14 @@ def populate_inventory(get_test_data, data_config): ("NREN Access", [], {'ASNET-AM', 'CESNET', 'GEANT', 'KIAE', 'LITNET', 'SWITCH'}), ("NREN Access", ["GEANT", "KIAE"], {'ASNET-AM', 'CESNET', 'LITNET', 'SWITCH'}), ( - "NREN Access", - [], - {'ASNET-AM', "LITNET", "CESNET", "GEANT", "KIAE", "SWITCH"}, + "NREN Access", + [], + {'ASNET-AM', "LITNET", "CESNET", "GEANT", "KIAE", "SWITCH"}, ), ( - "NREN Access", - ["GEANT"], - {'ASNET-AM', "LITNET", "CESNET", "KIAE", "SWITCH"}, + "NREN Access", + ["GEANT"], + {'ASNET-AM', "LITNET", "CESNET", "KIAE", "SWITCH"}, ), ("testfolder", ["GEANT"], {"KIAE", "SWITCH"}), ], @@ -853,7 +846,7 @@ def test_provision_re_peer_dashboard( { "router": "mx1.dub2.ie.geant.net", "name": "xe-0/0/0.1", - "description": "PHY SVC P_AE10 SRF9948758 | HEANET-AP2-LL3", # noqa: E501 + "description": "PHY SVC P_AE10 SRF9948758 | HEANET-AP2-LL3", "dashboards": ["RE_PEER"], "dashboard_info": {"name": "ESNET", "interface_type": "LOGICAL"}, "dashboards_info": [{"name": "ESNET", "interface_type": "LOGICAL"}], @@ -905,64 +898,50 @@ def test_vlan_interfaces(mocker, data_config, mock_grafana, reporting_provider, 'dashboard_info': {'interface_type': 'AGGREGATE', 'name': 'REDIRIS'}, 'dashboards': ['NREN', 'RE_CUST'], 'dashboards_info': [{'interface_type': 'AGGREGATE', 'name': 'REDIRIS'}], 'description': 'LAG CUSTOMER REDIRIS SRF21114 $GA-01800 |', 'ipv4': [], 'ipv6': [], 'name': 'ae16', - 'port_type': 'ACCESS', 'router': 'mx1.mad.es.geant.net', 'snmp-index': 654, 'vlan_type': 'TRUNK'}, - - {'bundle': [], 'bundle-parents': ['et-4/0/0', 'et-5/0/5', 'et-8/1/2', 'et-8/1/5'], 'circuits': [ - {'id': 739804, 'name': 'UC3M-REDIRIS-BELNET-SLICES-IMEC', 'status': 'non-monitored', 'type': 'GEANT PLUS'}], - 'dashboard_info': {'interface_type': 'LOGICAL', 'name': 'REDIRIS'}, - 'dashboards': ["VLAN Interfaces"], - 'dashboards_info': [{'interface_type': 'LOGICAL', 'name': 'REDIRIS'}, - {'interface_type': 'LOGICAL', 'name': 'BELNET'}], - 'description': 'SRV_L2CIRCUIT CUSTOMER REDIRIS BELNET #UC3M-RedIRIS-BELNET-SLICES-IMEC $GS-02514 |', - 'ipv4': [], 'ipv6': [], 'name': 'ae16.975', 'port_type': 'SERVICE', 'router': 'mx1.mad.es.geant.net', - 'snmp-index': 818, 'vlan_type': 'VLAN'}, - - {'bundle': [], 'bundle-parents': ['et-4/0/0', 'et-5/0/5', 'et-8/1/2', 'et-8/1/5'], 'circuits': [ - {'id': 732759, 'name': 'FRA-MAD-RARE-REDIRIS-23017-VL201', 'status': 'non-monitored', - 'type': 'GEANT PLUS'}], 'dashboard_info': {'interface_type': 'LOGICAL', 'name': 'RARE'}, - 'dashboards': ['L2_CIRCUIT'], 'dashboards_info': [{'interface_type': 'LOGICAL', 'name': 'RARE'}, - {'interface_type': 'LOGICAL', 'name': 'REDIRIS'}], - 'description': 'SRV_L2CIRCUIT CUSTOMER RARE REDIRIS #fra-mad-RARE-REDIRIS-23017-VL201 $GS-02274', 'ipv4': [], - 'ipv6': [], 'name': 'ae16.201', 'port_type': 'SERVICE', 'router': 'mx1.mad.es.geant.net', 'snmp-index': 642, - 'vlan_type': 'VLAN'}, - - {'bundle': [], 'bundle-parents': [], 'circuits': [ - {'id': 729417, 'name': 'PAR-LON2-SUPERPOP-QFX-2-GEANT', 'status': 'operational', 'type': 'GEANT - GBS'}], - 'dashboard_info': {'interface_type': 'LOGICAL', 'name': 'GEANT-IT'}, 'dashboards': ['GBS_10G'], - 'dashboards_info': [{'interface_type': 'LOGICAL', 'name': 'GEANT-IT'}], - 'description': 'SRV_10GGBS CUSTOMER GEANT-IT #par-lon2-SUPERPOP-QFX-2-GEANT $GS-00081 |', 'ipv4': [], - 'ipv6': [], 'name': 'xe-2/2/7.0', 'port_type': 'SERVICE', 'router': 'mx1.lon2.uk.geant.net', 'snmp-index': 613, - 'vlan_type': 'VLAN'}, - - {'bundle': ['xe-0/1/0', 'xe-0/1/1'], 'bundle-parents': ['xe-0/1/0', 'xe-0/1/1'], 'circuits': [], - 'dashboard_info': {'interface_type': 'AGGREGATE', 'name': 'LITNET'}, 'dashboards': ['NREN', 'RE_CUST'], - 'dashboards_info': [{'interface_type': 'AGGREGATE', 'name': 'LITNET'}], - 'description': 'LAG CUSTOMER LITNET AP2 #LITNET-AP2-LAG $GA-02071 |', 'ipv4': [], 'ipv6': [], 'name': 'ae10', - 'port_type': 'ACCESS', 'router': 'art1.kau.lt.geant.net', 'snmp-index': 588, 'vlan_type': 'TRUNK'}, - - {'bundle': [], 'bundle-parents': ['et-0/0/2'], 'circuits': [ - {'id': 679356, 'name': 'LAT-AP1-IPV6', 'status': 'operational', 'type': 'GEANT IP'}], - 'dashboard_info': {'interface_type': 'LOGICAL', 'name': 'LAT'}, - 'dashboards': ['NREN', 'RE_CUST'], - 'dashboards_info': [{'interface_type': 'LOGICAL', 'name': 'LAT'}], - 'description': 'SRV_GLOBAL CUSTOMER LAT #LAT-AP1 $GS-00484 | ASN5538', - 'ipv4': ['62.40.124.237/30'], 'ipv6': ['2001:798:99:1::51/126'], 'name': 'ae10.83', - 'port_type': 'SERVICE', 'router': 'art1.kau.lt.geant.net', 'snmp-index': 604, - 'vlan_type': 'VLAN'}, - - {'bundle': [], 'bundle-parents': ['et-2/1/2', 'et-2/1/5', 'et-11/1/0'], 'circuits': [ - {'id': 707643, 'name': 'GARR-UDMILANO_EXPRESSROUTE_VLAN4086', 'status': 'operational', - 'type': 'EXPRESS ROUTE'}], 'dashboard_info': {'interface_type': 'LOGICAL', 'name': 'GARR'}, - 'dashboards': ['GCS'], 'dashboards_info': [{'interface_type': 'LOGICAL', 'name': 'GARR'}], - 'description': 'SRV_GCS CUSTOMER GARR MICROSOFT #GARR-UDMilano_ExpressRoute_Vlan4086 $GS-01148 | UNIT CONFIGURATION HAS BEEN SYSTEM GENERATED', - 'ipv4': [], 'ipv6': [], 'name': 'ae10.4086', 'port_type': 'SERVICE', 'router': 'art1.kau.lt.geant.net', - 'snmp-index': 795, 'vlan_type': 'VLAN'}, - - {'bundle': [], 'bundle-parents': [], 'circuits': [], - 'dashboard_info': {'interface_type': 'PHYSICAL', 'name': 'BUD-ZAG'}, 'dashboards': ['INFRASTRUCTURE_BACKBONE'], - 'dashboards_info': [{'interface_type': 'PHYSICAL', 'name': 'BUD-ZAG'}], - 'description': 'PHY INFRASTRUCTURE BACKBONE P_ae5 | BUD-ZAG', 'ipv4': [], 'ipv6': [], 'name': 'et-7/0/2', - 'port_type': 'UNKNOWN', 'router': 'mx1.bud.hu.geant.net', 'snmp-index': 1133, 'vlan_type': 'ACCESS'}, + 'port_type': 'ACCESS', 'router': 'mx1.mad.es.geant.net', 'snmp-index': 654, 'vlan_type': 'TRUNK'}, {'bundle': [], 'bundle-parents': ['et-4/0/0', 'et-5/0/5', 'et-8/1/2', 'et-8/1/5'], 'circuits': [ + {'id': 739804, 'name': 'UC3M-REDIRIS-BELNET-SLICES-IMEC', 'status': 'non-monitored', 'type': 'GEANT PLUS'}], + 'dashboard_info': {'interface_type': 'LOGICAL', 'name': 'REDIRIS'}, + 'dashboards': ["VLAN Interfaces"], + 'dashboards_info': [{'interface_type': 'LOGICAL', 'name': 'REDIRIS'}, + {'interface_type': 'LOGICAL', 'name': 'BELNET'}], + 'description': 'SRV_L2CIRCUIT CUSTOMER REDIRIS BELNET #UC3M-RedIRIS-BELNET-SLICES-IMEC $GS-02514 |', + 'ipv4': [], 'ipv6': [], 'name': 'ae16.975', 'port_type': 'SERVICE', 'router': 'mx1.mad.es.geant.net', + 'snmp-index': 818, 'vlan_type': 'VLAN'}, {'bundle': [], 'bundle-parents': ['et-4/0/0', 'et-5/0/5', 'et-8/1/2', 'et-8/1/5'], 'circuits': [ + {'id': 732759, 'name': 'FRA-MAD-RARE-REDIRIS-23017-VL201', 'status': 'non-monitored', + 'type': 'GEANT PLUS'}], 'dashboard_info': {'interface_type': 'LOGICAL', 'name': 'RARE'}, + 'dashboards': ['L2_CIRCUIT'], 'dashboards_info': [{'interface_type': 'LOGICAL', 'name': 'RARE'}, + {'interface_type': 'LOGICAL', 'name': 'REDIRIS'}], + 'description': 'SRV_L2CIRCUIT CUSTOMER RARE REDIRIS #fra-mad-RARE-REDIRIS-23017-VL201 $GS-02274', 'ipv4': [], + 'ipv6': [], 'name': 'ae16.201', 'port_type': 'SERVICE', 'router': 'mx1.mad.es.geant.net', 'snmp-index': 642, + 'vlan_type': 'VLAN'}, {'bundle': [], 'bundle-parents': [], 'circuits': [ + {'id': 729417, 'name': 'PAR-LON2-SUPERPOP-QFX-2-GEANT', 'status': 'operational', 'type': 'GEANT - GBS'}], + 'dashboard_info': {'interface_type': 'LOGICAL', 'name': 'GEANT-IT'}, 'dashboards': ['GBS_10G'], + 'dashboards_info': [{'interface_type': 'LOGICAL', 'name': 'GEANT-IT'}], + 'description': 'SRV_10GGBS CUSTOMER GEANT-IT #par-lon2-SUPERPOP-QFX-2-GEANT $GS-00081 |', 'ipv4': [], + 'ipv6': [], 'name': 'xe-2/2/7.0', 'port_type': 'SERVICE', 'router': 'mx1.lon2.uk.geant.net', 'snmp-index': 613, + 'vlan_type': 'VLAN'}, {'bundle': ['xe-0/1/0', 'xe-0/1/1'], 'bundle-parents': ['xe-0/1/0', 'xe-0/1/1'], 'circuits': [], + 'dashboard_info': {'interface_type': 'AGGREGATE', 'name': 'LITNET'}, 'dashboards': ['NREN', 'RE_CUST'], + 'dashboards_info': [{'interface_type': 'AGGREGATE', 'name': 'LITNET'}], + 'description': 'LAG CUSTOMER LITNET AP2 #LITNET-AP2-LAG $GA-02071 |', 'ipv4': [], 'ipv6': [], 'name': 'ae10', + 'port_type': 'ACCESS', 'router': 'art1.kau.lt.geant.net', 'snmp-index': 588, 'vlan_type': 'TRUNK'}, {'bundle': [], 'bundle-parents': ['et-0/0/2'], 'circuits': [ + {'id': 679356, 'name': 'LAT-AP1-IPV6', 'status': 'operational', 'type': 'GEANT IP'}], + 'dashboard_info': {'interface_type': 'LOGICAL', 'name': 'LAT'}, + 'dashboards': ['NREN', 'RE_CUST'], + 'dashboards_info': [{'interface_type': 'LOGICAL', 'name': 'LAT'}], + 'description': 'SRV_GLOBAL CUSTOMER LAT #LAT-AP1 $GS-00484 | ASN5538', + 'ipv4': ['62.40.124.237/30'], 'ipv6': ['2001:798:99:1::51/126'], 'name': 'ae10.83', + 'port_type': 'SERVICE', 'router': 'art1.kau.lt.geant.net', 'snmp-index': 604, + 'vlan_type': 'VLAN'}, {'bundle': [], 'bundle-parents': ['et-2/1/2', 'et-2/1/5', 'et-11/1/0'], 'circuits': [ + {'id': 707643, 'name': 'GARR-UDMILANO_EXPRESSROUTE_VLAN4086', 'status': 'operational', + 'type': 'EXPRESS ROUTE'}], 'dashboard_info': {'interface_type': 'LOGICAL', 'name': 'GARR'}, + 'dashboards': ['GCS'], 'dashboards_info': [{'interface_type': 'LOGICAL', 'name': 'GARR'}], + 'description': 'SRV_GCS CUSTOMER GARR MICROSOFT #GARR-UDMilano_ExpressRoute_Vlan4086 $GS-01148 | UNIT CONFIGURATION HAS BEEN SYSTEM GENERATED', + 'ipv4': [], 'ipv6': [], 'name': 'ae10.4086', 'port_type': 'SERVICE', 'router': 'art1.kau.lt.geant.net', + 'snmp-index': 795, 'vlan_type': 'VLAN'}, {'bundle': [], 'bundle-parents': [], 'circuits': [], + 'dashboard_info': {'interface_type': 'PHYSICAL', 'name': 'BUD-ZAG'}, 'dashboards': ['INFRASTRUCTURE_BACKBONE'], + 'dashboards_info': [{'interface_type': 'PHYSICAL', 'name': 'BUD-ZAG'}], + 'description': 'PHY INFRASTRUCTURE BACKBONE P_ae5 | BUD-ZAG', 'ipv4': [], 'ipv6': [], 'name': 'et-7/0/2', + 'port_type': 'UNKNOWN', 'router': 'mx1.bud.hu.geant.net', 'snmp-index': 1133, 'vlan_type': 'ACCESS'}, ] populate_inventory( @@ -983,33 +962,27 @@ def test_vlan_interfaces(mocker, data_config, mock_grafana, reporting_provider, ) _mocked_gws_indirect.return_value = [] - # _mocked_vlan_data = mocker.patch( - # "brian_dashboard_manager.grafana.provision.get_router_dashboard_data" - # ) - # _mocked_vlan_data.return_value = [] - # - # _mocked_dashboard_data_dropdown = mocker.patch( - # "brian_dashboard_manager.grafana.provision.get_dashboard_data_dropdown" - # ) - # _mocked_dashboard_data_dropdown.return_value = [] - data_config["organizations"] = [ {"name": "Testorg1", "excluded_nrens": ["GEANT"], "excluded_dashboards": []}, ] provision(data_config) folder_uid = "VLAN_Interfaces" - # assert len(mock_grafana.folders[folder_uid]) == 1 + result = mock_grafana.dashboards_by_folder_uid[folder_uid] assert len(result) == 3 - # assert result[0]["title"] == "art1.kau.lt.geant.net" + assert result[0]["tags"][0] == "vlandash" - panels = mock_grafana.dashboards_by_folder_uid[folder_uid][0]["panels"] - expected_types = ["text", "row"] + dashboards = mock_grafana.dashboards_by_folder_uid[folder_uid] + panels = [] + for dashboard in dashboards: + panels.extend(dashboard["panels"]) + expected_types = ["text", "row", "text", "row", "text", "row"] assert [p["type"] for p in panels] == expected_types assert "INFO" in panels[0]["options"]["content"] - # assert "ae10" in panels[1]["title"] - # assert len(panels[1]["panels"]) == 3 + assert "ae10" in set(p['title'] for p in panels) + panel_ae10 = [p for p in panels if p['title'] == 'ae10'][0] + assert len(panel_ae10["panels"]) == 3 @responses.activate -- GitLab