def call_get(index): loop = int(lis[index + 1]) for number in range(loop): if lis[index] == "get": print "\n..................Going to GET Device Information..............." mysql_py.mysql_Truncate_Table("DM_GET") #time.sleep(3) #print "Available Devices for GET" Discover_List = mysql_py.mysql_Fetch_Discover() if len(Discover_List) > 0: for inputHandle in Discover_List: # inputHandle = raw_input("input handle to get data : ") # print "GET the device Information for Handle: ",inputHandle # time.sleep(10) fun.VITA_DM_Get(inputHandle, fun.user_get_callback) time.sleep(5) mysql_py.mysql_Fetch_Handle("DM_GET", inputHandle) # time.sleep(5) else: raise Exception( "Error:No resource found for getting device info") else: print "..................wrong get called ................." sys.exit(0)
def call_observe(index): loop = int(lis[index + 1]) print "************************************" print " Observe called " print "************************************" mysql_py.mysql_Truncate_Table("DM_Observe") for number in range(loop): if lis[index] == "observe": Discover_List = mysql_py.mysql_Fetch_Discover() if len(Discover_List) > 0: for inputHandle in Discover_List: #mysql_py.mysql_Delet_old_Observe(inputHandle) #time.sleep(10) print "\n observe called for Handle :", inputHandle fun.VITA_DM_Observe(inputHandle, fun.user_observe_callback, 0) time.sleep(5) mysql_py.mysql_Fetch_Handle("DM_Observe", inputHandle) else: raise Exception("No resources for observe" + str(lis)) else: print "..................wrong observe called ................." VITA_TL_Send(W_Observe) sys.exit(0)
def call_discover(index): loop = int(lis[index + 1]) # print "length: ", loop for number in range(loop): if lis[index] == "discover": print "Delete All Tables before Discovering Devices ", number mysql_py.mysql_Truncate_Table("DM_Discover") mysql_py.mysql_Truncate_Table("DM_GET") mysql_py.mysql_Truncate_Table("DM_Observe") time.sleep(3) fun.VITA_DM_Discover(fun.user_discover_callback) print "in sleep in python after discovery" for sec in range(5): time.sleep(1) Discover_List = mysql_py.mysql_Fetch_Discover() # time.sleep(5) else: print "..................wrong discover called ................." sys.exit(0) if len(Discover_List) > 0: pass else: raise Exception('Resources not found ' + str(lis))