Ejemplo n.º 1
0
 def check_open_close_many_groups_captive_portal_function(
         self, group0_ssid, group1_ssid, group2_ssid, password, wlan, eth):
     result = []
     tmp1 = SSIDBusiness(self.driver)
     for i in range(2):
         #点击group0的强制门户认证
         #点击三个网络组的强制门户认证
         tmp1.click_many_group_portal(3)
         #使用免认证的规则,访问腾讯首页,判断是否跳转到portal页面
         for j in [group0_ssid, group1_ssid, group2_ssid]:
             result1 = CPBusiness.check_jump_to_No_auth_portal(
                 self, j, password, wlan, eth)
             result.append(result1)
         #测试完成一遍后,再次登录ap页面,为后续循环测试做好准备
         #刷新页面重新登录ap页面
         Lg = LoginBusiness(self.driver)
         Lg.refresh_login_ap()
         time.sleep(30)
     #删除master ap的两个ssid
     tmp1 = SSIDBusiness(self.driver)
     tmp1.del_all_NG()
     #删除7000新建的两个网络组
     tmp2 = NGBusiness(self.driver)
     tmp2.mixed_7000_del_NG()
     print result
     return result
Ejemplo n.º 2
0
 def check_many_group_portal_function(self, group0_ssid, group1_ssid,
                                      group2_ssid, password, wlan, eth):
     result = []
     #7000新建两个网络组,开启dhcp server
     tmp1 = NGBusiness(self.driver)
     tmp1.mixed_7000_new_many_NG(2)
     #76xx上新建1个对应的网络组
     self.driver.get(data_basic['DUT_web'])
     self.driver.implicitly_wait(60)
     self.driver.refresh()
     time.sleep(10)
     tmp3 = SSIDBusiness(self.driver)
     tmp3.new_vlan_ssid(group2_ssid, password, "3")
     #开启三个网络组的强制门户认证
     tmp3.click_ssid_portal(1)
     tmp3.click_ssid_portal(3)
     #master ap加入所有的网络组
     tmp2 = APSBusiness(self.driver)
     tmp2.add_master_to_all_NG()
     #使用免认证的规则,访问腾讯首页,判断是否跳转到portal页面
     for j in [group0_ssid, group1_ssid, group2_ssid]:
         result1 = CPBusiness.check_jump_to_No_auth_portal(
             self, j, password, wlan, eth)
         result.append(result1)
     print result
     return result
Ejemplo n.º 3
0
 def test_014_check_dhcp_gateway_different_ip(self):
     u"""验证网关与接口地址不在同一网段,设置失败(testlink_ID:2469)"""
     log.debug("014")
     tmp = NGBusiness(self.driver)
     result = tmp.check_dhcp_gateway_different_ip("192.168.2.1")
     self.assertTrue(
         result), "check dhcp gateway is different from ap ip, test fail!"
     print "check dhcp gateway is different from ap ip, test pass!"
Ejemplo n.º 4
0
 def test_009_check_dhcp_different_net(self):
     u"""dhcp地址池与接口地址非同一网段(testlink_ID:2464)"""
     log.debug("009")
     #dhcp地址池与接口地址非同一网段
     tmp = NGBusiness(self.driver)
     result = tmp.check_dhcp_start_more_end("192.168.2.1", "192.168.2.254")
     self.assertTrue(result), "check ipv4 dhcp is different net,test fail!"
     print "check ipv4 dhcp is different net,test pass!"
Ejemplo n.º 5
0
 def test_016_check_dhcp_dns_valid(self):
     u"""验证可设置合法格式的dns(testlink_ID:2471)"""
     log.debug("016")
     tmp = NGBusiness(self.driver)
     result1 = tmp.check_dhcp_dns("8.8.8.8")
     result2 = tmp.check_dhcp_dns("114.114.114.114")
     self.assertFalse(result1)
     self.assertFalse(result2), "check ipv4 dhcp dns,test fail!"
     print "check ipv4 dhcp dns,test pass!"
Ejemplo n.º 6
0
 def test_015_check_dhcp_dns_invalid(self):
     u"""验证不可设置非法格式的dns(testlink_ID:2470)"""
     log.debug("015")
     tmp = NGBusiness(self.driver)
     result1 = tmp.check_dhcp_dns("1.1.1.256")
     result2 = tmp.check_dhcp_dns(u"192。168.1.2")
     self.assertTrue(result1)
     self.assertTrue(result2), "check ipv4 dhcp dns,test fail!"
     print "check ipv4 dhcp dns,test pass!"
