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
Branches
Tags
No related merge requests found
......@@ -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'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment