Added dfs method

Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
jitendracandela
2021-12-29 15:26:44 +05:30
parent b571c33ef3
commit 5841984c5b
4 changed files with 64 additions and 11 deletions

View File

@@ -36,6 +36,7 @@ class APNOS:
self.password = credentials['password'] # if mode=1, enter jumphost password else ap password self.password = credentials['password'] # if mode=1, enter jumphost password else ap password
self.port = credentials['port'] # if mode=1, enter jumphost ssh port else ap ssh port self.port = credentials['port'] # if mode=1, enter jumphost ssh port else ap ssh port
self.mode = credentials['jumphost'] # 1 for jumphost, 0 for direct ssh self.mode = credentials['jumphost'] # 1 for jumphost, 0 for direct ssh
self.model = credentials['mode']
if self.mode: if self.mode:
self.tty = credentials['jumphost_tty'] # /dev/ttyAP1 self.tty = credentials['jumphost_tty'] # /dev/ttyAP1
# kill minicom instance # kill minicom instance
@@ -601,19 +602,41 @@ class APNOS:
status = "Error" status = "Error"
return status return status
def dfs(self):
if self.model == "wifi5":
cmd = "cd /sys/kernel/debug/ieee80211/phy1/ath10k/ && echo 1 > dfs_simulate_radar"
print("cmd: ", cmd)
client = self.ssh_cli_connect()
command = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \
f"cmd --value \"{cmd}\" "
stdin, stdout, stderr = client.exec_command(command)
output = stdout.read()
print("hey", output)
client.close()
else:
cmd = f'cd && cd /sys/kernel/debug/ath11k/ && cd ipq* && cd mac0 && ls && echo 1 > dfs_simulate_radar '
print("cmd: ", cmd)
client = self.ssh_cli_connect()
command = f"cd ~/cicd-git/ && ./openwrt_ctl.py {self.owrt_args} -t {self.tty} --action " \
f"cmd --value \"{cmd}\" "
stdin, stdout, stderr = client.exec_command(command)
output = stdout.read()
print("hey", output)
client.close()
if __name__ == '__main__': if __name__ == '__main__':
obj = { obj = {
'model': 'eap102', 'model': 'eap102',
'mode': 'wifi6', 'mode': 'wifi6',
'serial': '903cb30bcf12', 'serial': '903cb30bcf12',
'jumphost': True, 'jumphost': True,
'ip': "192.168.200.80", 'ip': "192.168.200.80",
'username': "lanforge", 'username': "lanforge",
'password': "lanforge", 'password': "lanforge",
'port': 22, 'port': 22,
'jumphost_tty': '/dev/ttyAP1', 'jumphost_tty': '/dev/ttyAP1',
'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/ecw5410/trunk/ecw5410-1.1.0.tar.gz" 'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/ecw5410/trunk/ecw5410-1.1.0.tar.gz"
} }
var = APNOS(credentials=obj, sdk="2.x") var = APNOS(credentials=obj, sdk="2.x")
a = var.get_uc_latest_config() a = var.get_uc_latest_config()
print(a) print(a)

View File

View File

@@ -0,0 +1,30 @@
import pytest
pytestmark = [pytest.mark.dfs, pytest.mark.bridge]
setup_params_general = {
"mode": "BRIDGE",
"ssid_modes": {
"wpa2_personal": [
{"ssid_name": "ssid_wpa2_2g", "appliedRadios": ["2G"], "security_key": "something"},
{"ssid_name": "ssid_wpa2_5g", "appliedRadios": ["5G"], "security_key": "something"}
]
},
"dfs":{
"channel":52,
"channel_bandwidth":80
},
"rf": {},
"radius": False
}
@pytest.mark.parametrize(
'setup_profiles',
[setup_params_general],
indirect=True,
scope="class"
)
class DFSTest(object):
def test_dfs(self, setup_profiles):
pass