# Path: vitrageclient/common/formatters.py
# class DOTFormatter(GraphFormatter):
# 
#     def _write_format(self, graph, stdout):
#         write_dot(graph, stdout)
# 
# Path: vitrageclient/common/formatters.py
# class GraphMLFormatter(GraphFormatter):
# 
#     def _write_format(self, graph, stdout):
#         writer = GraphMLWriter(graph=graph)
#         writer.dump(stdout)
# 
# Path: vitrageclient/tests/cli/base.py
# class CliTestCase(base.BaseTestCase):
# 
#     """Test case base class for all unit tests."""
# 
#     # original error method of argparse uses exit
#     # I just want to raise an exception and get the error message
#     # that exit outputs
#     @staticmethod
#     def _my_parser_error_func(message):
#         raise argparse.ArgumentTypeError(message)
# 
# Path: vitrageclient/v1/cli/topology.py
# class TopologyShow(show.ShowOne):
#     """Show the topology of the system"""
# 
#     @staticmethod
#     def positive_non_zero_int(argument_value):
#         if argument_value is None:
#             return None
#         try:
#             value = int(argument_value)
#         except ValueError:
#             msg = "%s must be an integer" % argument_value
#             raise argparse.ArgumentTypeError(msg)
#         if value <= 0:
#             msg = "%s must be greater than 0" % argument_value
#             raise argparse.ArgumentTypeError(msg)
#         return value
# 
#     def get_parser(self, prog_name):
#         parser = super(TopologyShow, self).get_parser(prog_name)
#         parser.add_argument('--filter',
#                             metavar='<query>',
#                             help='query for the graph)')
# 
#         parser.add_argument('--limit',
#                             type=self.positive_non_zero_int,
#                             metavar='<depth>',
#                             help='the depth of the topology graph')
# 
#         parser.add_argument('--root',
#                             help='the root of the topology graph')
# 
#         parser.add_argument('--graph-type',
#                             choices=['tree', 'graph'],
#                             default='graph',
#                             dest='type',
#                             help='graph type. '
#                                  'Valid graph types: [tree, graph]')
# 
#         parser.add_argument('--all-tenants',
#                             default=False,
#                             dest='all_tenants',
#                             action='store_true',
#                             help='Shows entities of all the tenants in the '
#                                  'entity graph')
# 
#         return parser
# 
#     @property
#     def formatter_namespace(self):
#         return 'vitrageclient.formatter.show'
# 
#     @property
#     def formatter_default(self):
#         return 'json'
# 
#     def take_action(self, parsed_args):
#         limit = parsed_args.limit
#         graph_type = parsed_args.type
#         query = parsed_args.filter
#         root = parsed_args.root
#         all_tenants = parsed_args.all_tenants
# 
#         if graph_type == 'graph' and limit is not None and root is None:
#             raise exc.CommandError("Graph-type 'graph' "
#                                    "requires a 'root' with 'limit'.")
# 
#         topology = utils.get_client(self).topology.get(limit=limit,
#                                                        graph_type=graph_type,
#                                                        query=query,
#                                                        root=root,
#                                                        all_tenants=all_tenants)
#         return self.dict2columns(topology)


