def test_044_failover_master_check_client_flow(self): u"""failover ap 切换到master ap模式后,当老的master ap回来,确认老master和现在master功能正常(testlink_ID:2403)""" log.debug("044") tmp = APSBusiness(self.driver) #登录failover ap的web界面 tmp.login_failover_ap(data_basic['slave_web2'], data_basic['superUser'], data_login['all']) #现在的master ap解除slave ap1的配对 tmp.unpair_special_slave_AP_backup(data_AP["slave:mac1"]) #开启master ap的controller tmp.open_master_controller(data_basic['DUT_ip'], data_basic['sshUser'], data_login['all']) time.sleep(60) #无线网卡连接现在的master ap result1 = tmp.connect_WPA_AP(data_ng['NG2_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc']) #无线网卡连接老的master ap result2 = tmp.connect_WPA_AP(data_wireless['all_ssid'], data_wireless['short_wpa'], data_basic['wlan_pc']) #该ap恢复出厂配置 tmp2 = UpgradeBusiness(self.driver) tmp2.web_factory_reset_backup(data_basic['slave_ip2']) #删除7000新建的网络组 tmp2 = NGBusiness(self.driver) tmp2.mixed_7000_del_NG() self.assertIn(data_ng['NG2_ssid'], result1) self.assertIn(data_wireless['all_ssid'], result2), "after failover change to master check client traffic,test fail!" print "after failover change to master check client traffic,test pass!"
def test_055_reboot_failover_switching(self): u"""指定failover ap,并断开master ap后,10分钟内,重启failover ap(testlink_ID:2413)""" log.debug("055") tmp = APSBusiness(self.driver) #设置slave ap2为failover ap tmp.change_slave_to_failover(data_AP["slave:mac2"]) #master ap关闭controller tmp.close_master_controller(data_basic['DUT_ip'], data_basic['sshUser'], data_login['all']) #等待1分钟 time.sleep(60) #重启failover ap tmp.reboot_router(data_basic['slave_ip2'],data_basic['sshUser'], data_login['all']) #等待3分钟 time.sleep(180) #failover ap依然是slave ap模式 ssh = SSH(data_basic['slave_ip2'], data_login['all']) result = ssh.ssh_cmd(data_basic['sshUser'], "uci show controller.main.role") #等待10分钟 time.sleep(610) #slave ap 变为failover 模式 ssh = SSH(data_basic['slave_ip2'], data_login['all']) result1 = ssh.ssh_cmd(data_basic['sshUser'], "uci show controller.main.role") result2 = ssh.ssh_cmd(data_basic['sshUser'], "uci show controller.main.failover") #登录failover ap的web界面 tmp.login_failover_ap(data_basic['slave_web2'], "failover", data_login['all']) #设置failover ap为master ap tmp.change_failover_to_master() result3 = ssh.ssh_cmd(data_basic['sshUser'], "uci show controller.main.role") result4 = ssh.ssh_cmd(data_basic['sshUser'], "uci show controller.main.failover") #登录failover ap的web界面 tmp.login_failover_ap(data_basic['slave_web2'], data_basic['superUser'], data_login['all']) #该ap恢复出厂配置 tmp2 = UpgradeBusiness(self.driver) tmp2.web_factory_reset_backup(data_basic['slave_ip2']) #开启master ap的controller tmp.open_master_controller(data_basic['DUT_ip'], data_basic['sshUser'], data_login['all']) time.sleep(60) self.assertIn("master", result1) self.assertIn("1", result2) self.assertIn("master", result3) self.assertIn("Entry not found", result4) self.assertIn("slave", result), "reboot failover ap, test fail!" print "reboot failover ap, test pass!"
def test_001_factory_reset(self): u"""登录路由后台把AP恢复出厂设置""" log.debug("001") #逻辑类对象,建一个实例 Lg = LoginBusiness(self.driver) #调用实例的登录GWN7610的web界面 Lg.login(data_basic['superUser'],data_login['all']) Lg.login_again() tmp = UpgradeBusiness(self.driver) tmp.web_factory_reset_backup(data_basic['DUT_ip']) time.sleep(30) #登录AP后台取出管理员密码 tmp1 = SSH(data_basic['DUT_ip'],data_basic['super_defalut_pwd']) result = tmp1.ssh_cmd(data_basic['sshUser'],"uci show grandstream.general.admin_password") print result #描述:启用无线网卡 tmp.wlan_enable(data_basic['wlan_pc']) assert "='admin'" in result,"reset the AP defalut config in ssh,fail!" print "reset the AP defalut config in ssh,pass!"
def test_028_failover_master_can_discover_ap(self): u"""failover ap 切换到master ap模式后,能够发现未匹配的ap(testlink_ID:2377)""" log.debug("028") tmp = APSBusiness(self.driver) #登录failover ap的web界面 tmp.login_failover_ap(data_basic['slave_web2'], data_basic['superUser'], data_login['all']) #搜索AP并判断,是否正确--backup result1 = tmp.search_AP_backup(data_AP["slave:mac1"]) time.sleep(60) #搜索AP并配对并判断是否配对成功 result2 = tmp.check_search_pair_special_AP(data_basic['slave_ip2'], data_basic['sshUser'], data_login['all'], data_AP["slave:mac1"]) #该ap恢复出厂配置 tmp1 = UpgradeBusiness(self.driver) tmp1.web_factory_reset_backup(data_basic['slave_ip2']) self.assertTrue(result1) self.assertTrue(result2), "after failover change to master can discover and pair ap, test fail!" print "after failover change to master can discover pair ap, test pass!"
def test_056_check_fallback_IP_function(self): u"""disable/enable dhcp server when GWN76xx is in unpaired status,fallback IP works fine(testlink_ID:2335,2343)""" log.debug("056") #修改7000网络组的dhcp ipv4的租期时间为2分钟 tmp = NGBusiness(self.driver) tmp.wlan_disable(data_basic['wlan_pc']) tmp.mixed_7000_dhcp_lease_time("2m") #先退出7000的登录 tmp2 = NavbarBusiness(self.driver) tmp2.logout() #打开master ap的web页面 self.driver.get(data_basic['DUT_web']) self.driver.implicitly_wait(10) time.sleep(10) #在页面上把master AP恢复出厂设置 tmp1 = UpgradeBusiness(self.driver) tmp1.web_factory_reset_backup(data_basic['DUT_ip']) #disable/enable dhcp server when GWN76xx is in unpaired status,fallback IP works fine result1,result2 = tmp.check_fallback_IP_function("192.168.1.2", data_basic['DUT_ip'],data_basic['sshUser'],data_basic["super_defalut_pwd"]) #先退出7000的登录 tmp2.logout() #修改7000网络组的dhcp ipv4的租期时间为12h tmp.mixed_7000_dhcp_lease_time("12h") #pc有线网卡释放ip tmp.dhcp_release_wlan(data_basic['lan_pc']) #pc有线网卡重新获取ip tmp.dhcp_wlan(data_basic['lan_pc']) #测试完毕,禁用无线网卡,使pc能够上网 tmp.dhcp_release_wlan(data_basic['wlan_pc']) tmp.disconnect_ap() tmp.wlan_disable(data_basic['wlan_pc']) #rsyslog服务器完成工作 tmp.finish_rsyslog("Failover") self.assertTrue(result1) self.assertTrue(result2), "dis/enable dhcp server,check fallback ip,test fail!" print "dis/enable dhcp server,check fallback ip,test pass!"