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

corrected Infinera data load

parent 0606c443
No related branches found
No related tags found
No related merge requests found
......@@ -175,11 +175,20 @@ def get_port_details(ds: IMS):
ds.get_all_entities(
'internalport', internal_port_nav_props, step_count=2000)
):
vendor = p['node']['equipmentdefinition']['name'].lower()
vendor = None
interface_name = None
try:
vendor = p['node']['equipmentdefinition']['vendor']['name'].lower()
except (TypeError, KeyError):
pass
# if there become more exceptions we will need to abstract this
if vendor == 'infinera':
interface_name = f"{p['shelf']['sequencenumber']}-{p['name']}"
else:
if vendor == 'infinera' and p.get('shelfid', None):
try:
interface_name = f"{p['shelf']['sequencenumber']}-{p['name']}"
except KeyError:
pass
if not interface_name:
interface_name = p['name']
data = {
'port_id': p['id'],
......
......@@ -535,10 +535,6 @@ def get_trap_metadata(source_equipment: str, interface: str, circuit_id: str) \
result = {
'locations': []
}
top_level_services = []
# todo - carry on from here
result.update(get_interface_services_and_locs(
ims_source_equipment,
......@@ -546,40 +542,6 @@ def get_trap_metadata(source_equipment: str, interface: str, circuit_id: str) \
r
))
services = r.get(
f'ims:interface_services:{source_equipment}:{interface}')
if services:
result['services'] = json.loads(services.decode('utf=8'))
for s in result['services']:
tls = get_top_level_services(s['id'], r)
if tls:
top_level_services.extend(tls)
if top_level_services:
result['related-services'] = top_level_services
for s in result['services']:
result['locations'].append(
build_locations(
_location_from_equipment(s['router'], r),
_location_from_equipment(s['other_end_equipment'], r))
)
# result['locations'] += \
# _location_from_equipment(s['equipment'], r)
# result['locations'] += \
# _location_from_equipment(s['other_end_equipment'], r)
gls = {tls['id']: {
'id': tls['id'],
'name': tls['name'],
'status': tls['status'],
'project': tls['project']
} for tls in top_level_services
if tls['circuit_type'] == 'geant lambda'}
if gls:
result['geant-lambda'] = list(gls.values())[0]
if len(gls) > 1:
logger.info(f'More than one Lambda, '
f'IDs {[x["id"] for x in gls.values()]}')
if not result:
return Response(
response="no available info for {} {}".format(
......
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