From 0e3de32fd53c2643fd903a717f4558e28e890a1c Mon Sep 17 00:00:00 2001 From: Eyal Date: Tue, 22 Mar 2016 16:46:37 +0200 Subject: [PATCH] fix misc intellij inspection warnings docstring, pep8 also disable some intellij warnings Change-Id: I11fc0e681cd6e3afb89cd034ed9236f0aeb37cdb --- doc/source/conf.py | 4 ++-- doc/source/vitrage-template-format.rst | 14 +++++------ vitrage/entity_graph/processor/processor.py | 1 + .../entity_graph/states/alarm_normalizator.py | 2 +- .../states/resource_normalizator.py | 2 +- vitrage/entity_graph/states/state_manager.py | 4 ++-- vitrage/evaluator/actions/action_executor.py | 1 + vitrage/evaluator/scenario_evaluator.py | 1 + .../evaluator/template_content_validator.py | 2 +- .../graph/algo_driver/sub_graph_matching.py | 2 +- vitrage/graph/driver/__init__.py | 1 + vitrage/graph/driver/graph.py | 5 ++-- vitrage/graph/driver/networkx_graph.py | 2 ++ vitrage/graph/filter.py | 2 +- vitrage/graph/utils.py | 1 + .../notifier/plugins/aodh/aodh_notifier.py | 2 ++ .../synchronizer/plugins/aodh/transformer.py | 1 + .../consistency/test_consistency.py | 1 + .../entity_graph/processor/test_processor.py | 1 + .../entity_graph/states/test_state_manager.py | 1 + vitrage/tests/mocks/entity_model.py | 1 - vitrage/tests/mocks/mock_syncronizer.py | 8 +------ vitrage/tests/mocks/mock_transformer.py | 10 +++----- vitrage/tests/mocks/trace_generator.py | 3 +++ vitrage/tests/mocks/utils.py | 1 - .../tests/unit/entity_graph/processor/base.py | 1 + .../entity_graph/processor/test_processor.py | 1 + .../entity_graph/states/test_state_manager.py | 1 + vitrage/tests/unit/evaluator/test_template.py | 2 +- vitrage/tests/unit/graph/test_graph.py | 1 + vitrage/tests/unit/graph/test_graph_algo.py | 24 +++++++++---------- .../nagios/test_nagios_alarm_transformer.py | 1 + .../nova/test_nova_host_transformer.py | 1 + .../nova/test_nova_instance_transformers.py | 1 + .../nova/test_nova_zone_transformer.py | 1 + .../test_static_physical_synchronizer.py | 8 +++---- .../test_static_physical_transformer.py | 1 + .../tests/api/topology/topology.py | 10 ++++---- vitrage_tempest_tests/tests/base_mock.py | 6 ++--- 39 files changed, 72 insertions(+), 60 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 69f458963..4ebfa14e4 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -22,7 +22,7 @@ sys.path.insert(0, os.path.abspath('../..')) # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', - #'sphinx.ext.intersphinx', + # 'sphinx.ext.intersphinx', 'oslosphinx' ] @@ -72,4 +72,4 @@ latex_documents = [ ] # Example configuration for intersphinx: refer to the Python standard library. -#intersphinx_mapping = {'http://docs.python.org/': None} +# intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/source/vitrage-template-format.rst b/doc/source/vitrage-template-format.rst index 1d60dc8ac..e93b86e2a 100644 --- a/doc/source/vitrage-template-format.rst +++ b/doc/source/vitrage-template-format.rst @@ -14,14 +14,14 @@ The template is written in YAML language, with the following structure. metadata: ... definitions: - entities: - - entity: ... - - entity: ... - relationships: - - relationship: ... - - relationship: ... + entities: + - entity: ... + - entity: ... + relationships: + - relationship: ... + - relationship: ... scenarios: - scenario: + scenario: condition: actions: - action: ... diff --git a/vitrage/entity_graph/processor/processor.py b/vitrage/entity_graph/processor/processor.py index d2e6b8507..6aef69956 100644 --- a/vitrage/entity_graph/processor/processor.py +++ b/vitrage/entity_graph/processor/processor.py @@ -29,6 +29,7 @@ LOG = log.getLogger(__name__) class Processor(processor.ProcessorBase): def __init__(self, conf, initialization_status, e_graph=None): + super(Processor, self).__init__() self.conf = conf self.transformer_manager = TransformerManager(self.conf) self.state_manager = StateManager(self.conf) diff --git a/vitrage/entity_graph/states/alarm_normalizator.py b/vitrage/entity_graph/states/alarm_normalizator.py index 4327c4ba8..a060c035b 100644 --- a/vitrage/entity_graph/states/alarm_normalizator.py +++ b/vitrage/entity_graph/states/alarm_normalizator.py @@ -22,7 +22,7 @@ from vitrage.entity_graph.states.normalized_alarm_severity \ class AlarmNormalizator(NormalizatorBase): def __init__(self): - pass + super(AlarmNormalizator, self).__init__() def important_states(self): return ImportantStates(NormalizedAlarmSeverity.UNKNOWN, diff --git a/vitrage/entity_graph/states/resource_normalizator.py b/vitrage/entity_graph/states/resource_normalizator.py index 31bfcf43d..8cd85f108 100644 --- a/vitrage/entity_graph/states/resource_normalizator.py +++ b/vitrage/entity_graph/states/resource_normalizator.py @@ -22,7 +22,7 @@ from vitrage.entity_graph.states.normalized_resource_state \ class ResourceNormalizator(NormalizatorBase): def __init__(self): - pass + super(ResourceNormalizator, self).__init__() def important_states(self): return ImportantStates(NormalizedResourceState.UNRECOGNIZED, diff --git a/vitrage/entity_graph/states/state_manager.py b/vitrage/entity_graph/states/state_manager.py index 506a6c7ea..f5b6ab543 100644 --- a/vitrage/entity_graph/states/state_manager.py +++ b/vitrage/entity_graph/states/state_manager.py @@ -204,8 +204,8 @@ class StateManager(object): @staticmethod def _get_all_local_variables_of_class(class_instance): - return [attr for attr in dir(class_instance) if not callable(attr) - and not attr.startswith("__")] + return [attr for attr in dir(class_instance) if not callable(attr) and + not attr.startswith("__")] def _is_all_plugins_states_exists(self, states_plugins, error_plugins): plugins = self.conf.synchronizer_plugins.plugin_type diff --git a/vitrage/evaluator/actions/action_executor.py b/vitrage/evaluator/actions/action_executor.py index 582b614c6..a0738a36d 100644 --- a/vitrage/evaluator/actions/action_executor.py +++ b/vitrage/evaluator/actions/action_executor.py @@ -123,6 +123,7 @@ class ActionExecutor(object): @staticmethod def _register_action_recipes(): + # noinspection PyDictCreation recipes = {} recipes[ActionType.SET_STATE] = importutils.import_object( diff --git a/vitrage/evaluator/scenario_evaluator.py b/vitrage/evaluator/scenario_evaluator.py index 24f483720..018c1e2ec 100644 --- a/vitrage/evaluator/scenario_evaluator.py +++ b/vitrage/evaluator/scenario_evaluator.py @@ -53,6 +53,7 @@ class ScenarioEvaluator(object): def process_event(self, before, current, is_vertex): """Notification of a change in the entity graph. + :param is_vertex: :param before: The graph element (vertex or edge) prior to the change that happened. None if the element was just created. :param current: The graph element (vertex or edge) after the diff --git a/vitrage/evaluator/template_content_validator.py b/vitrage/evaluator/template_content_validator.py index 4201dcbb3..36eed31e8 100644 --- a/vitrage/evaluator/template_content_validator.py +++ b/vitrage/evaluator/template_content_validator.py @@ -22,7 +22,7 @@ def syntax_validate(template_conf): pass -def validate_scenario_condition(condition_str): +def validate_scenario_condition(condition): """Validate the condition content. Check: diff --git a/vitrage/graph/algo_driver/sub_graph_matching.py b/vitrage/graph/algo_driver/sub_graph_matching.py index d06de2af1..308c381c2 100644 --- a/vitrage/graph/algo_driver/sub_graph_matching.py +++ b/vitrage/graph/algo_driver/sub_graph_matching.py @@ -134,7 +134,7 @@ def _get_edges_to_mapped_vertices(graph, vertex_id): """Get all edges (to/from) vertex where neighbor has a MAPPED_V_ID :type graph: driver.Graph - :type vertex: driver.Vertex + :type vertex_id: driver.Vertex :rtype: set of driver.Edge """ subgraph_edges_to_mapped_vertices = [] diff --git a/vitrage/graph/driver/__init__.py b/vitrage/graph/driver/__init__.py index 395ac8843..0b59534b2 100644 --- a/vitrage/graph/driver/__init__.py +++ b/vitrage/graph/driver/__init__.py @@ -22,6 +22,7 @@ def create_graph(name, root_id=None): For now only return NXGraph + :param root_id: :type name: str :rtype: Graph """ diff --git a/vitrage/graph/driver/graph.py b/vitrage/graph/driver/graph.py index 68fff9af9..daa9551d3 100644 --- a/vitrage/graph/driver/graph.py +++ b/vitrage/graph/driver/graph.py @@ -149,13 +149,13 @@ class Graph(object): Fetch an edge from the graph, according to its two vertices and label :param source_id: vertex id of the source vertex - :type source_id: str + :type source_id: str or None :param target_id: vertex id of the target vertex :type target_id: str :param label: the label property of the edge - :type label: str + :type label: str or None :return: The edge between the two vertices or None :rtype: Edge @@ -310,6 +310,7 @@ class Graph(object): vertex_attr_filter={'prop_key':['YES', 'CAT']}, edge_attr_filter={'LABEL':['ON', 'WITH']}) + :param direction: :param v_id: vertex id :type v_id: str :param vertex_attr_filter: expected keys and values diff --git a/vitrage/graph/driver/networkx_graph.py b/vitrage/graph/driver/networkx_graph.py index d6b6c9dd7..af8a7e63e 100644 --- a/vitrage/graph/driver/networkx_graph.py +++ b/vitrage/graph/driver/networkx_graph.py @@ -147,6 +147,7 @@ class NXGraph(Graph): def update_vertex(self, v, hard_update=False): """Update the vertex properties + :param hard_update: :type v: Vertex """ orig_prop = self._g.node.get(v.vertex_id, None) @@ -160,6 +161,7 @@ class NXGraph(Graph): def update_edge(self, e, hard_update=False): """Update the edge properties + :param hard_update: :type e: Edge """ orig_prop = self._g.edge.get( diff --git a/vitrage/graph/filter.py b/vitrage/graph/filter.py index aaefaaf5d..8713f00b8 100644 --- a/vitrage/graph/filter.py +++ b/vitrage/graph/filter.py @@ -20,7 +20,7 @@ def check_filter(data, attr_filter, *args): :param attr_filter: a dictionary of either field_name : value (mandatory) field_name : list of values - data[field_name] must match ANY of the values - :param ignore_keys: list of filter keys to ignore (if exist) + :param args: list of filter keys to ignore (if exist) :rtype: bool """ if not attr_filter: diff --git a/vitrage/graph/utils.py b/vitrage/graph/utils.py index 24d7e1d36..e8d818904 100644 --- a/vitrage/graph/utils.py +++ b/vitrage/graph/utils.py @@ -81,6 +81,7 @@ def create_edge(source_id, metadata=None): """A builder to create an edge + :param update_timestamp: :param source_id: :type source_id: str :param target_id: diff --git a/vitrage/notifier/plugins/aodh/aodh_notifier.py b/vitrage/notifier/plugins/aodh/aodh_notifier.py index 557282822..2c386a883 100644 --- a/vitrage/notifier/plugins/aodh/aodh_notifier.py +++ b/vitrage/notifier/plugins/aodh/aodh_notifier.py @@ -45,6 +45,7 @@ class AodhNotifier(NotifierBase): elif event_type == NotifierEventTypes.ACTIVATE_DEDUCED_ALARM_EVENT: self._activate_aodh_alarm(data) + # noinspection PyMethodMayBeStatic def _activate_aodh_alarm(self, data): LOG.info('### Activate aodh alarm') # alarm_name = aodh_alarm_name_generator( @@ -84,6 +85,7 @@ class AodhNotifier(NotifierBase): # user_id # time_constraints + # noinspection PyMethodMayBeStatic def _deactivate_aodh_alarm(self, data): LOG.info('### Deactivate aodh alarm') # try: diff --git a/vitrage/synchronizer/plugins/aodh/transformer.py b/vitrage/synchronizer/plugins/aodh/transformer.py index 2b4968df7..29736fafb 100644 --- a/vitrage/synchronizer/plugins/aodh/transformer.py +++ b/vitrage/synchronizer/plugins/aodh/transformer.py @@ -69,6 +69,7 @@ class AodhTransformer(BaseAlarmTransformer): update_timestamp=update_timestamp, metadata=metadata) + # noinspection PyMethodMayBeStatic def _create_neighbors(self, entity_event): # TODO(iafek): get neighbour resource by its id return [] diff --git a/vitrage/tests/functional/entity_graph/consistency/test_consistency.py b/vitrage/tests/functional/entity_graph/consistency/test_consistency.py index 2be6d54d8..08db0cefd 100644 --- a/vitrage/tests/functional/entity_graph/consistency/test_consistency.py +++ b/vitrage/tests/functional/entity_graph/consistency/test_consistency.py @@ -64,6 +64,7 @@ class TestConsistencyFunctional(TestEntityGraphFunctionalBase): ), ] + # noinspection PyAttributeOutsideInit def setUp(self): super(TestConsistencyFunctional, self).setUp() self.initialization_status = InitializationStatus() diff --git a/vitrage/tests/functional/entity_graph/processor/test_processor.py b/vitrage/tests/functional/entity_graph/processor/test_processor.py index 57f2af418..ba9df1d11 100644 --- a/vitrage/tests/functional/entity_graph/processor/test_processor.py +++ b/vitrage/tests/functional/entity_graph/processor/test_processor.py @@ -28,6 +28,7 @@ class TestProcessorFunctional(TestEntityGraphFunctionalBase): NUM_VERTICES_AFTER_DELETION = 1 NUM_EDGES_AFTER_DELETION = 0 + # noinspection PyAttributeOutsideInit def setUp(self): super(TestProcessorFunctional, self).setUp() self.conf = cfg.ConfigOpts() diff --git a/vitrage/tests/functional/entity_graph/states/test_state_manager.py b/vitrage/tests/functional/entity_graph/states/test_state_manager.py index 8b4f273b3..5cba712ac 100644 --- a/vitrage/tests/functional/entity_graph/states/test_state_manager.py +++ b/vitrage/tests/functional/entity_graph/states/test_state_manager.py @@ -29,6 +29,7 @@ from vitrage.tests.functional.entity_graph.base import \ class TestStateManagerFunctional(TestEntityGraphFunctionalBase): + # noinspection PyAttributeOutsideInit def setUp(self): super(TestStateManagerFunctional, self).setUp() self.conf = cfg.ConfigOpts() diff --git a/vitrage/tests/mocks/entity_model.py b/vitrage/tests/mocks/entity_model.py index 6ef3ee77d..fdd50c3e0 100644 --- a/vitrage/tests/mocks/entity_model.py +++ b/vitrage/tests/mocks/entity_model.py @@ -12,7 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -__author__ = 'erosensw' from vitrage.tests.mocks.utils import generate_vals from vitrage.tests.mocks.utils import merge_vals diff --git a/vitrage/tests/mocks/mock_syncronizer.py b/vitrage/tests/mocks/mock_syncronizer.py index f7c2e8c53..1c782ebab 100644 --- a/vitrage/tests/mocks/mock_syncronizer.py +++ b/vitrage/tests/mocks/mock_syncronizer.py @@ -47,9 +47,6 @@ def generate_random_events_list(generator_spec_list): :param generator_spec_list: list of generators :type generator_spec_list: list - :param default_num: default number of events to generate - :type default_num: list - :return list of synchronizer events :rtype list @@ -72,9 +69,6 @@ def generate_sequential_events_list(generator_spec_list): :param generator_spec_list: list of generators :type generator_spec_list: list - :param default_num: default number of events to generate - :type default_num: list - :return list of synchronizer events :rtype list @@ -239,7 +233,7 @@ def simple_nagios_alarm_generators(host_num, Returns generators for a given number of Nagios alarms. :param host_num: number of hosts - :param snapshot_events: number of snapshot alarms per hosts + :param events_num: number of snapshot alarms per hosts :param snap_vals: preset vals for ALL snapshot events :return: generators for zone_num zones as specified """ diff --git a/vitrage/tests/mocks/mock_transformer.py b/vitrage/tests/mocks/mock_transformer.py index 8236aa6bb..938b2b061 100644 --- a/vitrage/tests/mocks/mock_transformer.py +++ b/vitrage/tests/mocks/mock_transformer.py @@ -29,9 +29,6 @@ def generate_random_events_list(generator_spec_list): :param generator_spec_list: list of generators :type generator_spec_list: list - :param default_num: default number of events to generate - :type default_num: list - :return list of synchronizer events :rtype list @@ -55,7 +52,7 @@ def simple_instance_generators(host_num, vm_num, snapshot_events=0, :param host_num: number of hosts :param vm_num: number of vms :param snapshot_events: number of snapshot events per instance - :param update_events: number of update events per instance + :param snap_vals: number of update events per instance :return: generators for vm_num vms as specified """ @@ -86,7 +83,7 @@ def simple_host_generators(zone_num, host_num, snapshot_events=0, :param zone_num: number of hosts :param host_num: number of vms :param snapshot_events: number of snapshot events per instance - :param update_events: number of update events per instance + :param snap_vals: number of update events per instance :return: generators for vm_num vms as specified """ @@ -114,9 +111,8 @@ def simple_zone_generators(zone_num, snapshot_events=0, snap_vals=None): instances. Instances will be distributed across hosts in round-robin style. :param zone_num: number of hosts - :param host_num: number of vms :param snapshot_events: number of snapshot events per instance - :param update_events: number of update events per instance + :param snap_vals: number of update events per instance :return: generators for vm_num vms as specified """ diff --git a/vitrage/tests/mocks/trace_generator.py b/vitrage/tests/mocks/trace_generator.py index 070f0e9c5..1da893497 100644 --- a/vitrage/tests/mocks/trace_generator.py +++ b/vitrage/tests/mocks/trace_generator.py @@ -125,6 +125,7 @@ class EventTraceGenerator(object): def generate_data_stream(models, event_num=100): """Generates a list of events. + :param models: :param event_num: number of events to generate :type event_num: int :return: list of generated events @@ -142,6 +143,7 @@ def generate_data_stream(models, event_num=100): def generate_round_robin_data_stream(models, event_num=100): """Generates a list of events. + :param models: :param event_num: number of events to generate :type event_num: int :return: list of generated events @@ -417,6 +419,7 @@ def combine_data(static_info_re, mapping_info, external_info): def get_trace_generators(entity_spec_list, default_events=100): """Returns a collection of event generators. + :param default_events: :param entity_spec_list: list of generator specs. :type entity_spec_list: list :return: list of generators diff --git a/vitrage/tests/mocks/utils.py b/vitrage/tests/mocks/utils.py index 44acf4553..1c22b4378 100644 --- a/vitrage/tests/mocks/utils.py +++ b/vitrage/tests/mocks/utils.py @@ -12,7 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -__author__ = 'erosensw' import json from os.path import dirname diff --git a/vitrage/tests/unit/entity_graph/processor/base.py b/vitrage/tests/unit/entity_graph/processor/base.py index 297a7f8bc..7424e2f5c 100644 --- a/vitrage/tests/unit/entity_graph/processor/base.py +++ b/vitrage/tests/unit/entity_graph/processor/base.py @@ -22,6 +22,7 @@ from vitrage.tests.unit.entity_graph.base import TestEntityGraphUnitBase class TestBaseProcessor(TestEntityGraphUnitBase): + # noinspection PyAttributeOutsideInit def setUp(self): super(TestBaseProcessor, self).setUp() self.conf = cfg.ConfigOpts() diff --git a/vitrage/tests/unit/entity_graph/processor/test_processor.py b/vitrage/tests/unit/entity_graph/processor/test_processor.py index 1c9fb5559..427e59fd7 100644 --- a/vitrage/tests/unit/entity_graph/processor/test_processor.py +++ b/vitrage/tests/unit/entity_graph/processor/test_processor.py @@ -40,6 +40,7 @@ class TestProcessor(TestEntityGraphUnitBase): NUM_VERTICES_AFTER_DELETION = 1 NUM_EDGES_AFTER_DELETION = 0 + # noinspection PyAttributeOutsideInit def setUp(self): super(TestProcessor, self).setUp() self.conf = cfg.ConfigOpts() diff --git a/vitrage/tests/unit/entity_graph/states/test_state_manager.py b/vitrage/tests/unit/entity_graph/states/test_state_manager.py index 433971121..bcd3c2182 100644 --- a/vitrage/tests/unit/entity_graph/states/test_state_manager.py +++ b/vitrage/tests/unit/entity_graph/states/test_state_manager.py @@ -51,6 +51,7 @@ class TestStateManager(base.BaseTest): for plugin_name in conf.synchronizer_plugins.plugin_type: load_plugin(conf, plugin_name) + # noinspection PyAttributeOutsideInit def setUp(self): super(TestStateManager, self).setUp() self.conf = cfg.ConfigOpts() diff --git a/vitrage/tests/unit/evaluator/test_template.py b/vitrage/tests/unit/evaluator/test_template.py index 2f7b91970..485c4e669 100644 --- a/vitrage/tests/unit/evaluator/test_template.py +++ b/vitrage/tests/unit/evaluator/test_template.py @@ -109,7 +109,7 @@ class BasicTemplateTest(base.BaseTest): 1. condition consists from one variable (type EdgeDescription) 2. Actions - set state action :param scenarios: parsed scenarios - :param scenarios_definition: + :param entities """ self.assertIsNotNone(scenarios) self.assertEqual(len(scenarios), 1) diff --git a/vitrage/tests/unit/graph/test_graph.py b/vitrage/tests/unit/graph/test_graph.py index ba9a2f968..7cb4eec6f 100644 --- a/vitrage/tests/unit/graph/test_graph.py +++ b/vitrage/tests/unit/graph/test_graph.py @@ -403,6 +403,7 @@ class GraphTest(GraphTestBase): else: self.assertIsNone(act, msg) + # noinspection PyAttributeOutsideInit def test_graph_callbacks(self): g = create_graph('test_graph_callbacks') diff --git a/vitrage/tests/unit/graph/test_graph_algo.py b/vitrage/tests/unit/graph/test_graph_algo.py index b6faace11..16abb49ce 100644 --- a/vitrage/tests/unit/graph/test_graph_algo.py +++ b/vitrage/tests/unit/graph/test_graph_algo.py @@ -291,8 +291,8 @@ class GraphAlgorithmTest(GraphTestBase): mappings = ga.sub_graph_matching(t, [ Mapping(t_v_host, host_vertex, is_vertex=True)]) self.assertEqual( - ENTITY_GRAPH_VMS_PER_HOST * ENTITY_GRAPH_ALARMS_PER_VM - * ENTITY_GRAPH_ALARMS_PER_HOST, + ENTITY_GRAPH_VMS_PER_HOST * ENTITY_GRAPH_ALARMS_PER_VM * + ENTITY_GRAPH_ALARMS_PER_HOST, len(mappings), 'Template - Four connected vertices' '(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm)' @@ -316,19 +316,19 @@ class GraphAlgorithmTest(GraphTestBase): len(mappings), 'Template - Five connected vertices' '(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm' - ',host -USES-> switch) template_root is a specific instance alarm ' - + str(mappings)) + ',host -USES-> switch) template_root ' + 'is a specific instance alarm ' + str(mappings)) mappings = ga.sub_graph_matching(t, [ Mapping(t_v_host, host_vertex, is_vertex=True)]) self.assertEqual( - ENTITY_GRAPH_VMS_PER_HOST * ENTITY_GRAPH_ALARMS_PER_VM - * ENTITY_GRAPH_ALARMS_PER_HOST, + ENTITY_GRAPH_VMS_PER_HOST * ENTITY_GRAPH_ALARMS_PER_VM * + ENTITY_GRAPH_ALARMS_PER_HOST, len(mappings), 'Template - Five connected vertices' '(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm' - ',host -USES-> switch) template_root is a specific host ' - + str(mappings)) + ',host -USES-> switch) template_root is a specific host ' + + str(mappings)) mappings = ga.sub_graph_matching(t, [ Mapping(t_v_switch, v_switch, is_vertex=True), @@ -338,8 +338,8 @@ class GraphAlgorithmTest(GraphTestBase): len(mappings), 'Template - Five connected vertices, two mappings given' '(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm' - ',host -USES-> switch) template_root is a specific host ' - + str(mappings)) + ',host -USES-> switch) template_root is a specific host ' + + str(mappings)) t.add_vertex(t_v_node_not_in_graph) t.add_edge(e_host_to_node_not_in_graph) @@ -350,8 +350,8 @@ class GraphAlgorithmTest(GraphTestBase): len(mappings), 'Template - Five connected vertices and a invalid edge' '(host alarm -ON-> host -CONTAINS-> instance <-ON- instance alarm' - ',host -USES-> switch) template_root is a instance alarm ' - + str(mappings)) + ',host -USES-> switch) template_root is a instance alarm ' + + str(mappings)) t.remove_vertex(t_v_node_not_in_graph) t.remove_vertex(t_v_host_alarm) diff --git a/vitrage/tests/unit/synchronizer/plugins/nagios/test_nagios_alarm_transformer.py b/vitrage/tests/unit/synchronizer/plugins/nagios/test_nagios_alarm_transformer.py index 126637a20..8697b1517 100644 --- a/vitrage/tests/unit/synchronizer/plugins/nagios/test_nagios_alarm_transformer.py +++ b/vitrage/tests/unit/synchronizer/plugins/nagios/test_nagios_alarm_transformer.py @@ -35,6 +35,7 @@ NOVA_HOST = 'nova.host' class NagiosTransformerTest(base.BaseTest): + # noinspection PyAttributeOutsideInit def setUp(self): super(NagiosTransformerTest, self).setUp() diff --git a/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_host_transformer.py b/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_host_transformer.py index aeea93645..f97929125 100644 --- a/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_host_transformer.py +++ b/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_host_transformer.py @@ -35,6 +35,7 @@ NOVA_ZONE = 'nova.zone' class NovaHostTransformerTest(base.BaseTest): + # noinspection PyAttributeOutsideInit def setUp(self): super(NovaHostTransformerTest, self).setUp() diff --git a/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_instance_transformers.py b/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_instance_transformers.py index 0bfd8020f..6f038ddb0 100644 --- a/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_instance_transformers.py +++ b/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_instance_transformers.py @@ -36,6 +36,7 @@ NOVA_HOST = 'nova.host' class NovaInstanceTransformerTest(base.BaseTest): + # noinspection PyAttributeOutsideInit def setUp(self): super(NovaInstanceTransformerTest, self).setUp() diff --git a/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_zone_transformer.py b/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_zone_transformer.py index f9ea6bb60..232fe496f 100644 --- a/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_zone_transformer.py +++ b/vitrage/tests/unit/synchronizer/plugins/nova/test_nova_zone_transformer.py @@ -34,6 +34,7 @@ NOVA_HOST = 'nova.host' class NovaZoneTransformerTest(base.BaseTest): + # noinspection PyAttributeOutsideInit def setUp(self): super(NovaZoneTransformerTest, self).setUp() diff --git a/vitrage/tests/unit/synchronizer/plugins/static_physical/test_static_physical_synchronizer.py b/vitrage/tests/unit/synchronizer/plugins/static_physical/test_static_physical_synchronizer.py index 62f7e652c..35a2461d5 100644 --- a/vitrage/tests/unit/synchronizer/plugins/static_physical/test_static_physical_synchronizer.py +++ b/vitrage/tests/unit/synchronizer/plugins/static_physical/test_static_physical_synchronizer.py @@ -69,6 +69,7 @@ class TestStaticPhysicalSynchronizer(base.BaseTest): '/static_plugins/changes_plugins'), ] + # noinspection PyAttributeOutsideInit def setUp(self): super(TestStaticPhysicalSynchronizer, self).setUp() self.conf = cfg.ConfigOpts() @@ -102,10 +103,9 @@ class TestStaticPhysicalSynchronizer(base.BaseTest): entities = self.static_physical_synchronizer.get_all(SyncMode.UPDATE) self.assertEqual(5, len(entities)) - self.conf = cfg.ConfigOpts() - self.conf.register_opts(self.CHANGES_OPTS, - group=STATIC_PHYSICAL) - self.static_physical_synchronizer.cfg = self.conf + conf = cfg.ConfigOpts() + conf.register_opts(self.CHANGES_OPTS, group=STATIC_PHYSICAL) + self.static_physical_synchronizer.cfg = conf # Action changes = self.static_physical_synchronizer.get_changes( diff --git a/vitrage/tests/unit/synchronizer/plugins/static_physical/test_static_physical_transformer.py b/vitrage/tests/unit/synchronizer/plugins/static_physical/test_static_physical_transformer.py index 8c108ec4e..c00498ae5 100644 --- a/vitrage/tests/unit/synchronizer/plugins/static_physical/test_static_physical_transformer.py +++ b/vitrage/tests/unit/synchronizer/plugins/static_physical/test_static_physical_transformer.py @@ -34,6 +34,7 @@ STATIC_PHYSICAL = 'static_physical' class TestStaticPhysicalTransformer(base.BaseTest): + # noinspection PyAttributeOutsideInit def setUp(self): super(TestStaticPhysicalTransformer, self).setUp() diff --git a/vitrage_tempest_tests/tests/api/topology/topology.py b/vitrage_tempest_tests/tests/api/topology/topology.py index 15d962392..fb5e1d3c9 100644 --- a/vitrage_tempest_tests/tests/api/topology/topology.py +++ b/vitrage_tempest_tests/tests/api/topology/topology.py @@ -40,23 +40,21 @@ class BaseTopologyTest(BaseVitrageTest): def test_get_tree(self): """Wrapper that returns a test tree.""" - self.graph_type = 'tree' - self.graph = self._get_topology() + self._get_topology('tree') def test_get_graph(self): """Wrapper that returns a test graph.""" - self.graph_type = 'graph' - self.graph = self._get_topology() + self._get_topology('graph') if self._validate_graph_correctness() is False: LOG.error('The graph ' + self.name + ' is not correct') else: LOG.info('The graph ' + self.name + ' is correct') - def _get_topology(self): + def _get_topology(self, graph_type): """Get Graph objects returned by the v1 client """ try: - g = TopologyController().get_graph(graph_type=self.graph_type, + g = TopologyController().get_graph(graph_type=graph_type, depth=self.depth, query=self.query, root=self.root) diff --git a/vitrage_tempest_tests/tests/base_mock.py b/vitrage_tempest_tests/tests/base_mock.py index 1dcd16f59..c5624c73e 100644 --- a/vitrage_tempest_tests/tests/base_mock.py +++ b/vitrage_tempest_tests/tests/base_mock.py @@ -31,10 +31,10 @@ class BaseMock(testtools.TestCase): ] def create_processor_with_graph(self): - self.conf = cfg.ConfigOpts() - self.conf.register_opts(self.PROCESSOR_OPTS, group='entity_graph') + conf = cfg.ConfigOpts() + conf.register_opts(self.PROCESSOR_OPTS, group='entity_graph') events = self._create_mock_events() - processor = proc.Processor(self.conf, InitializationStatus()) + processor = proc.Processor(conf, InitializationStatus()) for event in events: processor.process_event(event)