def InitProcess(my_manager,pruned_GN_Nodes,pruned_MP_Nodes,USERURN,email_id,user_password_for_drupal,SLICEURN,dpadmin_username,dpadmin_passwd,slice_crypt,pKey): # STEP 1: Check nodes for OS Compatibilty msg = "Checking if Nodes at AM --> "+my_manager+" for \n"+"1. Check if Global Node Present\n2. Find Nodes to be monitored by GEMINI\n3. OS Compatibility of selected Nodes" gemini_util.write_to_log(msg,gemini_util.printtoscreen) (result,msg) = gemini_util.precheckNodes(pruned_GN_Nodes[0],pruned_MP_Nodes,pKey) if(result): msg = "All nodes at AM --> "+my_manager+" are GEMINI capable.\nWill proceed with the GENI Desktop Init Process" gemini_util.write_to_log(msg,gemini_util.printtoscreen) else: msg = "ERROR @ {"+my_manager+"} :: "+msg gemini_util.write_to_log(msg,gemini_util.printtoscreen) sys.exit(1) (status,msg) = gemini_util.lock_unlock_MC(pruned_GN_Nodes[0],"init_lock",pKey) msg = "["+my_manager+"] "+msg if(not status): msg = msg + "\nConfiguring next AM if available" gemini_util.write_to_log(msg,gemini_util.printtoscreen) return else: gemini_util.write_to_log(msg,gemini_util.printtoscreen) #Place on the GN Node - DRUPAL_ADMIN_PASSWORD , userurn , sliceurn , slicename, cmurn, cmhrn , vnc_passwd, topinfo, portal_public_key (result,msg) = gemini_util.dump_Expinfo_on_GN(pruned_GN_Nodes[0],USERURN,email_id,user_password_for_drupal,SLICEURN,my_manager,dpadmin_username,dpadmin_passwd,slice_crypt,pKey) if(result): msg = "GN that monitors MP Nodes at "+my_manager+" has all the Exp info it needs. Will now proceed with the Initialization process." gemini_util.write_to_log(msg,gemini_util.printtoscreen) else: msg = "GN ERROR @ {"+my_manager+"} :: while placing Exp info "+str(msg) gemini_util.write_to_log(msg,gemini_util.printtoscreen) sys.exit(1) # STEP 2 : Download Passive measurement scripts and start ssh-key generator on the GN # STEP 2b : Save MC public key onto a file pn GN, fetch it from the GN and place it on all MP Nodes # STEP 3 : Install Shell in a box on all nodes and generate the Shellinabox config (result,msg) = gemini_util.install_keys_plus_shell_in_a_box(pruned_GN_Nodes[0],pruned_MP_Nodes,pKey) if(result): msg = "All nodes at AM --> "+my_manager+" have been Initialized." gemini_util.write_to_log(msg,gemini_util.printtoscreen) else: msg = "ERROR @ {"+my_manager+"} :: during Initialization "+str(msg) gemini_util.write_to_log(msg,gemini_util.printtoscreen) sys.exit(1) return
# Do all instrumentation stuff here. # and intrument. dp_username = "******" dp_passwd = gemini_util.random_password() m = hashlib.sha1(PassPhraseCB(1)) password = m.hexdigest() crypt_passwd = gemini_util.generate_crypt_passwd(password,LOGFILE,debug) for my_manager in managers_to_monitor: # Check if GN Node startup scripts have completed # If its not yet started, it will do that too. (status,msg) = gemini_util.lock_unlock_MC(my_manager["GN_sliver_urn"],"lock",username,LOGFILE,keyfile,debug) if(not status): msg = msg + "Configuring next AM \n" gemini_util.write_to_log(LOGFILE,msg,gemini_util.printtoscreen,debug) continue else: gemini_util.write_to_log(LOGFILE,msg,gemini_util.printtoscreen,debug) annotated_manifest = gemini_util.addNodeLocation(my_manager["manifest_dom"],my_manager["manifest_version"],my_manager["urn"],my_manager["node_location_array"],LOGFILE,debug) gemini_util.copy_manifest_to_MC(annotated_manifest,my_manager["GN_sliver_urn"],username,LOGFILE,keyfile,debug ) gemini_util.send_to_instools_portal(my_manager["GN_sliver_urn"],username,crypt_passwd,password,email_id,my_manager["urn"],my_manager["hrn"],SLICENAME,CERT_ISSUER,LOGFILE,keyfile,debug) gemini_util.update_Drupaladmin_acctinfo(my_manager["GN_sliver_urn"],username,dp_username,dp_passwd,LOGFILE,keyfile,debug) rval = gemini_util.setupkeys (my_manager["nodes_sliver_urn"],username,my_manager["GN_sliver_urn"],my_manager["GN_isVirtual"], debug, LOGFILE,keyfile) gemini_util.startStatscollection(my_manager["urn"],my_manager["hrn"],SLICEURN,USERURN,my_manager["GN_sliver_urn"],username,LOGFILE,keyfile,debug )
# STEP 1: Check nodes for OS Compatibilty pruned_GN_Nodes = gemini_util.pruneNodes(GN_Nodes,my_manager,'GN',LOGFILE,debug) if (len(pruned_GN_Nodes) == 0): msg = "No GN Nodes that monitor MP Nodes at AM = "+my_manager+" present. Continuing with the next AM if available" gemini_util.write_to_log(LOGFILE,msg,gemini_util.printtoscreen,debug) continue if (len(pruned_GN_Nodes) > 1): msg = "Multiple GN Nodes that monitor MP Nodes at AM = "+my_manager+" present . This is not supported yet" gemini_util.write_to_log(LOGFILE,msg,gemini_util.printtoscreen,debug) sys.exit(1) pruned_MP_Nodes = gemini_util.pruneNodes(MP_Nodes,my_manager,'',LOGFILE,debug) # This lock will also install sftware needed for Passive measurements on GN which cannot be done in parallel # with any other operations (status,msg) = gemini_util.lock_unlock_MC(pruned_GN_Nodes[0],"install_lock",LOGFILE,keyfile,debug) if(not status): msg = msg + "\nConfiguring next AM if available" gemini_util.write_to_log(LOGFILE,msg,gemini_util.printtoscreen,debug) continue else: gemini_util.write_to_log(LOGFILE,msg,gemini_util.printtoscreen,debug) # This lock will just set a flag on the GN to indicate the beginning of the configuration process (status,msg) = gemini_util.lock_unlock_MC(pruned_GN_Nodes[0],"instrument_lock",LOGFILE,keyfile,debug) if(not status): msg = msg + "\nConfiguring next AM if available" gemini_util.write_to_log(LOGFILE,msg,gemini_util.printtoscreen,debug) continue else: gemini_util.write_to_log(LOGFILE,msg,gemini_util.printtoscreen,debug)
def InstrumentizeProcess(my_manager, pruned_GN_Nodes, pruned_MP_Nodes, pKey, gn_ms_proxycert_file, gn_ms_proxykey_file, mp_blipp_proxycert_file, mp_blipp_proxykey_file, USERURN, email_id, SLICEURN, slice_uuid, unis_topo, q): # This lock will also install sftware needed for Passive measurements on GN which cannot be done in parallel # with any other operations (status, msg) = gemini_util.lock_unlock_MC(pruned_GN_Nodes[0], "install_lock", pKey) if (not status): msg = msg + "\nConfiguring next AM if available" gemini_util.write_to_log(msg, gemini_util.printtoscreen) q.put("done_flag") return else: gemini_util.write_to_log(msg, gemini_util.printtoscreen) # This lock will just set a flag on the GN to indicate the beginning of the configuration process (status, msg) = gemini_util.lock_unlock_MC(pruned_GN_Nodes[0], "instrument_lock", pKey) if (not status): msg = msg + "\nConfiguring next AM if available" gemini_util.write_to_log(msg, gemini_util.printtoscreen) q.put("done_flag") else: gemini_util.write_to_log(msg, gemini_util.printtoscreen) (status, msg) = gemini_util.update_Drupaladmin_acctinfo(pruned_GN_Nodes[0], pKey) if (not status): msg = msg + "\nERROR @ {" + my_manager + "} :: Problem updating Drupal Admin AccInfo\nYour Gemini configuration will not work\nPlease abort and contact GEMINI Dev Team for help\n" gemini_util.write_to_log(msg, gemini_util.printtoscreen) sys.exit(1) msg = "Installing and configuring MP Nodes for Passive Measurements at " + my_manager gemini_util.write_to_log(msg, gemini_util.printtoscreen) gemini_util.InstallMP_Passive(pruned_MP_Nodes, pruned_GN_Nodes[0], pKey) msg = "Starting Passive Measurements Data Collection for MP Nodes at " + my_manager gemini_util.write_to_log(msg, gemini_util.printtoscreen) (status, msg) = gemini_util.startStatscollection(pruned_GN_Nodes[0], pKey) if (not status): msg = msg + "\nERROR @ {" + my_manager + "} :: Problem starting Passive measurement data collection\nYour Gemini configuration will not work\nPlease abort and contact GEMINI Dev Team for help\n" gemini_util.write_to_log(msg, gemini_util.printtoscreen) sys.exit(1) gemini_util.do_netflow_stuff(pruned_GN_Nodes[0], 'init', pKey) # gemini_util.do_netflow_stuff(pruned_GN_Nodes[0],'start',keyfile) gemini_util.vnc_passwd_create(pruned_MP_Nodes, pruned_GN_Nodes[0], pKey) gemini_util.drupal_account_create(pruned_GN_Nodes[0], pKey) if (not gemini_util.DISABLE_ACTIVE): msg = "Installing Proxy Certificates for nodes at " + my_manager gemini_util.write_to_log(msg, gemini_util.printtoscreen) gemini_util.install_GN_Certs(pruned_GN_Nodes, pKey, gn_ms_proxycert_file, gn_ms_proxykey_file) gemini_util.install_MP_Certs(pruned_MP_Nodes, pKey, mp_blipp_proxycert_file, mp_blipp_proxykey_file) if (not gemini_util.DISABLE_ACTIVE): msg = "Creating BLiPP service configurations, sending to UNIS for nodes at " + my_manager gemini_util.write_to_log(msg, gemini_util.printtoscreen) gemini_util.createBlippServiceEntries(pruned_MP_Nodes, pruned_GN_Nodes[0], unis_topo[my_manager], slice_uuid) msg = "Installing and configuring MP Nodes for Active Measurements at " + my_manager gemini_util.write_to_log(msg, gemini_util.printtoscreen) #gemini_util.install_Active_measurements(pruned_MP_Nodes,pruned_GN_Nodes[0],USERURN,SLICEURN,slice_uuid,unis_topo[my_manager],LAMPCERT,pKey) gemini_util.install_Active_measurements(pruned_MP_Nodes, pruned_GN_Nodes[0], USERURN, SLICEURN, slice_uuid, unis_topo[my_manager], pKey) gemini_util.initialize_Drupal_menu(pruned_GN_Nodes[0], pKey) # This is just to make sure we have the right user info who instrumented the slice # A scenario here is in case of a shared slice where one user initializes the slice and another instruments it. (result, msg) = gemini_util.dump_Expinfo_on_GN(pruned_GN_Nodes[0], USERURN, email_id, '', '', '', '', '', '', pKey) # Unlock the GN (status, msg) = gemini_util.lock_unlock_MC(pruned_GN_Nodes[0], "instrument_unlock", pKey) if (not status): msg = msg + "\nERROR @ {" + my_manager + "} :: Problem unlocking\nYour Gemini configuration will not work\nPlease abort and contact GEMINI Dev Team for help\n" gemini_util.write_to_log(msg, gemini_util.printtoscreen) sys.exit(1) return
def InstrumentizeProcess(my_manager,pruned_GN_Nodes,pruned_MP_Nodes,pKey,gn_ms_proxycert_file,gn_ms_proxykey_file,mp_blipp_proxycert_file,mp_blipp_proxykey_file,USERURN,email_id,SLICEURN,slice_uuid,unis_topo,q): # This lock will also install sftware needed for Passive measurements on GN which cannot be done in parallel # with any other operations (status,msg) = gemini_util.lock_unlock_MC(pruned_GN_Nodes[0],"install_lock",pKey) if(not status): msg = msg + "\nConfiguring next AM if available" gemini_util.write_to_log(msg,gemini_util.printtoscreen) q.put("done_flag") return else: gemini_util.write_to_log(msg,gemini_util.printtoscreen) # This lock will just set a flag on the GN to indicate the beginning of the configuration process (status,msg) = gemini_util.lock_unlock_MC(pruned_GN_Nodes[0],"instrument_lock",pKey) if(not status): msg = msg + "\nConfiguring next AM if available" gemini_util.write_to_log(msg,gemini_util.printtoscreen) q.put("done_flag") else: gemini_util.write_to_log(msg,gemini_util.printtoscreen) (status,msg) = gemini_util.update_Drupaladmin_acctinfo(pruned_GN_Nodes[0],pKey) if(not status): msg = msg + "\nERROR @ {"+my_manager+"} :: Problem updating Drupal Admin AccInfo\nYour Gemini configuration will not work\nPlease abort and contact GEMINI Dev Team for help\n" gemini_util.write_to_log(msg,gemini_util.printtoscreen) sys.exit(1) msg = "Installing and configuring MP Nodes for Passive Measurements at "+my_manager gemini_util.write_to_log(msg,gemini_util.printtoscreen) gemini_util.InstallMP_Passive (pruned_MP_Nodes,pruned_GN_Nodes[0],pKey) msg = "Starting Passive Measurements Data Collection for MP Nodes at "+my_manager gemini_util.write_to_log(msg,gemini_util.printtoscreen) (status,msg) = gemini_util.startStatscollection(pruned_GN_Nodes[0],pKey) if(not status): msg = msg + "\nERROR @ {"+my_manager+"} :: Problem starting Passive measurement data collection\nYour Gemini configuration will not work\nPlease abort and contact GEMINI Dev Team for help\n" gemini_util.write_to_log(msg,gemini_util.printtoscreen) sys.exit(1) gemini_util.do_netflow_stuff(pruned_GN_Nodes[0],'init',pKey) # gemini_util.do_netflow_stuff(pruned_GN_Nodes[0],'start',keyfile) gemini_util.vnc_passwd_create(pruned_MP_Nodes,pruned_GN_Nodes[0],pKey) gemini_util.drupal_account_create(pruned_GN_Nodes[0],pKey) if(not gemini_util.DISABLE_ACTIVE): msg = "Installing Proxy Certificates for nodes at "+my_manager gemini_util.write_to_log(msg,gemini_util.printtoscreen) gemini_util.install_GN_Certs(pruned_GN_Nodes,pKey,gn_ms_proxycert_file,gn_ms_proxykey_file) gemini_util.install_MP_Certs(pruned_MP_Nodes,pKey,mp_blipp_proxycert_file,mp_blipp_proxykey_file) if(not gemini_util.DISABLE_ACTIVE): msg = "Creating BLiPP service configurations, sending to UNIS for nodes at "+my_manager gemini_util.write_to_log(msg,gemini_util.printtoscreen) gemini_util.createBlippServiceEntries(pruned_MP_Nodes,pruned_GN_Nodes[0],unis_topo[my_manager],slice_uuid) msg = "Installing and configuring MP Nodes for Active Measurements at "+my_manager gemini_util.write_to_log(msg,gemini_util.printtoscreen) #gemini_util.install_Active_measurements(pruned_MP_Nodes,pruned_GN_Nodes[0],USERURN,SLICEURN,slice_uuid,unis_topo[my_manager],LAMPCERT,pKey) gemini_util.install_Active_measurements(pruned_MP_Nodes,pruned_GN_Nodes[0],USERURN,SLICEURN,slice_uuid,unis_topo[my_manager],pKey) gemini_util.initialize_Drupal_menu(pruned_GN_Nodes[0],pKey) # This is just to make sure we have the right user info who instrumented the slice # A scenario here is in case of a shared slice where one user initializes the slice and another instruments it. (result,msg) = gemini_util.dump_Expinfo_on_GN(pruned_GN_Nodes[0],USERURN,email_id,'','','','','','',pKey) # Unlock the GN (status,msg) = gemini_util.lock_unlock_MC(pruned_GN_Nodes[0],"instrument_unlock",pKey) if(not status): msg = msg + "\nERROR @ {"+my_manager+"} :: Problem unlocking\nYour Gemini configuration will not work\nPlease abort and contact GEMINI Dev Team for help\n" gemini_util.write_to_log(msg,gemini_util.printtoscreen) sys.exit(1) return
def InitProcess(my_manager, pruned_GN_Nodes, pruned_MP_Nodes, USERURN, email_id, user_password_for_drupal, SLICEURN, dpadmin_username, dpadmin_passwd, slice_crypt, pKey): # STEP 1: Check nodes for OS Compatibilty msg = "Checking if Nodes at AM --> " + my_manager + " for \n" + "1. Check if Global Node Present\n2. Find Nodes to be monitored by GEMINI\n3. OS Compatibility of selected Nodes" gemini_util.write_to_log(msg, gemini_util.printtoscreen) (result, msg) = gemini_util.precheckNodes(pruned_GN_Nodes[0], pruned_MP_Nodes, pKey) if (result): msg = "All nodes at AM --> " + my_manager + " are GEMINI capable.\nWill proceed with the GENI Desktop Init Process" gemini_util.write_to_log(msg, gemini_util.printtoscreen) else: msg = "ERROR @ {" + my_manager + "} :: " + msg gemini_util.write_to_log(msg, gemini_util.printtoscreen) sys.exit(1) (status, msg) = gemini_util.lock_unlock_MC(pruned_GN_Nodes[0], "init_lock", pKey) msg = "[" + my_manager + "] " + msg if (not status): msg = msg + "\nConfiguring next AM if available" gemini_util.write_to_log(msg, gemini_util.printtoscreen) return else: gemini_util.write_to_log(msg, gemini_util.printtoscreen) #Place on the GN Node - DRUPAL_ADMIN_PASSWORD , userurn , sliceurn , slicename, cmurn, cmhrn , vnc_passwd, topinfo, portal_public_key (result, msg) = gemini_util.dump_Expinfo_on_GN(pruned_GN_Nodes[0], USERURN, email_id, user_password_for_drupal, SLICEURN, my_manager, dpadmin_username, dpadmin_passwd, slice_crypt, pKey) if (result): msg = "GN that monitors MP Nodes at " + my_manager + " has all the Exp info it needs. Will now proceed with the Initialization process." gemini_util.write_to_log(msg, gemini_util.printtoscreen) else: msg = "GN ERROR @ {" + my_manager + "} :: while placing Exp info " + str( msg) gemini_util.write_to_log(msg, gemini_util.printtoscreen) sys.exit(1) # STEP 2 : Download Passive measurement scripts and start ssh-key generator on the GN # STEP 2b : Save MC public key onto a file pn GN, fetch it from the GN and place it on all MP Nodes # STEP 3 : Install Shell in a box on all nodes and generate the Shellinabox config (result, msg) = gemini_util.install_keys_plus_shell_in_a_box( pruned_GN_Nodes[0], pruned_MP_Nodes, pKey) if (result): msg = "All nodes at AM --> " + my_manager + " have been Initialized." gemini_util.write_to_log(msg, gemini_util.printtoscreen) else: msg = "ERROR @ {" + my_manager + "} :: during Initialization " + str( msg) gemini_util.write_to_log(msg, gemini_util.printtoscreen) sys.exit(1) return
# Repeat the loop for each CM # Create all required directories for the INSTOOLS Code if needed. # Do all instrumentation stuff here. # and intrument. dp_username = "******" dp_passwd = gemini_util.random_password() m = hashlib.sha1(PassPhraseCB(1)) password = m.hexdigest() crypt_passwd = gemini_util.generate_crypt_passwd(password, LOGFILE, debug) for my_manager in managers_to_monitor: # Check if GN Node startup scripts have completed # If its not yet started, it will do that too. (status, msg) = gemini_util.lock_unlock_MC(my_manager["GN_sliver_urn"], "lock", username, LOGFILE, keyfile, debug) if (not status): msg = msg + "Configuring next AM \n" gemini_util.write_to_log(LOGFILE, msg, gemini_util.printtoscreen, debug) continue else: gemini_util.write_to_log(LOGFILE, msg, gemini_util.printtoscreen, debug) annotated_manifest = gemini_util.addNodeLocation( my_manager["manifest_dom"], my_manager["manifest_version"], my_manager["urn"], my_manager["node_location_array"], LOGFILE, debug) gemini_util.copy_manifest_to_MC(annotated_manifest, my_manager["GN_sliver_urn"], username,