diff --git a/inventory_provider/db/ims_data.py b/inventory_provider/db/ims_data.py index 455905eb2ef1ba43c62efd27f2ecbbf9caf7ce0b..838aed07bcd07a01ad91dc7a46ae94b0810591f6 100644 --- a/inventory_provider/db/ims_data.py +++ b/inventory_provider/db/ims_data.py @@ -123,7 +123,8 @@ def get_port_id_services(ds: IMS): InventoryStatus(circuit['inventorystatusid']), 'unknown'), 'circuit_type': circuit['circuit_type'], 'service_type': products[circuit['productid']], - 'project': customers[circuit['customerid']] + 'project': customers[circuit['customerid']], + 'customerid': circuit['customerid'] } ports = [] if circuit['internalports']: @@ -168,6 +169,7 @@ def get_port_id_services(ds: IMS): 'circuit_type': _get_circuit_type(circuit), 'service_type': products[circuit['productid']], 'project': customers[circuit['customerid']], + 'customerid': circuit['customerid'], 'port_a_id': portrelate.get( 'portid', portrelate.get('internalportid', '')) diff --git a/inventory_provider/tasks/worker.py b/inventory_provider/tasks/worker.py index e0d00fff4d81f3f2d9aecef360c6e10f53c59d8d..00d2e8174b98927afcce1c11fa7d3ab89deb09a9 100644 --- a/inventory_provider/tasks/worker.py +++ b/inventory_provider/tasks/worker.py @@ -634,6 +634,13 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): circuits = port_id_services.get(details['port_id'], []) for circ in circuits: + contacts = set() + contacts.update( + customer_contacts.get( + circ['customerid'], + [] + ) + ) circ['fibre-routes'] = \ [{ 'id': hierarchy[x]['id'], @@ -643,7 +650,6 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): circ['top-level-services'] = \ get_top_level_services(circ['id']) - contacts = set() for tlc in circ['top-level-services']: contacts.update(tlc.pop('contacts')) circ['contacts'] = sorted(list(contacts))