Skip to content
Snippets Groups Projects
Commit 5eb00ac5 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Monitoring component:

- Fixed unitary tests
parent b40be8a6
No related branches found
No related tags found
2 merge requests!235Release TeraFlowSDN 3.0,!160Resolve "(CTTC) Forecaster component"
...@@ -226,6 +226,18 @@ def ingestion_data(kpi_id_int): ...@@ -226,6 +226,18 @@ def ingestion_data(kpi_id_int):
kpi_value) kpi_value)
sleep(0.1) sleep(0.1)
##################################################
# Prepare Environment, should be the first test
##################################################
def test_prepare_environment(
context_client : ContextClient, # pylint: disable=redefined-outer-name,unused-argument
):
context_id = json_context_id(DEFAULT_CONTEXT_NAME)
context_client.SetContext(Context(**json_context(DEFAULT_CONTEXT_NAME)))
context_client.SetTopology(Topology(**json_topology(DEFAULT_TOPOLOGY_NAME, context_id=context_id)))
########################### ###########################
# Tests Implementation # Tests Implementation
########################### ###########################
...@@ -601,10 +613,6 @@ def test_listen_events( ...@@ -601,10 +613,6 @@ def test_listen_events(
events_collector = EventsDeviceCollector(metrics_db.name_mapping) events_collector = EventsDeviceCollector(metrics_db.name_mapping)
events_collector.start() events_collector.start()
context_id = json_context_id(DEFAULT_CONTEXT_NAME)
context_client.SetContext(Context(**json_context(DEFAULT_CONTEXT_NAME)))
context_client.SetTopology(Topology(**json_topology(DEFAULT_TOPOLOGY_NAME, context_id=context_id)))
LOGGER.info('Adding Device {:s}'.format(DEVICE_DEV1_UUID)) LOGGER.info('Adding Device {:s}'.format(DEVICE_DEV1_UUID))
device_with_connect_rules = copy.deepcopy(DEVICE_DEV1) device_with_connect_rules = copy.deepcopy(DEVICE_DEV1)
device_with_connect_rules['device_config']['config_rules'].extend(DEVICE_DEV1_CONNECT_RULES) device_with_connect_rules['device_config']['config_rules'].extend(DEVICE_DEV1_CONNECT_RULES)
...@@ -629,11 +637,17 @@ def test_listen_events( ...@@ -629,11 +637,17 @@ def test_listen_events(
assert len(kpi_id_list) > 0 assert len(kpi_id_list) > 0
device_client.DeleteDevice(response) device_client.DeleteDevice(response)
events_collector.stop()
LOGGER.warning('test_listen_events end')
##################################################
# Cleanup Environment, should be the last test
##################################################
def test_cleanup_environment(
context_client : ContextClient, # pylint: disable=redefined-outer-name,unused-argument
):
context_id = json_context_id(DEFAULT_CONTEXT_NAME) context_id = json_context_id(DEFAULT_CONTEXT_NAME)
context_client.RemoveTopology(TopologyId(**json_topology_id(DEFAULT_TOPOLOGY_NAME, context_id=context_id))) context_client.RemoveTopology(TopologyId(**json_topology_id(DEFAULT_TOPOLOGY_NAME, context_id=context_id)))
context_client.RemoveContext(ContextId(**context_id)) context_client.RemoveContext(ContextId(**context_id))
events_collector.stop()
LOGGER.warning('test_listen_events end')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment