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

grouped interface name generation in single place

parent 90f4d7c4
No related branches found
No related tags found
No related merge requests found
...@@ -21,10 +21,6 @@ IMS_OPSDB_STATUS_MAP = { ...@@ -21,10 +21,6 @@ IMS_OPSDB_STATUS_MAP = {
InventoryStatus.READY_FOR_CEASURE: 'Disposed' InventoryStatus.READY_FOR_CEASURE: 'Disposed'
} }
interface_generators = {
'infinera': lambda x: f"{x['shelf']['sequencenumber']}-{x['name']}"
}
def get_fibre_info(ds: IMS): def get_fibre_info(ds: IMS):
# get all the wdm ots circuits where each node is in a different location # get all the wdm ots circuits where each node is in a different location
...@@ -76,10 +72,9 @@ def get_fibre_info(ds: IMS): ...@@ -76,10 +72,9 @@ def get_fibre_info(ds: IMS):
def get_port_id_services(ds: IMS): def get_port_id_services(ds: IMS):
# get subset of circuits - # this is the only place that speeds are used,
# start with just the ams fra lag, then expand to # products are used else where to define services, so a relevant list of
# include the relevant carrier circuits # products has been moved to the ims module as IMS_SERVICE_NAMES
# service types come from the 'product' information
speeds = { speeds = {
'L3VPN', 'L3VPN',
'LAG', 'LAG',
...@@ -174,12 +169,12 @@ def get_port_details(ds: IMS): ...@@ -174,12 +169,12 @@ def get_port_details(ds: IMS):
ds.get_all_entities( ds.get_all_entities(
'internalport', internal_port_nav_props, step_count=2000) 'internalport', internal_port_nav_props, step_count=2000)
): ):
vendor = p['node']['equipmentdefinition']['name'] vendor = p['node']['equipmentdefinition']['name'].lower()
interface_name = \ # if there become more exceptions we will need to abstract this
interface_generators.get( if vendor == 'infinera':
vendor.lower(), interface_name = f"{p['shelf']['sequencenumber']}-{p['name']}"
lambda x: x['name'] else:
)(p) interface_name = p['name']
data = { data = {
'port_id': p['id'], 'port_id': p['id'],
'equipment_name': p['node']['name'], 'equipment_name': p['node']['name'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment