more tempest refactoring

replace the old filter by parameters method with general_utils match.
remove unicode to str method.
remove _get_value method.

Change-Id: I6e54d7894d05ed908715f5b7a26d35b54b51beb3
This commit is contained in:
Idan Hefetz 2017-12-04 11:55:51 +00:00
parent 1e526b7c48
commit 7a897511db
13 changed files with 80 additions and 111 deletions

View File

@ -16,10 +16,10 @@ import json
from oslo_log import log as logging from oslo_log import log as logging
from vitrage.common.constants import VertexProperties as VProps
from vitrage.datasources.aodh import AODH_DATASOURCE from vitrage.datasources.aodh import AODH_DATASOURCE
from vitrage_tempest_tests.tests.api.alarms.base import BaseAlarmsTest from vitrage_tempest_tests.tests.api.alarms.base import BaseAlarmsTest
from vitrage_tempest_tests.tests.common import aodh_utils from vitrage_tempest_tests.tests.common import aodh_utils
from vitrage_tempest_tests.tests.common import general_utils as g_utils
from vitrage_tempest_tests.tests.common import nova_utils from vitrage_tempest_tests.tests.common import nova_utils
from vitrage_tempest_tests.tests.common.tempest_clients import TempestClients from vitrage_tempest_tests.tests.common.tempest_clients import TempestClients
from vitrage_tempest_tests.tests import utils from vitrage_tempest_tests.tests import utils
@ -55,7 +55,7 @@ class TestAlarms(BaseAlarmsTest):
'vitrage alarm list', self.conf) 'vitrage alarm list', self.conf)
self._compare_alarms_lists( self._compare_alarms_lists(
api_alarms, cli_alarms, AODH_DATASOURCE, api_alarms, cli_alarms, AODH_DATASOURCE,
utils.uni2str(instances[0].id)) instances[0].id)
except Exception as e: except Exception as e:
self._handle_exception(e) self._handle_exception(e)
raise raise
@ -78,12 +78,11 @@ class TestAlarms(BaseAlarmsTest):
cli_items = cli_alarms.splitlines() cli_items = cli_alarms.splitlines()
api_by_type = self._filter_list_by_pairs_parameters( api_by_type = g_utils.all_matches(
api_alarms, [VProps.VITRAGE_TYPE], [resource_type]) api_alarms, vitrage_type=resource_type)
cli_by_type = cli_alarms.count(' ' + resource_type + ' ') cli_by_type = cli_alarms.count(' ' + resource_type + ' ')
api_by_id = self._filter_list_by_pairs_parameters( api_by_id = g_utils.all_matches(api_alarms, resource_id=resource_id)
api_alarms, ['resource_id'], [resource_id])
cli_by_id = cli_alarms.count(resource_id) cli_by_id = cli_alarms.count(resource_id)
self.assertEqual(len(cli_items), len(api_alarms) + 4) self.assertEqual(len(cli_items), len(api_alarms) + 4)

View File

