From 884e2346cdb711a78357db7e035ac4f459f3fd14 Mon Sep 17 00:00:00 2001 From: Anil Kumar Tegala <80811302+anil-tegala@users.noreply.github.com> Date: Mon, 28 Aug 2023 19:08:59 +0530 Subject: [PATCH] Wifi 12753 (#840) * test added to validate master-config1 Signed-off-by: anil-tegala * allure info added to master-config1 test Signed-off-by: anil-tegala * added master-config2 test Signed-off-by: anil-tegala --------- Signed-off-by: anil-tegala --- .../master_config_tests/master-config-2.json | 259 ++++++++++++++++++ .../master_config_tests/test_master_config.py | 62 +++++ 2 files changed, 321 insertions(+) create mode 100644 tests/access_point_tests/master_config_tests/master-config-2.json diff --git a/tests/access_point_tests/master_config_tests/master-config-2.json b/tests/access_point_tests/master_config_tests/master-config-2.json new file mode 100644 index 000000000..c7e6783f6 --- /dev/null +++ b/tests/access_point_tests/master_config_tests/master-config-2.json @@ -0,0 +1,259 @@ +{ + "uuid": 2, + "globals": { + "wireless-multimedia": { + "profile": "rfc8325" + } + }, + "radios": [ + { + "band": "2G", + "country": "CA", + "channel-mode": "HE", + "channel-width": 40, + "channel": 11, + "dtim-period": 3 + }, + { + "band": "5G", + "channel": 36, + "channel-mode": "HE", + "channel-width": 80, + "country": "CA", + "dtim-period": 3 + } + ], + "interfaces": [ + { + "name": "WAN", + "role": "upstream", + "services": [ "lldp" ], + "ethernet": [ + { + "select-ports": [ + "WAN*" + ] + } + ], + "ipv4": { + "addressing": "dynamic" + }, + "ssids": [ + { + "name": "radsec-proxy-2", + "wifi-bands": [ + "2G", "5G" + ], + "bss-mode": "ap", + "encryption": { + "proto": "wpa2", + "ieee80211w": "optional" + }, + "radius": { + "authentication": { + "host": "10.28.3.100", + "port": 1812, + "secret": "testing123" + }, + "accounting": { + "host": "10.28.3.100", + "port": 1813, + "secret": "testing123" + } + }, + "services": [ "radius-gw-proxy" ] + }, + { + "bss-mode": "ap", + "encryption": { + "ieee80211w": "optional", + "key": "OpenWifi1", + "proto": "psk2" + }, + "isolate-clients": true, + "name": "Client-isolation-3", + "wifi-bands": [ + "2G","5G" + ] + }, + { + "name": "local-mac-acl-4", + "access-control-list": { + "mode": "allow", + "mac-address": [ + "ac:67:5d:7e:90:a0" + ] + }, + "wifi-bands": [ + "2G", + "5G" + ], + "bss-mode": "ap", + "encryption": { + "proto": "none", + "ieee80211w": "optional" + } + }, + { + "name": "radius-mac-acl-5", + "wifi-bands": [ + "2G","5G" + ], + "bss-mode": "ap", + "encryption": { + "proto": "none" + }, + "radius": { + "authentication": { + "host": "192.168.178.192", + "port": 1812, + "secret": "secret", + "mac-filter": true + } + } + },{ + "name": "owe-transition-2G-6", + "role": "downstream", + "wifi-bands": [ + "2G" + ], + "bss-mode": "ap", + "encryption": { + "proto": "owe-transition", + "ieee80211w": "required" + } + },{ + "name": "owe-transition-5G-6", + "role": "downstream", + "wifi-bands": [ + "5G" + ], + "bss-mode": "ap", + "encryption": { + "proto": "owe-transition", + "ieee80211w": "required" + } + }, + { + "name": "power-save-7", + "role": "downstream", + "wifi-bands": [ + "2G","5G" + ], + "power-save": true, + "unicast-conversion": false, + "bss-mode": "ap", + "encryption": { + "proto": "psk2", + "key": "OpenWifi", + "ieee80211w": "optional" + } + }, + { + "name": "captive-uam-8", + "services": [ + "captive" + ], + "wifi-bands": [ + "5G", + "2G" + ], + "bss-mode": "ap", + "encryption": { + "proto": "psk2", + "key": "OpenWifi", + "ieee80211w": "optional" + }, "captive": { + "auth-mode": "uam", + "uam-port": 3990, + "uam-secret": "hotsys123", + "uam-server": "https://customer.hotspotsystem.com/customer/hotspotlogin.php", + "nasid": "AlmondLabs", + "auth-server": "radius.hotspotsystem.com", + "auth-port": 1812, + "auth-secret": "hotsys123", + "walled-garden-fqdn": [ + "*.google.com", + "facebook.com", + "telecominfraproject.com", + "customer.hotspotsystem.com" + ] + } + }] + }, + { + "name": "LAN", + "role": "downstream", + "services": [ "ssh", "lldp" ], + "ethernet": [ + { + "select-ports": [ + "LAN*" + ] + } + ], + "ipv4": { + "addressing": "static", + "subnet": "192.168.1.1/24", + "dhcp": { + "lease-first": 10, + "lease-count": 100, + "lease-time": "6h" + } + } + } + ], + "metrics": { + "statistics": { + "interval": 120, + "types": [ "ssids", "lldp", "clients" ] + }, + "health": { + "interval": 120 + } + }, + "services": { + "lldp": { + "describe": "uCentral", + "location": "universe" + }, + "ssh": { + "port": 22 + }, + "quality-of-service": { + "select-ports": [ "WAN" ], + "bandwidth_up": 1000, + "bandwidth_down": 1000, + "bulk-detection": { + "dscp": "CS1", + "packets-per-second": 500 + }, + "classifier": [ + { + "dscp": "CS1", + "ports": [ + { "protocol": "any", "port": 53 }, + { "protocol": "tcp", "port": 80 } + ], + "dns": [ + { "fqdn": "telecominfraproject.com", "suffix-matching": false } + ] + }, { + "dscp": "AF41", + "dns": [ + { "fqdn": "zoom.us" } + ] + } + ] + }, + "airtime-fairness": { + "voice-weight": 4, + "packet-threshold": 100, + "bulk-threshold": 50, + "priority-threshold": 30, + "weight-normal": 256, + "weight-priority": 384, + "weight-bulk": 128 + } + } +} \ No newline at end of file diff --git a/tests/access_point_tests/master_config_tests/test_master_config.py b/tests/access_point_tests/master_config_tests/test_master_config.py index 01cdd5e77..704807a97 100644 --- a/tests/access_point_tests/master_config_tests/test_master_config.py +++ b/tests/access_point_tests/master_config_tests/test_master_config.py @@ -22,6 +22,12 @@ with open(file_path, 'r') as file: json_string = file.read() config_data_1 = json.loads(json_string) +file_path2 = os.path.join(test_file_dir, 'master-config-2.json') +with open(file_path, 'r') as file: + json_string = file.read() + config_data_2 = json.loads(json_string) + + pytestmark = [pytest.mark.master_config] @@ -88,3 +94,59 @@ class TestMasterConfig(object): pytest.fail("Some or ALL Configured SSID's are not present in iwinfo") assert True + + + @allure.testcase(url="https://telecominfraproject.atlassian.net/browse/WIFI-12753", name="WIFI-12753") + @pytest.mark.wpa_personal + @pytest.mark.master_config2 + def test_master_config_two(self, get_test_library, check_connectivity, get_target_object): + """ + Master Config Two + pytest -m "master_config2" + """ + for ap in range(len(get_target_object.device_under_tests_info)): + serial_number = get_target_object.device_under_tests_info[ap]['identifier'] + logging.info(config_data_1) + payload = {"configuration": json.dumps(config_data_1), "serialNumber": serial_number, "UUID": 1} + uri = get_target_object.firmware_library_object.sdk_client.build_uri( + "device/" + serial_number + "/configure") + logging.info("Sending Command: " + "\n" + str(uri) + "\n" + + "TimeStamp: " + str(datetime.utcnow()) + "\n" + + "Data: " + str(json.dumps(payload, indent=2)) + "\n" + + "Headers: " + str(get_target_object.firmware_library_object.sdk_client.make_headers())) + allure.attach(name="Push Config:", body="Sending Command: " + "\n" + str(uri) + "\n" + + "TimeStamp: " + str(datetime.utcnow()) + "\n" + + "Data: " + str(payload) + "\n" + + "Headers: " + str( + get_target_object.firmware_library_object.sdk_client.make_headers())) + resp = requests.post(uri, data=json.dumps(payload), + headers=get_target_object.firmware_library_object.sdk_client.make_headers(), + verify=False, timeout=120) + logging.info(resp.json()) + allure.attach(name=f"Response - {resp.status_code}{resp.reason}", body=str(resp.json())) + if int(resp.status_code) == 200: + time.sleep(120) + else: + pytest.exit("Configuration Push Failed") + + # check RX message from AP after config push + after_config_push = get_target_object.dut_library_object.get_dut_logs() + logging.info(after_config_push) + + # get pushed config from ap + config_pushed = get_target_object.dut_library_object.run_generic_command(cmd="cat /etc/ucentral/ucentral" + ".active", attach_allure=True) + logging.info(config_pushed) + # check ssid info in iwinfo + configured_ssids = config_data_2 + iw_info = get_target_object.dut_library_object.get_iwinfo() + if iw_info is not None: + interface_pattern = r'(\S+)\s+ESSID:\s+"(.*?)"' + matches = re.findall(interface_pattern, iw_info) + logging.info(matches) + if matches and len(matches) != 0: + data = {interface: essid for interface, essid in matches} + else: + pytest.fail("Some or ALL Configured SSID's are not present in iwinfo") + + assert True