Skip to content
Snippets Groups Projects
Commit a4d7f11d authored by Nikolay Stanchev's avatar Nikolay Stanchev
Browse files

Fixes a bug with error reporting in the RTT API endpoint

parent 2e0cd78f
No related branches found
No related tags found
No related merge requests found
......@@ -194,13 +194,15 @@ class GraphAPI(object):
log.error("Unexpected error occurred while executing RTT cypher query for graph with UUID {0} - {1}".format(graph_id, e))
raise HTTPBadRequest("The Neo4j cypher query didn't return a valid result for the temporal graph with ID {0}".format(graph_id))
sf_node = graph.match(nodes=(None, endpoint_node), r_type="realisedBy").first().start_node
sf_edge = graph.match(nodes=(None, endpoint_node), r_type="realisedBy").first()
sf_node = sf_edge.start_node if sf_edge is not None else None
if sf_node is None:
msg = "No service function found associated with endpoint {0}".format(endpoint_node["name"])
log.error("Unexpected error: {0}".format(msg))
raise HTTPBadRequest(msg)
sf_package_node = graph.match(nodes=(sf_node, None), r_type="instanceOf").first().end_node
sf_package_edge = graph.match(nodes=(sf_node, None), r_type="instanceOf").first()
sf_package_node = sf_package_edge.end_node if sf_package_edge is not None else None
if sf_package_node is None:
msg = "No service function package found associated with service function {0}".format(sf_node["name"])
log.error("Unexpected error: {0}".format(msg))
......
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