def callaps(ap_ip, iterations, iteration_interval): iteration_counter = 0 timestring = time.strftime("%m.%d.%y-%H.%M.%S", time.localtime()) filename = os.path.join("/Users/vsathiam/Documents/LOGS","WAP-sta-top-"+ap_ip+"-"+timestring+".txt") command_string="show top -b -n 1" while iteration_counter < iterations: remote_conn = wap(username = "******", password = "******", ap_ip = ap_ip, timeout = 8) remote_conn.establish_connection() try: output = remote_conn.send_command(command_string) except: print "Unable to send command" return if iteration_counter==0: #remote_conn.writefile(command_string,filename) remote_conn.writefile(ap_ip,filename) try: remote_conn.appendfile(output, filename) except: print "Unable to append output to file" return time.sleep(1) remote_conn.disconnect() time.sleep(iteration_interval) iteration_counter += 1 try: csvfile = remote_conn.parse_file_process(filename) except: print "Unable to parse file" return remote_conn.generate_chart(csvfile, ap_ip)
def apiniticpu(ap_ip, commands): remote_conn = wap(username = "******", password = "******", ap_ip =ap_ip, timeout = 8) remote_conn.establish_connection() for command_string in commands: try: output = remote_conn.send_command(command_string) except: print "Unable to send command:", command_string
def apiniticpu(ap_ip, commands): remote_conn = wap(username="******", password="******", ap_ip=ap_ip, timeout=8) remote_conn.establish_connection() for command_string in commands: try: output = remote_conn.send_command(command_string) except: print "Unable to send command:", command_string