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

updates graph API to return traffic_source tag

parent 17f8924f
No related branches found
No related tags found
No related merge requests found
......@@ -388,7 +388,7 @@ class TestGraphAPI(object):
assert error_raised, "HTTP Not Found error must be thrown for a non existing endpoint"
# go through the set of input/output (expected) parameters and assert actual results match with expected ones
for dc, endpoint, forward_latencies, reverse_latencies, response_time, request_size, response_size, rtt, global_tags in (
for startpoint, endpoint, forward_latencies, reverse_latencies, response_time, request_size, response_size, rtt, global_tags in (
("DC6", "nginx_1_ep2", [], [], 22.2, 35600, 6420, 22.2, {"flame_location": "DC6", "flame_sfe": "nginx_1_ep2", "flame_server": "DC6", "flame_sfc": "test_sfc", "flame_sfci": "test_sfc_premium", "flame_sfp": "nginx", "flame_sf": "nginx_1"}),
("127.0.0.6", "nginx_1_ep2", [0], [0], 22.2, 35600, 6420, 22.2, {"flame_location": "DC6", "flame_sfe": "nginx_1_ep2", "flame_server": "DC6", "flame_sfc": "test_sfc", "flame_sfci": "test_sfc_premium", "flame_sfp": "nginx", "flame_sf": "nginx_1"}),
("ue6", "nginx_1_ep2", [0, 0], [0, 0], 22.2, 35600, 6420, 22.2, {"flame_location": "DC6", "flame_sfe": "nginx_1_ep2", "flame_server": "DC6", "flame_sfc": "test_sfc", "flame_sfci": "test_sfc_premium", "flame_sfp": "nginx", "flame_sf": "nginx_1"}),
......@@ -401,12 +401,12 @@ class TestGraphAPI(object):
request = testing.DummyRequest()
request.matchdict["graph_id"] = request_id
request.params["endpoint"] = endpoint
request.params["startpoint"] = dc
request.params["startpoint"] = startpoint
response = GraphAPI(request).run_rtt_query()
# approximation is used to avoid long float numbers retrieved from influx, the test case ensures the results are different enough so that approximation of +-1 is good enough for testing
assert response.pop("round_trip_time") == pytest.approx(rtt, 1), "Incorrect RTT response"
assert response == {"forward_latencies": forward_latencies, "reverse_latencies": reverse_latencies, "total_forward_latency": sum(forward_latencies), "total_reverse_latency": sum(reverse_latencies),
"bandwidth": 104857600, "response_time": response_time, "global_tags": global_tags,
"bandwidth": 104857600, "response_time": response_time, "local_tags": {"traffic_source": startpoint}, "global_tags": global_tags,
"request_size": request_size, "response_size": response_size}, "Incorrect RTT response"
# send a new request for a new service function chain to create a second subgraph to test
......@@ -432,7 +432,7 @@ class TestGraphAPI(object):
request_id = graph_subresponse["uuid"]
# go through the set of input/output (expected) parameters and assert actual results match with expected ones
for dc, endpoint, forward_latencies, reverse_latencies, response_time, request_size, response_size, rtt, global_tags in (
for startpoint, endpoint, forward_latencies, reverse_latencies, response_time, request_size, response_size, rtt, global_tags in (
("DC5", "apache_1_ep1", [], [], 17.6, 1480, 7860, 17.6, {"flame_location": "DC5", "flame_sfe": "apache_1_ep1", "flame_server": "DC5", "flame_sfc": "test_sfc", "flame_sfci": "test_sfc_non_premium", "flame_sfp": "apache", "flame_sf": "apache_1"}),
("127.0.0.5", "apache_1_ep1", [0], [0], 17.6, 1480, 7860, 17.6, {"flame_location": "DC5", "flame_sfe": "apache_1_ep1", "flame_server": "DC5", "flame_sfc": "test_sfc", "flame_sfci": "test_sfc_non_premium", "flame_sfp": "apache", "flame_sf": "apache_1"}),
("DC5", "minio_2_ep1", [], [], 7, 2998, 3610, 7, {"flame_location": "DC5", "flame_sfe": "minio_2_ep1", "flame_server": "DC5", "flame_sfc": "test_sfc", "flame_sfci": "test_sfc_non_premium", "flame_sfp": "minio", "flame_sf": "minio_2"}),
......@@ -447,14 +447,14 @@ class TestGraphAPI(object):
request = testing.DummyRequest()
request.matchdict["graph_id"] = request_id
request.params["endpoint"] = endpoint
request.params["startpoint"] = dc
request.params["startpoint"] = startpoint
response = GraphAPI(request).run_rtt_query()
# approximation is used to avoid long float numbers retrieved from influx, the test case ensures the results are different enough so that approximation of +-1 is good enough for testing
assert response.pop("request_size") == pytest.approx(request_size, 1), "Incorrect RTT response"
assert response.pop("response_size") == pytest.approx(response_size, 1), "Incorrect RTT response"
assert response.pop("round_trip_time") == pytest.approx(rtt, 1), "Incorrect RTT response"
assert response == {"forward_latencies": forward_latencies, "reverse_latencies": reverse_latencies, "total_forward_latency": sum(forward_latencies), "total_reverse_latency": sum(reverse_latencies),
"bandwidth": 104857600, "response_time": response_time, "global_tags": global_tags}, "Incorrect RTT response"
"bandwidth": 104857600, "response_time": response_time, "local_tags": {"traffic_source": startpoint}, "global_tags": global_tags}, "Incorrect RTT response"
def test_delete_network_graph(self):
"""
......
......@@ -167,6 +167,7 @@ class GraphAPI(object):
result["global_tags"] = {"flame_sfe": endpoint_node["name"], "flame_server": hosted_by_node["name"], "flame_location": hosted_by_node["name"],
"flame_sfc": reference_node["sfc"], "flame_sfci": reference_node["sfci"], "flame_sfp": sf_package_node["name"], "flame_sf": sf_node["name"]}
result["local_tags"] = {"traffic_source": startpoint_node_label}
# calculate the Round-Trip-Time
total_forward_latency = sum(result["forward_latencies"])
......
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