Skip to content
Snippets Groups Projects
Commit 6479bdc1 authored by Sam Roberts's avatar Sam Roberts
Browse files

Merge branch 'feature/POL1-487-copernicus-dashboard' into 'develop'

add copernicus-specific logic to set up copernicus-specific dashboard

See merge request live-projects/dashboardv3/inventory-provider!7
parents 0fa52597 e9f3c0f6
No related branches found
No related tags found
No related merge requests found
...@@ -116,6 +116,9 @@ class BRIAN_DASHBOARDS(Enum): ...@@ -116,6 +116,9 @@ class BRIAN_DASHBOARDS(Enum):
# NREN customer # NREN customer
NREN = auto() NREN = auto()
# COPERNICUS
COPERNICUS = auto()
# only used in INTERFACE_LIST_SCHEMA and sphinx docs # only used in INTERFACE_LIST_SCHEMA and sphinx docs
_DASHBOARD_IDS = [d.name for d in list(BRIAN_DASHBOARDS)] _DASHBOARD_IDS = [d.name for d in list(BRIAN_DASHBOARDS)]
...@@ -415,7 +418,8 @@ def _get_dashboards(interface): ...@@ -415,7 +418,8 @@ def _get_dashboards(interface):
router = interface.get('router', '').lower() router = interface.get('router', '').lower()
ifc_name = interface.get('name', '') ifc_name = interface.get('name', '')
description = interface.get('description', '').strip() description = interface.get('description', '').strip()
if re.search(r'COPERNICUS.*?\|', description, flags=re.IGNORECASE):
yield BRIAN_DASHBOARDS.COPERNICUS
if 'SRV_CLS' in description: if 'SRV_CLS' in description:
yield BRIAN_DASHBOARDS.CLS yield BRIAN_DASHBOARDS.CLS
if 'SRV_CLS PRIVATE' in description: if 'SRV_CLS PRIVATE' in description:
...@@ -507,6 +511,8 @@ def _get_dashboard_data(ifc): ...@@ -507,6 +511,8 @@ def _get_dashboard_data(ifc):
host = ifc['router'] host = ifc['router']
location = host.split('.')[1].upper() location = host.split('.')[1].upper()
name = f'{name} - {location}' name = f'{name} - {location}'
elif BRIAN_DASHBOARDS.COPERNICUS.name in dashboards:
name = "COPERNICUS"
else: else:
name = _get_customer_name(description) name = _get_customer_name(description)
......
...@@ -296,7 +296,9 @@ def test_fw_counter_bytes_oid_values(customer, interface_name, expected_oid): ...@@ -296,7 +296,9 @@ def test_fw_counter_bytes_oid_values(customer, interface_name, expected_oid):
('SRV_MDVPN CUSTOMER REDIRIS #RedIRIS_AP1_BGP_LU_CoC_1 | MD VPN CoC-REDIRIS - ', # noqa: E501 ('SRV_MDVPN CUSTOMER REDIRIS #RedIRIS_AP1_BGP_LU_CoC_1 | MD VPN CoC-REDIRIS - ', # noqa: E501
['MDVPN_CUSTOMERS', 'NREN']), ['MDVPN_CUSTOMERS', 'NREN']),
('SRV_L2CIRCUIT CUSTOMER TENET PSNC #lon-lon-GEANTOPEN-PSNC-TENET-18067 |', # noqa: E501 ('SRV_L2CIRCUIT CUSTOMER TENET PSNC #lon-lon-GEANTOPEN-PSNC-TENET-18067 |', # noqa: E501
['GEANTOPEN', 'L2_CIRCUIT']) ['GEANTOPEN', 'L2_CIRCUIT']),
('SRV_L3VPN RE_INTERCONNECT REDCLARA #REDCLARA-MAD-COPERNICUS | ASN27750',
['LHCONE', 'COPERNICUS', 'RE_PEER'])
]) ])
def test_interface_dashboard_mapping(description, expected_dashboards): def test_interface_dashboard_mapping(description, expected_dashboards):
interface = { interface = {
...@@ -375,6 +377,14 @@ def test_interface_dashboard_mapping(description, expected_dashboards): ...@@ -375,6 +377,14 @@ def test_interface_dashboard_mapping(description, expected_dashboards):
'description': 'SRV_MDVPN CUSTOMER', 'description': 'SRV_MDVPN CUSTOMER',
'dashboards': ['MDVPN_CUSTOMERS', 'NREN'] 'dashboards': ['MDVPN_CUSTOMERS', 'NREN']
}, {'name': 'SRV_MDVPN CUSTOMER', 'interface_type': 'LOGICAL'}), }, {'name': 'SRV_MDVPN CUSTOMER', 'interface_type': 'LOGICAL'}),
({
'description': 'SRV_MDVPN CUSTOMER',
'dashboards': ['MDVPN_CUSTOMERS', 'NREN']
}, {'name': 'SRV_MDVPN CUSTOMER', 'interface_type': 'LOGICAL'}),
({
'description': 'SRV_L3VPN RE_INTERCONNECT REDCLARA #REDCLARA-MAD-COPERNICUS | ASN27750', # noqa: E501
'dashboards': ['COPERNICUS']
}, {'name': 'COPERNICUS', 'interface_type': 'LOGICAL'}),
]) ])
def test_description_dashboard_parsing(interface, dashboard_info): def test_description_dashboard_parsing(interface, dashboard_info):
......
...@@ -74,7 +74,7 @@ def test_extract_ims_data(mocker): ...@@ -74,7 +74,7 @@ def test_extract_ims_data(mocker):
assert res['customer_contacts'] == {'123': 'CON A', '456': 'CON B'} assert res['customer_contacts'] == {'123': 'CON A', '456': 'CON B'}
assert res['circuit_ids_to_monitor'] == [123, 456, 789] assert res['circuit_ids_to_monitor'] == [123, 456, 789]
assert res['additional_circuit_customer_ids'] == \ assert res['additional_circuit_customer_ids'] == \
[{'id a': ['A', 'A2']}, {'id b': ['B']}] [{'id a': ['A', 'A2']}, {'id b': ['B']}]
assert res['hierarchy'] == { assert res['hierarchy'] == {
'1': {'id': '1', 'value': 'A'}, '1': {'id': '1', 'value': 'A'},
'2': {'id': '2', 'value': 'B'} '2': {'id': '2', 'value': 'B'}
...@@ -436,7 +436,7 @@ def test_persist_ims_data(mocker, data_config, mocked_redis): ...@@ -436,7 +436,7 @@ def test_persist_ims_data(mocker, data_config, mocked_redis):
["poller_cache:eq1", "poller_cache:eq2"] ["poller_cache:eq1", "poller_cache:eq2"]
assert json.loads(r.get("ims:sid_services").decode("utf-8")) == \ assert json.loads(r.get("ims:sid_services").decode("utf-8")) == \
data["sid_services"] data["sid_services"]
def test_retrieve_and_persist_neteng_managed_device_list( def test_retrieve_and_persist_neteng_managed_device_list(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment