Skip to content
Snippets Groups Projects
Commit ef219637 authored by Stephen C Phillips's avatar Stephen C Phillips
Browse files

Adds bandwidth to each path

parent a1777647
No related branches found
No related tags found
No related merge requests found
......@@ -78,25 +78,29 @@ class Simulator(object):
'target': 'SR2',
'source': 'SR1',
'path_id': 'SR1---SR2',
'latency': 5
'latency': 5,
'bandwidth': 100*1024*1024
},
{
'target': 'SR1',
'source': 'SR2',
'path_id': 'SR1---SR2',
'latency': 5
'latency': 5,
'bandwidth': 100*1024*1024
},
{
'target': 'SR3',
'source': 'SR1',
'path_id': 'SR1---SR3',
'latency': 15
'latency': 5,
'bandwidth': 100*1024*1024
},
{
'target': 'SR1',
'source': 'SR3',
'path_id': 'SR1---SR3',
'latency': 15
'latency': 5,
'bandwidth': 100*1024*1024
}
]
......@@ -133,7 +137,7 @@ class Simulator(object):
if i % sample_period_net == 0:
path = random.choice(paths)
self.db_client.write_points(
lp.generate_network_delay_report(path['path_id'], path['source'], path['target'], path['latency'], sim_time))
lp.generate_network_delay_report(path['path_id'], path['source'], path['target'], path['latency'], path['bandwidth'], sim_time))
# increase/decrease the delay in every sample report (min delay is 1)
path['latency'] = max(1, path['latency'] + random.randint(-3, 3))
......
......@@ -64,7 +64,7 @@ def generate_e2e_delay_report(path_id, source_sfr, target_sfr, endpoint, sf_inst
return result
def generate_network_delay_report(path_id, source_sfr, target_sfr, latency, time):
def generate_network_delay_report(path_id, source_sfr, target_sfr, latency, bandwidth, time):
"""
Generates a platform measurement about the network delay between two specific service routers.
......@@ -72,6 +72,7 @@ def generate_network_delay_report(path_id, source_sfr, target_sfr, latency, time
:param source_sfr: the source service router
:param target_sfr: the target service router
:param latency: the e2e network delay for traversing the path between the two service routers
:param bandwidth: the bandwidth of the path (minimum of bandwidths of the links it is composed of)
:param time: the measurement timestamp
:return: a list of dict-formatted reports to post on influx
"""
......@@ -83,7 +84,8 @@ def generate_network_delay_report(path_id, source_sfr, target_sfr, latency, time
"target": target_sfr
},
"fields": {
"latency": latency
"latency": latency,
"bandwidth": bandwidth
},
"time": _getNSTime(time)
}]
......
......@@ -59,7 +59,7 @@ class TestE2ESimulation(object):
@pytest.mark.parametrize("query, expected_result", [
('SELECT count(*) FROM "E2EMetrics"."autogen"."network_delays"',
{"time": "1970-01-01T00:00:00Z", "count_latency": 120}),
{"time": "1970-01-01T00:00:00Z", "count_latency": 120, "count_bandwidth": 120}),
('SELECT count(*) FROM "E2EMetrics"."autogen"."service_delays"',
{"time": "1970-01-01T00:00:00Z", "count_response_time": 24, "count_request_size": 24, "count_response_size": 24}),
('SELECT count(*) FROM "E2EMetrics"."autogen"."e2e_delays"',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment