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

Small updates after code review

parent ff669cdf
No related branches found
No related tags found
No related merge requests found
...@@ -48,9 +48,9 @@ def main(global_config, **settings): ...@@ -48,9 +48,9 @@ def main(global_config, **settings):
Base.metadata.bind = engine # bind the engine to the Base class metadata Base.metadata.bind = engine # bind the engine to the Base class metadata
settings['sfemc_fqdn'] = os.environ['SFEMC_FQDN'] # read the SFEMC FQDN from the OS environment settings['sfemc_fqdn'] = os.environ['SFEMC_FQDN'] # read the SFEMC FQDN from the OS environment
settings['sfemc_port'] = os.environ.get('SFEMC_PORT', 8080) # read the SFEMC port number from the OS environment, if not set use 8080 as default settings['sfemc_port'] = int(os.environ.get('SFEMC_PORT', 8080)) # read the SFEMC port number from the OS environment, if not set use 8080 as default
settings['sdn_controller_ip'] = os.environ['SDN_CONTROLLER_IP'] # read the SDN controller IP address from the OS environment settings['sdn_controller_ip'] = os.environ['SDN_CONTROLLER_IP'] # read the SDN controller IP address from the OS environment
settings['sdn_controller_port'] = os.environ.get('SDN_CONTROLLER_PORT', 8080) # read the SDN controller port number from the OS environment, if not set use 8080 as default settings['sdn_controller_port'] = int(os.environ.get('SDN_CONTROLLER_PORT', 8080)) # read the SDN controller port number from the OS environment, if not set use 8080 as default
settings['influx_port'] = int(settings['influx_port']) # the influx port setting must be converted to integer instead of a string settings['influx_port'] = int(settings['influx_port']) # the influx port setting must be converted to integer instead of a string
settings['kapacitor_port'] = int(settings['kapacitor_port']) # the kapacitor port setting must be converted to integer instead of a string settings['kapacitor_port'] = int(settings['kapacitor_port']) # the kapacitor port setting must be converted to integer instead of a string
......
...@@ -107,11 +107,14 @@ class TestGraphAPI(object): ...@@ -107,11 +107,14 @@ class TestGraphAPI(object):
from_timestamp, to_timestamp, graph_db = db_testing_data from_timestamp, to_timestamp, graph_db = db_testing_data
ue_nodes = set([node["name"] for node in graph_db.nodes.match("UserEquipment")]) ue_nodes = set([node["name"] for node in graph_db.nodes.match("UserEquipment")])
assert ue_nodes == set("ue" + str(i) for i in [2, 3, 6]), "UE nodes have not been created" assert ue_nodes == set("ue" + str(i) for i in [2, 3, 6]), "UE nodes must have been created by the db_testing_data fixture"
dc_nodes = set([node["name"] for node in graph_db.nodes.match("Cluster")]) dc_nodes = set([node["name"] for node in graph_db.nodes.match("Cluster")])
assert dc_nodes == set("DC" + str(i) for i in range(1, 7)), "Compute nodes must have been created by the db_testing_data fixture" assert dc_nodes == set("DC" + str(i) for i in range(1, 7)), "Compute nodes must have been created by the db_testing_data fixture"
switch_nodes = set([node["name"] for node in graph_db.nodes.match("Switch")])
assert switch_nodes == set("127.0.0." + str(i) for i in range(1, 7)), "Switch nodes must have been created by the db_testing_data fixture"
# test with invalid URL parameters naming # test with invalid URL parameters naming
service_functions = dict(nginx={"measurement_name": "nginx", "response_time_field": "mean(avg_processing_time)", service_functions = dict(nginx={"measurement_name": "nginx", "response_time_field": "mean(avg_processing_time)",
"request_size_field": "mean(avg_request_size)", "response_size_field": "mean(avg_response_size)"}, "request_size_field": "mean(avg_request_size)", "response_size_field": "mean(avg_response_size)"},
...@@ -285,7 +288,9 @@ class TestGraphAPI(object): ...@@ -285,7 +288,9 @@ class TestGraphAPI(object):
assert response == {"uuid": graph_2_id, "deleted": 3}, "Incorrect response when deleting temporal graph" assert response == {"uuid": graph_2_id, "deleted": 3}, "Incorrect response when deleting temporal graph"
assert len(graph_db.nodes.match("Endpoint")) == 0, "All endpoint nodes should have been deleted" assert len(graph_db.nodes.match("Endpoint")) == 0, "All endpoint nodes should have been deleted"
assert set([node["name"] for node in graph_db.nodes.match("Cluster")]) == set(["DC" + str(i) for i in range(1, 7)]), "Compute nodes must not be deleted" assert set([node["name"] for node in graph_db.nodes.match("Cluster")]) == set(["DC" + str(i) for i in range(1, 7)]), "Cluster nodes must not be deleted"
assert set([node["name"] for node in graph_db.nodes.match("Switch")]) == set(["127.0.0." + str(i) for i in range(1, 7)]), "Switch nodes must not be deleted"
assert set([node["name"] for node in graph_db.nodes.match("UserEquipment")]) == set(["ue" + str(i) for i in (2, 3, 6)]), "UE nodes must not be deleted"
assert set([node["name"] for node in graph_db.nodes.match("ServiceFunction")]) == {"nginx_1", "apache_1", "minio_1", "minio_2"}, "Service functions must not be deleted." assert set([node["name"] for node in graph_db.nodes.match("ServiceFunction")]) == {"nginx_1", "apache_1", "minio_1", "minio_2"}, "Service functions must not be deleted."
assert set([node["name"] for node in graph_db.nodes.match("ServiceFunctionPackage")]) == {"nginx", "minio", "apache"}, "Service function packages must not be deleted" assert set([node["name"] for node in graph_db.nodes.match("ServiceFunctionPackage")]) == {"nginx", "minio", "apache"}, "Service function packages must not be deleted"
assert set([node["name"] for node in graph_db.nodes.match("ServiceFunctionChainInstance")]) == {"test_sfc_premium", "test_sfc_non_premium"}, "Service function chain instances must not be deleted" assert set([node["name"] for node in graph_db.nodes.match("ServiceFunctionChainInstance")]) == {"test_sfc_premium", "test_sfc_non_premium"}, "Service function chain instances must not be deleted"
......
...@@ -310,7 +310,7 @@ class GraphAPI(object): ...@@ -310,7 +310,7 @@ class GraphAPI(object):
ues = load(fh) ues = load(fh)
except Exception as e: except Exception as e:
log.error("Unexpected error: {0}".format(e)) log.error("Unexpected error: {0}".format(e))
log.error("No ue-to-cluster mapping was found while building the network topology.") log.error("No service-route-to-ue mapping was found while building the network topology.")
ues = {} ues = {}
# build the network graph and retrieve the number of switch nodes and cluster nodes that were created # build the network graph and retrieve the number of switch nodes and cluster nodes that were created
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment