Example #1
0
 def check_radius_portal(self,ssid,password,wlan,eth,t,radius_name,\
                         radius_password):
     #无线网卡释放ip地址
     CPControl.dhcp_release_wlan(self, wlan)
     #禁用有线网卡
     CPControl.wlan_disable(self, eth)
     time.sleep(60)
     #使用无线网卡连接group0的ssid
     CPControl.connect_WPA_AP(self, ssid, password, wlan)
     #再次禁用有线网卡--防止无线网卡的多次连接时会重启全部网络导致有限网卡再次开启
     CPControl.wlan_disable(self, eth)
     #循环三次检查无线网卡是否能够上网
     for i in range(3):
         #无线网卡释放ip地址
         CPControl.dhcp_release_wlan(self, wlan)
         #无线网卡再次获取ip地址
         CPControl.dhcp_wlan(self, wlan)
         CPControl.move_resolv(self)
         #如果不能访问网络
         tmp = CPControl.get_ping(self, "www.qq.com")
         if tmp == 0:
             break
         else:
             "check wlan card can access internet or not,again."
     #打开http的页面http://www.qq.com
     portal_title = CPBusiness.wait_for_title(self, "http://www.qq.com")
     print "Access tencent webpage first, goin to %s" % portal_title
     #radius portal页面输入用户名密码然后点击登录
     redirect_title = CPBusiness.enter_radius_portal(
         self, radius_name, radius_password)
     print "click agree, goin to %s" % redirect_title
     #再次确定能否访问腾讯首页
     again_title = CPBusiness.wait_for_title(self, "http://www.qq.com")
     print "Access tencent webpage again, goin to %s" % again_title
     current_time = time.strftime('%m-%d %H:%M',
                                  time.localtime(time.time()))
     print "-----------rick.zeng portal debug:finished access tencent again time:%s-----------" % current_time
     #验证过期时间
     #再次等待一段时间
     time.sleep(t)
     #打开http的页面http://www.qq.com
     expiration_title = CPBusiness.wait_for_title(self, "http://www.qq.com")
     print "wait %s seconds,access tencent webpage again, goin to %s" % (
         t, expiration_title)
     current_time = time.strftime('%m-%d %H:%M',
                                  time.localtime(time.time()))
     print "-----------rick.zeng portal debug:wait expiration time,finished access tencent time:%s-----------" % current_time
     #无线网卡释放ip地址
     CPControl.dhcp_release_wlan(self, wlan)
     #断开无线连接
     CPControl.disconnect_ap(self)
     #启用有线网卡
     CPControl.wlan_enable(self, eth)
     print "portal_title is %s" % portal_title
     print "redirect_title is %s" % redirect_title
     print "again_title is %s" % again_title
     print "expiration_title is %s" % expiration_title
     return portal_title, redirect_title, again_title, expiration_title
Example #2
0
    def check_jump_to_No_auth_portal_backup(self, ssid, password, wlan, eth,
                                            wifi_encryption):
        #无线网卡释放ip地址
        CPControl.dhcp_release_wlan(self, wlan)
        #禁用有线网卡
        CPControl.wlan_disable(self, eth)
        time.sleep(60)
        #使用无线网卡连接group0的ssid
        if wifi_encryption == "open":
            CPControl.connect_NONE_AP(self, ssid, wlan)
        elif wifi_encryption == "wep":
            CPControl.connect_WEP_AP(self, ssid, password, wlan)
        elif wifi_encryption == "wpa":
            CPControl.connect_WPA_AP(self, ssid, password, wlan)
        elif wifi_encryption == "wpa_hiddenssid":
            CPControl.connect_WPA_hiddenssid_AP(self, ssid, password, wlan)
        elif wifi_encryption == "802.1x":
            CPControl.connect_8021x_AP(self, ssid,
                                       data_basic['radius_usename'],
                                       data_basic['radius_password'], wlan)

        #再次禁用有线网卡--防止无线网卡的多次连接时会重启全部网络导致有限网卡再次开启
        CPControl.wlan_disable(self, eth)
        #循环三次检查无线网卡是否能够上网
        for i in range(3):
            #无线网卡释放ip地址
            CPControl.dhcp_release_wlan(self, wlan)
            #无线网卡再次获取ip地址
            CPControl.dhcp_wlan(self, wlan)
            CPControl.move_resolv(self)
            #如果不能访问网络
            tmp = CPControl.get_ping(self, "www.qq.com")
            if tmp == 0:
                break
            else:
                "check wlan card can access internet or not,again."
        #打开http的页面http://www.qq.com
        redirect_title = CPBusiness.wait_for_title(self, "http://www.qq.com")
        print "Access tencent webpage, jump to %s webpage" % redirect_title
        #无线网卡释放ip地址
        CPControl.dhcp_release_wlan(self, wlan)
        #断开无线连接
        CPControl.disconnect_ap(self)
        #启用有线网卡
        CPControl.wlan_enable(self, eth)
        print redirect_title
        if redirect_title == "gatewayname Entry":
            return True
        else:
            return False
