def main(nstext, exp): # check the ns file for errors (passed,message) = remote_emulab.checkNS(nstext) if (not passed): print message print "checkNS failed, please fix the ns file and try again" return # start a new exp in non-batchmode print "starting a new exp..." remote_emulab.startexp(proj,exp,nstext) # wait for the exp to go active # by default times out in 10 minutes print "exp started, waiting for active..." remote_emulab.wait_for_active(proj,exp) #print "now active... getting links" links = remote_emulab.get_links(proj,exp) simple_links = remote_emulab.simplify_links(proj,exp,links)
# specify the exp name, this is unique for any class assignment exp = "lantest" #specify the name of an ns file being used mynsfn = "hello.ns" # EXECUTE A BASIC SENERIO # read the ns file into a string mynsfobj = open(mynsfn) mynsfilestr = mynsfobj.read() mynsfobj.close() # check the ns file for errors (passed,message) = remote_emulab.checkNS(mynsfilestr) # did the parsing fail? if (not passed): print message print "checkNS failed, please fix the ns file and try again" else: # start a new exp in non-batchmode print "starting a new exp..." remote_emulab.startexp(proj,exp,mynsfilestr) # wait for the exp to go active