diff options
Diffstat (limited to 'emulab_support.py')
-rw-r--r-- | emulab_support.py | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/emulab_support.py b/emulab_support.py index 6c31cd6..6fe0055 100644 --- a/emulab_support.py +++ b/emulab_support.py @@ -30,14 +30,6 @@ import configparser import warnings warnings.filterwarnings("ignore") -tag = "emulab-support" - -def log_debug(message): - print(tag + "(DBG): " + message) - -def log_error(message): - print(tag + "(ERR): " + message) - def get_ssh_client(): ssh_client = paramiko.SSHClient() ssh_client.load_system_host_keys() @@ -90,14 +82,14 @@ def execute_command(testbed, hostname, command, time_out = 3): stdin, stdout, stderr = ssh_client.exec_command(command) err = str(stderr.read()).strip('b\'\"\\n') if err != "": - log_error(err) + print(err) output = str(stdout.read()).strip('b\'\"\\n') ssh_client.close() return output except Exception as e: - log_error(str(e)) + print(str(e)) return def copy_file_to_testbed(testbed, hostname, text, file_name): @@ -124,7 +116,7 @@ def copy_file_to_testbed(testbed, hostname, text, file_name): stdin, stdout, stderr = ssh_client.exec_command(cmd) err = str(stderr.read()).strip('b\'\"\\n') if err != "": - log_error(err) + print(err) sftp_client = ssh_client.open_sftp() remote_file = sftp_client.open(file_name, 'w') @@ -133,7 +125,7 @@ def copy_file_to_testbed(testbed, hostname, text, file_name): remote_file.close() except Exception as e: - log_error(str(e)) + print(str(e)) def get_experiment_list(testbed, project_name = None): ''' @@ -186,10 +178,10 @@ def create_experiment(testbed, nodes, links): try: if exp_name in exp_list[proj_name][proj_name]: - log_debug("Experiment already exists.") + print("Experiment already exists.") return except: - log_debug("First experiment to be created for that project.") + print("First experiment to be created for that project.") ns = generate_ns_script(testbed, nodes, links) dest_file_name = '/users/'+ testbed.username + \ @@ -203,7 +195,7 @@ def create_experiment(testbed, nodes, links): execute_command(testbed, ops_server(testbed), cmd, time_out = None) execute_command(testbed, ops_server(testbed),'rm ' + dest_file_name) - log_debug("New experiment succesfully created.") + print("New experiment succesfully created.") def generate_ns_script(testbed, nodes, p2plinks): ''' @@ -242,7 +234,7 @@ def wait_until_nodes_up(testbed): @param testbed: testbed info ''' - log_debug("Waiting until all nodes are up") + print("Waiting until all nodes are up") cmd = '/usr/testbed/bin/script_wrapper.py expinfo -e' + \ testbed.proj_name + \ @@ -258,7 +250,7 @@ def wait_until_nodes_up(testbed): res = execute_command(testbed, ops_server(testbed), cmd) if res == "active": active = True - log_debug("Still waiting") + print("Still waiting") time.sleep(5) def complete_experiment_graph(testbed, nodes, p2plinks): @@ -315,7 +307,7 @@ def setup_vlan(testbed, node_name, vlan_id, int_name): @param vlan_id: the VLAN id @param int_name: the name of the interface ''' - log_debug("Setting up VLAN on node " + node_name) + print("Setting up VLAN on node " + node_name) node_full_name = full_name(node_name, testbed) cmd = "sudo ip link add link " + \ |