@ -30,10 +30,10 @@ from vitrage.evaluator.actions.evaluator_event_transformer \
import VITRAGE_DATASOURCE import VITRAGE_DATASOURCE
from vitrage_tempest_tests.tests.api.alarms.base import BaseAlarmsTest from vitrage_tempest_tests.tests.api.alarms.base import BaseAlarmsTest
from vitrage_tempest_tests.tests.common import aodh_utils from vitrage_tempest_tests.tests.common import aodh_utils
from vitrage_tempest_tests.tests.common import general_utils as g_utils
from vitrage_tempest_tests.tests.common import nova_utils from vitrage_tempest_tests.tests.common import nova_utils
from vitrage_tempest_tests.tests.common.tempest_clients import TempestClients from vitrage_tempest_tests.tests.common.tempest_clients import TempestClients
from vitrage_tempest_tests.tests.common import vitrage_utils from vitrage_tempest_tests.tests.common import vitrage_utils
from vitrage_tempest_tests.tests import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
RCA_ALARM_NAME = 'rca_test_host_alarm' RCA_ALARM_NAME = 'rca_test_host_alarm'
@ -57,9 +57,10 @@ class BaseRcaTest(BaseAlarmsTest):
list_alarms = self.vitrage_client.alarm.list(vitrage_id='all', list_alarms = self.vitrage_client.alarm.list(vitrage_id='all',
all_tenants=True) all_tenants=True)
expected_alarm = self._filter_list_by_pairs_parameters( expected_alarm = g_utils.all_matches(
list_alarms, [VProps.RESOURCE_ID, VProps.VITRAGE_TYPE], list_alarms,
[resource_id, AODH_DATASOURCE]) resource_id=resource_id,
vitrage_type=AODH_DATASOURCE)
if not expected_alarm: if not expected_alarm:
return None return None
return expected_alarm[0] return expected_alarm[0]
@ -80,14 +81,16 @@ class BaseRcaTest(BaseAlarmsTest):
self.assertNotEqual(len(rca), 0, 'The rca is empty') self.assertNotEqual(len(rca), 0, 'The rca is empty')
LOG.info("The rca alarms list is : " + str(json.dumps(rca))) LOG.info("The rca alarms list is : " + str(json.dumps(rca)))
resource_alarm = self._filter_list_by_pairs_parameters( resource_alarm = g_utils.all_matches(
rca, [VProps.VITRAGE_TYPE, VProps.NAME], rca,
[AODH_DATASOURCE, RCA_ALARM_NAME]) vitrage_type=AODH_DATASOURCE,
name=RCA_ALARM_NAME)
deduce_alarms = self._filter_list_by_pairs_parameters( deduce_alarms = g_utils.all_matches(
rca, [VProps.VITRAGE_TYPE, VProps.NAME, VProps.SEVERITY], rca,
[VITRAGE_DATASOURCE, VITRAGE_ALARM_NAME, vitrage_type=VITRAGE_DATASOURCE,
OperationalAlarmSeverity.WARNING]) name=VITRAGE_ALARM_NAME,
severity=OperationalAlarmSeverity.WARNING)
self.assertEqual(3, len(rca)) self.assertEqual(3, len(rca))
self.assertEqual(1, len(resource_alarm)) self.assertEqual(1, len(resource_alarm))
@ -101,30 +104,26 @@ class BaseRcaTest(BaseAlarmsTest):
# Find the vitrage_id of the deduced alarms using their original id. # Find the vitrage_id of the deduced alarms using their original id.
vitrage_resources = TempestClients.vitrage().resource.list( vitrage_resources = TempestClients.vitrage().resource.list(
all_tenants=False) all_tenants=False)
vitrage_instance_0_id = self._filter_list_by_pairs_parameters( vitrage_instance_0_id = g_utils.first_match(vitrage_resources,
vitrage_resources, [VProps.ID], id=instances[0].id)
[utils.uni2str(instances[0].id)])[0]
vitrage_instance_1_id = self._filter_list_by_pairs_parameters( vitrage_instance_1_id = g_utils.first_match(vitrage_resources,
vitrage_resources, [VProps.ID], id=instances[1].id)
[utils.uni2str(instances[1].id)])[0]
# Find the deduced alarms based on their properties # Find the deduced alarms based on their properties
deduce_alarms_1 = self._filter_list_by_pairs_parameters( deduce_alarms_1 = g_utils.all_matches(
alarms, alarms,
[VProps.VITRAGE_TYPE, VProps.NAME, VProps.VITRAGE_RESOURCE_TYPE, vitrage_type=VITRAGE_DATASOURCE,
VProps.VITRAGE_RESOURCE_ID], name=VITRAGE_ALARM_NAME,
[VITRAGE_DATASOURCE, VITRAGE_ALARM_NAME, vitrage_resource_type=NOVA_INSTANCE_DATASOURCE,
NOVA_INSTANCE_DATASOURCE, vitrage_resource_id=vitrage_instance_0_id[VProps.VITRAGE_ID])
vitrage_instance_0_id[VProps.VITRAGE_ID]])
deduce_alarms_2 = self._filter_list_by_pairs_parameters( deduce_alarms_2 = g_utils.all_matches(
alarms, alarms,
[VProps.VITRAGE_TYPE, VProps.NAME, VProps.VITRAGE_RESOURCE_TYPE, vitrage_type=VITRAGE_DATASOURCE,
VProps.VITRAGE_RESOURCE_ID], name=VITRAGE_ALARM_NAME,
[VITRAGE_DATASOURCE, VITRAGE_ALARM_NAME, vitrage_resource_type=NOVA_INSTANCE_DATASOURCE,
NOVA_INSTANCE_DATASOURCE, vitrage_resource_id=vitrage_instance_1_id[VProps.VITRAGE_ID])
vitrage_instance_1_id[VProps.VITRAGE_ID]])
self.assertEqual(3, len(alarms), "Expected 3 alarms - 1 on host and " self.assertEqual(3, len(alarms), "Expected 3 alarms - 1 on host and "
"2 deduced") "2 deduced")
@ -137,12 +136,10 @@ class BaseRcaTest(BaseAlarmsTest):
flag = True flag = True
for item in links: for item in links:
source_alarm_name = self._get_value( source_alarm_name = alarms[item['source']].get(VProps.NAME)
alarms[item['source']], VProps.NAME) target_alarm_name = alarms[item['target']].get(VProps.NAME)
target_alarm_name = self._get_value( if item.get('key') != EdgeLabel.CAUSES \
alarms[item['target']], VProps.NAME) or item.get(EdgeProperties.RELATIONSHIP_TYPE) != EdgeLabel.CAUSES \
if self._get_value(item, 'key') != EdgeLabel.CAUSES \
or self._get_value(item, EdgeProperties.RELATIONSHIP_TYPE) != EdgeLabel.CAUSES \
or source_alarm_name != RCA_ALARM_NAME \ or source_alarm_name != RCA_ALARM_NAME \
or target_alarm_name != VITRAGE_ALARM_NAME: or target_alarm_name != VITRAGE_ALARM_NAME:
flag = False flag = False
@ -152,33 +149,26 @@ class BaseRcaTest(BaseAlarmsTest):
def _validate_set_state(self, topology, instances): def _validate_set_state(self, topology, instances):
self.assertNotEqual(len(topology), 0, 'The topology graph is empty') self.assertNotEqual(len(topology), 0, 'The topology graph is empty')
host = g_utils.all_matches(
host = self._filter_list_by_pairs_parameters(
topology, topology,
[VProps.VITRAGE_TYPE, VProps.ID, VProps.VITRAGE_STATE, vitrage_type=NOVA_HOST_DATASOURCE,
VProps.VITRAGE_AGGREGATED_STATE], id=self._get_hostname(),
[NOVA_HOST_DATASOURCE, vitrage_state=OperationalResourceState.ERROR,
self._get_hostname(), vitrage_aggregated_state=OperationalResourceState.ERROR)
OperationalResourceState.ERROR,
OperationalResourceState.ERROR])
vm1 = self._filter_list_by_pairs_parameters( vm1 = g_utils.all_matches(
topology, topology,
[VProps.VITRAGE_TYPE, VProps.ID, VProps.VITRAGE_STATE, vitrage_type=NOVA_INSTANCE_DATASOURCE,
VProps.VITRAGE_AGGREGATED_STATE], id=instances[0].id,
[NOVA_INSTANCE_DATASOURCE, vitrage_state=OperationalResourceState.SUBOPTIMAL,
utils.uni2str(instances[0].id), vitrage_aggregated_state=OperationalResourceState.SUBOPTIMAL)
OperationalResourceState.SUBOPTIMAL,
OperationalResourceState.SUBOPTIMAL])
vm2 = self._filter_list_by_pairs_parameters( vm2 = g_utils.all_matches(
topology, topology,
[VProps.VITRAGE_TYPE, VProps.ID, VProps.VITRAGE_STATE, vitrage_type=NOVA_INSTANCE_DATASOURCE,
VProps.VITRAGE_AGGREGATED_STATE], id=instances[1].id,
[NOVA_INSTANCE_DATASOURCE, vitrage_state=OperationalResourceState.SUBOPTIMAL,
utils.uni2str(instances[1].id), vitrage_aggregated_state=OperationalResourceState.SUBOPTIMAL)
OperationalResourceState.SUBOPTIMAL,
OperationalResourceState.SUBOPTIMAL])
self.assertEqual(1, len(host)) self.assertEqual(1, len(host))
self.assertEqual(1, len(vm1)) self.assertEqual(1, len(vm1))
@ -208,7 +198,7 @@ class BaseRcaTest(BaseAlarmsTest):
def _get_hostname(self): def _get_hostname(self):
host = vitrage_utils.get_first_host() host = vitrage_utils.get_first_host()
return self._get_value(item=host, key=VProps.ID) return host.get(VProps.ID)
@staticmethod @staticmethod
def _clean_timestamps(alist): def _clean_timestamps(alist):

View File

@ -50,8 +50,7 @@ class TestRca(BaseRcaTest):
resource_id=instances[0].id, resource_id=instances[0].id,
alarm_name='instance_rca_alarm', unic=True) alarm_name='instance_rca_alarm', unic=True)
vitrage_id = self._get_value( vitrage_id = instance_alarm.get(VProps.VITRAGE_ID)
instance_alarm, VProps.VITRAGE_ID)
api_rca = self.vitrage_client.rca.get(alarm_id=vitrage_id) api_rca = self.vitrage_client.rca.get(alarm_id=vitrage_id)
cli_rca = utils.run_vitrage_command( cli_rca = utils.run_vitrage_command(
'vitrage rca show ' + vitrage_id, self.conf) 'vitrage rca show ' + vitrage_id, self.conf)
@ -82,8 +81,7 @@ class TestRca(BaseRcaTest):
resource_id=self._get_hostname(), resource_id=self._get_hostname(),
alarm_name=RCA_ALARM_NAME) alarm_name=RCA_ALARM_NAME)
api_rca = self.vitrage_client.rca.get( api_rca = self.vitrage_client.rca.get(
alarm_id=self._get_value(host_alarm, alarm_id=host_alarm.get(VProps.VITRAGE_ID), all_tenants=True)
VProps.VITRAGE_ID), all_tenants=True)
self._validate_rca(rca=api_rca['nodes']) self._validate_rca(rca=api_rca['nodes'])
self._validate_relationship(links=api_rca['links'], self._validate_relationship(links=api_rca['links'],

View File

@ -16,6 +16,7 @@ import json
from oslo_log import log as logging from oslo_log import log as logging
from vitrage_tempest_tests.tests.base import BaseVitrageTempest from vitrage_tempest_tests.tests.base import BaseVitrageTempest
from vitrage_tempest_tests.tests.common import general_utils as g_utils
from vitrage_tempest_tests.tests import utils from vitrage_tempest_tests.tests import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -77,8 +78,9 @@ class BaseTemplateTest(BaseVitrageTempest):
len(api_templates) + 4) len(api_templates) + 4)
def _validate_passed_templates_length(self, api_templates, cli_templates): def _validate_passed_templates_length(self, api_templates, cli_templates):
api_passes_templates = self._filter_list_by_pairs_parameters( api_passes_templates = g_utils.all_matches(
api_templates, ['status details'], [self.OK_MSG]) api_templates,
**{'status details': self.OK_MSG})
cli_passes_templates = cli_templates.count(' ' + self.OK_MSG + ' ') cli_passes_templates = cli_templates.count(' ' + self.OK_MSG + ' ')
self.assertEqual(cli_passes_templates, len(api_passes_templates)) self.assertEqual(cli_passes_templates, len(api_passes_templates))

View File

@ -60,21 +60,6 @@ class BaseVitrageTempest(base.BaseTestCase):
cls.num_default_entities = 3 cls.num_default_entities = 3
cls.num_default_edges = 2 cls.num_default_edges = 2
@staticmethod
def _filter_list_by_pairs_parameters(origin_list,
keys, values):
filtered_list = []
for item in origin_list:
verification = 0
for index in range(len(keys)):
if utils.uni2str(item[keys[index]]) == values[index]:
verification += 1
else:
break
if verification == len(keys):
filtered_list.append(item)
return filtered_list
def _create_graph_from_graph_dictionary(self, api_graph): def _create_graph_from_graph_dictionary(self, api_graph):
self.assertIsNotNone(api_graph) self.assertIsNotNone(api_graph)
graph = NXGraph() graph = NXGraph()

View File

@ -14,16 +14,14 @@
import six import six
def get_first_match(list_of_dicts, **kwargs): def first_match(list_of_dicts, **kwargs):
subset_dict = _subset_dict(**kwargs) subset_dict = _subset_dict(**kwargs)
for d in list_of_dicts: for d in list_of_dicts:
if is_subset(subset_dict, d): if is_subset(subset_dict, d):
return d return d
def get_all_matches(list_of_dicts, **kwargs): def all_matches(list_of_dicts, **kwargs):
# TODO(idan_hefetz) this method can replace the notorious
# TODO(idan_hefetz) '_filter_list_by_pairs_parameters'
subset_dict = _subset_dict(**kwargs) subset_dict = _subset_dict(**kwargs)
return [d for d in list_of_dicts if is_subset(subset_dict, d)] return [d for d in list_of_dicts if is_subset(subset_dict, d)]

