Esempio n. 1
0
 def add_NG_max(self, host, user, pwd, add_ssid, key):
     #点击网络组菜单,然后在点击额外ssid菜单
     AddSSIDBusiness.NG_SSID_menu(self)
     for i in range(14):
         #点击添加
         AddSSIDControl.add_button(self)
         #设置开启额外ssid
         AddSSIDControl.set_enable_disable(self)
         #设置ssid
         AddSSIDControl.set_ssid(self, "%s%s" % (add_ssid, (i + 2)))
         #设置wpa的密码
         AddSSIDControl.set_wpa_key(self, key)
         #添加窗口中,点击保存
         AddSSIDControl.save(self)
     #弹出窗口中,点击应用
     AddSSIDControl.apply(self)
     element = self.driver.find_element_by_id("newssid")
     result1 = element.get_attribute("disabled")
     ssh = SSH(host, pwd)
     result2 = ssh.ssh_cmd(user, "uci show grandstream.ssid14.id")
     result3 = ssh.ssh_cmd(user, "iwconfig ath31")
     print "result1 = %s" % result1
     print "result2 = %s" % result2
     print "result3 = %s" % result3
     return result1, result2, result3
Esempio n. 2
0
 def test_046_check_connection_m_time_function(self):
     u"""Connection Time单位选择m分钟,功能测试(testlink_ID:3202)"""
     log.debug("046")
     tmp = TimePolicyBusiness(self.driver)
     #断开无线网卡的连接
     tmp.disconnect_ap()
     #先修改ap的系统时间为01:00:00
     ssh = SSH(data_basic['DUT_ip'], data_login['all'])
     ssh.ssh_cmd(data_basic['sshUser'], "date -s 01:00:00")
     #按照默认配置,新建一个时间策略
     tmp.new_timepolicy_default(0, u"时间策略1", "2", "23", "m")
     #进入网络组中选择客户端时间策略
     tmp1 = SSIDBusiness(self.driver)
     tmp1.change_client_time_policy_pagedown(1, u"时间策略1")
     #无线网卡连接
     tmp1.connect_DHCP_WPA_AP(data_wireless['all_ssid'],
         data_wireless['short_wpa'], data_basic['wlan_pc'])
     #等待3分钟
     time.sleep(240)
     #判断AP是否依然连接
     result1 = subprocess.check_output("iw dev %s link"%data_basic['wlan_pc'], shell=True)
     #释放无线网卡的ip
     tmp1.dhcp_release_wlan(data_basic['wlan_pc'])
     #获取禁止的客户端页面所有标题
     tmp2 = BannedClientsBusiness(self.driver)
     result2 = tmp2.get_bannedclients_title()
     wlan_mac = tmp2.get_wlan_mac(data_basic['wlan_pc']).upper()
     self.assertNotIn(data_wireless['all_ssid'], result1)
     self.assertIn(wlan_mac, result2),
     "check connection time function is min, test fail!"
     print "check connection time function is min, test pass!"
Esempio n. 3
0
 def test_048_check_connection_time_d_function(self):
     u"""Connection Time单位选择d天,功能测试(testlink_ID:3204)"""
     log.debug("048")
     tmp2 = BannedClientsBusiness(self.driver)
     #断开无线网卡的连接
     tmp2.disconnect_ap()
     #先解锁客户端
     tmp2.unblock_clients(1)
     #先修改ap的系统时间为2018-08-08 01:00:00
     ssh = SSH(data_basic['DUT_ip'], data_login['all'])
     ssh.ssh_cmd(data_basic['sshUser'], "date 201808080100")
     #按照默认配置,编辑一个时间策略-1天
     tmp = TimePolicyBusiness(self.driver)
     tmp.edit_timepolicy_default(0, u"时间策略1", "1", "23", "d")
     #无线网卡连接
     tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'],
         data_wireless['short_wpa'], data_basic['wlan_pc'])
     #再修改ap的系统时间为2018-08-09 01:00:00
     ssh = SSH(data_basic['DUT_ip'], data_login['all'])
     ssh.ssh_cmd(data_basic['sshUser'], "date 201808090100")
     #等待3分钟
     time.sleep(180)
     #判断AP是否依然连接
     result1 = subprocess.check_output("iw dev %s link"%data_basic['wlan_pc'], shell=True)
     #释放无线网卡的ip
     tmp.dhcp_release_wlan(data_basic['wlan_pc'])
     #获取禁止的客户端页面所有标题
     result2 = tmp2.get_bannedclients_title()
     wlan_mac = tmp2.get_wlan_mac(data_basic['wlan_pc']).upper()
     self.assertNotIn(data_wireless['all_ssid'], result1)
     self.assertIn(wlan_mac, result2),
     "check connection time function is day, test fail!"
     print "check connection time function is day, test pass!"
