Skip to content

Commit

Permalink
do not get slice model if requested
Browse files Browse the repository at this point in the history
  • Loading branch information
kthare10 committed Aug 29, 2024
1 parent 8404f87 commit 2257909
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
22 changes: 12 additions & 10 deletions fabric_cf/orchestrator/core/orchestrator_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,20 +682,22 @@ def get_slice_graph(self, *, token: str, slice_id: str, graph_format_str: str, a

slice_obj = next(iter(slice_list))

if slice_obj.get_graph_id() is None:
raise OrchestratorException(f"Slice# {slice_obj} does not have graph id")
slice_model_str = None
if graph_format_str != "NONE":
if slice_obj.get_graph_id() is None:
raise OrchestratorException(f"Slice# {slice_obj} does not have graph id")

slice_model = FimHelper.get_graph(graph_id=slice_obj.get_graph_id())
slice_model = FimHelper.get_graph(graph_id=slice_obj.get_graph_id())

graph_format = self.__translate_graph_format(graph_format=graph_format_str)
if graph_format == GraphFormat.JSON_NODELINK:
slice_model_str = slice_model.serialize_graph()
slice_model = FimHelper.get_networkx_graph_from_string(graph_str=slice_model_str)
graph_format = self.__translate_graph_format(graph_format=graph_format_str)
if graph_format == GraphFormat.JSON_NODELINK:
slice_model_str = slice_model.serialize_graph()
slice_model = FimHelper.get_networkx_graph_from_string(graph_str=slice_model_str)

if slice_model is None:
raise OrchestratorException(f"Slice# {slice_obj} graph could not be loaded")
if slice_model is None:
raise OrchestratorException(f"Slice# {slice_obj} graph could not be loaded")

slice_model_str = slice_model.serialize_graph(format=graph_format)
slice_model_str = slice_model.serialize_graph(format=graph_format)
return ResponseBuilder.get_slice_summary(slice_list=slice_list, slice_model=slice_model_str)[0]
except Exception as e:
self.logger.error(traceback.format_exc())
Expand Down
3 changes: 2 additions & 1 deletion fabric_cf/orchestrator/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,8 @@
"enum": [
"GRAPHML",
"JSON_NODELINK",
"CYTOSCAPE"
"CYTOSCAPE",
"NONE"
]
}
}
Expand Down
2 changes: 2 additions & 0 deletions fabric_cf/orchestrator/swagger_server/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ paths:
- GRAPHML
- JSON_NODELINK
- CYTOSCAPE
- NONE
default: GRAPHML
- name: level
in: query
Expand Down Expand Up @@ -492,6 +493,7 @@ paths:
- GRAPHML
- JSON_NODELINK
- CYTOSCAPE
- NONE
default: GRAPHML
responses:
"200":
Expand Down

0 comments on commit 2257909

Please sign in to comment.