diff --git a/clmctest/monitoring/LineProtocolGenerator.py b/clmctest/monitoring/LineProtocolGenerator.py index 416a144a552e249f876b1edae0322af2232b00d9..93771d79f0fc7a2b4c192abfdc8f1c2d83174fcb 100644 --- a/clmctest/monitoring/LineProtocolGenerator.py +++ b/clmctest/monitoring/LineProtocolGenerator.py @@ -87,7 +87,7 @@ def generate_ipendpoint_route(resource, requests, latency, time): return result -def generate_mc_endpoint_config(state, cpu, mem, storage, statePeriod, time): +def generate_endpoint_config(state, cpu, mem, storage, statePeriod, time): """ generates a measurement @@ -100,7 +100,7 @@ def generate_mc_endpoint_config(state, cpu, mem, storage, statePeriod, time): :return: dictionary object representing the data to post to influx """ - result = [{"measurement": "mcEndpointConfig", + result = [{"measurement": "endpointConfig", "tags": { "state": state diff --git a/clmctest/monitoring/test_endpoint_config.py b/clmctest/monitoring/test_endpoint_config.py index 14b8bef76e5c2853493ad7dbc0473a920bd64af7..0d0a09da8c6ba9ffb31826e0271a26ee886103a1 100644 --- a/clmctest/monitoring/test_endpoint_config.py +++ b/clmctest/monitoring/test_endpoint_config.py @@ -12,7 +12,7 @@ Tests the monitoring of endpoints' configuration states - currently based on mod Line Protocol report format: -mcEndpointConfig <global tags>,<state> <statePeriod=milliseconds>,<cpus=numberOfCPUs>, <memory=memoryOfVM>, <storage=storageCapacityOfVM> time +endpointConfig <global tags>,<state> <statePeriod=milliseconds>,<cpus=numberOfCPUs>, <memory=memoryOfVM>, <storage=storageCapacityOfVM> time """ @@ -20,15 +20,15 @@ mcEndpointConfig <global tags>,<state> <statePeriod=milliseconds>,<cpus=numberOf state_delays = [{'placing': random.randint(7500, 12500), 'booting': random.randint(7500, 12500), 'connecting': random.randint(7500, 12500)}, {'placing': random.randint(7500, 12500), 'booting': random.randint(7500, 12500), 'connecting': random.randint(7500, 12500)}] -measurement_name = 'mcEndpointConfig' # measurement name for configuration of media components' endpoints +measurement_name = 'endpointConfig' # measurement name for configuration of media components' endpoints @pytest.mark.parametrize("query, result", [ - ('SELECT "state", "statePeriod", "cpus", "memory", "storage" FROM "CLMCMetrics"."autogen"."mcEndpointConfig" WHERE ipendpoint=\'adaptive_streaming_I1_apache1\' and sf=\'adaptive_streaming\'', + ('SELECT "state", "statePeriod", "cpus", "memory", "storage" FROM "CLMCMetrics"."autogen"."endpointConfig" WHERE ipendpoint=\'adaptive_streaming_I1_apache1\' and sf=\'adaptive_streaming\'', {'placing': {"state": "placing", "statePeriod": state_delays[0]['placing'], "cpus": 1, "memory": 2048, "storage": '10GB'}, 'booting': {"state": "booting", "statePeriod": state_delays[0]['booting'], "cpus": 1, "memory": 2048, "storage": '10GB'}, 'connecting': {"state": "connecting", "statePeriod": state_delays[0]['connecting'], "cpus": 1, "memory": 2048, "storage": '10GB'}}), - ('SELECT "state", "statePeriod", "cpus", "memory", "storage" FROM "CLMCMetrics"."autogen"."mcEndpointConfig" WHERE ipendpoint=\'adaptive_streaming_I1_apache2\' and sf=\'adaptive_streaming\'' , + ('SELECT "state", "statePeriod", "cpus", "memory", "storage" FROM "CLMCMetrics"."autogen"."endpointConfig" WHERE ipendpoint=\'adaptive_streaming_I1_apache2\' and sf=\'adaptive_streaming\'' , {'placing': {"state": "placing", "statePeriod": state_delays[1]['placing'], "cpus": 1, "memory": 2048, "storage": '10GB'}, 'booting': {"state": "booting", "statePeriod": state_delays[1]['booting'], "cpus": 1, "memory": 2048, "storage": '10GB'}, 'connecting': {"state": "connecting", "statePeriod": state_delays[1]['connecting'], "cpus": 1, "memory": 2048, "storage": '10GB'}}) @@ -55,17 +55,17 @@ def test_endpoint_config(query, result, get_db_client): @pytest.mark.parametrize("query, result", [ - ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."mcEndpointConfig" WHERE state=\'placing\' and ipendpoint=\'adaptive_streaming_I1_apache1\' and sf=\'adaptive_streaming\'', + ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."endpointConfig" WHERE state=\'placing\' and ipendpoint=\'adaptive_streaming_I1_apache1\' and sf=\'adaptive_streaming\'', {"mean_statePeriod": state_delays[0]['placing']}), - ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."mcEndpointConfig" WHERE state=\'booting\' and ipendpoint=\'adaptive_streaming_I1_apache1\' and sf=\'adaptive_streaming\'', + ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."endpointConfig" WHERE state=\'booting\' and ipendpoint=\'adaptive_streaming_I1_apache1\' and sf=\'adaptive_streaming\'', {"mean_statePeriod": state_delays[0]['booting']}), - ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."mcEndpointConfig" WHERE state=\'connecting\' and ipendpoint=\'adaptive_streaming_I1_apache1\' and sf=\'adaptive_streaming\'', + ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."endpointConfig" WHERE state=\'connecting\' and ipendpoint=\'adaptive_streaming_I1_apache1\' and sf=\'adaptive_streaming\'', {"mean_statePeriod": state_delays[0]['connecting']}), - ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."mcEndpointConfig" WHERE state=\'placing\' and ipendpoint=\'adaptive_streaming_I1_apache2\' and sf=\'adaptive_streaming\'', + ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."endpointConfig" WHERE state=\'placing\' and ipendpoint=\'adaptive_streaming_I1_apache2\' and sf=\'adaptive_streaming\'', {"mean_statePeriod": state_delays[1]['placing']}), - ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."mcEndpointConfig" WHERE state=\'booting\' and ipendpoint=\'adaptive_streaming_I1_apache2\' and sf=\'adaptive_streaming\'', + ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."endpointConfig" WHERE state=\'booting\' and ipendpoint=\'adaptive_streaming_I1_apache2\' and sf=\'adaptive_streaming\'', {"mean_statePeriod": state_delays[1]['booting']}), - ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."mcEndpointConfig" WHERE state=\'connecting\' and ipendpoint=\'adaptive_streaming_I1_apache2\' and sf=\'adaptive_streaming\'', + ('SELECT MEAN("statePeriod") as "mean_statePeriod" FROM "CLMCMetrics"."autogen"."endpointConfig" WHERE state=\'connecting\' and ipendpoint=\'adaptive_streaming_I1_apache2\' and sf=\'adaptive_streaming\'', {"mean_statePeriod": state_delays[1]['connecting']}) ]) def test_mean_config_periods(query, result, get_db_client): @@ -110,7 +110,7 @@ def generate_states_data(streaming_sim_config, get_db_client): measurement_time = 0 for state in ('placing', 'booting', 'connecting'): epURL = streaming_sim_config['hosts'][i]['ip_address'] # endpoint URL - mc_EndpointID = streaming_sim_config['hosts'][i]['ipendpoint_id'] + endpointID = streaming_sim_config['hosts'][i]['ipendpoint_id'] cpu = streaming_sim_config['hosts'][i]['cpus'] mem = streaming_sim_config['hosts'][i]['memory'] disk = streaming_sim_config['hosts'][i]['disk'] @@ -119,9 +119,9 @@ def generate_states_data(streaming_sim_config, get_db_client): db_client = InfluxDBClient(host=epURL, port=8186, database=db_name, timeout=10) period = state_delays[i-1].get(state) - print("Endpoint - {0}, state - {1}, period - {2}ms".format(mc_EndpointID, state, period)) + print("Endpoint - {0}, state - {1}, period - {2}ms".format(endpointID, state, period)) - db_client.write_points(lp.generate_mc_endpoint_config(state, cpu, mem, disk, period, measurement_time)) + db_client.write_points(lp.generate_endpoint_config(state, cpu, mem, disk, period, measurement_time)) measurement_time += period time.sleep(10)