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

Updated routes related to external-inventroy(opsdb) updates

parent 3017e536
No related branches found
No related tags found
No related merge requests found
......@@ -58,33 +58,36 @@ def update_interfaces():
return Response("OK")
@routes.route("update-equipment-locations", methods=['GET'])
def update_equipment_locations():
@routes.route("update-service-hierarchy", methods=['GET'])
def update_service_hierarchy():
config = current_app.config['INVENTORY_PROVIDER_CONFIG']
with opsdb.connection(config['ops-db']) as db:
result = opsdb.get_equipment_location_data(db)
external_inventory.update_equipment_locations(result)
result = opsdb.get_circuit_hierarchy(db)
external_inventory.update_service_hierarchy(result)
return Response("OK")
@routes.route("update-from-inventory-system", methods=['GET'])
def update_from_inventory_system():
@routes.route("update-equipment-locations", methods=['GET'])
def update_equipment_locations():
config = current_app.config['INVENTORY_PROVIDER_CONFIG']
with opsdb.connection(config['ops-db']) as db:
result = opsdb.get_circuits(db)
external_inventory.update_services_to_monitor(result)
external_inventory.update_interfaces_to_services(result)
# todo - add other updates
result = opsdb.get_equipment_location_data(db)
external_inventory.update_equipment_locations(result)
return Response("OK")
@routes.route("update-service-hierarchy", methods=['GET'])
def update_service_hierarchy():
@routes.route("update-from-inventory-system", methods=['GET'])
def update_from_inventory_system():
config = current_app.config['INVENTORY_PROVIDER_CONFIG']
with opsdb.connection(config['ops-db']) as db:
result = opsdb.get_circuit_hierarchy(db)
external_inventory.update_service_hierarchy(result)
circuits = opsdb.get_circuits(db)
hierarchy = opsdb.get_circuit_hierarchy(db)
equipment_locations = opsdb.get_equipment_location_data(db)
external_inventory.update_services_to_monitor(circuits)
external_inventory.update_interfaces_to_services(circuits)
external_inventory.update_service_hierarchy(hierarchy)
external_inventory.update_equipment_locations(equipment_locations)
return Response("OK")
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