Esempio n. 1
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. 2
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 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. 4
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. 5
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. 6
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
 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. 8
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. 9
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
Esempio n. 10
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. 11
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. 12
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. 13
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. 14
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. 15
0
 def test_029_check_config(self):
     u"""重启后配置检查(testlink_ID:767)"""
     log.debug('029')
     tmp = SSH(data_basic["DUT_ip"], data_login["all"])
     result = tmp.ssh_cmd(data_basic['sshUser'],
                          "uci show grandstream.ssid0.ssid")
     assert data_wireless[
         'all_ssid'] in result, "check config after rebooting,test fail!"
     print "check config after rebooting,test pass!"
Esempio n. 16
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!"
 def check_change_user_pwd(self, admin_pwd, user_pwd, host, ssh_user):
     #修改user密码,点击保存
     AccessBusiness.change_user_pwd(self, user_pwd, user_pwd)
     #弹出窗口中,点击应用
     AccessControl.apply(self)
     ssh = SSH(host, admin_pwd)
     result1 = ssh.ssh_cmd(ssh_user,
                           "uci show grandstream.general.user_password")
     return result1
 def get_country_code(self):
     #登录web页面获取DUT的hostname
     DUT_hostname = SWControl.get_DUT_hostname(self)
     data_basic = data.data_basic()
     data_login = data.data_login()
     ssh = SSH(data_basic['DUT_ip'],data_login['all'])
     tmp1 = ssh.ssh_cmd(data_basic['sshUser'],"ubus call controller.core status | grep part_number")
     tmp = tmp1.split("\"")[3][-4]
     if DUT_hostname == "GWN7610":
         #如果是USA,返回1
         if tmp == "1":
             print "The AP is USA product!"
             return 1
         #如果是WORLD,返回0
         elif tmp == "6":
             print "The AP is WORLD product!"
             return 0
         else:
             print "PN value is not correct!"
             return None
     elif DUT_hostname == "GWN7600":
         #如果是USA,返回1
         if tmp == "5":
             print "The AP is USA product!"
             return 1
         #如果是WORLD,返回0
         elif tmp == "7":
             print "The AP is WORLD product!"
             return 0
         else:
             print "PN value is not correct!"
             return None
     elif DUT_hostname == "GWN7600LR":
         #如果是USA,返回1
         if tmp == "1":
             print "The AP is USA product!"
             return 1
         #如果是WORLD,返回0
         elif tmp == "2":
             print "The AP is WORLD product!"
             return 0
         else:
             print "PN value is not correct!"
             return None
     elif DUT_hostname == "GWN7002W":
         #如果是USA,返回1
         if tmp == "8":
             print "The AP is USA product!"
             return 1
         #如果是WORLD,返回0
         elif tmp == "9":
             print "The AP is WORLD product!"
             return 0
         else:
             print "PN value is not correct!"
             return None
Esempio n. 19
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!"
 def check_tx_power(self, host, user, pwd, ath):
     try:
         ssh = SSH(host, pwd)
         result = ssh.ssh_cmd(user, "iwconfig %s |grep Tx-Power" % ath)
         list = result.split("=", 1)
         power = list[1].split(" ", 1)[0]
         print power
         return power
     except:
         print "can't find %s interface" % ath
         return None
Esempio n. 21
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
Esempio n. 22
0
 def check_del_Global_Blacklist_mac(self, mac, host, user, pwd):
     #删除Global Blacklist里面的所有的mac
     ClientAccessBusiness.del_Global_Blacklist_mac(self)
     #获取Global Blacklist的mac地址
     result1 = ClientAccessBusiness.get_Global_Blacklist_mac(self)
     ssh = SSH(host, pwd)
     result2 = ssh.ssh_cmd(user, "iptables -nvL")
     if (mac.upper() not in result1) and (mac not in result2):
         return True
     else:
         return False
Esempio n. 23
0
 def get_ap_ssh_power(self, ath, host, user, pwd):
     time.sleep(10)
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "iwconfig %s | grep Tx-Power" % ath)
     a = result.split("Tx-Power=")
     for b in a:
         if " dBm" in b:
             c = b.split(" dBm")
     power = c[0]
     print power
     return power
Esempio n. 24
0
 def test_057_check_same_admin_pwd(self):
     u"""修改admin密码时,输入和当前密码一样的新密码(testlink_ID:886)"""
     #修改admin密码时,输入和当前密码一样的新密码
     log.debug('057')
     tmp = AccessBusiness(self.driver)
     tmp.change_admin_pwd(data_login['all'], data_login['all'],
                          data_login['all'])
     ssh = SSH(data_basic['DUT_ip'], data_login['all'])
     result = ssh.ssh_cmd(data_basic['sshUser'],
                          "uci show grandstream.general.admin_password")
     assert (data_login['all'] in result), "input same admin pwd,test fail!"
     print "input same admin pwd,test pass!"
 def check_current_channel(self, host, user, pwd, ath):
     ssh = SSH(host, pwd)
     result = ssh.ssh_cmd(user, "iwlist %s channel" % ath)
     lists = result.split("\r\n")[2:-3]
     list = []
     for i in range(len(lists)):
         tmp = lists[i].replace("Channel ", "").split(":")[0].strip(" ")
         if (int(tmp) <= 48) or (int(tmp) >= 149):
             list.append(str(int(tmp)))
     channels = ",".join(list)
     print channels
     return channels
 def web_factory_reset_backup2(self, host, user, pwd):
     UpgradeBusiness.web_factory_reset_backup(self, host)
     time.sleep(60)
     #登录AP后台取出管理员密码
     ssh1 = SSH(host, pwd)
     result = ssh1.ssh_cmd(user,
                           "uci show grandstream.general.admin_password")
     print result
     if "='admin'" in result:
         return True
     else:
         return False
Esempio n. 27
0
 def test_033_check_ok_reset_confirm(self):
     u"""点击重置并确认(testlink_ID:771)"""
     log.debug('033')
     #只有默认时,搜索-配对-加入网络组
     tmp = UpgradeBusiness(self.driver)
     result1, result2 = tmp.check_ok_reset_confirm(data_basic["DUT_ip"])
     tmp1 = SSH(data_basic["DUT_ip"], data_basic["super_defalut_pwd"])
     result3 = tmp1.ssh_cmd(data_basic['sshUser'],
                            "uci show grandstream.general.admin_password")
     assert (result1 != 0) and (result2 == 0) and (
         "='admin'" in result3), "confirm reset,test fail!"
     print "confirm reset,test pass!"
 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. 29
0
 def test_046_failover_ruturn_slave(self):
     u"""当老的master ap回来后,failover ap将变回slave ap模式(testlink_ID:2397)"""
     log.debug("046")
     tmp = APSBusiness(self.driver)
     #开启master ap的controller
     tmp.open_master_controller(data_basic['DUT_ip'],
         data_basic['sshUser'], data_login['all'])
     time.sleep(60)
     ssh = SSH(data_basic['slave_ip2'], data_login['all'])
     result = ssh.ssh_cmd(data_basic['sshUser'], "uci show controller.main.role")
     self.assertIn("slave", result), "when old master come back,failover return slave ap mode,test fail!"
     print "when old master come back,failover return slave ap mode,test pass!"
Esempio n. 30
0
 def test_010_check_failover_configuration_immediately(self):
     u"""指定failover ap后,确认failover ap的配置立即生效(testlink_ID:2359)"""
     log.debug("010")
     #slave ap  变为failover 模式
     ssh = SSH(data_basic['slave_ip2'], data_login['all'])
     result1 = ssh.ssh_cmd(data_basic['sshUser'], "uci show controller.main.role")
     #检查slave ap是否变为failover ap
     tmp = APSBusiness(self.driver)
     result2 = tmp.check_change_to_failover_AP(data_AP['slave:mac2'],
                 data_basic['DUT_ip'], data_basic['sshUser'], data_login['all'])
     self.assertIn("slave", result1)
     self.assertTrue(result2), "Designate a failover ap check configuration take effect immediately,test fail!"
     print "Designate a failover ap check configuration take effect immediately,test pass!"