Merge "small refactoring on graph creation and checks"
This commit is contained in:
commit
37a4340a55
@ -288,7 +288,7 @@ class BaseVitrageTempest(test.BaseTestCase):
|
|||||||
graph = nx.MultiDiGraph() if not graph else graph
|
graph = nx.MultiDiGraph() if not graph else graph
|
||||||
|
|
||||||
if 'children' in api_graph:
|
if 'children' in api_graph:
|
||||||
children = api_graph.copy()['children']
|
children = api_graph['children']
|
||||||
del api_graph['children']
|
del api_graph['children']
|
||||||
|
|
||||||
vitrage_id = api_graph[VProps.VITRAGE_ID]
|
vitrage_id = api_graph[VProps.VITRAGE_ID]
|
||||||
@ -306,13 +306,13 @@ class BaseVitrageTempest(test.BaseTestCase):
|
|||||||
graph = nx.MultiDiGraph()
|
graph = nx.MultiDiGraph()
|
||||||
|
|
||||||
nodes = api_graph['nodes']
|
nodes = api_graph['nodes']
|
||||||
for i in range(len(nodes)):
|
for i, node in enumerate(nodes):
|
||||||
graph.add_node(str(i), **nodes[i])
|
graph.add_node(str(i), **node)
|
||||||
|
|
||||||
edges = api_graph['links']
|
edges = api_graph['links']
|
||||||
for i in range(len(edges)):
|
for edge in edges:
|
||||||
graph.add_edge(str(edges[i]['source']),
|
graph.add_edge(str(edge['source']),
|
||||||
str(edges[i]['target']),
|
str(edge['target']),
|
||||||
EdgeProperties.RELATIONSHIP_TYPE)
|
EdgeProperties.RELATIONSHIP_TYPE)
|
||||||
|
|
||||||
return graph
|
return graph
|
||||||
|
Loading…
x
Reference in New Issue
Block a user