Example #3
0
    def access_No_auth_portal(self, ssid, password, wlan, eth,
                              wifi_encryption):
        #无线网卡释放ip地址
        CPControl.dhcp_release_wlan(self, wlan)
        #禁用有线网卡
        CPControl.wlan_disable(self, eth)
        time.sleep(30)
        #使用无线网卡连接group0的ssid
        if wifi_encryption == "open":
            CPControl.connect_NONE_AP(self, ssid, wlan)
        elif wifi_encryption == "wep":
            CPControl.connect_WEP_AP(self, ssid, password, wlan)
        elif wifi_encryption == "wpa":
            CPControl.connect_WPA_AP(self, ssid, password, wlan)
        elif wifi_encryption == "wpa_hiddenssid":
            CPControl.connect_WPA_hiddenssid_AP(self, ssid, password, wlan)
        elif wifi_encryption == "802.1x":
            CPControl.connect_8021x_AP(self, ssid,
                                       data_basic['radius_usename'],
                                       data_basic['radius_password'], wlan)

        #再次禁用有线网卡--防止无线网卡的多次连接时会重启全部网络导致有限网卡再次开启
        CPControl.wlan_disable(self, eth)
        #循环三次检查无线网卡是否能够上网
        for i in range(3):
            #无线网卡释放ip地址
            CPControl.dhcp_release_wlan(self, wlan)
            #无线网卡再次获取ip地址
            CPControl.dhcp_wlan(self, wlan)
            CPControl.move_resolv(self)
            #如果不能访问网络
            tmp = CPControl.get_ping(self, "www.qq.com")
            if tmp == 0:
                break
            else:
                print "check wlan card can access internet or not,again."
        #打开http的页面http://www.qq.com
        portal_title = CPBusiness.wait_for_title(self, "http://www.qq.com")
        print "Access tencent webpage first, goin to %s" % portal_title
        #免认证页面点击同意,然后再点击登录
        redirect_title = CPBusiness.enter_default_portal(self)
        print "click agree, goin to %s" % redirect_title
        return portal_title, redirect_title
Example #4
0
 def check_jump_to_No_auth_portal(self, ssid, password, wlan, eth):
     #无线网卡释放ip地址
     CPControl.dhcp_release_wlan(self, wlan)
     #禁用有线网卡
     CPControl.wlan_disable(self, eth)
     time.sleep(30)
     #使用无线网卡连接group0的ssid
     CPControl.connect_WPA_AP(self, ssid, password, wlan)
     #再次禁用有线网卡--防止无线网卡的多次连接时会重启全部网络导致有限网卡再次开启
     CPControl.wlan_disable(self, eth)
     #循环三次检查无线网卡是否能够上网
     for i in range(3):
         #无线网卡释放ip地址
         CPControl.dhcp_release_wlan(self, wlan)
         #无线网卡再次获取ip地址
         CPControl.dhcp_wlan(self, wlan)
         CPControl.move_resolv(self)
         #如果不能访问网络
         tmp = CPControl.get_ping(self, "www.qq.com")
         if tmp == 0:
             break
         else:
             print "check wlan card can access internet or not,again."
     #打开http的页面http://www.qq.com
     redirect_title = CPBusiness.wait_for_title(self, "http://www.qq.com")
     print "Access tencent webpage, jump to %s webpage" % redirect_title
     #无线网卡释放ip地址
     CPControl.dhcp_release_wlan(self, wlan)
     #断开无线连接
     CPControl.disconnect_ap(self)
     #启用有线网卡
     CPControl.wlan_enable(self, eth)
     print redirect_title
     if redirect_title == "gatewayname Entry":
         return True
     else:
         return False