From 8c358c29b07ad126614c1c327d2d95f517d793f4 Mon Sep 17 00:00:00 2001 From: Morgan Richomme Date: Mon, 30 Nov 2015 09:39:54 +0100 Subject: Add functions to retrieve POD name in Functest JIRA: FUNCTEST-108 Change-Id: I3453933e12cd7af9b06f50b327873f7516609566 Signed-off-by: Morgan Richomme --- testcases/functest_utils.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'testcases/functest_utils.py') diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py index 323297f2..59af2175 100644 --- a/testcases/functest_utils.py +++ b/testcases/functest_utils.py @@ -210,6 +210,7 @@ def create_neutron_port(neutron_client, name, network_id, ip): print "Error:", sys.exc_info()[0] return False + def delete_neutron_port(neutron_client, port_id): try: neutron_client.delete_port(port_id) @@ -218,6 +219,7 @@ def delete_neutron_port(neutron_client, port_id): print "Error:", sys.exc_info()[0] return False + def get_network_id(neutron_client, network_name): networks = neutron_client.list_networks()['networks'] id = '' @@ -444,6 +446,19 @@ def get_installer_type(logger=None): return installer + +def get_pod_name(logger=None): + """ + Get PoD Name from env variable NODE_NAME + """ + try: + return os.environ['NODE_NAME'] + except KeyError: + if logger: + logger.error("Unable to retrieve the POD name from environment.Using pod name 'unknown-pod'") + return "unknown-pod" + + def push_results_to_db(db_url, case_name, logger, pod_name, git_version, payload): url = db_url + "/results" installer = get_installer_type(logger) -- cgit 1.2.3-korg