Skip to content
Snippets Groups Projects
test_gws_indirect.py 2.6 KiB
Newer Older
import responses
from brian_dashboard_manager.templating.gws import generate_indirect
from brian_dashboard_manager.inventory_provider.interfaces import \
    get_gws_indirect


TEST_DATA = [
    {
        "id": 712361,
        "name": "FCCN-AP3-IAS",
        "customer": "FCCN",
        "speed": 107374182400,
        "pop": "PORTO",
        "hostname": "rt1.por.pt.geant.net",
        "interface": "ae10.333",
        "type": "GWS - INDIRECT",
        "status": "operational"
    },
    {
        "id": 661222,
        "name": "FCCN-AP2-IAS",
        "customer": "FCCN",
        "speed": 42949672960,
        "pop": "LISBON 2",
        "hostname": "mx1.lis.pt.geant.net",
        "interface": "ae10.333",
        "type": "GWS - INDIRECT",
        "status": "operational"
    },
    {
        "id": 661500,
        "name": "IUCC-AP1-IAS",
        "customer": "IUCC",
        "speed": 32212254720,
        "pop": "LONDON",
        "hostname": "mx1.lon.uk.geant.net",
        "interface": "ae21.333",
        "type": "GWS - INDIRECT",
        "status": "operational"
    },
    {
        "id": 663112,
        "name": "ROEDUNET_AP1_IAS",
        "customer": "ROEDUNET",
        "speed": 42949672960,
        "pop": "BUCHAREST",
        "hostname": "mx1.buc.ro.geant.net",
        "interface": "ae11.333",
        "type": "GWS - INDIRECT",
        "status": "operational"
    },
    {
        "id": 663228,
        "name": "IUCC-AP2-IAS",
        "customer": "IUCC",
        "speed": 32212254720,
        "pop": "FRANKFURT",
        "hostname": "mx1.fra.de.geant.net",
        "interface": "ae21.333",
        "type": "GWS - INDIRECT",
        "status": "operational"
    },
    {
        "id": 661641,
        "name": "FCCN-AP1-IAS",
        "customer": "FCCN",
        "speed": 42949672960,
        "pop": "LISBON",
        "hostname": "mx2.lis.pt.geant.net",
        "interface": "ae10.333",
        "type": "GWS - INDIRECT",
        "status": "operational"
    }
]


@responses.activate
def test_gws(data_config, client):
        method=responses.GET,
        url=f"{data_config['inventory_provider']}/poller/gws/indirect",

    gws_data = get_gws_indirect(data_config['inventory_provider'])

    dashboards = list(generate_indirect(gws_data, 'testdatasource'))

    assert len(dashboards) == 3

    assert dashboards[0]['title'] == 'GWS Indirect - FCCN'
    assert len(dashboards[0]['panels']) == 3

    assert dashboards[1]['title'] == 'GWS Indirect - IUCC'
    assert len(dashboards[1]['panels']) == 2

    assert dashboards[2]['title'] == 'GWS Indirect - ROEDUNET'
    assert len(dashboards[2]['panels']) == 1