def main(): try: optlist, args = getopt.getopt(sys.argv[1:], "", ["debug", "port="]) port = 10000 debug = False for k,v in optlist: if k == "--port": port = int(v) elif k == "--debug": debug = True except: print usage return nodes = crawl.crawl(port, debug = debug) print crawl.check_results(nodes) for task in tasks: print task.run(port, nodes, debug)
def run(self): """ deploys bundled basicnode module to plab nodes using plab_assistant. crawls the ring continuously for 48 hours and then gathers logs. """ plab = plab_assistant.plab_assistant("install", nodes=None, username=self.slice_name, \ path_to_files=self.path_to_files, ssh_key=self.ssh_key) plab.run() os.chdir(self.base_path + "/node") os.system("sed 's/<Enabled>false/<Enabled>true/' -i node.config." + self.slice_name) # start local basicnode without cronolog... start_basicnode = "./basicnode node.config." + self.slice_name + " &> log &" p = subprocess.Popen(start_basicnode.split(' ')) self.local_basicnode_pid = p.pid time.sleep(60) os.chdir(self.base_path) start_utc = datetime.datetime.utcnow() test_length = datetime.timedelta(hours=48) content = open("node/node.config." + self.slice_name).read() port_line = re.search("<XmlRpcManager>.*</XmlRpcManager>", content, re.S).group() port = int(re.search("\d+", port_line).group()) while datetime.datetime.utcnow() - start_utc < test_length: nodes = crawl.crawl(port) consistency, count = crawl.check_results(nodes) os.chdir(self.base_path) f = open("crawl.csv", "a") f.write( str(time.asctime()) + ", " + str(consistency) + ", " + str(count) + "\n") f.close() time.sleep(60 * 15) # done with the test, start getting logs and cleaning up. plab = plab_assistant.plab_assistant("get_logs", nodes=None, username=self.slice_name, \ path_to_files=self.path_to_files, ssh_key=self.ssh_key) plab.run() os.system("zip -r9 results.zip logs output.log crawl.csv") # Actually not necessary because installation cleans nodes first. plab = plab_assistant.plab_assistant("uninstall", nodes=None, username=self.slice_name, \ path_to_files=self.path_to_files, ssh_key=self.ssh_key) plab.run() try: os.kill(self.local_basicnode_pid, signal.SIGKILL) except: pass
def run(self): """ deploys bundled basicnode module to plab nodes using plab_assistant. crawls the ring continuously for 48 hours and then gathers logs. """ plab = plab_assistant.plab_assistant("install", nodes=None, username=self.slice_name, \ path_to_files=self.path_to_files, ssh_key=self.ssh_key) plab.run() os.chdir(self.base_path + "/node") os.system("sed 's/<Enabled>false/<Enabled>true/' -i node.config." + self.slice_name) # start local basicnode without cronolog... start_basicnode = "./basicnode node.config." + self.slice_name + " &> log &" p = subprocess.Popen(start_basicnode.split(' ')) self.local_basicnode_pid = p.pid time.sleep(60) os.chdir(self.base_path) start_utc = datetime.datetime.utcnow() test_length = datetime.timedelta(hours = 48) content = open("node/node.config." + self.slice_name).read() port_line = re.search("<XmlRpcManager>.*</XmlRpcManager>", content, re.S).group() port = int(re.search("\d+", port_line).group()) while datetime.datetime.utcnow() - start_utc < test_length: nodes = crawl.crawl(port) consistency, count = crawl.check_results(nodes) os.chdir(self.base_path) f = open("crawl.csv", "a") f.write(str(time.asctime()) + ", " + str(consistency) + ", " + str(count) + "\n") f.close() time.sleep(60 * 15) # done with the test, start getting logs and cleaning up. plab = plab_assistant.plab_assistant("get_logs", nodes=None, username=self.slice_name, \ path_to_files=self.path_to_files, ssh_key=self.ssh_key) plab.run() os.system("zip -r9 results.zip logs output.log crawl.csv") # Actually not necessary because installation cleans nodes first. plab = plab_assistant.plab_assistant("uninstall", nodes=None, username=self.slice_name, \ path_to_files=self.path_to_files, ssh_key=self.ssh_key) plab.run() try: os.kill(self.local_basicnode_pid, signal.SIGKILL) except: pass