Skip to content
Snippets Groups Projects
Commit f03d6f3d authored by Vidya Ambadipudi's avatar Vidya Ambadipudi Committed by Robert Latta
Browse files

added more categories for service classification

parent 99691c0e
No related branches found
No related tags found
No related merge requests found
......@@ -689,17 +689,38 @@ def refresh_finalizer(self, pending_task_ids_json):
class PollerServiceCategory(str, enum.Enum):
MDVPN = 'mdvpn'
LHCONE = 'lhcone'
LHCONE_CUST = 'lhcone_cust'
LHCONE_PEER = 'lhcone_peer'
L2_Circuits = 'l2_circuits'
IAS = 'ias'
RE_CUST = 're_cust'
RE_PEER = 're_peer'
BACKBONE = 'backbone'
@log_task_entry_and_exit
def _build_service_category_interface_list(update_callback=lambda s: None):
def _classify(ifc):
if ifc['description'].startswith('SRV_MDVPN'):
if ifc['description'].startswith('SRV_MDVPN CUSTOMER'):
yield PollerServiceCategory.MDVPN
if 'LHCONE' in ifc['description']:
yield PollerServiceCategory.LHCONE
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 'PHY CUSTOMER' in ifc['description'] \
and 'LAG CUSTOMER' in ifc['description'] \
and '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
update_callback('loading all known interfaces')
interfaces = data.build_service_interface_user_list(InventoryTask.config)
......
......@@ -61,9 +61,19 @@ def test_build_interface_services(mocked_worker_module):
seen_types.add(type)
assert type in ('mdvpn', 'lhcone')
expected_seen_types = set(['mdvpn', 'lhcone'])
assert type in ('mdvpn',
'lhcone_peer',
're_peer',
'ias',
'lhcone',
'lhcone_cust')
expected_seen_types = set(['mdvpn',
'lhcone_peer',
're_peer',
'ias',
'lhcone',
'lhcone_cust'])
assert seen_types == expected_seen_types
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment