minor lf_dut logic fix for open and eap ssid's and full l3 cx information in general client connectivity added

Signed-off-by: shivamcandela <shivam.thakur@candelatech.com>
This commit is contained in:
shivamcandela
2021-07-29 00:51:35 +05:30
parent 049acfbb00
commit c5da340af6
6 changed files with 84 additions and 45 deletions

View File

@@ -354,6 +354,7 @@ class APNOS:
def get_uc_latest_config(self): def get_uc_latest_config(self):
try: try:
connected, latest, active = self.get_ucentral_status() connected, latest, active = self.get_ucentral_status()
print()
client = self.ssh_cli_connect() client = self.ssh_cli_connect()
cmd = "cat /etc/ucentral/ucentral.cfg." + latest cmd = "cat /etc/ucentral/ucentral.cfg." + latest
if self.mode: if self.mode:
@@ -361,6 +362,7 @@ class APNOS:
f"cmd --value \"{cmd}\" " f"cmd --value \"{cmd}\" "
stdin, stdout, stderr = client.exec_command(cmd) stdin, stdout, stderr = client.exec_command(cmd)
output = stdout.read().decode('utf-8').splitlines()[1] output = stdout.read().decode('utf-8').splitlines()[1]
print(output)
json_output = json.loads(output) # , sort_keys=True) json_output = json.loads(output) # , sort_keys=True)
print(type(json_output)) print(type(json_output))
client.close() client.close()
@@ -411,7 +413,7 @@ class APNOS:
for j in r[i]["interfaces"]: for j in r[i]["interfaces"]:
encryption = j["config"]["encryption"] encryption = j["config"]["encryption"]
if encryption == "psk" or encryption == "psk2" or encryption == "psk-mixed" or \ if encryption == "psk" or encryption == "psk2" or encryption == "psk-mixed" or \
encryption == "sae" or encryption == "sae-mixed": encryption == "sae" or encryption == "sae-mixed":
wifi_info[j["ifname"]] = [j["config"]["ssid"], j["config"]["encryption"], j["config"]["key"]] wifi_info[j["ifname"]] = [j["config"]["ssid"], j["config"]["encryption"], j["config"]["key"]]
else: else:
wifi_info[j["ifname"]] = [j["config"]["ssid"], j["config"]["encryption"], ""] wifi_info[j["ifname"]] = [j["config"]["ssid"], j["config"]["encryption"], ""]
@@ -490,6 +492,17 @@ class APNOS:
logs = "" logs = ""
return logs return logs
def get_ap_version_ucentral(self):
client = self.ssh_cli_connect()
cmd = "cat /tmp/ucentral.version"
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":~# cat /tmp/ucentral.version", b"").decode('utf-8')
client.close()
return output
def get_vifc(self): def get_vifc(self):
client = self.ssh_cli_connect() client = self.ssh_cli_connect()
cmd = "vifC" cmd = "vifC"
@@ -543,5 +556,5 @@ if __name__ == '__main__':
'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/edgecore_eap102/20210625-edgecore_eap102-uCentral-trunk-4225122-upgrade.bin" 'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/edgecore_eap102/20210625-edgecore_eap102-uCentral-trunk-4225122-upgrade.bin"
} }
var = APNOS(credentials=obj, sdk="2.x") var = APNOS(credentials=obj, sdk="2.x")
x = var.get_interface_details() x = var.get_ap_version_ucentral()
print(x) print(x)

View File

@@ -26,6 +26,7 @@ from sta_connect2 import StaConnect2
import time import time
import string import string
import random import random
S = 12 S = 12
# from eap_connect import EAPConnect # from eap_connect import EAPConnect
from test_ipv4_ttls import TTLSTest from test_ipv4_ttls import TTLSTest
@@ -118,6 +119,15 @@ class RunTest:
print("test result: " + result) print("test result: " + result)
result = True result = True
print("Client Connectivity :", self.staConnect.passes) print("Client Connectivity :", self.staConnect.passes)
endp_data = []
for i in self.staConnect.resulting_endpoints:
endp_data.append(self.staConnect.resulting_endpoints[i]["endpoint"])
cx_data = ""
for i in endp_data:
for j in i:
cx_data = cx_data + str(j) + " : " + str(i[j]) + "\n"
cx_data = cx_data + "\n"
allure.attach(name="cx_data", body=str(cx_data))
if self.staConnect.passes(): if self.staConnect.passes():
print("client connection to", self.staConnect.dut_ssid, "successful. Test Passed") print("client connection to", self.staConnect.dut_ssid, "successful. Test Passed")
else: else:
@@ -380,9 +390,9 @@ class RunTest:
# target_csv=self.local_report_path + report_name + "/kpi.csv") # target_csv=self.local_report_path + report_name + "/kpi.csv")
# influx.post_to_influx() # influx.post_to_influx()
return self.dualbandptest_obj return self.dualbandptest_obj
def ratevsrange(self, station_name=None, mode="BRIDGE", vlan_id=100, download_rate="85%", dut_name="TIP", def ratevsrange(self, station_name=None, mode="BRIDGE", vlan_id=100, download_rate="85%", dut_name="TIP",
upload_rate="0", duration="1m", instance_name="test_demo", raw_lines=None): upload_rate="0", duration="1m", instance_name="test_demo", raw_lines=None):
if mode == "BRIDGE": if mode == "BRIDGE":
self.client_connect.upstream_port = self.upstream_port self.client_connect.upstream_port = self.upstream_port
elif mode == "NAT": elif mode == "NAT":
@@ -391,22 +401,22 @@ class RunTest:
self.client_connect.upstream_port = self.upstream_port + "." + str(vlan_id) self.client_connect.upstream_port = self.upstream_port + "." + str(vlan_id)
self.rvr_obj = RvrTest(lf_host=self.lanforge_ip, self.rvr_obj = RvrTest(lf_host=self.lanforge_ip,
lf_port=self.lanforge_port, lf_port=self.lanforge_port,
ssh_port=self.lf_ssh_port, ssh_port=self.lf_ssh_port,
local_path=self.local_report_path, local_path=self.local_report_path,
lf_user="lanforge", lf_user="lanforge",
lf_password="lanforge", lf_password="lanforge",
instance_name=instance_name, instance_name=instance_name,
config_name="rvr_config", config_name="rvr_config",
upstream="1.1." + self.upstream_port, upstream="1.1." + self.upstream_port,
pull_report=True, pull_report=True,
load_old_cfg=False, load_old_cfg=False,
upload_speed=upload_rate, upload_speed=upload_rate,
download_speed=download_rate, download_speed=download_rate,
duration=duration, duration=duration,
station="1.1." + station_name[0], station="1.1." + station_name[0],
dut=dut_name, dut=dut_name,
raw_lines=raw_lines) raw_lines=raw_lines)
self.rvr_obj.setup() self.rvr_obj.setup()
self.rvr_obj.run() self.rvr_obj.run()
report_name = self.rvr_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1] report_name = self.rvr_obj.report_name[0]['LAST']["response"].split(":::")[1].split("/")[-1]
@@ -415,6 +425,7 @@ class RunTest:
influx.post_to_influx() influx.post_to_influx()
return self.rvr_obj return self.rvr_obj
if __name__ == '__main__': if __name__ == '__main__':
lanforge_data = { lanforge_data = {
"ip": "localhost", "ip": "localhost",

View File

@@ -255,7 +255,7 @@ CONFIGURATION = {
'password': "pumpkin77", 'password': "pumpkin77",
'port': 22, 'port': 22,
'jumphost_tty': '/dev/ttyAP3', 'jumphost_tty': '/dev/ttyAP3',
'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/edgecore_eap102/20210625-edgecore_eap102-uCentral-trunk-4225122-upgrade.bin" 'version': "https://tip.jfrog.io/artifactory/tip-wlan-ap-firmware/uCentral/tplink_ec420/20210728-tplink_ec420-uCentral-trunk-12ad0d5-upgrade.bin"
} }
], ],
"traffic_generator": { "traffic_generator": {
@@ -264,14 +264,14 @@ CONFIGURATION = {
"ip": "10.28.3.10", "ip": "10.28.3.10",
"port": 8080, "port": 8080,
"ssh_port": 22, "ssh_port": 22,
"2.4G-Radio": ["1.1.wiphy4"], "2.4G-Radio": ["1.1.wiphy0", "1.1.wiphy4"],
"5G-Radio": ["1.1.wiphy5"], "5G-Radio": ["1.1.wiphy1", "1.1.wiphy5"],
"AX-Radio": ["1.1.wiphy0", "1.1.wiphy1", "1.1.wiphy2", "1.1.wiphy3"], "AX-Radio": ["1.1.wiphy0", "1.1.wiphy1", "1.1.wiphy2", "1.1.wiphy3"],
"upstream": "1.1.eth2", "upstream": "1.1.eth2",
"upstream_subnet": "10.28.2.1/24", "upstream_subnet": "10.28.2.1/24",
"uplink": "1.1.eth3", "uplink": "1.1.eth3",
"2.4G-Station-Name": "wlan0", "2.4G-Station-Name": "sta00",
"5G-Station-Name": "wlan1", "5G-Station-Name": "sta10",
"AX-Station-Name": "ax" "AX-Station-Name": "ax"
} }
} }

View File

@@ -6,7 +6,6 @@ import sys
import os import os
import time import time
import allure import allure
import re import re
import logging import logging
@@ -674,7 +673,17 @@ def add_allure_environment_property(request: SubRequest) -> Optional[Callable]:
@fixture(scope='session') @fixture(scope='session')
def add_env_properties(get_configuration, add_allure_environment_property: Callable) -> None: def get_uc_ap_version(get_apnos, get_configuration):
version_list = []
for access_point_info in get_configuration['access_point']:
ap_ssh = get_apnos(access_point_info)
version = ap_ssh.get_ap_version_ucentral()
version_list.append(version)
yield version_list
@fixture(scope='session')
def add_env_properties(get_configuration, get_uc_ap_version, add_allure_environment_property: Callable) -> None:
add_allure_environment_property('Access-Point-Model', get_configuration["access_point"][0]["model"]) add_allure_environment_property('Access-Point-Model', get_configuration["access_point"][0]["model"])
add_allure_environment_property('Access-Point-Firmware-Version', get_configuration["access_point"][0]["version"]) add_allure_environment_property('Access-Point-Firmware-Version', "\n".join(get_uc_ap_version))
add_allure_environment_property('Cloud-Controller-SDK-URL', get_configuration["controller"]["url"]) add_allure_environment_property('Cloud-Controller-SDK-URL', get_configuration["controller"]["url"])

View File

@@ -813,7 +813,6 @@ def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment
ssid = ["ssid_idx=" + str(interface) + ssid = ["ssid_idx=" + str(interface) +
" ssid=" + ap_wifi_data[ap_interfaces[interface]][0] + " ssid=" + ap_wifi_data[ap_interfaces[interface]][0] +
" security=OPEN" + " security=OPEN" +
" password=" + ap_wifi_data[ap_interfaces[interface]][2] +
" bssid=" + ap_wifi_data[ap_interfaces[interface]][3][0] " bssid=" + ap_wifi_data[ap_interfaces[interface]][3][0]
] ]
idx_mapping[str(interface)] = [ap_wifi_data[ap_interfaces[interface]][0], idx_mapping[str(interface)] = [ap_wifi_data[ap_interfaces[interface]][0],
@@ -898,7 +897,6 @@ def setup_profiles(request, setup_controller, testbed, setup_vlan, get_equipment
ssid = ["ssid_idx=" + str(interface) + ssid = ["ssid_idx=" + str(interface) +
" ssid=" + ap_wifi_data[ap_interfaces[interface]][0] + " ssid=" + ap_wifi_data[ap_interfaces[interface]][0] +
" security=EAP-TTLS" + " security=EAP-TTLS" +
" password=" + ap_wifi_data[ap_interfaces[interface]][2] +
" bssid=" + str(ap_wifi_data[ap_interfaces[interface]][3][0]).lower() " bssid=" + str(ap_wifi_data[ap_interfaces[interface]][3][0]).lower()
] ]

View File

@@ -2,7 +2,7 @@ import allure
import pytest import pytest
pytestmark = [pytest.mark.client_connectivity, pytest.mark.vlan, pytest.mark.enterprise, pytest.mark.ttls, pytestmark = [pytest.mark.client_connectivity, pytest.mark.vlan, pytest.mark.enterprise, pytest.mark.ttls,
pytest.mark.ucentral, pytest.mark.sanity] # pytest.mark.usefixtures("setup_test_run") pytest.mark.ucentral, pytest.mark.sanity] # pytest.mark.usefixtures("setup_test_run")
setup_params_enterprise = { setup_params_enterprise = {
"mode": "VLAN", "mode": "VLAN",
@@ -11,8 +11,8 @@ setup_params_enterprise = {
{"ssid_name": "ssid_wpa_eap_2g", "appliedRadios": ["2G"]}, {"ssid_name": "ssid_wpa_eap_2g", "appliedRadios": ["2G"]},
{"ssid_name": "ssid_wpa_eap_5g", "appliedRadios": ["5G"]}], {"ssid_name": "ssid_wpa_eap_5g", "appliedRadios": ["5G"]}],
"wpa2_enterprise": [ "wpa2_enterprise": [
{"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["2G"], "vlan":100}, {"ssid_name": "ssid_wpa2_eap_2g", "appliedRadios": ["2G"], "vlan": 100},
{"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["5G"], "vlan":100}], {"ssid_name": "ssid_wpa2_eap_5g", "appliedRadios": ["5G"], "vlan": 100}],
"wpa3_enterprise": [ "wpa3_enterprise": [
{"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["2G"]}, {"ssid_name": "ssid_wpa3_eap_2g", "appliedRadios": ["2G"]},
{"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["5G"]}]}, {"ssid_name": "ssid_wpa3_eap_5g", "appliedRadios": ["5G"]}]},
@@ -28,14 +28,13 @@ setup_params_enterprise = {
indirect=True, indirect=True,
scope="class" scope="class"
) )
@pytest.mark.usefixtures("setup_profiles") @pytest.mark.usefixtures("setup_profiles")
class TestVLANModeEnterpriseTTLSSuiteOne(object): class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa_enterprise @pytest.mark.wpa_enterprise
@pytest.mark.twog @pytest.mark.twog
def test_wpa_enterprise_2g(self, get_vif_state,station_names_twog, setup_profiles, get_lanforge_data, lf_test, update_report, def test_wpa_enterprise_2g(self, get_vif_state, station_names_twog, setup_profiles, get_lanforge_data, lf_test,
update_report,
test_cases, radius_info, exit_on_fail): test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][0] profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][0]
ssid_name = profile_data["ssid_name"] ssid_name = profile_data["ssid_name"]
@@ -59,7 +58,8 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa_enterprise @pytest.mark.wpa_enterprise
@pytest.mark.fiveg @pytest.mark.fiveg
def test_wpa_enterprise_5g(self, get_vif_state,station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, update_report, def test_wpa_enterprise_5g(self, get_vif_state, station_names_fiveg, setup_profiles, get_lanforge_data, lf_test,
update_report,
test_cases, radius_info, exit_on_fail): test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][1] profile_data = setup_params_enterprise["ssid_modes"]["wpa_enterprise"][1]
ssid_name = profile_data["ssid_name"] ssid_name = profile_data["ssid_name"]
@@ -85,7 +85,8 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.sanity_light @pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise @pytest.mark.wpa2_enterprise
@pytest.mark.twog @pytest.mark.twog
def test_wpa2_enterprise_2g(self, get_vif_state,station_names_twog, setup_profiles, get_lanforge_data, lf_test, update_report, def test_wpa2_enterprise_2g(self, get_vif_state, station_names_twog, setup_profiles, get_lanforge_data, lf_test,
update_report,
test_cases, radius_info, exit_on_fail): test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][0] profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][0]
ssid_name = profile_data["ssid_name"] ssid_name = profile_data["ssid_name"]
@@ -111,7 +112,8 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.sanity_light @pytest.mark.sanity_light
@pytest.mark.wpa2_enterprise @pytest.mark.wpa2_enterprise
@pytest.mark.fiveg @pytest.mark.fiveg
def test_wpa2_enterprise_5g(self, get_vif_state,station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, update_report, def test_wpa2_enterprise_5g(self, get_vif_state, station_names_fiveg, setup_profiles, get_lanforge_data, lf_test,
update_report,
test_cases, radius_info, exit_on_fail): test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][1] profile_data = setup_params_enterprise["ssid_modes"]["wpa2_enterprise"][1]
ssid_name = profile_data["ssid_name"] ssid_name = profile_data["ssid_name"]
@@ -135,7 +137,8 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa3_enterprise @pytest.mark.wpa3_enterprise
@pytest.mark.twog @pytest.mark.twog
def test_wpa3_enterprise_2g(self, get_vif_state,station_names_twog, setup_profiles, get_lanforge_data, lf_test, update_report, def test_wpa3_enterprise_2g(self, get_vif_state, station_names_twog, setup_profiles, get_lanforge_data, lf_test,
update_report,
test_cases, radius_info, exit_on_fail): test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][0] profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][0]
ssid_name = profile_data["ssid_name"] ssid_name = profile_data["ssid_name"]
@@ -158,7 +161,8 @@ class TestVLANModeEnterpriseTTLSSuiteOne(object):
@pytest.mark.wpa3_enterprise @pytest.mark.wpa3_enterprise
@pytest.mark.fiveg @pytest.mark.fiveg
def test_wpa3_enterprise_5g(self, get_vif_state,station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, update_report, def test_wpa3_enterprise_5g(self, get_vif_state, station_names_fiveg, setup_profiles, get_lanforge_data, lf_test,
update_report,
test_cases, radius_info, exit_on_fail): test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][1] profile_data = setup_params_enterprise["ssid_modes"]["wpa3_enterprise"][1]
ssid_name = profile_data["ssid_name"] ssid_name = profile_data["ssid_name"]
@@ -207,7 +211,8 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed @pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.twog @pytest.mark.twog
def test_wpa_wpa2_enterprise_2g(self, get_vif_state,station_names_twog, setup_profiles, get_lanforge_data, lf_test, update_report, def test_wpa_wpa2_enterprise_2g(self, get_vif_state, station_names_twog, setup_profiles, get_lanforge_data, lf_test,
update_report,
test_cases, radius_info, exit_on_fail): test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][0] profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][0]
ssid_name = profile_data["ssid_name"] ssid_name = profile_data["ssid_name"]
@@ -231,7 +236,8 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa_wpa2_enterprise_mixed @pytest.mark.wpa_wpa2_enterprise_mixed
@pytest.mark.fiveg @pytest.mark.fiveg
def test_wpa_wpa2_enterprise_5g(self, get_vif_state,station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, def test_wpa_wpa2_enterprise_5g(self, get_vif_state, station_names_fiveg, setup_profiles, get_lanforge_data,
lf_test,
update_report, test_cases, radius_info, exit_on_fail): update_report, test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][1] profile_data = setup_params_enterprise_two["ssid_modes"]["wpa_wpa2_enterprise_mixed"][1]
ssid_name = profile_data["ssid_name"] ssid_name = profile_data["ssid_name"]
@@ -255,7 +261,8 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed @pytest.mark.wpa3_enterprise_mixed
@pytest.mark.twog @pytest.mark.twog
def test_wpa3_enterprise_mixed_2g(self, get_vif_state,station_names_twog, setup_profiles, get_lanforge_data, lf_test, def test_wpa3_enterprise_mixed_2g(self, get_vif_state, station_names_twog, setup_profiles, get_lanforge_data,
lf_test,
update_report, test_cases, radius_info, exit_on_fail): update_report, test_cases, radius_info, exit_on_fail):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][0] profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][0]
ssid_name = profile_data["ssid_name"] ssid_name = profile_data["ssid_name"]
@@ -278,7 +285,8 @@ class TestVLANModeEnterpriseTTLSSuiteTwo(object):
@pytest.mark.wpa3_enterprise_mixed @pytest.mark.wpa3_enterprise_mixed
@pytest.mark.fiveg @pytest.mark.fiveg
def test_wpa3_enterprise_mixed_5g(self, get_vif_state,station_names_fiveg, setup_profiles, get_lanforge_data, lf_test, def test_wpa3_enterprise_mixed_5g(self, get_vif_state, station_names_fiveg, setup_profiles, get_lanforge_data,
lf_test,
update_report, exit_on_fail, update_report, exit_on_fail,
test_cases, radius_info): test_cases, radius_info):
profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][1] profile_data = setup_params_enterprise_two["ssid_modes"]["wpa3_enterprise_mixed"][1]