View File

@ -11,13 +11,10 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from vitrage.common.constants import VertexProperties as VProps from vitrage_tempest_tests.tests.common import general_utils as g_utils
from vitrage_tempest_tests.tests.common.tempest_clients import TempestClients from vitrage_tempest_tests.tests.common.tempest_clients import TempestClients
from vitrage_tempest_tests.tests.utils import uni2str
def get_public_network(): def get_public_network():
nets = TempestClients.neutron().list_networks() nets = TempestClients.neutron().list_networks()
return next( return g_utils.first_match(nets['networks'], name='public')
(n for n in nets['networks'] if uni2str(n[VProps.NAME]) == 'public'),
None)

View File

@ -42,7 +42,7 @@ def create_instances(num_instances=1, set_public_network=False, name='vm'):
def delete_all_instances(**kwargs): def delete_all_instances(**kwargs):
instances = TempestClients.nova().servers.list() instances = TempestClients.nova().servers.list()
instances_to_delete = g_utils.get_all_matches(instances, **kwargs) instances_to_delete = g_utils.all_matches(instances, **kwargs)
for item in instances_to_delete: for item in instances_to_delete:
try: try:
TempestClients.nova().servers.delete(item) TempestClients.nova().servers.delete(item)

View File

@ -39,10 +39,10 @@ def generate_fake_host_alarm(hostname, event_type, enabled=True):
def get_first_host(**kwargs): def get_first_host(**kwargs):
hosts = TempestClients.vitrage().resource.list( hosts = TempestClients.vitrage().resource.list(
NOVA_HOST_DATASOURCE, all_tenants=True) NOVA_HOST_DATASOURCE, all_tenants=True)
return g_utils.get_first_match(hosts, **kwargs) return g_utils.first_match(hosts, **kwargs)
def get_first_instance(**kwargs): def get_first_instance(**kwargs):
instances = TempestClients.vitrage().resource.list( instances = TempestClients.vitrage().resource.list(
NOVA_INSTANCE_DATASOURCE, all_tenants=True) NOVA_INSTANCE_DATASOURCE, all_tenants=True)
return g_utils.get_first_match(instances, **kwargs) return g_utils.first_match(instances, **kwargs)

View File

@ -16,6 +16,7 @@ from oslo_log import log as logging
from vitrage.common.constants import VertexProperties as VProps from vitrage.common.constants import VertexProperties as VProps
from vitrage_tempest_tests.tests.api.topology.base import BaseTopologyTest from vitrage_tempest_tests.tests.api.topology.base import BaseTopologyTest
from vitrage_tempest_tests.tests.common import general_utils as g_utils
from vitrage_tempest_tests.tests.common import nova_utils from vitrage_tempest_tests.tests.common import nova_utils
from vitrage_tempest_tests.tests import utils from vitrage_tempest_tests.tests import utils
@ -99,6 +100,5 @@ class TestNeutron(BaseTopologyTest):
def _port_to_network_edges(self, networks, ports): def _port_to_network_edges(self, networks, ports):
counter = 0 counter = 0
for net in networks: for net in networks:
counter += len(self._filter_list_by_pairs_parameters( counter += len(g_utils.all_matches(ports, network_id=net['id']))
ports, ['network_id'], [net['id']]))
return counter return counter

View File

