Commit f25e1e71 authored by Filip Pokryvka's avatar Filip Pokryvka 🤸🏻
Browse files

contrib.gui: hostapd_wireless setup with many AP visible

parent 5d636626
......@@ -437,8 +437,8 @@ def prepare_openvpn(context, version="ip46", path="/tmp/openvpn-"):
assert running, f"openvpn server did not start, exitcode: {server.returncode}"
@step('Prepare Wi-Fi | with certificates from "{certs_dir}" | with crypto "{crypto}"')
def prepare_wifi(context, certs_dir="contrib/8021x/certs", crypto="default"):
@step('Prepare Wi-Fi | with certificates from "{certs_dir}" | with crypto "{crypto}" | with "{ap_num}" APs')
def prepare_wifi(context, certs_dir="contrib/8021x/certs", crypto="default", ap_num=""):
arch, _ = cmd_output_rc("arch")
arch = arch.strip()
if arch != "x86_64":
......@@ -454,7 +454,7 @@ def prepare_wifi(context, certs_dir="contrib/8021x/certs", crypto="default"):
cmd_output_rc, "sudo mv -f /etc/pki/tls/openssl.cnf.bak /etc/pki/tls/openssl.cnf", shell=True)
assert subprocess.call(
f"sudo bash {NM_CI_RUNNER_CMD} prepare/hostapd_wireless.sh {certs_dir} namespace {crypto}_crypto"
f"sudo bash {NM_CI_RUNNER_CMD} prepare/hostapd_wireless.sh {certs_dir} namespace {crypto}_crypto many_ap={ap_num}"
"&> /tmp/hostapd_wireless.log", shell=True) == 0, "wifi setup failed !!!"
......@@ -489,7 +489,8 @@ def prepare_8021x(context, certs_dir="contrib/8021x/certs", crypto=None):
@step('Prepare wireguard')
def prepare_wireguard(context):
output, rc = cmd_output_rc_embed(context, f"sudo bash {NM_CI_RUNNER_CMD} prepare/wireguard.sh", shell=True)
output, rc = cmd_output_rc_embed(
context, f"sudo bash {NM_CI_RUNNER_CMD} prepare/wireguard.sh", shell=True)
assert rc == 0, "wireguard setup failed!!!"
......
......@@ -240,7 +240,23 @@ private_key_passwd=redhat
rsn_pairwise=GCMP-256
group_cipher=GCMP-256
group_mgmt_cipher=BIP-GMAC-256
" >> $HOSTAPD_CFG
fi
if ((MANY_AP)); then
while ((num_ap < MANY_AP)); do
((num_ap++))
echo "
bss=wlan1_open_$num_ap
ssid=open_$num_ap
channel=1
hw_mode=g
auth_algs=1
wpa=0
" >> $HOSTAPD_CFG
done
fi
# Create a list of users for network authentication, authentication types, and corresponding credentials.
......@@ -350,6 +366,13 @@ function wireless_hostapd_check ()
fi
fi
echo "* Checking 'many_ap'"
many_ap=$(sed -n 's/.*bss=wlan1_open_//p' $HOSTAPD_CFG | tail -n1)
if [ "$many_ap" != "$MANY_AP" ]; then
echo "Not OK!! - need $MANY_AP, found $many_ap"
need_setup=1
fi
if [ $need_setup -eq 1 ]; then
rm -rf /tmp/nm_wifi_supp_configured
wireless_hostapd_teardown
......@@ -499,14 +522,20 @@ else
echo "Configure and start hostapd..."
# Set DO_NAMESPACE to true if "namespace" in arguments
DO_NAMESPACE=false
if [[ " $@ " == *" namespace "* ]]; then
DO_NAMESPACE=true
fi
MANY_AP=
CRYPTO="default"
if [[ " $@ " == *" legacy_crypto "* ]]; then
for arg in "$@"; do
if [[ "$arg" == "namespace" ]]; then
DO_NAMESPACE=true
fi
if [[ "$arg" == "legacy_crypto" ]]; then
CRYPTO="legacy"
fi
fi
if [[ "$arg" == "many_ap="* ]]; then
MANY_AP=${arg#many_ap=}
fi
done
CERTS_PATH=${1:?"Error. Path to certificates is not specified."}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment