diff --git a/inventory_provider/db/ims_data.py b/inventory_provider/db/ims_data.py index 79d4bd084eb37760365a7e2c0d98990a1c6e0b38..c4b522cffd8eb46b43ba34afa07752e534c423e3 100644 --- a/inventory_provider/db/ims_data.py +++ b/inventory_provider/db/ims_data.py @@ -21,10 +21,6 @@ IMS_OPSDB_STATUS_MAP = { InventoryStatus.READY_FOR_CEASURE: 'Disposed' } -interface_generators = { - 'infinera': lambda x: f"{x['shelf']['sequencenumber']}-{x['name']}" -} - def get_fibre_info(ds: IMS): # get all the wdm ots circuits where each node is in a different location @@ -76,10 +72,9 @@ def get_fibre_info(ds: IMS): def get_port_id_services(ds: IMS): - # get subset of circuits - - # start with just the ams fra lag, then expand to - # include the relevant carrier circuits - # service types come from the 'product' information + # this is the only place that speeds are used, + # products are used else where to define services, so a relevant list of + # products has been moved to the ims module as IMS_SERVICE_NAMES speeds = { 'L3VPN', 'LAG', @@ -174,12 +169,12 @@ def get_port_details(ds: IMS): ds.get_all_entities( 'internalport', internal_port_nav_props, step_count=2000) ): - vendor = p['node']['equipmentdefinition']['name'] - interface_name = \ - interface_generators.get( - vendor.lower(), - lambda x: x['name'] - )(p) + vendor = p['node']['equipmentdefinition']['name'].lower() + # if there become more exceptions we will need to abstract this + if vendor == 'infinera': + interface_name = f"{p['shelf']['sequencenumber']}-{p['name']}" + else: + interface_name = p['name'] data = { 'port_id': p['id'], 'equipment_name': p['node']['name'],