@ -55,7 +55,7 @@ class TestActionsBase(BaseVitrageTempest):
alarms = TempestClients.vitrage().alarm.list( alarms = TempestClients.vitrage().alarm.list(
vitrage_id=resource_id, vitrage_id=resource_id,
all_tenants=True) all_tenants=True)
deduces = g_utils.get_all_matches(alarms, **deduced_props) deduces = g_utils.all_matches(alarms, **deduced_props)
self.assertEqual( self.assertEqual(
deduced_count, deduced_count,
len(deduces), len(deduces),
@ -66,7 +66,7 @@ class TestActionsBase(BaseVitrageTempest):
self.assertEqual(len(expected_alarms), len(rca['nodes'])) self.assertEqual(len(expected_alarms), len(rca['nodes']))
for expected_alarm in expected_alarms: for expected_alarm in expected_alarms:
self.assertIsNotNone( self.assertIsNotNone(
g_utils.get_first_match(rca['nodes'], **expected_alarm), g_utils.first_match(rca['nodes'], **expected_alarm),
'expected_alarm is not in the rca %s' % str(expected_alarm)) 'expected_alarm is not in the rca %s' % str(expected_alarm))
rca_inspected = rca['nodes'][rca['inspected_index']] rca_inspected = rca['nodes'][rca['inspected_index']]
self.assertEqual( self.assertEqual(

View File

@ -178,8 +178,8 @@ class TestBasicActions(TestActionsBase):
all_tenants=True) all_tenants=True)
self.assertEqual(True, len(alarms) >= 2, 'alarms %s' % str(alarms)) self.assertEqual(True, len(alarms) >= 2, 'alarms %s' % str(alarms))
deduced = g_utils.get_first_match(alarms, **DEDUCED_PROPS) deduced = g_utils.first_match(alarms, **DEDUCED_PROPS)
trigger = g_utils.get_first_match(alarms, **TRIGGER_ALARM_2_PROPS) trigger = g_utils.first_match(alarms, **TRIGGER_ALARM_2_PROPS)
# Get Rca for the deduced # Get Rca for the deduced
rca = TempestClients.vitrage().rca.get( rca = TempestClients.vitrage().rca.get(

View File

@ -170,9 +170,9 @@ class TestOverlappingcActions(TestActionsBase):
vitrage_id=self.orig_host.get(VProps.VITRAGE_ID), vitrage_id=self.orig_host.get(VProps.VITRAGE_ID),
all_tenants=True) all_tenants=True)
deduced = g_utils.get_first_match(alarms, **DEDUCED_PROPS) deduced = g_utils.first_match(alarms, **DEDUCED_PROPS)
trigger1 = g_utils.get_first_match(alarms, **TRIGGER_ALARM_1_PROPS) trigger1 = g_utils.first_match(alarms, **TRIGGER_ALARM_1_PROPS)
trigger2 = g_utils.get_first_match(alarms, **TRIGGER_ALARM_2_PROPS) trigger2 = g_utils.first_match(alarms, **TRIGGER_ALARM_2_PROPS)
# Get Rca for the deduced # Get Rca for the deduced
rca = TempestClients.vitrage().rca.get( rca = TempestClients.vitrage().rca.get(
@ -195,8 +195,8 @@ class TestOverlappingcActions(TestActionsBase):
vitrage_id=self.orig_host.get(VProps.VITRAGE_ID), vitrage_id=self.orig_host.get(VProps.VITRAGE_ID),
all_tenants=True) all_tenants=True)
deduced = g_utils.get_first_match(alarms, **DEDUCED_PROPS) deduced = g_utils.first_match(alarms, **DEDUCED_PROPS)
trigger2 = g_utils.get_first_match(alarms, **TRIGGER_ALARM_2_PROPS) trigger2 = g_utils.first_match(alarms, **TRIGGER_ALARM_2_PROPS)
# Get Rca for the deduced # Get Rca for the deduced
rca = TempestClients.vitrage().rca.get( rca = TempestClients.vitrage().rca.get(
@ -215,15 +215,15 @@ class TestOverlappingcActions(TestActionsBase):
all_tenants=True) all_tenants=True)
self.assertEqual( self.assertEqual(
0, 0,
len(g_utils.get_all_matches(alarms, **TRIGGER_ALARM_1_PROPS)), len(g_utils.all_matches(alarms, **TRIGGER_ALARM_1_PROPS)),
'trigger alarm 1 should have been removed') 'trigger alarm 1 should have been removed')
self.assertEqual( self.assertEqual(
0, 0,
len(g_utils.get_all_matches(alarms, **TRIGGER_ALARM_2_PROPS)), len(g_utils.all_matches(alarms, **TRIGGER_ALARM_2_PROPS)),
'trigger alarm 2 should have been removed') 'trigger alarm 2 should have been removed')
self.assertEqual( self.assertEqual(
0, 0,
len(g_utils.get_all_matches(alarms, **DEDUCED_PROPS)), len(g_utils.all_matches(alarms, **DEDUCED_PROPS)),
'deduced alarm should have been removed') 'deduced alarm should have been removed')
except Exception as e: except Exception as e: