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

added ETH circuits into required data

parent 69f63ee8
No related branches found
No related tags found
No related merge requests found
import logging
import re
from collections import OrderedDict, defaultdict
from copy import copy
from itertools import chain
from inventory_provider import environment
......@@ -75,6 +76,10 @@ def get_port_id_services(ds: IMS):
# 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
# The products here are all the products we need to be able to build map
# ports to services
products = copy(IMS_SERVICE_NAMES)
products.add('ETHERNET')
speeds = {
'L3VPN',
'LAG',
......@@ -89,7 +94,7 @@ def get_port_id_services(ds: IMS):
]
def _get_circuits():
for st in IMS_SERVICE_NAMES:
for st in products:
for c in ds.get_filtered_entities(
'Circuit',
f'product.name == "{st}"',
......@@ -148,8 +153,8 @@ def get_port_id_services(ds: IMS):
tmp_ports = sorted(
circuit['ports'], key=lambda x: x['sequencenumber'])
ports = [tmp_ports[0]['id'], tmp_ports[-1]['id']]
elif circuit['internalportaid'] or circuit['internalportbid']:
ports = [circuit['internalportaid'], circuit['internalportbid']]
# elif circuit['internalportaid'] or circuit['internalportbid']:
# ports = [circuit['internalportaid'], circuit['internalportbid']]
elif circuit['portaid'] or circuit['portbid']:
ports = [circuit['portaid'], circuit['portbid']]
yield from _populate_end_info(cd, ports)
......@@ -187,6 +192,7 @@ def get_circuit_hierarchy(ds: IMS):
circuit_nav_props = [
ims.CIRCUIT_PROPERTIES['Customer'],
ims.CIRCUIT_PROPERTIES['Product'],
ims.CIRCUIT_PROPERTIES['Speed'],
ims.CIRCUIT_PROPERTIES['SubCircuits'],
ims.CIRCUIT_PROPERTIES['CarrierCircuits']
]
......@@ -202,6 +208,7 @@ def get_circuit_hierarchy(ds: IMS):
'status': IMS_OPSDB_STATUS_MAP.get(
InventoryStatus(circuit['inventorystatusid']), 'unknown'),
'product': circuit['product']['name'],
'speed': circuit['speed']['name'],
'project': circuit['customer']['name'],
'sub-circuits': sub_circuits,
'carrier-circuits': carrier_circuits
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment