Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wifi 1335 #679

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
35 changes: 35 additions & 0 deletions libs/apnos/apnos.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,41 @@ def dfs_logread(self):
logs = ""
return logs

def get_ifconfig(self):
client = self.ssh_cli_connect()
cmd = "ifconfig"
if self.mode:
cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \
f"cmd --value \"{cmd}\" "
stdin, stdout, stderr = client.exec_command(cmd)
output = stdout.read().replace(b":~# ifconfig", b"").decode('utf-8')
o = output
client.close()
return o

def get_ip_route(self):
client = self.ssh_cli_connect()
cmd = "ip route show"
if self.mode:
cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \
f"cmd --value \"{cmd}\" "
stdin, stdout, stderr = client.exec_command(cmd)
output = stdout.read().replace(b":~# ifconfig", b"").decode('utf-8')
o = output
client.close()
return o

def get_ip_addr(self):
client = self.ssh_cli_connect()
cmd = "ip addr show"
if self.mode:
cmd = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \
f"cmd --value \"{cmd}\" "
stdin, stdout, stderr = client.exec_command(cmd)
output = stdout.read().replace(b":~# ifconfig", b"").decode('utf-8')
o = output
client.close()
return o

if __name__ == '__main__':
obj = {
Expand Down
7 changes: 7 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,13 @@ def collect_logs():
# Adding memory Profile code after every test completion
output = ap_ssh.get_memory_profile()
allure.attach(name="ucode /usr/share/ucentral/sysinfo.uc ", body=str(output))
# Adding Ifconfig, ip route show and ip addr show commands info after every test completion
output = ap_ssh.get_ifconfig()
allure.attach(name="ifconfig after testcase completion", body=str(output))
output = ap_ssh.get_ip_route()
allure.attach(name="ip route show after testcase completion", body=str(output))
output = ap_ssh.get_ip_addr()
allure.attach(name="ip addr show after testcase completion", body=str(output))

request.addfinalizer(collect_logs)

Expand Down
15 changes: 15 additions & 0 deletions tests/fixtures_2x.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,14 @@ def setup_profiles(self, request, param, setup_controller, testbed, get_equipmen
output = ap_ssh.get_memory_profile()
allure.attach(name="ucode /usr/share/ucentral/sysinfo.uc ", body=str(output))

#Adding Ifconfig, ip route show and ip addr show commands info before applying config
output = ap_ssh.get_ifconfig()
allure.attach(name="ifconfig before config apply", body=str(output))
output = ap_ssh.get_ip_route()
allure.attach(name="ip route show before config apply", body=str(output))
output = ap_ssh.get_ip_addr()
allure.attach(name="ip addr show before config apply", body=str(output))

time_1 = time.time()

# Apply config
Expand Down Expand Up @@ -833,6 +841,13 @@ def setup_profiles(self, request, param, setup_controller, testbed, get_equipmen
# Adding memory Profile code after applying config
output = ap_ssh.get_memory_profile()
allure.attach(name="ucode /usr/share/ucentral/sysinfo.uc ", body=str(output))
# Adding Ifconfig, ip route show and ip addr show commands info after applying config
output = ap_ssh.get_ifconfig()
allure.attach(name="ifconfig after config apply", body=str(output))
output = ap_ssh.get_ip_route()
allure.attach(name="ip route show after config apply", body=str(output))
output = ap_ssh.get_ip_addr()
allure.attach(name="ip addr show after config apply", body=str(output))

def teardown_session():
wifi_status = ap_ssh.get_wifi_status()
Expand Down