Esempio n. 4
0
 def test_041_failover_master_check_change_success(self):
     u"""failover ap 切换到master ap模式后,确认failover ap已经切换成master ap模式(testlink_ID:2408)"""
     log.debug("041")
     #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")
     self.assertIn("master", result1)
     self.assertIn("Entry not found", result2), "after failover change to master check change success,test fail!"
     print "when old master change success,test pass!"
Esempio n. 5
0
 def check_macfilter_whitelist(self, mac, host, user, pwd):
     ssh = SSH(host, pwd)
     result2 = ssh.ssh_cmd(user, "uci show wireless.ath0.macfilter")
     result3 = ssh.ssh_cmd(user, "uci show wireless.ath1.macfilter")
     result4 = ssh.ssh_cmd(user, "uci show wireless.ath0.maclist")
     result5 = ssh.ssh_cmd(user, "uci show wireless.ath1.maclist")
     if ('allow' in result2) and ('allow' in result3) \
         and (mac in result4) and (mac in result5):
         return True
     else:
         return False
 def check_bandwidth_not_set(self,n,host,user,pwd):
     ssh = SSH(host,pwd)
     result = ssh.ssh_cmd(user,"uci show grandstream.rule%s.urate"%n)
     result1 = ssh.ssh_cmd(user,"uci show grandstream.rule%s.drate"%n)
     result2 = result.strip()
     result3 = result1.strip()
     print(result2,result3)
     if ("uci: Entry not found"==result2) and \
             ("uci: Entry not found"==result3):
         return True
     else:
         return False
Esempio n. 7
0
 def check_Whitelist_cli(self, host, user, pwd, mac):
     mac_tmp = mac.lower()
     ssh = SSH(host, pwd)
     result01 = ssh.ssh_cmd(user, "uci show wireless.ath0.macfilter")
     result02 = ssh.ssh_cmd(user, "uci show wireless.ath0.maclist")
     result11 = ssh.ssh_cmd(user, "uci show wireless.ath1.macfilter")
     result12 = ssh.ssh_cmd(user, "uci show wireless.ath1.maclist")
     if ("allow" in result01) and ("allow" in result11) and \
         (mac_tmp in result02) and (mac_tmp in result12):
         return True
     else:
         return False
 def check_change_pwd(self, current_pwd, admin_pwd, user_pwd, host,
                      ssh_user):
     #修改所有密码,点击保存
     AccessBusiness.change_pwd(self, current_pwd, admin_pwd, user_pwd)
     #弹出窗口中,点击应用
     AccessControl.apply(self)
     ssh = SSH(host, admin_pwd)
     result1 = ssh.ssh_cmd(ssh_user,
                           "uci show grandstream.general.admin_password")
     result2 = ssh.ssh_cmd(ssh_user,
                           "uci show grandstream.general.user_password")
     return result1, result2
Esempio n. 9
0
    def test_051_check_timeout_reconnection_weekly_function(self):
        u"""Timeout type选择reset weekly测试(testlink_ID:3207)"""
        log.debug("051")
        tmp2 = BannedClientsBusiness(self.driver)
        #等待4分钟--等待客户端再次被踢掉
        time.sleep(240)
        #先解锁客户端
        tmp2.unblock_clients(1)
        #断开无线网卡的连接
        tmp2.disconnect_ap()
        tmp = TimePolicyBusiness(self.driver)
        tmp.change_timeout_weekly(0, u"星期三", "23")
        #先修改ap的系统时间为2018-08-07 22:00:00(当天是星期二)
        ssh = SSH(data_basic['DUT_ip'], data_login['all'])
        ssh.ssh_cmd(data_basic['sshUser'], "date 201808072200")
        #无线网卡连接
        tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'],
            data_wireless['short_wpa'], data_basic['wlan_pc'])
        #等待6分钟
        time.sleep(360)
        #判断AP是否依然连接
        result1 = subprocess.check_output("iw dev %s link"%data_basic['wlan_pc'], shell=True)
        #获取禁止的客户端页面所有标题
        tmp2.dhcp_release_wlan(data_basic['wlan_pc'])
        result2 = tmp2.get_bannedclients_title()
        wlan_mac = tmp2.get_wlan_mac(data_basic['wlan_pc']).upper()

        #再修改ap的系统时间为2018-08-08 22:59:00(当天是星期三)
        ssh = SSH(data_basic['DUT_ip'], data_login['all'])
        ssh.ssh_cmd(data_basic['sshUser'], "date 201808082259")
        #等待3分钟
        time.sleep(180)
        #无线网卡连接
        result3 = tmp.connect_DHCP_WPA_AP(data_wireless['all_ssid'],
            data_wireless['short_wpa'], data_basic['wlan_pc'])
        tmp2.dhcp_release_wlan(data_basic['wlan_pc'])
        result4 = tmp2.get_bannedclients_title()

        #测试完毕,禁用无线网卡,使pc够上网
        tmp.dhcp_release_wlan(data_basic['wlan_pc'])
        tmp.disconnect_ap()
        tmp.wlan_disable(data_basic['wlan_pc'])
        #rsyslog服务器完成工作
        tmp.finish_rsyslog("ClientTimePolicy")
        # self.assertNotIn(data_wireless['all_ssid'], result1)
        # self.assertIn(wlan_mac, result2)
        self.assertIn(data_wireless['all_ssid'], result3)
        self.assertNotIn(wlan_mac, result4),
        "check reconnection timeout function is weekly, test fail!"
        print "check reconnection timeout function is weekly, test pass!"
Esempio n. 10
0
 def check_add_mac_Global_Blacklist(self, mac, host, user, pwd):
     ClientAccessBusiness.edit_accesslist_onemac(self, mac)
     #获取Global Blacklist的mac地址
     result1 = ClientAccessBusiness.get_Global_Blacklist_mac(self)
     ssh = SSH(host, pwd)
     result2 = ssh.ssh_cmd(user, "uci show wireless.ath0.macfilter")
     result3 = ssh.ssh_cmd(user, "uci show wireless.ath1.macfilter")
     result4 = ssh.ssh_cmd(user, "uci show wireless.ath0.maclist")
     result5 = ssh.ssh_cmd(user, "uci show wireless.ath1.maclist")
     if (mac.upper() in result1) and ('deny' in result2) and ('deny' in result3) \
         and (mac in result4) and (mac in result5):
         return True
     else:
         return False
Esempio n. 11
0
    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!"
Esempio n. 12
0
 def get_first_ssid(self, host, user, pwd):
     """
     获取第一个wifi的ssid
     """
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "uci show wireless.wlan0.ssid")
     return result
Esempio n. 13
0
 def get_ap_ssh_uptime(self, host, user, pwd):
     ssh = SSH(host, pwd)
     uptime = ssh.ssh_cmd(user, "uptime")
     tmp = uptime.split("up ")[1].split(" min")[0]
     result = int(tmp) * 60
     print result
     return result
Esempio n. 14
0
 def check_ap_pair_cloud(self, ip, user, pwd):
     ssh = SSH(ip, pwd)
     result = ssh.ssh_cmd(user, "netstat | grep %s" % ip)
     if "gateway.gwn.cloud:https ESTABLISHED" in result:
         return True
     else:
         return False
 def get_wan_way(self, host, user, pwd):
     """
     判断wan口的上网方式
     """
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "uci show network.wan.proto")
     return result
 def check_time_zone(self):
     tmp = UpgradeBusiness(self.driver)
     result = []
     fail_info = []
     #点击系统设置
     tmp.System_menu()
     #点击基本菜单
     tmp.Basic_menu()
     timezone_list = data_timezone['timezone_list']
     timezone_str = data_timezone['timezone_str']
     for i in range(len(timezone_list)):
         #选择设置不同的时区
         BasicControl.set_time_zone(self, timezone_list[i])
         tmp.save()
         tmp.apply()
         print "change timezone: %s successfully!" % timezone_list[i]
         #登录AP后台判断字符串是否正确
         ssh = SSH(data_basic['DUT_ip'], data_login["all"])
         result1 = ssh.ssh_cmd(data_basic['sshUser'], "date -R")
         if timezone_str[i] in result1:
             result.append(True)
         else:
             timezone_fail_info = "%s\t\t\t%s\t\t\t%s" % (
                 timezone_list[i], result1, timezone_str[i])
             fail_info.append(timezone_fail_info)
             result.append(False)
     #如果有fail信息,则打印
     if fail_info != []:
         print "timezone\t\t\ttest result\t\t\tcorrect result"
         fail_info_str = "\n".join(fail_info)
         print fail_info_str
     return result
