Skip to content
Snippets Groups Projects
Commit 94dbeaff authored by Nikolay Stanchev's avatar Nikolay Stanchev
Browse files

Updated simulator and aggregator to be consistent with the discussion on FQDNs...

Updated simulator and aggregator to be consistent with the discussion on FQDNs and service function instances
parent e8ecb471
No related branches found
No related tags found
No related merge requests found
......@@ -93,24 +93,24 @@ class Aggregator(Thread):
network_delays[(tags['path'], tags['source'], tags['target'])] = next(result_points)['net_delay']
# query the service delays and group them by FQDN, service function instance and sfr
# query the service delays and group them by endpoint, service function instance and sfr
service_delays = {}
result = self.db_client.query('SELECT mean(response_time) as "response_time" FROM "E2EMetrics"."autogen"."service_delays" WHERE time >= {0} and time < {1} GROUP BY FQDN, sf_instance, sfr'.format(boundary_time_nano, current_time_nano))
result = self.db_client.query('SELECT mean(response_time) as "response_time" FROM "E2EMetrics"."autogen"."service_delays" WHERE time >= {0} and time < {1} GROUP BY endpoint, sf_instance, sfr'.format(boundary_time_nano, current_time_nano))
for item in result.items():
metadata, result_points = item
# measurement = metadata[0]
tags = metadata[1]
service_delays[tags['sfr']] = (next(result_points)['response_time'], tags['FQDN'], tags['sf_instance'])
service_delays[tags['sfr']] = (next(result_points)['response_time'], tags['endpoint'], tags['sf_instance'])
# for each path identifier check if there is a media service delay report for the target sfr - if so, generate an e2e_delay measurement
# for each network path check if there is a media service delay report for the target sfr - if so, generate an e2e_delay measurement
for path in network_delays:
# check if target sfr is reported in service delays, that is there is a media service instance being connected to target sfr
# check if target sfr is reported in service delays, in other words - if there is a media service instance being connected to target sfr
path_id, source, target = path
if target not in service_delays:
# if not continue with the other path reports
# if not continue with the other network path reports
continue
e2e_arguments = {"path_ID": None, "source_SFR": None, "target_SFR": None, "fqdn": None, "sf_instance": None, "delay_forward": None, "delay_reverse": None,
e2e_arguments = {"path_ID": None, "source_SFR": None, "target_SFR": None, "endpoint": None, "sf_instance": None, "delay_forward": None, "delay_reverse": None,
"delay_service": None, "time": boundary_time}
e2e_arguments['path_ID'] = path_id
......@@ -118,24 +118,27 @@ class Aggregator(Thread):
# reverse the path ID to get the network delay for the reversed path
reversed_path = (path_id, target, source)
assert reversed_path in network_delays # an assertion is made here, since reversed path must always be reported as well
assert reversed_path in network_delays # reversed path must always be reported with the forward one - if there is network path A-B, there is also network path B-A
e2e_arguments['delay_reverse'] = network_delays[reversed_path]
# get the response time of the media component connected to the target SFR
service_delay = service_delays[target]
response_time, fqdn, sf_instance = service_delay
response_time, endpoint, sf_instance = service_delay
# put these points in the e2e arguments dictionary
e2e_arguments['delay_service'] = response_time
e2e_arguments['fqdn'] = fqdn
e2e_arguments['endpoint'] = endpoint
e2e_arguments['sf_instance'] = sf_instance
# if all the arguments of the e2e delay measurements were reported, then generate and post to Influx an E2E measurement row
if None not in e2e_arguments.items():
self.db_client.write_points(
lp.generate_e2e_delay_report(e2e_arguments['path_ID'], e2e_arguments['source_SFR'], e2e_arguments['target_SFR'], e2e_arguments['fqdn'],
lp.generate_e2e_delay_report(e2e_arguments['path_ID'], e2e_arguments['source_SFR'], e2e_arguments['target_SFR'], e2e_arguments['endpoint'],
e2e_arguments['sf_instance'], e2e_arguments['delay_forward'], e2e_arguments['delay_reverse'], e2e_arguments['delay_service'],
e2e_arguments['time']))
old_timestamp = current_time
while current_time != old_timestamp + 5:
# wait until {REPORT_PERIOD} seconds have passed
while current_time != old_timestamp + self.REPORT_PERIOD:
sleep(1)
current_time = int(time())
......
......@@ -112,8 +112,8 @@ class Simulator(object):
# measure service response time every 5 seconds
if i % sample_period_media == 0:
self.db_client.write_points(lp.generate_service_delay_report(mean_delay_seconds_media, "ms-A.ict-flame.eu",
"test-sf-clmc-agent-build_INSTANCE", "SR3", sim_time))
self.db_client.write_points(lp.generate_service_delay_report(mean_delay_seconds_media, "endpoint-1",
"ms-A.ict-flame.eu", "SR3", sim_time))
# increase/decrease the delay in every sample report (min delay is 10)
mean_delay_seconds_media = max(10, mean_delay_seconds_media + random.choice([random.randint(10, 20), random.randint(-20, -10)]))
......
......@@ -29,14 +29,14 @@ import uuid
from random import randint
def generate_e2e_delay_report(path_id, source_sfr, target_sfr, fqdn, sf_instance, delay_forward, delay_reverse, delay_service, time):
def generate_e2e_delay_report(path_id, source_sfr, target_sfr, endpoint, sf_instance, delay_forward, delay_reverse, delay_service, time):
"""
Generates a combined averaged measurement about the e2e delay and its contributing parts
:param path_ID: The path identifier, which is a bidirectional path ID for the request and the response path
:param source_SFR: source service router
:param target_SFR: target service router
:param fqdn: FQDN of the media service
:param endpoint: endpoint of the media component
:param sf_instance: service function instance (media component)
:param delay_forward: Path delay (Forward direction)
:param delay_reverse: Path delay (Reverse direction)
......@@ -50,7 +50,7 @@ def generate_e2e_delay_report(path_id, source_sfr, target_sfr, fqdn, sf_instance
"path_ID": path_id,
"source_SFR": source_sfr,
"target_SFR": target_sfr,
"FQDN": fqdn,
"endpoint": endpoint,
"sf_instance": sf_instance
},
"fields": {
......@@ -91,12 +91,12 @@ def generate_network_delay_report(path_id, source_sfr, target_sfr, e2e_delay, ti
return result
def generate_service_delay_report(response_time, fqdn, sf_instance, sfr, time):
def generate_service_delay_report(response_time, endpoint, sf_instance, sfr, time):
"""
Generates a service measurement about the media service response time.
:param response_time: the media service response time (This is not the response time for the whole round-trip, but only for the processing part of the media service component)
:param fqdn: FQDN of the media service
:param endpoint: endpoint of the media component
:param sf_instance: service function instance
:param sfr: the service function router that connects the endpoint of the SF instance to the FLAME network
:param time: the measurement timestamp
......@@ -105,7 +105,7 @@ def generate_service_delay_report(response_time, fqdn, sf_instance, sfr, time):
result = [{"measurement": "service_delays",
"tags": {
"FQDN": fqdn,
"endpoint": endpoint,
"sf_instance": sf_instance,
"sfr": sfr
},
......
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