# used to send configuration requests
# to the dummynet box.
DBOX_KNOWN_HOSTS="/var/tmp/.dbox_known_hosts"
+DBOX_KEY="/usr/share/dummynet/dbox_key"
DEFAULT_TIMEOUT= "1H"
SSH = "ssh -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=yes ";
SSH += "-o UserKnownHostsFile=" + "'"+DBOX_KNOWN_HOSTS+"'" + " ";
- # use the right key, we need
- # apache:apache key when called from python,
- # root:root when called from php or plcsh
- DBOX_KEY="/usr/share/dummynet/dbox_key"
- id = os.popen("id -u").read()
- id = int(id)
- if (id != 0):
- DBOX_KEY += "_apache";
-
# the ssh command takes as input
# the node_ip, the slicename, the port number
# a timeout and a filename (0 don't upload)
cmd_line += " noerror"
# send the command to the dummynetbox
+ # get output and return code
command = os.popen(cmd_line);
output = command.read();
ret = str(command.close());
+
if (ret == "None"):
- ret = cmd_line + "Command executed"
- return "OK " + ret + "\n" + output
+ ret = "0"
else:
- ret = "Some errors occurred, a detailed description of the output follows"
- return cmd_line + "ERROR " + ret + "\n" + output
+ ret = "1"
+
+ ret += " \n" + output
return ret