Ejemplo n.º 7
0
 def test_012_check_dhcp_gateway_invalid(self):
     u"""验证不可设置非法格式网关地址(testlink_ID:2467)"""
     log.debug("012")
     #验证不可设置非法格式网关地址
     tmp = NGBusiness(self.driver)
     result1 = tmp.check_dhcp_gateway("1.1.1.256")
     result2 = tmp.check_dhcp_gateway(u"192。168.1.2")
     self.assertTrue(result1)
     self.assertTrue(result2), "check ipv4 dhcp gateway address,test fail!"
     print "check ipv4 dhcp gateway address,test pass!"
Ejemplo n.º 8
0
 def test_008_check_dhcp_start_more_end(self):
     u"""验证不可设置开始地址大于结束地址(testlink_ID:2463)"""
     log.debug("008")
     #开始地址大于结束地址是否合法
     tmp = NGBusiness(self.driver)
     result = tmp.check_dhcp_start_more_end("192.168.1.100", "192.168.1.99")
     self.assertTrue(
         result
     ), "check ipv4 dhcp start address more than end address,test fail!"
     print "check ipv4 dhcp start address more than end address,test pass!"
Ejemplo n.º 9
0
 def test_006_check_dhcp_end_invalid(self):
     u"""验证不可设置非法的结束地址(testlink_ID:2461)"""
     log.debug("006")
     #验证不可设置非法的结束地址
     tmp = NGBusiness(self.driver)
     result1 = tmp.check_dhcp_end_valid("1.1.1.256")
     result2 = tmp.check_dhcp_end_valid(u"192。168.1.2")
     self.assertTrue(result1)
     self.assertTrue(result2), "check ipv4 dhcp end address,test fail!"
     print "check ipv4 dhcp end address,test pass!"
 def test_008_option43_tftp_downgrade(self):
     u"""测试option 43 tftp降级(testlink_ID:1114_1)"""
     log.debug("008")
     #打开web登录7000,并进入网络组,修改网络组的dhcp选项
     tmp = NGBusiness(self.driver)
     tmp.mixed_7000_dhcp_option("43,B.%s" % data_basic['tftp_old_addr'])
     #重启76xx并取出版本号来判断
     result = tmp.reboot_get_version(data_basic['DUT_ip'],data_basic['sshUser'],\
                     data_login['all'],data_basic['old_version'])
     assert result, "test option43 tftp downgrade,fail!"
     print "test option43 tftp downgrade,pass!"
Ejemplo n.º 11
0
 def test_003_close_ap_dhcp(self):
     u"""验证dhcp关闭功能生效(testlink_ID:2458)"""
     log.debug("003")
     #关闭master ap的dhcp server
     tmp = NGBusiness(self.driver)
     tmp.click_ip4_dhcp()
     #检查是否勾选
     result = tmp.check_ap_dhcp_server()
     self.assertIsNone(
         result), "check ap dhcp server close in webpage,test fail!"
     print "check ap dhcp server close in webpage,test pass!"
 def test_003_option66_tftp_upgrade(self):
     u"""测试option 66 tftp升级(testlink_ID:1110_2)"""
     log.debug("003")
     #打开web登录7000,并进入网络组,修改网络组的dhcp选项
     tmp = NGBusiness(self.driver)
     tmp.mixed_7000_dhcp_option("66,%s" % data_basic['tftp_new_addr'])
     ##重启76xx并取出版本号来判断
     result = tmp.reboot_get_version(data_basic['DUT_ip'],data_basic['sshUser'],\
                     data_login['all'],data_basic['version'])
     assert result, "test option66 tftp upgrade,fail!"
     print "test option66 tftp upgrade,pass!"
 def test_004_option66_http_downgrade(self):
     u"""设置上级GWN7000的配置,测试option 66 http降级(testlink_ID:1110_1)"""
     log.debug("004")
     #打开web登录7000,并进入网络组,修改网络组的dhcp选项
     tmp = NGBusiness(self.driver)
     tmp.mixed_7000_dhcp_option("66,http://%s" %
                                data_basic['http_old_addr'])
     ##重启76xx并取出版本号来判断
     result = tmp.reboot_get_version(data_basic['DUT_ip'],data_basic['sshUser'],\
                     data_login['all'],data_basic['old_version'])
     assert result, "test option66 http downgrade,fail!"
     print "test option66 http downgrade,pass!"
Ejemplo n.º 14
0
 def test_011_check_dhcp_lease_time_valid(self):
     u"""验证可设置合法格式的dhcp租约(testlink_ID:2466)"""
     log.debug("011")
     #合法格式的dhcp的租约
     tmp = NGBusiness(self.driver)
     result1 = tmp.check_dhcp_lease_time("2m")
     result2 = tmp.check_dhcp_lease_time("12h")
     result3 = tmp.check_dhcp_lease_time("1193046h")
     self.assertFalse(result1)
     self.assertFalse(result2)
     self.assertFalse(result3), "check dhcp valid lease time, test fail!"
     print "check dhcp valid lease time, test pass!"
Ejemplo n.º 15
0
 def test_007_check_dhcp_end_valid(self):
     u"""验证可设置合法的结束地址(testlink_ID:2462)"""
     log.debug("007")
     #验证可设置合法的结束地址
     tmp = NGBusiness(self.driver)
     result1 = tmp.check_dhcp_end_valid("10.10.10.1")
     result2 = tmp.check_dhcp_end_valid("172.168.1.1")
     result3 = tmp.check_dhcp_end_valid("192.168.1.1")
     self.assertFalse(result1)
     self.assertFalse(result2)
     self.assertFalse(result3), "check ipv4 dhcp end address,test fail!"
     print "check ipv4 dhcp end address,test pass!"
Ejemplo n.º 16
0
 def test_025_dhcp_least_time_1193046h(self):
     u"""验证设置租期为1193046h,检查配置是否为1193046h(testlink_ID:2480)"""
     log.debug("025")
     tmp = NGBusiness(self.driver)
     #仅仅设置租期为1193046h
     tmp.set_dhcp_lease_time("1193046h")
     #登录后台,检查租期时间
     result = tmp.check_ap_dhcp_lease_time(data_basic['DUT_ip'],
                                           data_basic['sshUser'],
                                           data_login['all'], "1193046h")
     self.assertTrue(result), "check lease time is 1193046h, test fail!"
     print "check lease time is 1193046h, test pass!"
Ejemplo n.º 17
0
 def test_024_dhcp_least_time_2m(self):
     u"""验证设置租期为2m,检查配置是否为2m(testlink_ID:2479)"""
     log.debug("024")
     tmp = NGBusiness(self.driver)
     #仅仅设置租期为2m
     tmp.set_dhcp_lease_time("2m")
     #登录后台,检查租期时间
     result = tmp.check_ap_dhcp_lease_time(data_basic['DUT_ip'],
                                           data_basic['sshUser'],
                                           data_login['all'], "2m")
     self.assertTrue(result), "check lease time is 2m, test fail!"
     print "check lease time is 2m, test pass!"
Ejemplo n.º 18
0
 def test_013_check_dhcp_gateway_valid(self):
     u"""验证可设置合法格式网关地址(testlink_ID:2468)"""
     log.debug("013")
     #验证可设置合法格式网关地址
     tmp = NGBusiness(self.driver)
     result1 = tmp.check_dhcp_gateway("10.10.10.1")
     result2 = tmp.check_dhcp_gateway("172.168.1.1")
     result3 = tmp.check_dhcp_gateway("192.168.1.1")
     self.assertFalse(result1)
     self.assertFalse(result2)
     self.assertFalse(result3), "check ipv4 dhcp gateway address,test fail!"
     print "check ipv4 dhcp gateway address,test pass!"
Ejemplo n.º 19
0
 def test_017_check_ap_dhcp_dns1_dns2(self):
     u"""验证首选和次选dns可设置相同(testlink_ID:2472)"""
     log.debug("017")
     tmp = NGBusiness(self.driver)
     dns = "180.76.76.76"
     #设置首选dns和次选dns
     tmp.set_ap_dhcp_dns1_dns2(dns, dns)
     #验证首选dns和次选dns是否设置成功
     result1, result2 = tmp.check_ap_dhcp_dns1_dns2()
     self.assertEqual(dns, result1)
     self.assertEqual(
         dns, result2), "check dns1 and dns2 can set same, test fail!"
     print "check dns1 and dns2 can set same, test fail!"
Ejemplo n.º 20
0
 def test_010_check_dhcp_lease_time_invalid(self):
     u"""验证不可设置非法格式的dhcp租约(testlink_ID:2465)"""
     log.debug("010")
     #非法格式的dhcp的租约
     tmp = NGBusiness(self.driver)
     result1 = tmp.check_dhcp_lease_time("12")
     result2 = tmp.check_dhcp_lease_time("12H")
     result3 = tmp.check_dhcp_lease_time("12M")
     result4 = tmp.check_dhcp_lease_time("12d")
     self.assertTrue(result1)
     self.assertTrue(result2)
     self.assertTrue(result3)
     self.assertTrue(result4), "check dhcp invalid lease time, test fail!"
     print "check dhcp invalid lease time, test pass!"
Ejemplo n.º 21
0
 def test_041_check_dns_gateway(self):
     u"""验证dns填写网关的地址,客户端可以访问网站(testlink_ID:2507)"""
     log.debug("041")
     tmp = NGBusiness(self.driver)
     #设置首选dns和次选dns-不点击dhcp server
     tmp.set_ap_dns1_dns2(data_basic['7000_ip'], "")
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     result = tmp.get_ping("www.qq.com")
     tmp.set_ap_dns1_dns2("180.76.76.76", "223.5.5.5")
     self.assertEqual(result, 0), "check set dsn to gateway,test fail!"
     print "check set dsn to gateway,test pass!"
Ejemplo n.º 22
0
    def test_021_slaveAP_upload(self):
        u"""AP 上传流量统计的准确性---slave ap(testlink_ID:1195_2)---有概率性bug"""
        log.debug("021")
        NG2_ssid = "%s-2"%data_ng["NG2_ssid"]
        tmp = OVBusiness(self.driver)
        #AP 上传流量统计的准确性---slave ap
        result1,result2 = tmp.check_slaveAP_upload_backup(NG2_ssid,\
                data_wireless["short_wpa"],data_basic['wlan_pc'],data_basic['lan_pc'],
                data_ap["slave:mac2"])
        #删除7000新建的网络组
        tmp1 = NGBusiness(self.driver)
        tmp1.mixed_7000_del_NG()

        assert ("MB" in result1) or ("GB" in result1),"check slave ap upload fail!"
        print "check slave ap upload pass!"
Ejemplo n.º 23
0
 def test_002_open_ap_dhcp(self):
     u"""验证dhcp开启功能生效(testlink_ID:2457)"""
     log.debug("002")
     tmp1 = APSBusiness(self.driver)
     #指定master ap为静态ip
     tmp1.set_ap_fixed_ip(data_AP['master:mac'], data_basic['DUT_ip'],
                          data_AP['fixed_netmask'], data_basic['7000_ip'])
     #开启master ap的dhcp server
     tmp = NGBusiness(self.driver)
     tmp.click_ip4_dhcp_server(data_basic['7000_ip'])
     #检查是否勾选
     result = tmp.check_ap_dhcp_server()
     self.assertTrue(
         result), "check ap dhcp server open in webpage,test fail!"
     print "check ap dhcp server open in webpage,test pass!"
Ejemplo n.º 24
0
 def test_023_dhcp_least_time_12h(self):
     u"""验证默认租期为12小时,检查配置是否是12小时(testlink_ID:2477)"""
     log.debug("023")
     tmp1 = APSBusiness(self.driver)
     #master ap为子网掩码改回
     tmp1.set_ap_fixed_ip_backup(data_AP['master:mac'],
                                 data_basic['DUT_ip'],
                                 data_AP['fixed_netmask'],
                                 data_basic['7000_ip'])
     tmp = NGBusiness(self.driver)
     #登录后台,检查租期时间
     result = tmp.check_ap_dhcp_lease_time(data_basic['DUT_ip'],
                                           data_basic['sshUser'],
                                           data_login['all'], "12h")
     self.assertTrue(result), "check default lease time is 12h, test fail!"
     print "check default lease time is 12h, test pass!"
Ejemplo n.º 25
0
    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!"
Ejemplo n.º 26
0
 def test_027_dhcp_close_function(self):
     u"""验证关闭dhcp功能后,网络终端无法获取ip(testlink_ID:2484)"""
     log.debug("027")
     tmp = NGBusiness(self.driver)
     #关闭新建网络组的dhcp server
     tmp.click_groupn_dhcp_server(1)
     #无线网卡重新获取ip
     tmp.dhcp_wlan(data_basic['wlan_pc'])
     #ping 网关
     result = tmp.get_ping("192.168.2.1")
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     self.assertNotEqual(result, 0), "disable dhcp server,test fail!"
     print "disable dhcp server,test pass!"
Ejemplo n.º 27
0
 def test_031_ipv4_close_function(self):
     u"""验证关闭ipv4功能,网络终端获取不到ip(testlink_ID:2487)"""
     log.debug("031")
     tmp = NGBusiness(self.driver)
     #关闭新建网络组的ipv4
     tmp.click_groupn_ipv4(1)
     #无线网卡重新获取ip
     tmp.dhcp_wlan(data_basic['wlan_pc'])
     #ping 网关
     result = tmp.get_ping("192.168.2.1")
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     self.assertNotEqual(result, 0), "disable ipv4,test fail!"
     print "disable ipv4,test pass!"
Ejemplo n.º 28
0
 def test_029_open_dhcp_server_again(self):
     u"""验证关闭dhcp功能后再开启,网络终端获取ip(testlink_ID:2486)"""
     log.debug("029")
     tmp = NGBusiness(self.driver)
     #开启新建网络组的dhcp server
     tmp.click_groupn_dhcp_server(1)
     #无线连接新的group
     tmp.connect_DHCP_WPA_AP(data_ng["NG2_ssid"] + "-2",
                             data_wireless["short_wpa"],
                             data_basic['wlan_pc'])
     #获取无线网卡的ip
     result = tmp.get_localIp(data_basic['wlan_pc'])
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     self.assertIn("192.168.2", result), "open dhcp server again,test fail!"
     print "open dhcp server again,test pass!"
Ejemplo n.º 29
0
 def check_client_roaming_expiration(self, ssid, password, wlan, eth, n,
                                     slave_mac):
     #修改过期时间为12min
     CPBusiness.change_portal_rule_expiration(self, n, "720")
     current_time1 = time.strftime('%m-%d %H:%M',
                                   time.localtime(time.time()))
     print "------1:%s" % current_time1
     #client连接master ap,并通过认证-不等待(1s)
     CPBusiness.check_No_auth_portal(self, ssid, password, wlan, eth, 1,
                                     "wpa")
     current_time2 = time.strftime('%m-%d %H:%M',
                                   time.localtime(time.time()))
     print "------2:%s" % current_time2
     #在网络组里面将master ap从group0中移除
     #刷新页面重新登录ap页面
     Lg = LoginBusiness(self.driver)
     Lg.refresh_login_ap()
     tmp1 = NGBusiness(self.driver)
     tmp1.del_all_ap()
     current_time3 = time.strftime('%m-%d %H:%M',
                                   time.localtime(time.time()))
     print "------3:%s" % current_time3
     #slave ap pair并添加到group0
     tmp2 = APSBusiness(self.driver)
     tmp2.search_pair_add_default(slave_mac)
     current_time4 = time.strftime('%m-%d %H:%M',
                                   time.localtime(time.time()))
     print "------4:%s" % current_time4
     #client连接上slave ap,不需要认证
     result1 = CPBusiness.check_jump_to_No_auth_portal(
         self, ssid, password, wlan, eth)
     current_time5 = time.strftime('%m-%d %H:%M',
                                   time.localtime(time.time()))
     print "------5:%s" % current_time5
     #等待过期时间到期后,client需要重新认证
     time.sleep(180)
     current_time6 = time.strftime('%m-%d %H:%M',
                                   time.localtime(time.time()))
     print "------6:%s" % current_time6
     result2 = CPBusiness.check_jump_to_No_auth_portal(
         self, ssid, password, wlan, eth)
     print result1, result2
     return result1, result2
Ejemplo n.º 30
0
 def test_040_check_dns12_valid(self):
     u"""验证填写有效的首选次选dns后,客户端可以访问网站(testlink_ID:2506)"""
     log.debug("040")
     tmp = NGBusiness(self.driver)
     #设置首选dns和次选dns-不点击dhcp server
     tmp.set_ap_dns1_dns2("180.76.76.76", "223.5.5.5")
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     result = tmp.get_ping("www.qq.com")
     self.assertEqual(result, 0), "check only dns1,2,test fail!"
     print "check only dns1,2,test pass!"