From 02703a2fe279c4d84e0291846c062b39b90974ae Mon Sep 17 00:00:00 2001 From: Vidya Ambadipudi <vidya.ambadipudi@geant.org> Date: Thu, 20 Aug 2020 14:46:53 +0200 Subject: [PATCH] added tests and removed unused category --- inventory_provider/tasks/worker.py | 1 - test/test_worker_utils.py | 38 ++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/inventory_provider/tasks/worker.py b/inventory_provider/tasks/worker.py index a299bddc..c38f0474 100644 --- a/inventory_provider/tasks/worker.py +++ b/inventory_provider/tasks/worker.py @@ -696,7 +696,6 @@ class PollerServiceCategory(str, enum.Enum): IAS = 'ias' RE_CUST = 're_cust' RE_PEER = 're_peer' - BACKBONE = 'backbone' def _classify_interface(ifc): diff --git a/test/test_worker_utils.py b/test/test_worker_utils.py index 3ad3f358..f3b2a81a 100644 --- a/test/test_worker_utils.py +++ b/test/test_worker_utils.py @@ -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 @@ -126,6 +132,12 @@ def test_build_subnet_db(mocked_worker_module): # this data is just enough to be an example # ... seems the method is not yet ready for testing @pytest.mark.parametrize('description,expected_categories', [ + [ + 'SRV_MDVPN CUSTOMER SANET SRF9939441 | VPN-Proxy to NREN CE', + { + worker.PollerServiceCategory.MDVPN + } + ], [ 'SRV_L3VPN CUSTOMER ESNET LHCONE SRF9928635 | ASN293 | GEN-EEX-ESNET-LHCONE', # noqa { @@ -133,9 +145,27 @@ def test_build_subnet_db(mocked_worker_module): } ], [ - 'SRV_MDVPN CUSTOMER SANET SRF9939441 | VPN-Proxy to NREN CE', + 'SRV_L3VPN RE KREONET LHCONE SRF17072 | ASN17579', # noqa { - worker.PollerServiceCategory.MDVPN + worker.PollerServiceCategory.LHCONE_PEER + } + ], + [ + 'SRV_IAS CUSTOMER ACONET SRF9947199 IASPS | ASN1853', # noqa + { + worker.PollerServiceCategory.IAS + } + ], + [ + 'SRV_GLOBAL RE_INTERCONNECT HBKU SRF18085 | ASN34945|', # noqa + { + worker.PollerServiceCategory.RE_PEER + } + ], + [ + 'SRV_GLOBAL RE_INTERCONNECT HBKU SRF18085 | ASN34945|', # noqa + { + worker.PollerServiceCategory.RE_PEER } ] ]) -- GitLab