Ejemplo n.º 1
0
    def do(self):

        if not local_steps.wait_for_ping(timeout=30, ip=self.ssh_host):
            self.set_errorm("", "AP did not respond to ping")
            return False

        commands = ddwrt_utils.generate_ap_config_atheros(
            self.mode,
            self.security,
            encryption=self.encryption,
            wifi_password=self.wifi_password,
            radius_ip=self.radius_ip,
            radius_secret=self.radius_secret,
            hidden_ssid=self.hidden_ssid,
            new_ssid=self.new_ssid,
            channel_bw=self.channel_bw,
            channel_no=self.channel_no,
            interface5ghz=self.interface5ghz,
            ipv6_enable=self.ipv6_enable,
            radvd_enable=self.radvd_enable,
            dhcp_lease=self.dhcp_lease)

        for command_group in ddwrt_utils.split_config(commands):
            local_steps.ssh_command(command=command_group,
                                    ssh_host=self.ssh_host,
                                    ssh_user=self.ssh_user,
                                    ssh_pass=self.ssh_pwd)()
Ejemplo n.º 2
0
 def do(self):
     local_steps.ssh_command(command="ifconfig ath0 " + self.state,
                             ssh_host=self.ssh_host,
                             ssh_user=self.ssh_user,
                             ssh_pwd=self.ssh_pwd)()
     if self.state == "up":
         reload_ap(self.ssh_host, self.ssh_user, self.ssh_pwd)()
Ejemplo n.º 3
0
    def do(self):

        if not local_steps.wait_for_ping(timeout=30, ip=self.ssh_host):
            self.set_errorm("", "AP did not respond to ping")
            return False

        # Copy the radvd conf file to the ap
        local_steps.scp_command(local=self.radvd_conf_file,
                                remote=self.remote_file,
                                ssh_host=self.ssh_host,
                                ssh_user=self.ssh_user)()
        #kill if the process is running & restart with new radvd config
        kill_command = "killall radvd - C / tmp / radvd.conf"
        self.step_data = local_steps.ssh_command(command=kill_command,
                                                 ssh_host=self.ssh_host,
                                                 ssh_user=self.ssh_user)()

        # Enable the radvd daemon and check if the process is running
        command = "radvd -C {0}".format(self.remote_file)
        self.step_data = local_steps.ssh_command(
            command=command,
            ssh_host=self.ssh_host,
            ssh_user=self.ssh_user,
            check_command="ps | grep radvd",
            check_command_output=command)()
Ejemplo n.º 4
0
 def do(self):
     #local_steps.ssh_command(command = "wl radio " + self.state, ssh_host = self.ssh_host, ssh_user = self.ssh_user, ssh_pwd = self.ssh_pwd)()
     #added code to disable/enable the wifi interface
     """ please refer the link for disable and eanble the radio , https://www.dd-wrt.com/phpBB2/viewtopic.php?t=263538"""
     local_steps.ssh_command(command="startservice radio_" + self.state +
                             "_" + self.interface5g,
                             ssh_host=self.ssh_host,
                             ssh_user=self.ssh_user,
                             ssh_pwd=self.ssh_pwd)()
     time.sleep(5)
     local_steps.ssh_command(command="stopservice radio_" + self.state +
                             "_" + self.interface5g,
                             ssh_host=self.ssh_host,
                             ssh_user=self.ssh_user,
                             ssh_pwd=self.ssh_pwd)()
Ejemplo n.º 5
0
 def do(self):
     sh_file = self.config + "_" + self.value + ".sh"
     sh_file_path = self.media_path + "ap_" + self.config + "/" + sh_file
     local_steps.scp_command(local=sh_file_path,
                             remote=".",
                             ssh_host=self.ssh_host,
                             ssh_user=self.ssh_user,
                             ssh_pass=self.ssh_pwd)()
     local_steps.ssh_command(command="chmod +x " + sh_file,
                             ssh_host=self.ssh_host,
                             ssh_user=self.ssh_user,
                             ssh_pass=self.ssh_pwd)()
     local_steps.ssh_command(command="./" + sh_file,
                             ssh_host=self.ssh_host,
                             ssh_user=self.ssh_user,
                             ssh_pass=self.ssh_pwd)()
Ejemplo n.º 6
0
    def do(self):

        if not local_steps.wait_for_ping(timeout=30, ip=self.ssh_host):
            self.set_errorm("", "AP did not respond to ping")
            return False

        commands = ddwrt_utils.generate_virtap_config_atheros(
            self.enable, self.security, self.encryption, self.wifi_password,
            self.radius_ip, self.radius_secret, self.hidden_ssid,
            self.new_ssid, self.interface5ghz)

        for command_group in ddwrt_utils.split_config(commands):
            local_steps.ssh_command(command=command_group,
                                    ssh_host=self.ssh_host,
                                    ssh_user=self.ssh_user,
                                    ssh_pass=self.ssh_pwd)()
Ejemplo n.º 7
0
    def do(self):

        if not local_steps.wait_for_ping(timeout=30, ip=self.ssh_host):
            self.set_errorm("", "AP did not respond to ping")
            return False

        command = "ip addr add {0} dev br0".format(self.ipv6_ip)
        self.step_data = local_steps.ssh_command(
            command=command,
            ssh_host=self.ssh_host,
            ssh_user=self.ssh_user,
            check_command="ifconfig br0 | grep inet6",
            check_command_output=self.ipv6_ip)
Ejemplo n.º 8
0
#
# @filename:    steps.py
# @description: Configure ddwrt router example
# @author:      [email protected]
#
##############################################################################

from testlib.scripts.ddwrt import ddwrt_steps
from testlib.scripts.connections.local import local_steps


DDWRT_IP = "10.237.100.219"
DDWRT_USER = "******"

DDWRT_SCRIPTS_PATH = "../../resources/ddwrt/"


ddwrt_steps.set_cfg(config = "mode",
                    value = "n",
                    ssh_host = DDWRT_IP,
                    ssh_user = DDWRT_USER,
                    media_path = DDWRT_SCRIPTS_PATH)()
ddwrt_steps.set_cfg(config = "security",
                    value = "wep_128",
                    ssh_host = DDWRT_IP,
                    ssh_user = DDWRT_USER,
                    media_path = DDWRT_SCRIPTS_PATH)()
local_steps.ssh_command(command = "reboot",
                        ssh_host = DDWRT_IP,
                        ssh_user = DDWRT_USER)()
Ejemplo n.º 9
0
 def do(self):
     local_steps.ssh_command(command="rc restart",
                             ssh_host=self.ssh_host,
                             ssh_user=self.ssh_user,
                             ssh_pwd=self.ssh_pwd)()
ddwrt_user = args["ssh_user"]
ddwrt_pwd = args["ssh_pass"]
ddwrt_ap_pass = args["passphrase"]
ddwrt_script_path = media_path

ddwrt_steps.set_cfg(config="security",
                    value="wpa2_psk",
                    ssh_host=ddwrt_ip,
                    ssh_user=ddwrt_user,
                    ssh_pwd=ddwrt_pwd,
                    media_path=ddwrt_script_path,
                    blocking=True)()

local_steps.ssh_command(command="reboot",
                        ssh_host=ddwrt_ip,
                        ssh_user=ddwrt_user,
                        ssh_pass=ddwrt_pwd,
                        blocking=True)()

time.sleep(30)

local_steps.wait_for_ping(ip=ddwrt_ip, blocking=True)()

wifi_steps.set_from_wifi_settings()()

time.sleep(30)

ap_list = [
    ddwrt_ap_name,
]