Skip to content
Snippets Groups Projects
Commit 7b74f650 authored by Robert Latta's avatar Robert Latta
Browse files

Merge branch 'feature/POL1-137' into 'develop'

Feature/pol1 137

See merge request live-projects/dashboardv3/inventory-provider!2
parents 331d937d 79418abb
No related branches found
No related tags found
No related merge requests found
......@@ -691,31 +691,40 @@ class PollerServiceCategory(str, enum.Enum):
MDVPN = 'mdvpn'
LHCONE_CUST = 'lhcone_cust'
LHCONE_PEER = 'lhcone_peer'
L2_Circuits = 'l2_circuits'
L2_CIRCUITS = 'l2_circuits'
AUTOMATED_L2_CIRCUITS = 'automated_l2_circuits'
IAS = 'ias'
RE_CUST = 're_cust'
RE_PEER = 're_peer'
BACKBONE = 'backbone'
def _classify_interface(ifc):
if ifc['description'].startswith('SRV_MDVPN CUSTOMER'):
yield PollerServiceCategory.MDVPN
if 'LHCONE' in ifc['description'] \
and 'SRV_L3VPN CUSTOMER' in ifc['description']:
yield PollerServiceCategory.LHCONE_CUST
if 'LHCONE' in ifc['description'] \
and 'SRV_L3VPN RE' in ifc['description']:
yield PollerServiceCategory.LHCONE_PEER
if 'SRV_L2CIRCUIT' in ifc['description'] \
and 'SRV_L3VPN' in ifc['description']:
yield PollerServiceCategory.L2_Circuits
if 'SRV_L2CIRCUIT' in ifc['description']:
yield PollerServiceCategory.L2_CIRCUITS
if 'SRV_GCS' in ifc['description']:
yield PollerServiceCategory.AUTOMATED_L2_CIRCUITS
if 'PHY CUSTOMER' in ifc['description'] \
and 'LAG CUSTOMER' in ifc['description'] \
and 'SRV_GLOBAL CUSTOMER' in ifc['description']:
or 'LAG CUSTOMER' in ifc['description'] \
or 'SRV_GLOBAL CUSTOMER' in ifc['description']:
yield PollerServiceCategory.RE_CUST
if 'SRV_GLOBAL RE_INTERCONNECT' in ifc['description']:
yield PollerServiceCategory.RE_PEER
if 'SRV_IAS CUSTOMER' in ifc['description']:
yield PollerServiceCategory.IAS
......
......@@ -65,16 +65,22 @@ def test_build_interface_services(mocked_worker_module):
assert type in ('mdvpn',
'lhcone_peer',
're_peer',
're_cust',
'ias',
'lhcone',
'lhcone_cust')
'lhcone_cust',
'l2_circuits',
'automated_l2_circuits')
expected_seen_types = set(['mdvpn',
'lhcone_peer',
're_peer',
're_cust',
'ias',
'lhcone',
'lhcone_cust'])
'lhcone_cust',
'l2_circuits',
'automated_l2_circuits'])
assert seen_types == expected_seen_types
......@@ -127,15 +133,46 @@ def test_build_subnet_db(mocked_worker_module):
# ... seems the method is not yet ready for testing
@pytest.mark.parametrize('description,expected_categories', [
[
'SRV_L3VPN CUSTOMER ESNET LHCONE SRF9928635 | ASN293 | GEN-EEX-ESNET-LHCONE', # noqa
'SRV_MDVPN CUSTOMER SANET SRF9939441 | VPN-Proxy to NREN CE',
{
worker.PollerServiceCategory.MDVPN
}
],
[
'SRV_L3VPN CUSTOMER ESNET LHCONE SRF9928635 | ASN293 | GEN-EEX',
{
worker.PollerServiceCategory.LHCONE_CUST
}
],
[
'SRV_MDVPN CUSTOMER SANET SRF9939441 | VPN-Proxy to NREN CE',
'SRV_L3VPN RE KREONET LHCONE SRF17072 | ASN17579',
{
worker.PollerServiceCategory.MDVPN
worker.PollerServiceCategory.LHCONE_PEER
}
],
[
'SRV_IAS CUSTOMER ACONET SRF9947199 IASPS | ASN1853',
{
worker.PollerServiceCategory.IAS
}
],
[
'SRV_GLOBAL CUSTOMER HBKU SRF18085 | ASN34945|',
{
worker.PollerServiceCategory.RE_CUST
}
],
[
'SRV_GLOBAL RE_INTERCONNECT HBKU SRF18085 | ASN34945|',
{
worker.PollerServiceCategory.RE_PEER
}
],
[
'SRV_MDVPN CUSTOMER LHCONE SRV_L3VPN CUSTOMER SRF18085 | ASN34945|',
{
worker.PollerServiceCategory.MDVPN,
worker.PollerServiceCategory.LHCONE_CUST
}
]
])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment