Ejemplo n.º 1
0
 def test_012_reboot_ap_check_ssh_password(self):
     u"""设备重启后,SSH登录验证(testlink_ID:1657)"""
     log.debug("012")
     tmp = SettingsBusiness(self.s)
     #获取默认ssh password
     default_ssh_password = tmp.get_ssh_pwd()
     #修改ssh 密码为纯数字
     tmp.set_setting({'sshPassword':"******"})
     time.sleep(60)
     tmp1 = APSBusiness(self.s)
     tmp1.reboot_many_aps(data_ap['7610_mac'], data_ap['7600_mac'], data_ap['7600lr_mac'])
     time.sleep(420)
     #在AP CLI下查看国家默认配置
     result1 = tmp.get_cli_ssh_password(data_basic['7600_ip'],
             data_basic['sshUser'], "abcdefgh")
     result2 = tmp.get_cli_ssh_password(data_basic['7600lr_ip'],
             data_basic['sshUser'], "abcdefgh")
     result3 = tmp.get_cli_ssh_password(data_basic['7610_ip'],
             data_basic['sshUser'], "abcdefgh")
     #把ssh 密码为默认
     tmp.set_setting({'sshPassword':default_ssh_password,
                      'countryDomain':"US"})
     time.sleep(60)
     self.assertIn("abcdefgh", result1)
     self.assertIn("abcdefgh", result2)
     self.assertIn("abcdefgh", result3)
Ejemplo n.º 2
0
 def test_001_Platform_Administrator_add_ap(self):
     u"""平台管理员-能添加ap"""
     log.debug("001")
     tmp1 = NetworkListBusiness(self.s)
     #描述:启用无线网卡
     tmp1.wlan_enable(data_basic['wlan_pc'])
     tmp1.dhcp_release_wlan(data_basic['wlan_pc'])
     #使用用户名密码,带着cookie登录cloud,并返回响应数据
     tmp1.webLogin(data_basic['cloud_user'], data_basic['cloud_pwd'])
     #获取默认网络组default的id
     networkid = tmp1.get_network_id("default")
     time.sleep(60)
     tmp = UserBusiness(self.s)
     #修改测试用户为平台管理员
     tmp.set_user_authority(data_basic['Cloud_test_user'], \
         data_basic['Cloud_test_email'], "Platform Administrator", [networkid])
     time.sleep(60)
     #admin用户退出登录
     tmp.webLogout()
     #使用测试用户登录
     tmp2 = APSBusiness(self.s)
     tmp2.webLogin(data_basic['Cloud_test_user'], data_basic['Cloud_test_pwd'])
     #添加ap-7610
     #将ap复位,并将ap的hosts替换,指向本地cloud,然后将该ap添加到cloud中
     tmp2.add_ap_2_local_cloud(data_basic['7610_ip'], data_ap['7610_mac'], "autotest_7610")
     #cloud上获取该网络组的ssh密码
     tmp3 = SettingsBusiness(self.s)
     ssh_pwd = tmp3.get_ssh_pwd()
     #判断ap是否已经和cloud配对上
     result = tmp2.check_ap_pair_cloud(data_basic['7610_ip'],
                 data_basic['sshUser'], ssh_pwd)
     self.assertTrue(result)
Ejemplo n.º 3
0
 def test_002_add_3_model_aps_2_cloud(self):
     u"""三个netwrok分别添加不同的ap,并判断是否添加成功"""
     log.debug("002")
     tmp = APSBusiness(self.s)
     tmp1 = NetworkListBusiness(self.s)
     tmp2 = SettingsBusiness(self.s)
     #将ap复位,并将ap的hosts替换,指向本地cloud,然后将该ap添加到cloud中
     tmp.add_ap_2_local_cloud(data_basic['7610_ip'], data_ap['7610_mac'],
                              "autotest_7610")
     #cloud上获取该网络组的ssh密码
     ssh_pwd = tmp2.get_ssh_pwd()
     #选择进入group1网络组
     tmp1.goin_network("group1")
     tmp.add_ap_2_local_cloud(data_basic['7600_ip'], data_ap['7600_mac'],
                              "autotest_7600")
     #cloud上获取该网络组的ssh密码
     ssh_pwd1 = tmp2.get_ssh_pwd()
     #选择进入group2网络组
     tmp1.goin_network("group2")
     tmp.add_ap_2_local_cloud(data_basic['7600lr_ip'],
                              data_ap['7600lr_mac'], "autotest_7600lr")
     #cloud上获取该网络组的ssh密码
     ssh_pwd2 = tmp2.get_ssh_pwd()
     #判断ap是否已经和cloud配对上
     result1 = tmp.check_ap_pair_cloud(data_basic['7610_ip'],
                                       data_basic['sshUser'], ssh_pwd)
     result2 = tmp.check_ap_pair_cloud(data_basic['7600_ip'],
                                       data_basic['sshUser'], ssh_pwd1)
     result3 = tmp.check_ap_pair_cloud(data_basic['7600lr_ip'],
                                       data_basic['sshUser'], ssh_pwd2)
     self.assertTrue(result1)
     self.assertTrue(result2)
     self.assertTrue(result3)
     print("add 3 model aps to cloud pass!")
Ejemplo n.º 4
0
 def test_011_error_password(self):
     u"""错误SSH密码登录失败验证(testlink_ID:1653)"""
     log.debug("011")
     tmp = SettingsBusiness(self.s)
     result = tmp.get_cli_ssh_password(data_basic['7600_ip'],
             data_basic['sshUser'], "12345678")
     self.assertNotIn("12345678", result)
Ejemplo n.º 5
0
 def test_001_add_3_model_aps_2_cloud(self):
     u"""cloud添加三种型号的ap,并判断是否添加成功(testlinkID:691-1)"""
     log.debug("001")
     tmp = APSBusiness(self.s)
     #描述:启用无线网卡
     tmp.wlan_enable(data_basic['wlan_pc'])
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     #将ap复位,并将ap的hosts替换,指向本地cloud,然后将该ap添加到cloud中
     tmp.add_ap_2_local_cloud(data_basic['7610_ip'], data_ap['7610_mac'], "autotest_7610")
     tmp.add_ap_2_local_cloud(data_basic['7600_ip'], data_ap['7600_mac'], "autotest_7600")
     tmp.add_ap_2_local_cloud(data_basic['7600lr_ip'], data_ap['7600lr_mac'], "autotest_7600lr")
     #cloud上获取该网络组的ssh密码
     tmp1 = SettingsBusiness(self.s)
     ssh_pwd = tmp1.get_ssh_pwd()
     #判断ap是否已经和cloud配对上
     result1 = tmp.check_ap_pair_cloud(data_basic['7610_ip'],
                 data_basic['sshUser'], ssh_pwd)
     result2 = tmp.check_ap_pair_cloud(data_basic['7600_ip'],
                 data_basic['sshUser'], ssh_pwd)
     result3 = tmp.check_ap_pair_cloud(data_basic['7600lr_ip'],
                 data_basic['sshUser'], ssh_pwd)
     self.assertTrue(result1)
     self.assertTrue(result2)
     self.assertTrue(result3)
     print "add 3 model aps to cloud pass!"
Ejemplo n.º 6
0
 def test_005_reset_ap_check_country(self):
     u"""重置验证国家(testlink_ID:1628)"""
     log.debug("005")
     #删除7600
     tmp1 = APSBusiness(self.s)
     tmp1.delete_ap(data_ap['7600_mac'])
     time.sleep(360)
     tmp = SettingsBusiness(self.s)
     result = tmp.get_cli_country(data_basic['7600_ip'],
             data_basic['sshUser'], "admin")
     self.assertIn("840", result)
Ejemplo n.º 7
0
 def test_004_reboot_ap_check_country(self):
     u"""页面重启验证国家(testlink_ID:1626)"""
     log.debug("004")
     #重启7600
     tmp1 = APSBusiness(self.s)
     tmp1.reboot_one_ap(data_ap['7600_mac'])
     time.sleep(420)
     tmp = SettingsBusiness(self.s)
     #在AP CLI下查看国家默认配置
     ssh_pwd = tmp.get_ssh_pwd()
     result = tmp.get_cli_country(data_basic['7600_ip'],
             data_basic['sshUser'], ssh_pwd)
     self.assertIn("156", result)
Ejemplo n.º 8
0
 def test_007_offline_ap_check_timezone(self):
     u"""AP离线时配置时区(testlink_ID:1643)"""
     log.debug("007")
     #重启7600
     tmp1 = APSBusiness(self.s)
     tmp1.reboot_one_ap(data_ap['7600_mac'])
     time.sleep(100)
     #修改时区为GWT
     tmp = SettingsBusiness(self.s)
     tmp.set_setting({'timezone':"Etc/GMT"})
     time.sleep(320)
     #获取ap cli的时区
     ssh_pwd = tmp.get_ssh_pwd()
     result = tmp.get_cli_timezone(data_basic['7600_ip'],
             data_basic['sshUser'], ssh_pwd)
     self.assertIn("+0000", result)
Ejemplo n.º 9
0
 def test_003_change_country_setting(self):
     u"""验证修改国家配置是否生效(testlink_ID:1624)"""
     log.debug("003")
     tmp = SettingsBusiness(self.s)
     #修改国家为中国
     tmp.set_setting({'countryDomain':"CN"})
     time.sleep(60)
     #在AP CLI下查看国家默认配置
     ssh_pwd = tmp.get_ssh_pwd()
     result1 = tmp.get_cli_country(data_basic['7600_ip'],
             data_basic['sshUser'], ssh_pwd)
     result2 = tmp.get_cli_ath0_country(data_basic['7600_ip'],
             data_basic['sshUser'], ssh_pwd)
     result3 = tmp.get_cli_ath1_country(data_basic['7600_ip'],
             data_basic['sshUser'], ssh_pwd)
     self.assertIn("156", result1)
     self.assertIn("156", result2)
     self.assertIn("156", result3)
Ejemplo n.º 10
0
 def test_002_check_country_default_setting(self):
     u"""国家检查默认配置(testlink_ID:1623)"""
     log.debug("002")
     tmp = SettingsBusiness(self.s)
     #获取默认国家信息
     country = tmp.get_countryDomain()
     #在AP CLI下查看国家默认配置
     ssh_pwd = tmp.get_ssh_pwd()
     result_7600 = tmp.get_cli_country(data_basic['7600_ip'],
             data_basic['sshUser'], ssh_pwd)
     result_7610 = tmp.get_cli_country(data_basic['7610_ip'],
             data_basic['sshUser'], ssh_pwd)
     result_7600lr = tmp.get_cli_country(data_basic['7600lr_ip'],
             data_basic['sshUser'], ssh_pwd)
     self.assertEqual("US", country)
     self.assertIn("840", result_7600)
     self.assertIn("840", result_7610)
     self.assertIn("840", result_7600lr)
Ejemplo n.º 11
0
 def test_006_reboot_ap_check_timezone(self):
     u"""重启AP之后查看时区(testlink_ID:1642)"""
     log.debug("006")
     #7600再添加回cloud
     tmp1 = APSBusiness(self.s)
     tmp1.add_ap_2_local_cloud(data_basic['7600_ip'], data_ap['7600_mac'], "autotest_7600")
     #修改时区为北京
     tmp = SettingsBusiness(self.s)
     tmp.set_setting({'timezone':"Asia/Shanghai"})
     time.sleep(60)
     #然后重启7600
     tmp1.reboot_one_ap(data_ap['7600_mac'])
     time.sleep(420)
     #获取ap cli的时区
     ssh_pwd = tmp.get_ssh_pwd()
     result = tmp.get_cli_timezone(data_basic['7600_ip'],
             data_basic['sshUser'], ssh_pwd)
     self.assertIn("+0800", result)
Ejemplo n.º 12
0
 def test_010_sshPassword_letter_and_digital(self):
     u"""字母和数字组合SSH密码检测(testlink_ID:1648,1651)"""
     log.debug("010")
     tmp = SettingsBusiness(self.s)
     #获取默认ssh password
     default_ssh_password = tmp.get_ssh_pwd()
     #修改ssh 密码为纯数字
     tmp.set_setting({'sshPassword':"******"})
     time.sleep(60)
     #在AP CLI下查看国家默认配置
     result1 = tmp.get_cli_ssh_password(data_basic['7600_ip'],
             data_basic['sshUser'], "abcd1234")
     result2 = tmp.get_cli_ssh_password(data_basic['7600lr_ip'],
             data_basic['sshUser'], "abcd1234")
     result3 = tmp.get_cli_ssh_password(data_basic['7610_ip'],
             data_basic['sshUser'], "abcd1234")
     #把ssh 密码为默认
     tmp.set_setting({'sshPassword':default_ssh_password})
     time.sleep(60)
     self.assertIn("abcd1234", result1)
     self.assertIn("abcd1234", result2)
     self.assertIn("abcd1234", result3)
Ejemplo n.º 13
0
 def test_009_sshPassword_letter(self):
     u"""纯字母SSH密码检测(testlink_ID:1647,1650)"""
     log.debug("009")
     tmp = SettingsBusiness(self.s)
     #获取默认ssh password
     default_ssh_password = tmp.get_ssh_pwd()
     #修改ssh 密码为纯数字
     tmp.set_setting({'sshPassword':"******"})
     time.sleep(60)
     #在AP CLI下查看国家默认配置
     result1 = tmp.get_cli_ssh_password(data_basic['7600_ip'],
             data_basic['sshUser'], "abcdefgh")
     result2 = tmp.get_cli_ssh_password(data_basic['7600lr_ip'],
             data_basic['sshUser'], "abcdefgh")
     result3 = tmp.get_cli_ssh_password(data_basic['7610_ip'],
             data_basic['sshUser'], "abcdefgh")
     #把ssh 密码为默认
     tmp.set_setting({'sshPassword':default_ssh_password})
     time.sleep(60)
     self.assertIn("abcdefgh", result1)
     self.assertIn("abcdefgh", result2)
     self.assertIn("abcdefgh", result3)
Ejemplo n.º 14
0
 def test_008_sshPassword_digital(self):
     u"""纯数字SSH密码检测(testlink_ID:1646,1649)"""
     log.debug("008")
     tmp = SettingsBusiness(self.s)
     #获取默认ssh password
     default_ssh_password = tmp.get_ssh_pwd()
     #修改ssh 密码为纯数字
     tmp.set_setting({'sshPassword':"******"})
     time.sleep(60)
     #在AP CLI下查看国家默认配置
     result1 = tmp.get_cli_ssh_password(data_basic['7600_ip'],
             data_basic['sshUser'], "12345678")
     result2 = tmp.get_cli_ssh_password(data_basic['7600lr_ip'],
             data_basic['sshUser'], "12345678")
     result3 = tmp.get_cli_ssh_password(data_basic['7610_ip'],
             data_basic['sshUser'], "12345678")
     #把ssh 密码为默认
     tmp.set_setting({'sshPassword':default_ssh_password})
     time.sleep(60)
     self.assertIn("12345678", result1)
     self.assertIn("12345678", result2)
     self.assertIn("12345678", result3)
    def test_002_check_connection_m_time_function(self):
        u"""Connection Time单位选择m(分钟)功能测试(Enable勾选)(testlink_ID:1589)"""
        log.debug("002")
        #新建一个策略time policy1,连接时间2分钟,重置时间每天23点
        tmp = TimePolicyBusiness(self.s)
        #断开无线网卡的连接
        tmp.disconnect_ap()
        data_dict = {
            'status': 1,
            'reconnectType': 1,
            'resetDay': 1,
            'resetHour': "23",
            'hour': "24",
            'resetTimeType': "AM",
            'timezone': "Etc/GMT",
            'connectionTimeMap': {
                'd': "0",
                'h': "0",
                'm': "2"
            },
            'connectionTimeoutMap': {
                'd': "",
                'h': "",
                'm': ""
            }
        }
        tmp.add_timepolicy("time policy1", data_dict)
        #获取时间策略的id
        timepolicy_id = tmp.get_timepolicy_id("time policy1")

        #修改ssid1的ssid,并开启时间策略,并选择time policy1
        tmp1 = SSIDSBusiness(self.s)
        encry_dict = {
            'ssid_encryption': "3",
            'ssid_wpa_encryption': "0",
            'ssid_wpa_key_mode': "0",
            'ssid_wpa_key': data_wireless['short_wpa']
        }
        data_dict1 = {
            'ssid_ssid':
            data_wireless['all_ssid'],
            'ssid_timed_client_policy':
            "%s" % timepolicy_id,
            'removed_macs':
            "%s,%s" %
            (data_ap['7610_mac'].upper(), data_ap['7600lr_mac'].upper())
        }
        tmp1.edit_ssid(data_ap['7600_mac'], 'GWN-Cloud', encry_dict,
                       data_dict1)
        time.sleep(120)

        #先修改ap的系统时间为01:00:00
        tmp2 = SettingsBusiness(self.s)
        ssh_pwd = tmp2.get_ssh_pwd()
        ssh = SSH(data_basic['7600_ip'], ssh_pwd)
        ssh.ssh_cmd(data_basic['sshUser'], "date -s 01:00:00")
        #无线网卡连接
        tmp1.connect_DHCP_WPA_AP(data_wireless['all_ssid'],
                                 data_wireless['short_wpa'],
                                 data_basic['wlan_pc'])
        #等待3分钟
        time.sleep(240)
        #判断AP是否依然连接
        result = subprocess.check_output("iw dev %s link" %
                                         data_basic['wlan_pc'],
                                         shell=True)
        print result
        tmp1.dhcp_release_wlan(data_basic['wlan_pc'])
        #断开无线网卡的连接
        tmp.disconnect_ap()
        #释放被禁的客户端
        client_mac = tmp.get_wlan_mac(data_basic['wlan_pc'])
        tmp.release_restrict_mac(client_mac)
        time.sleep(60)
        self.assertIn("Not connected.", result)
    def test_004_check_connection_time_d_function(self):
        u"""Connection Time单位选择d功能测试(Enabled勾选)(testlink_ID:1501)"""
        log.debug("004")
        tmp = TimePolicyBusiness(self.s)
        # #断开无线网卡的连接
        # tmp.disconnect_ap()
        # #释放被禁的客户端
        # client_mac = tmp.get_wlan_mac(data_basic['wlan_pc'])
        # tmp.release_restrict_mac(client_mac)
        # time.sleep(60)

        #新增策略time policy3,连接时间1d,重置时间每周周一的23点
        data_dict = {
            'status': 1,
            'reconnectType': 2,
            'resetDay': 1,
            'resetHour': "23",
            'hour': "24",
            'resetTimeType': "AM",
            'timezone': "Etc/GMT",
            'connectionTimeMap': {
                'd': "1",
                'h': "0",
                'm': "0"
            },
            'connectionTimeoutMap': {
                'd': "",
                'h': "",
                'm': ""
            }
        }
        tmp.add_timepolicy("time policy3", data_dict)
        #获取时间策略的id
        timepolicy_id = tmp.get_timepolicy_id("time policy3")
        #修改ssid1的ssid,并开启时间策略,并选择time policy3
        tmp1 = SSIDSBusiness(self.s)
        encry_dict = {
            'ssid_encryption': "3",
            'ssid_wpa_encryption': "0",
            'ssid_wpa_key_mode': "0",
            'ssid_wpa_key': data_wireless['short_wpa']
        }
        data_dict1 = {'ssid_timed_client_policy': "%s" % timepolicy_id}
        tmp1.edit_ssid(data_ap['7600_mac'], data_wireless['all_ssid'],
                       encry_dict, data_dict1)
        time.sleep(120)

        #先修改ap的系统时间为2018-08-08 10:00:00
        tmp2 = SettingsBusiness(self.s)
        ssh_pwd = tmp2.get_ssh_pwd()
        ssh = SSH(data_basic['7600_ip'], ssh_pwd)
        ssh.ssh_cmd(data_basic['sshUser'], "date 201808081000")
        #无线网卡连接
        tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'],
                                data_wireless['short_wpa'],
                                data_basic['wlan_pc'])
        #再修改ap的系统时间为2018-08-09 10:00:00
        ssh.ssh_cmd(data_basic['sshUser'], "date 201808091000")
        #等待3分钟
        time.sleep(180)
        #判断AP是否依然连接
        result = subprocess.check_output("iw dev %s link" %
                                         data_basic['wlan_pc'],
                                         shell=True)
        print result
        #释放无线网卡的ip
        tmp.dhcp_release_wlan(data_basic['wlan_pc'])
        #断开无线网卡的连接
        tmp.disconnect_ap()
        #释放被禁的客户端
        client_mac = tmp.get_wlan_mac(data_basic['wlan_pc'])
        tmp.release_restrict_mac(client_mac)
        time.sleep(60)
        self.assertIn("Not connected.", result)
Ejemplo n.º 17
0
 def setUp(self):
     self.s = requests.session()
     tmp = SettingsBusiness(self.s)
     #使用用户名密码,带着cookie登录cloud,并返回响应数据
     tmp.webLogin(data_basic['cloud_user'], data_basic['cloud_pwd'])