support networkx 2.1

Change-Id: Id583a698bffdd7d7f77ba0da40f7b11e4735940f
This commit is contained in:
Idan Hefetz 2018-07-23 11:49:42 +00:00
parent 5646004687
commit 11d0c31fca

View File

@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
from networkx.readwrite import json_graph
import six
import sys
import traceback
@ -317,7 +319,14 @@ class BaseVitrageTempest(base.BaseTestCase):
def _print_entity_graph(self):
api_graph = TempestClients.vitrage().topology.get(all_tenants=True)
graph = self._create_graph_from_graph_dictionary(api_graph)
LOG.info('Entity Graph: \n%s', graph.json_output_graph())
node_link_data = json_graph.node_link_data(graph._g)
for index, node in enumerate(node_link_data['nodes']):
if VProps.ID in graph._g.node[node[VProps.ID]]:
node[VProps.ID] = graph._g.node[node[VProps.ID]][VProps.ID]
node[VProps.GRAPH_INDEX] = index
LOG.info('Entity Graph: \n%s', json.dumps(node_link_data))
def _handle_exception(self, exception):
traceback.print_exc()