Esempio n. 17
0
 def check_mac_list(self, host, user, pwd):
     ssh = SSH(host, pwd)
     tmp = ssh.ssh_cmd(user, "cat /etc/config/grandstream | grep mac")
     tmp1 = tmp.split("\r\n\t")
     result = len(tmp1) - 2
     print result
     return result
 def check_bandwidth_downstream(self,n,value,host,user,pwd):
     ssh = SSH(host,pwd)
     if int(value)<100:
         value = ("%sM")%value
     else:
         value = ("%sK")%value
     result = ssh.ssh_cmd(user,"uci show grandstream.rule%s.urate"%n)
     result1 = ssh.ssh_cmd(user,"uci show grandstream.rule%s.drate"%n)
     result2 = result.strip()
     result3 = result1.strip()
     print(result2,result3)
     if ("grandstream.rule%s.drate='%sbps'"%(n,value)==result3)and \
             ("uci: Entry not found"==result2):
         return True
     else:
         return False
Esempio n. 19
0
 def check_banned_mac(self, host, user, pwd):
     ssh = SSH(host, pwd)
     tmp = ssh.ssh_cmd(user,
                       "cat /etc/config/grandstream | grep client_ban")
     tmp1 = tmp.split("\r\n\t")
     result = len(tmp1) - 1
     print result
     return result
Esempio n. 20
0
 def check_ap_bandwidth(self, host, user, pwd, width):
     """登录ap的后台,检查带宽"""
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "uci show wireless.radio0.htmode")
     if width in result:
         return True
     else:
         return False
Esempio n. 21
0
 def check_ap_power(self, host, user, pwd, power):
     """登录ap的后台,发射功率"""
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "uci show wireless.radio0.txpower")
     if power in result:
         return True
     else:
         return False
Esempio n. 22
0
 def check_ap_max_client_number(self, host, user, pwd, n):
     """登录ap的后台,最大用户数"""
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "uci show wireless.wlan0.maxassoc")
     if n in result:
         return True
     else:
         return False
Esempio n. 23
0
 def check_ap_shortGI(self, host, user, pwd):
     """登录ap的后台,检查短防护时间间隔是否开启"""
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "uci show wireless.radio0.shortgi")
     if "1" in result:
         return True
     else:
         return False
Esempio n. 24
0
 def check_ap_WMM(self, host, user, pwd):
     """登录ap的后台,检查无线多媒体是否开启"""
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "uci show wireless.wlan0.wmm")
     if "1" in result:
         return True
     else:
         return False
Esempio n. 25
0
 def check_ap_wireless_isolate(self, host, user, pwd):
     """登录ap的后台,检查无线隔离是否开启"""
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "uci show wireless.wlan0.isolate")
     if "1" in result:
         return True
     else:
         return False
Esempio n. 26
0
 def test_047_master_camebake_over_10mins(self):
     u"""在10分钟后,master ap回来后,确认master 和failover ap正常(testlink_ID:2373)"""
     log.debug("047")
     #检查master ap
     ssh = SSH(data_basic['DUT_ip'], data_login['all'])
     result = ssh.ssh_cmd(data_basic['sshUser'], "uci show controller.main.role")
     self.assertIn("master", result), "Master ap came back over 10 mins,test fail!"
     print "Master ap came back over 10 mins,test pass!"
Esempio n. 27
0
 def check_ap_rts_threshold(self, host, user, pwd, value):
     """登录ap的后台,检查rts阈值"""
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "uci show wireless.radio0.rts")
     if str(value) in result:
         return True
     else:
         return False
 def check_user_pwd_once(self, user_pwd1, admin_pwd, host, ssh_user):
     #修改user密码,点击保存
     AccessBusiness.change_user_pwd(self, user_pwd1, "")
     #登录路由后台,确认密码没有改变
     ssh = SSH(host, admin_pwd)
     result = ssh.ssh_cmd(ssh_user,
                          "uci show grandstream.general.user_password")
     return result
Esempio n. 29
0
 def check_Global_Blacklist_cli(self, host, user, pwd, mac):
     mac_tmp = mac.lower()
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "uci show wireless.global.client_ban")
     if mac_tmp in result:
         return True
     else:
         return False
Esempio n. 30
0
 def test_034_check_config(self):
     u"""恢复出厂后的系统配置情况(testlink_ID:772)"""
     log.debug('034')
     tmp = SSH(data_basic["DUT_ip"], data_basic["super_defalut_pwd"])
     result = tmp.ssh_cmd(data_basic['sshUser'],
                          "uci show grandstream.zone0.ssid")
     assert data_wireless[
         'all_ssid'] not in result, "check config after resetting,test fail!"
     print "check config after resetting,test pass!"