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

updated monitored-in-geant-nms filtering

parent 700b9c56
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,18 @@ def get_non_monitored_circuit_ids(ds: IMS):
yield d['extrafieldvalueobjectinfo']['objectid']
def get_monitored_circuit_ids(ds: IMS):
# note the id for the relevant field is hard-coded. I didn't want to use
# the name of the field as this can be changed by users
for d in ds.get_filtered_entities(
'ExtraFieldValue',
'extrafield.id == 2898 | value == 1',
EXTRA_FIELD_VALUE_PROPERTIES['ExtraFieldValueObjectInfo'],
step_count=10000
):
yield d['extrafieldvalueobjectinfo']['objectid']
def get_service_types(ds: IMS):
for d in ds.get_filtered_entities(
'ComboBoxData',
......
......@@ -143,7 +143,7 @@ def get_interface_services_and_loc(ims_source_equipment, ims_interface, redis):
for s in json.loads(raw_services.decode('utf-8')):
related_services.update(
{r['id']: r for r in s['related-services']})
if s['monitored']:
if s['monitored'] and s['circuit_type'] == 'service':
contacts.update(set(s.pop('contacts', set())))
_format_service(s)
result['services'].append(s)
......
......@@ -573,6 +573,8 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
{k: v for k, v in ims_data.get_customer_service_emails(ds1)}
circuit_ids_not_to_monitor = \
list(ims_data.get_non_monitored_circuit_ids(ds1))
circuit_ids_to_monitor = \
list(ims_data.get_monitored_circuit_ids(ds1))
hierarchy = None
port_id_details = defaultdict(list)
......@@ -616,10 +618,7 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
nonlocal hierarchy
hierarchy = {}
for d in ims_data.get_circuit_hierarchy(ds1):
if d['id'] in circuit_ids_not_to_monitor:
d['monitored'] = False
else:
d['monitored'] = True
d['monitored'] = d['id'] in circuit_ids_to_monitor
d['contacts'] = customer_contacts.get(d['customerid'], [])
hierarchy[d['id']] = d
logger.debug("hierarchy complete")
......
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