from argparse import ArgumentParser
from argparse import ArgumentTypeError
from unittest import mock
from testtools import ExpectedException
from vitrageclient.common.formatters import DOTFormatter
from vitrageclient.common.formatters import GraphMLFormatter
from vitrageclient.tests.cli.base import CliTestCase
from vitrageclient.v1.cli.topology import TopologyShow
import io
import json
      "project_id": "210140f1f5a94af99e0adf79a883b75a",
      "vitrage_operational_state": "OK",
      "vitrage_aggregated_state": "AVAILABLE",
      "vitrage_is_placeholder": false,
      "state": "available",
      "attachments": [],
      "graph_index": 3,
      "vitrage_id": "f0ca9fac-3ebd-4748-97ba-e93a7e7108aa",
      "size": 1,
      "vitrage_type": "cinder.volume",
      "vitrage_is_deleted": false,
      "vitrage_category": "RESOURCE",
      "vitrage_cached_id": "f998c5f7bf1851e17e3eea902800a7df",
      "update_timestamp": "2018-12-31T08:43:32Z",
      "is_real_vitrage_id": true,
      "volume_type": "lvmdriver-1"
    },
    {
      "id": "cebf5d5b-d7b1-4cfb-86fa-f660306b4c1a",
      "vitrage_sample_timestamp": "2018-12-31T13:44:04Z",
      "vitrage_datasource_name": "neutron.network",
      "project_id": "210140f1f5a94af99e0adf79a883b75a",
      "vitrage_operational_state": "OK",
      "vitrage_category": "RESOURCE",
      "vitrage_is_placeholder": false,
      "state": "ACTIVE",
      "update_timestamp": "2018-12-30T08:30:33Z",
      "is_real_vitrage_id": true,
      "vitrage_id": "eea46e33-81dc-4430-a771-852bac37b43d",
      "vitrage_aggregated_state": "ACTIVE",

# Path: vitrageclient/common/formatters.py
# class DOTFormatter(GraphFormatter):
# 
#     def _write_format(self, graph, stdout):
#         write_dot(graph, stdout)
# 
# Path: vitrageclient/common/formatters.py
# class GraphMLFormatter(GraphFormatter):
# 
#     def _write_format(self, graph, stdout):
#         writer = GraphMLWriter(graph=graph)
#         writer.dump(stdout)
# 
# Path: vitrageclient/tests/cli/base.py
# class CliTestCase(base.BaseTestCase):
# 
#     """Test case base class for all unit tests."""
# 
#     # original error method of argparse uses exit
#     # I just want to raise an exception and get the error message
#     # that exit outputs
#     @staticmethod
#     def _my_parser_error_func(message):
#         raise argparse.ArgumentTypeError(message)
# 
# Path: vitrageclient/v1/cli/topology.py
# class TopologyShow(show.ShowOne):
#     """Show the topology of the system"""
# 
#     @staticmethod
#     def positive_non_zero_int(argument_value):
#         if argument_value is None:
#             return None
#         try:
#             value = int(argument_value)
#         except ValueError:
#             msg = "%s must be an integer" % argument_value
#             raise argparse.ArgumentTypeError(msg)
#         if value <= 0:
#             msg = "%s must be greater than 0" % argument_value
#             raise argparse.ArgumentTypeError(msg)
#         return value
# 
#     def get_parser(self, prog_name):
#         parser = super(TopologyShow, self).get_parser(prog_name)
#         parser.add_argument('--filter',
#                             metavar='<query>',
#                             help='query for the graph)')
# 
#         parser.add_argument('--limit',
#                             type=self.positive_non_zero_int,
#                             metavar='<depth>',
#                             help='the depth of the topology graph')
# 
#         parser.add_argument('--root',
#                             help='the root of the topology graph')
# 
#         parser.add_argument('--graph-type',
#                             choices=['tree', 'graph'],
#                             default='graph',
#                             dest='type',
#                             help='graph type. '
#                                  'Valid graph types: [tree, graph]')
# 
#         parser.add_argument('--all-tenants',
#                             default=False,
#                             dest='all_tenants',
#                             action='store_true',
#                             help='Shows entities of all the tenants in the '
#                                  'entity graph')
# 
#         return parser
# 
#     @property
#     def formatter_namespace(self):
#         return 'vitrageclient.formatter.show'
# 
#     @property
#     def formatter_default(self):
#         return 'json'
# 
#     def take_action(self, parsed_args):
#         limit = parsed_args.limit
#         graph_type = parsed_args.type
#         query = parsed_args.filter
#         root = parsed_args.root
#         all_tenants = parsed_args.all_tenants
# 
#         if graph_type == 'graph' and limit is not None and root is None:
#             raise exc.CommandError("Graph-type 'graph' "
#                                    "requires a 'root' with 'limit'.")
# 
#         topology = utils.get_client(self).topology.get(limit=limit,
#                                                        graph_type=graph_type,
#                                                        query=query,
#                                                        root=root,
#                                                        all_tenants=all_tenants)
#         return self.dict2columns(topology)


# Path: vitrageclient/tests/cli/test_topology_show.py
from argparse import ArgumentParser
from argparse import ArgumentTypeError
from unittest import mock
from testtools import ExpectedException
from vitrageclient.common.formatters import DOTFormatter
from vitrageclient.common.formatters import GraphMLFormatter
from vitrageclient.tests.cli.base import CliTestCase
from vitrageclient.v1.cli.topology import TopologyShow
import io
import json

      "project_id": "210140f1f5a94af99e0adf79a883b75a",
      "vitrage_operational_state": "OK",
      "vitrage_aggregated_state": "AVAILABLE",
      "vitrage_is_placeholder": false,
      "state": "available",
      "attachments": [],
      "graph_index": 3,
      "vitrage_id": "f0ca9fac-3ebd-4748-97ba-e93a7e7108aa",
      "size": 1,
      "vitrage_type": "cinder.volume",
      "vitrage_is_deleted": false,
      "vitrage_category": "RESOURCE",
      "vitrage_cached_id": "f998c5f7bf1851e17e3eea902800a7df",
      "update_timestamp": "2018-12-31T08:43:32Z",
      "is_real_vitrage_id": true,
      "volume_type": "lvmdriver-1"
    },
    {
      "id": "cebf5d5b-d7b1-4cfb-86fa-f660306b4c1a",
      "vitrage_sample_timestamp": "2018-12-31T13:44:04Z",
      "vitrage_datasource_name": "neutron.network",
      "project_id": "210140f1f5a94af99e0adf79a883b75a",
      "vitrage_operational_state": "OK",
      "vitrage_category": "RESOURCE",
      "vitrage_is_placeholder": false,
      "state": "ACTIVE",
      "update_timestamp": "2018-12-30T08:30:33Z",
      "is_real_vitrage_id": true,
      "vitrage_id": "eea46e33-81dc-4430-a771-852bac37b43d",
      "vitrage_aggregated_state": "ACTIVE",

      "vitrage_type": "neutron.network",