From c91319f938ab1dc4c6f0bfdc7b83ac673cd985da Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Thu, 3 Oct 2024 13:07:22 -0700 Subject: [PATCH 01/17] antenna_stations_traffic.sh: Deprecate script Signed-off-by: Alex Gavin --- .../antenna_stations_traffic.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename antenna_stations_traffic.sh => archive/antenna_stations_traffic.sh (100%) diff --git a/antenna_stations_traffic.sh b/archive/antenna_stations_traffic.sh similarity index 100% rename from antenna_stations_traffic.sh rename to archive/antenna_stations_traffic.sh From d2aeeeb3e8a659cc29bb8bb82561e4fd26395861 Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Thu, 3 Oct 2024 13:07:53 -0700 Subject: [PATCH 02/17] create_virtualenv.sh: Remove script, see update_dependencies.py Signed-off-by: Alex Gavin --- create_virtualenv.sh | 5 ----- 1 file changed, 5 deletions(-) delete mode 100755 create_virtualenv.sh diff --git a/create_virtualenv.sh b/create_virtualenv.sh deleted file mode 100755 index b48e8bfe8..000000000 --- a/create_virtualenv.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -sudo dnf install virtualenv -y -su -l lanforge -c "cd ~ && python3 -m venv lanforge_env" -su -l lanforge -c "echo 'source ~/lanforge_env/bin/activate' >> ~/.bashrc" -echo "Please restart your terminal, your virtualenv will activate automtically" From f050823d26a8bb119b1f5c967385bbb647386e39 Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 7 Oct 2024 18:34:51 -0700 Subject: [PATCH 03/17] jlanpro_test.pl: Archive internal test script Signed-off-by: Alex Gavin --- jlanpro_test.pl => archive/jlanpro_test.pl | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename jlanpro_test.pl => archive/jlanpro_test.pl (100%) diff --git a/jlanpro_test.pl b/archive/jlanpro_test.pl similarity index 100% rename from jlanpro_test.pl rename to archive/jlanpro_test.pl From 05750f5019215343c7029de0d9d1f85e976ddadf Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Thu, 3 Oct 2024 13:08:19 -0700 Subject: [PATCH 04/17] lf_mail.py: Deprecate script Signed-off-by: Alex Gavin --- lf_mail.py => py-scripts/scripts_deprecated/lf_mail.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lf_mail.py => py-scripts/scripts_deprecated/lf_mail.py (100%) diff --git a/lf_mail.py b/py-scripts/scripts_deprecated/lf_mail.py similarity index 100% rename from lf_mail.py rename to py-scripts/scripts_deprecated/lf_mail.py From 980971c398d77f68a69d84a8cb44fc41c7afdd72 Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 7 Oct 2024 13:59:11 -0700 Subject: [PATCH 05/17] test_perl_json.sh: Remove incomplete test script Signed-off-by: Alex Gavin --- test_perl_json.sh | 63 ----------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100755 test_perl_json.sh diff --git a/test_perl_json.sh b/test_perl_json.sh deleted file mode 100755 index 10a17c702..000000000 --- a/test_perl_json.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -unset proxy -unset http_proxy -## ----- ----- ----- ----- ----- ----- ----- ----- ----- -----# -## tests to exercise perl-json api # -## ----- ----- ----- ----- ----- ----- ----- ----- ----- -----# - - -# ares-f30m64.jbr.candelatech.com -HOST=${1:-localhost} -BASEURL="http://${HOST}:8080" -HELPURL="${BASEURL}/help" -FORMURL="${BASEURL}/cli-form" -JSONURL="${BASEURL}/cli-json" - -function Get() { - [ -f /tmp/$$.result ] && rm -f /tmp/$$.result - curl -sq -H 'Accept: application/json' "${BASEURL}${@}" &> /tmp/$$.result - wc -l /tmp/$$.result - if [[ $? = 0 ]]; then - json_reformat < /tmp/$$.result - fi -} - -# test that we have a connection to lfclient -echo "Testing $HOST $BASEURL" -Get /port/1/1/eth1 || exit 1 - -cd json -./port_test.pl --host $HOST --ssid kedtest-wpa2 --pass kedtest-wpa2 -sleep 1 -./test_sta_mode.pl --host $HOST -sleep 1 -./json_port_test3.sh $HOST - - -## ----- ----- ----- ----- ----- ----- ----- ----- ----- -----# - -# create a pair of redirect ports -RDD=('rd0a' 'rd0b' 'rd1a' 'rd1b') - - - -# create a wanlink between two of them -WL='wl1' -WLEP=("${WL}-A" "${WL}-B") - -# create a layer 3 connection between the a-side rdds -CX='tcp1' -EPS=("${CX}-A" "${CX}-B") - -# start the wanlink - -# start the layer3 - -# print port stats after 30 seconds - - - - -### -### -### From 0b4587071a7affce66bfba211507e28da32b6f9e Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 7 Oct 2024 18:35:21 -0700 Subject: [PATCH 06/17] ubuntu_server_installer.bash: Archive script, logic subsumed by kinstall Signed-off-by: Alex Gavin --- .../ubuntu_server_installer.bash | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ubuntu_server_installer.bash => archive/ubuntu_server_installer.bash (100%) diff --git a/ubuntu_server_installer.bash b/archive/ubuntu_server_installer.bash similarity index 100% rename from ubuntu_server_installer.bash rename to archive/ubuntu_server_installer.bash From 2698b4b0695509189355778a7e47c16c15d34d06 Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 7 Oct 2024 13:59:39 -0700 Subject: [PATCH 07/17] upgrade_py_venv.bash: Move to internal repository Signed-off-by: Alex Gavin --- upgrade_py_venv.bash | 303 ------------------------------------------- 1 file changed, 303 deletions(-) delete mode 100755 upgrade_py_venv.bash diff --git a/upgrade_py_venv.bash b/upgrade_py_venv.bash deleted file mode 100755 index 8ee0bd409..000000000 --- a/upgrade_py_venv.bash +++ /dev/null @@ -1,303 +0,0 @@ -#!/bin/bash -# -# Build and/or install a version of python and create the virtual environment it wants. -# Start by building the updated python version. Then package it. Then do a "make install" -# -# this is the comcast python upgrade steps: -# -set -eu - -# wget https://yumrepo.sys.comcast.net/cats/candela/Python-3.10.11.tar.xz -PYVER="" #3.10.14" -SHORTVER="" -VENVD="" #venv-3.10" -BUILD_DEST="" -PORTAPYD="$HOME/python" -DEST_TYPE="" -OSSL_DOM="https://www.openssl.org/source/" -OSSL_SRC="openssl-3.0.13.tar.gz" -OSSL_DIR="${OSSL_SRC%.tar.gz}" -OSSL_URL="${OSSL_DOM}/$OSSL_SRC" -OSSL_DEST="${HOME}/python/$OSSL_DIR" - -declare -A source_urls=( - ["3.8.19"]="https://www.python.org/ftp/python/3.8.19/Python-3.8.19.tar.xz" - ["3.9.17"]="https://www.python.org/ftp/python/3.9.17/Python-3.9.17.tar.xz" - ["3.10.14"]="https://www.python.org/ftp/python/3.10.14/Python-3.10.14.tar.xz" -) -declare -A dest_dirs=( - ["local-3.8.19"]="/usr/local/lib/python3.8" - ["local-3.9.17"]="/usr/local/lib/python3.9" - ["local-3.10.14"]="/usr/local/lib/python3.10" - ["portable-3.8.19"]="$PORTAPYD/python3.8.19" - ["portable-3.9.17"]="$PORTAPYD/python3.9.17" - ["portable-3.10.14"]="$PORTAPYD//python3.10" -) - -declare -A build_choices=( - ["local"]="/usr/local" - ["portable"]="$PORTAPYD" -) - -declare -A dirs_to_clean=( - ["/usr/local-3.8.19"]="${dest_dirs['local-3.8.19']}" - ["$PORTAPYD-3.8.19"]="${dest_dirs['portable-3.8.19']}" - ["/usr/local-3.9.17"]="${dest_dirs['local-3.9.17']}" - ["$PORTAPYD-3.9.17"]="${dest_dirs['portable-3.9.17']}" - ["/usr/local-3.10.14"]="${dest_dirs['local-3.10.14']}" - ["$PORTAPYD-3.10.14"]="${dest_dirs['portable-3.10.14']}" -) - -function help() { - cat < - -c # remove $PORTAPYD/ - - Example of cleaning the /usr/local install of python library files - $0 -a3.9.17 -blocal -c - - Example of buildng $PORTAPYD for python 3.10.11: - $0 -a3.10.14 -bportable -EOF -} -show_help=0 -opts="a:b:ch" -do_clean=0 -while getopts $opts opt; do - case "$opt" in - a) - # found is to test for the python version number - found="${dest_dirs[local-$OPTARG]+1}" - if [[ -z $found ]]; then - show_help=1 - echo "Versions available: " - printf " %s\n" "${!source_urls[@]}" - exit 1 - else - PYVER="$OPTARG" - VENVD="venv-$OPTARG" - SHORTVER="${PYVER%.*}" - fi - ;; - b) - if [[ -z ${OPTARG:-} ]]; then - show_help=1 - 1>&2 echo "-b requires argument" - fi - found="${build_choices[$OPTARG]+1}" - if [[ -z $found ]]; then - 1>&2 echo "No matching -b action [${OPTARG:-}], choose local or portable " - show_help=1 - else - BUILD_DEST="${OPTARG}-${PYVER}" - BUILD_DEST="${dest_dirs[$BUILD_DEST]}" - DEST_TYPE="$OPTARG" - echo "Directories: BUILD_DEST[$BUILD_DEST] DEST_TYPE[$DEST_TYPE]" - fi - ;; - c) - # echo "C $opt $OPTARG" - if [[ -z ${PYVER:-} ]] || [[ -z $DEST_TYPE ]]; then - 1>&2 echo "-c requires -a to be set and dest_type[$DEST_TYPE]" - show_help=1 - else - found="${dest_dirs[${DEST_TYPE}-$PYVER]+1}" - if [[ -z $found ]]; then - 1>&2 echo "Clean: did not see version [${PYVER:-}] or dest_type[$DEST_TYPE]" - show_help=1 - elif [[ -z ${BUILD_DEST:-} ]]; then - 1>&2 echo "-c requires -a and -b" - show_help=1 - else - do_clean=1 - fi - fi - ;; - h) - show_help=1 - ;; - esac -done - -if [[ -z ${PYVER:-} ]] || [[ -z ${VENVD} ]] || [[ -z ${BUILD_DEST:-} ]]; then - 1>&2 echo "Incomplete build options: PYVER[${PYVER:-}] VENVD[${VENVD:-}] BUILD_DEST[${BUILD_DEST:-}]" - show_help=1 -fi - -if (( show_help == 1 )); then - help - exit 0 -fi - -if (( do_clean == 1 )); then - echo "Cleaning $BUILD_DEST $PYVER " - if [[ ! -d "$BUILD_DEST" ]]; then - 1>&2 echo "Unable to find $BUILD_DEST" - else - echo "Build dest: $BUILD_DEST" - fi - # set -veux - dir_key="${DEST_TYPE}-$PYVER" - if [[ ! -d "${dest_dirs[$dir_key]}" ]]; then - 1>&2 echo "Unable to find ${dest_dirs[$dir_key]}/ dir_key[$dir_key]" - else - echo "Cleaning! will remove:" - echo "$HOME/Downloads/Python-$PYVER" - echo "$BUILD_DEST/lib/python$SHORTVER" - echo "$BUILD_DEST/" - fi -fi - - -## ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -## Clean things -## ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -if (( do_clean == 1 )); then - - read -p "Will remove these files...[enter]" - rm -f /tmp/clean-list.txt - dirlist=( - "$HOME/$VENVD" - "$HOME/Downloads/Python-$PYVER" - "$BUILD_DEST/lib/python$SHORTVER" - "$BUILD_DEST/bin/python3" - "$BUILD_DEST/bin/python$SHORTVER" - "$BUILD_DEST/bin/python${SHORTVER}-config" - "$BUILD_DEST/bin/python3-config" - "$BUILD_DEST/bin/pydoc3" - "$BUILD_DEST/bin/pydoc${SHORTVER}" - "$BUILD_DEST/bin/2to3-${SHORTVER}" - "$BUILD_DEST/bin/2to3" - ) - for dirnaam in "${dirlist[@]}"; do - if [[ -e "$dirnaam" ]]; then - find "$dirnaam" -depth >> /tmp/clean-list.txt - else - 1>&2 echo "Unable to find $dirnaam" - fi - done - if [[ -s /tmp/clean-list.txt ]]; then - echo "You are about to see the files to be removed: " - sleep 3 - less /tmp/clean-list.txt - read -p "\nProceed to remove files? [enter|ctrl-c] " - sleep 1 - cat /tmp/clean-list.txt | sudo xargs -n100 rm -rf - else - echo "No files found to clean up! This is unexpected" - exit 1 - fi - echo "Cleaning finished." - exit 0 -fi - - - -# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -# Download source -# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -set -v -mkdir -p $PORTAPYD ||: -sudo chown -R lanforge: $PORTAPYD -set +v -cd $HOME/Downloads -if [[ ! -f Python-$PYVER.tar.xz ]]; then - echo "Downloading python $PYVER source..." - wget https://www.python.org/ftp/python/$PYVER/Python-$PYVER.tar.xz -fi -if [[ ! -f $OSSL_SRC ]]; then - echo "Downloading openssl..." - wget -O $OSSL_SRC $OSSL_URL - tar xf $OSSL_SRC - PKI=$(sudo find /etc/ -name openssl.cnf -printf "%h\n") - echo "Configuring openssl..." - cd $OSSL_DIR - ./config \ - --prefix=$OSSL_DEST \ - --libdir=lib \ - --openssldir=$PKI - sleep 1 - echo "Building openssl..." - make -j1 depend - make -j$(nproc) - make install_sw - cd - -fi - - -## ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -## Build things -## ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- - -echo "Checking build requirements..." -sudo dnf install libffi-devel \ - tcl tcl-devel \ - readline readline-devel \ - zlib zlib-devel \ - openssl-devel openssl-libs - -if [[ -x Python-$PYVER/python ]]; then - echo "Python already compiled. Remove $PWD/python to recompile" - sleep 5 -else - if [[ ! -d Python-$PYVER ]]; then - tar xf Python-$PYVER.tar.xz - fi - echo "Compiling python $PYVER..." - sleep 5 - cd Python-$PYVER - sudo chown -R $LOGNAME: . - make clean ||: - make distclean ||: - set -v - ./configure \ - --with-openssl=$HOME/Downloads/$OSSL_DIR \ - --with-openssl-rpath=auto \ - --with-ensurepip \ - --enable-optimizations \ - --prefix=$BUILD_DEST - - make -j$(nproc) || { - echo "Build error" - exit 1 - } - set +v - echo "About to install...." - # sleep 5 - sudo make install - if [[ -x $BUILD_DEST/bin/python$SHORTVER ]]; then - echo "Updating etc alternatives..." - sudo update-alternatives --install /usr/bin/python python $BUILD_DEST/bin/python$SHORTVER 20 - sudo update-alternatives --config python - else - 1>&2 echo "Unable to find $BUILD_DEST/bin/python$SHORTVER, alternatives not updated" - read -p "Continue? [enter|ctrl-c] " - fi -fi -cd -if [[ -f $VENVD/pyenv.cfg ]]; then - echo "Not removing old $VENVD. If you want to rebuild it, remove $VENVD/pyenv.cfg" -else - echo "Rebuilding $VENVD..." - rm -rf $VENVD - mkdir $VENVD - $BUILD_DEST/bin/python3 -m venv $VENVD - . $VENVD/bin/activate - $HOME/scripts/py-scripts/update_dependencies.py -fi -# check if lanforge/.bashrc is updated to source venv -if grep -q "$VENVD" $HOME/.bashrc; then - echo "Found $VENVD alias" -else - echo "Creating $VENVD alias..." - ( - echo "alias $VENVD='. \$HOME/$VENVD/bin/activate'" - echo "if [[ -r \$HOME/USE_$VENVD ]]; then . \$HOME/$VENVD/bin/activate; fi" - ) >> "$HOME/.bashrc" -fi -# uncomment this you want new shells to automatically source venv -# touch $HOME/USE_VENV3-10 -# From cb9536752e4c9262b799e5e1aa2baca38cd9f96b Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 7 Oct 2024 14:01:22 -0700 Subject: [PATCH 08/17] dataplane_test_profile.py: Remove, superceded by lf_dataplane_test.py Signed-off-by: Alex Gavin --- py-json/dataplane_test_profile.py | 47 ------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 py-json/dataplane_test_profile.py diff --git a/py-json/dataplane_test_profile.py b/py-json/dataplane_test_profile.py deleted file mode 100644 index 0ebdda6b5..000000000 --- a/py-json/dataplane_test_profile.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python3 -# flake8: noqa -""" -Library to Run Dataplane Test: Using lf_cv_base class - -""" -import sys -import os -import importlib - - -sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../"))) - -lf_cv_base = importlib.import_module("py-json.lf_cv_base") -ChamberViewBase = lf_cv_base.ChamberViewBase - - -class DataPlaneTest(ChamberViewBase): - - def __init__(self, lfclient_host="localhost", lfclient_port=8080, debug_=False): - super().__init__(_lfjson_host=lfclient_host, _lfjson_port=lfclient_port, _debug=debug_) - self.set_config() - - def set_config(self): - blob_data = """show_events: 1 show_log: 0 port_sorting: 0 kpi_id: Dataplane Pkt-Size bg: 0xE0ECF8 test_rig: show_scan: 1 auto_helper: 0 skip_2: 0 skip_5: 0 skip_5b: 1 skip_dual: 0 skip_tri: 1 selected_dut: TIP duration: 15000 traffic_port: 1.1.136 sta00500 upstream_port: 1.1.2 eth2 path_loss: 10 speed: 85% speed2: 0Kbps min_rssi_bound: -150 max_rssi_bound: 0 channels: AUTO modes: Auto pkts: 60;142;256;512;1024;MTU spatial_streams: AUTO security_options: AUTObandw_options: AUTO traffic_types: UDP;TCP directions: DUT Transmit;DUT Receive txo_preamble: OFDM txo_mcs: 0 CCK, OFDM, HT, VHT txo_retries: No Retry txo_sgi: OFF txo_txpower: 15 attenuator: 0 attenuator2: 0 attenuator_mod: 255 attenuator_mod2: 255 attenuations: 0..+50..950 attenuations2: 0..+50..950 chamber: 0 tt_deg: 0..+45..359 cust_pkt_sz: show_bar_labels: 1 show_prcnt_tput: 0 show_3s: 0 show_ll_graphs: 1 show_gp_graphs: 1 show_1m: 1 pause_iter: 0 show_realtime: 1 operator: mconn: 1 mpkt: 1000 tos: 0 loop_iterations: 1""" - self.add_text_blobs(type="Plugin-Settings", name="dataplane-test-latest-shivam", data=blob_data) - pass - - def set_params(self): - pass - - def run_test(self): - pass - - def wait_until_test_finishes(self): - pass - - def collect_reports(self): - pass - - -def main(): - DataPlaneTest(lfclient_host="localhost", lfclient_port=8080, debug_=True) - - -if __name__ == '__main__': - main() From 7d01c7bd66b29e0bc98d589aa34da0dc06d4c5d8 Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 7 Oct 2024 14:02:00 -0700 Subject: [PATCH 09/17] py-json/show_ports.py: Remove example script, see py-scripts/examples/show_ports.py Signed-off-by: Alex Gavin --- py-json/show_ports.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100755 py-json/show_ports.py diff --git a/py-json/show_ports.py b/py-json/show_ports.py deleted file mode 100755 index 8f99bbe37..000000000 --- a/py-json/show_ports.py +++ /dev/null @@ -1,35 +0,0 @@ -# flake8: noqa -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# example of how to check a LANforge json url - -# - -# the syntax of the request is /port/// - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -import sys -import os -import importlib -import pprint - -if sys.version_info[0] != 3: - print("This script requires Python 3") - exit() - -sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../"))) - -LFRequest = importlib.import_module("py-json.LANforge.LFRequest") - - -def main(): - url = "http://localhost:8080/port/1/1/list" - - lf_r = LFRequest.LFRequest(url) - json_response = lf_r.getAsJson() - j_printer = pprint.PrettyPrinter(indent=2) - j_printer.pprint(json_response) - - # for record in json_response['interfaces']: - # j_printer.pprint(record) - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -if __name__ == "__main__": - main() From 512c830ad25f511423298c18ecdc17a228ec96be Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 7 Oct 2024 14:03:34 -0700 Subject: [PATCH 10/17] py-json/old-examples: Remove deprecated example scripts Signed-off-by: Alex Gavin --- py-json/old-examples/create_sta.py | 371 ---------------------------- py-json/old-examples/generic_cx.py | 78 ------ py-json/old-examples/test_l4.py | 59 ----- py-json/old-examples/wct-example.py | 161 ------------ 4 files changed, 669 deletions(-) delete mode 100755 py-json/old-examples/create_sta.py delete mode 100755 py-json/old-examples/generic_cx.py delete mode 100755 py-json/old-examples/test_l4.py delete mode 100755 py-json/old-examples/wct-example.py diff --git a/py-json/old-examples/create_sta.py b/py-json/old-examples/create_sta.py deleted file mode 100755 index 7e2d3c256..000000000 --- a/py-json/old-examples/create_sta.py +++ /dev/null @@ -1,371 +0,0 @@ -#!/usr/bin/python3 -# flake8: noqa -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# example of how to create a LANforge station - -# - -# two examples, first using the URL-Encoded POST - -# second using JSON POST data - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -import sys -if sys.version_info[0] != 3: - print("This script requires Python 3") - exit() -import argparse -import logging -import time -from time import sleep -import pprint -import LANforge -from LANforge import LFRequest -from LANforge import LFUtils -from LANforge.LFUtils import NA - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -def main(): - host = "localhost" - base_url = "http://%s:8080"%host - resource_id = 1 # typically you're using resource 1 in stand alone realm - radio = "wiphy0" - start_id = 200 - end_id = 202 - padding_number = 10000 # the first digit of this will be deleted - ssid = "jedway-wpa2-x2048-4-1" - passphrase = "jedway-wpa2-x2048-4-1" - - parser = argparse.ArgumentParser(description="test creating a station") - parser.add_argument("-m", "--host", type=str, help="json host to connect to") - parser.add_argument("-r", "--radio", type=str, help="radio to create a station on") - parser.add_argument("-a", "--start_id", type=int, help="starting station id") - parser.add_argument("-b", "--end_id", type=int, help="ending station id") - parser.add_argument("-s", "--ssid", type=str, help="station ssid") - parser.add_argument("-p", "--passwd", type=str, help="password for ssid") - - args = None - try: - args = parser.parse_args() - if (args.host is not None): - host = args.host, - baseurl = base_url = "http://%s:8080"%host - if (args.radio is not None): - radio = args.radio - if (args.start_id is not None): - start_id = args.start_id - if (args.end_id is not None): - end_id = args.end_id - if (args.ssid is not None): - ssid = args.ssid - if (args.passwd is not None): - passphrase = args.passwd - except Exception as e: - logging.exception(e) - usage() - exit(2) - - # station numbers are heavily manipulated strings, often using manual padding - # sta200 is not sta0200 nor sta00200, and we can format these numbers by adding - # a 1000 or 10000 to the station id, and trimming the first digit off - - j_printer = pprint.PrettyPrinter(indent=2) - json_post = "" - json_response = "" - found_stations = [] - lf_r = LFRequest.LFRequest(base_url+"/port/1/1/wiphy0") - wiphy0_json = lf_r.getAsJson() - if (wiphy0_json is None) or (wiphy0_json['interface'] is None): - print("Unable to find radio. Are we connected?") - exit(1) - - # If you need to inspect a radio.... - #print("# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -") - #print("# radio wiphy0 -") - #print("# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -") - #LFUtils.debug_printer.pprint(wiphy0_json['interface']['alias']) - #parent_radio_mac = wiphy0_json['interface']['mac'] - #print("# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -") - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Example 1 - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # This section uses URLs /cli-form/rm_vlan, /cli-form/add_sta - # The /cli-form URIs take URL-encoded form posts - # - # For each of the station names, delete them if they exist. It - # takes a few milliseconds to delete them, so after deleting them - # you need to poll until they don't appear. - # - # NOTE: the ID field of the EID is ephemeral, so best stick to - # requesting the station name. The station name can be formatted - # with leading zeros, sta00001 is legal - # and != {sta0001, sta001, sta01, or sta1} - - desired_stations = LFUtils.portNameSeries("sta", start_id, end_id, padding_number) - #LFUtils.debug_printer.pprint(desired_stations) - print("Example 1: will create stations %s"%(",".join(desired_stations))) - for sta_name in desired_stations: - url = base_url+"/port/1/%s/%s" % (resource_id, sta_name) - print("Ex 1: Checking for station : "+url) - lf_r = LFRequest.LFRequest(url) - json_response = lf_r.getAsJson(show_error=False) - if (json_response != None): - found_stations.append(sta_name) - - for sta_name in found_stations: - print("Ex 1: Deleting station %s ...."%sta_name) - lf_r = LFRequest.LFRequest(base_url+"/cli-form/rm_vlan") - lf_r.addPostData( { - "shelf":1, - "resource": resource_id, - "port": sta_name, - "suppress_preexec_cli": "yes", - "suppress_preexec_method": 1 - }) - json_response = lf_r.formPost() - sleep(0.05) # best to give LANforge a few millis between rm_vlan commands - - LFUtils.waitUntilPortsDisappear(resource_id, base_url, found_stations) - - print("Ex 1: Next we create stations...") - #68727874560 was previous flags - for sta_name in desired_stations: - print("Ex 1: Next we create station %s"%sta_name) - lf_r = LFRequest.LFRequest(base_url+"/cli-form/add_sta") - # flags are a decimal equivalent of a hexadecimal bitfield - # you can submit as either 0x(hex) or (dec) - # a helper page is available at http://localhost:8080/help/add_sta - # - # You can watch console output of the LANforge GUI client when you - # get errors to this command, and you can also watch the websocket - # output for a response to this command at ws://localhost:8081 - # Use wsdump ws://localhost:8081/ - # - # modes are listed at http:///LANforgeDocs-5.4.1/lfcli_ug.html - # or at https://www.candelatech.com/lfcli_ug.html - # - # mac address field is a pattern for creation: entirely random mac addresses - # do not take advantage of address mask matchin in Ath10k hardware, so we developed - # this pattern to randomize a section of octets. XX: keep parent, *: randomize, and - # chars [0-9a-f]: use this digit - # - # If you get errors like "X is invalid hex chara cter", this indicates a previous - # rm_vlan call has not removed your station yet: you cannot rewrite mac addresses - # with this call, just create new stations - lf_r.addPostData( LFUtils.staNewDownStaRequest(sta_name, resource_id=resource_id, radio=radio, ssid=ssid, passphrase=passphrase)) - lf_r.formPost() - sleep(0.1) - - LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations) - for sta_name in desired_stations: - sleep(1) - print("doing portSetDhcpDownRequest on "+sta_name) - lf_r = LFRequest.LFRequest(base_url+"/cli-form/set_port") - lf_r.addPostData( LFUtils.portSetDhcpDownRequest(resource_id, sta_name)) - lf_r.formPost() - - - # the LANforge API separates STA creation and ethernet port settings - # We need to revisit the stations we create and amend flags to add - # things like DHCP or ip+gateway, admin-{up,down} - - LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations) - for sta_name in desired_stations: - sleep(1) - print("Ex 1: station up %s"%sta_name) - lf_r = LFRequest.LFRequest(base_url+"/cli-json/set_port") - data = LFUtils.portDhcpUpRequest(resource_id, sta_name) - lf_r.addPostData(data) - lf_r.jsonPost() - - - LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations) - # for sta_name in desired_stations: - # print("Ex 1: sta down %s"%sta_name) - # lf_r = LFRequest.LFRequest(base_url+"/cli-json/set_port") - # lf_r.addPostData(LFUtils.portDownRequest(resource_id, sta_name)) - # lf_r.jsonPost() - # sleep(0.05) - print("...done with example 1\n\n") - sleep(4) - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Example 2 - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # uses URLs /cli-json/rm_vlan, /cli-json/add_sta - # and those accept POST in json formatted text - desired_stations = [] - found_stations = [] - start_id = 220 - end_id = 222 - desired_stations = LFUtils.portNameSeries("sta", start_id, end_id, padding_number) - - print("Example 2: using port list to find stations") - sleep(1) - url = base_url+"/port/1/%s/list?fields=alias" % (resource_id) - lf_r = LFRequest.LFRequest(url) - json_response = lf_r.getAsJson() - if json_response is None: - raise Exception("no reponse to: "+url) - port_map = LFUtils.portListToAliasMap(json_response) - #LFUtils.debug_printer.pprint(port_map) - - for sta_name in desired_stations: - print("Ex 2: checking for station : "+sta_name) - if sta_name in port_map.keys(): - #print("found station : "+sta_name) - found_stations.append(sta_name) - - for sta_name in found_stations: - print("Ex 2: delete station %s ..."%sta_name) - lf_r = LFRequest.LFRequest(base_url+"/cli-json/rm_vlan") - lf_r.addPostData({ - "shelf":1, - "resource": resource_id, - "port": sta_name - }) - lf_r.jsonPost(show_error=False) - sleep(0.05) - - LFUtils.waitUntilPortsDisappear(resource_id, base_url, found_stations) - for sta_name in desired_stations: - print("Ex 2: create station %s"%sta_name) - lf_r = LFRequest.LFRequest(base_url+"/cli-json/add_sta") - lf_r.addPostData(LFUtils.staNewDownStaRequest(sta_name, resource_id=resource_id, radio=radio, ssid=ssid, passphrase=passphrase)) - lf_r.jsonPost() - sleep(1) - - LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations) - # the LANforge API separates STA creation and ethernet port settings - # We need to revisit the stations we create and amend flags to add - # things like DHCP or ip+gateway, admin-{up,down} - for sta_name in desired_stations: - print("Ex 2: set port %s"%sta_name) - lf_r = LFRequest.LFRequest(base_url+"/cli-json/set_port") - data = LFUtils.portDhcpUpRequest(resource_id, sta_name) - lf_r.addPostData(data) - lf_r.jsonPost() - sleep(0.05) - - print("...done with Example 2") - sleep(1) - - print("Example 3: bring ports up and down") - sleep(1) - print("Ex 3: setting ports up...") - desired_stations.insert(0, "sta0200") - desired_stations.insert(1, "sta0201") - desired_stations.insert(2, "sta0202") - wait_for_these = [] - for sta_name in desired_stations: - lf_r = LFRequest.LFRequest(base_url+"/port/1/%s/%s?fields=port,device,down"%(resource_id, sta_name)) - json_response = lf_r.getAsJson() - if json_response['interface']['down'] is 'true': - url = base_url+"/cli-json/set_port" - lf_r = LFRequest.LFRequest(url) - lf_r.addPostData(LFUtils.portDhcpUpRequest(resource_id, sta_name)) - print("setting %s up"%sta_name) - lf_r.jsonPost() - wait_for_these.append(sta_name) - LFUtils.waitUntilPortsAdminUp(resource_id, base_url, wait_for_these) - sleep(4) - print("Ex 3: setting ports down...") - for sta_name in desired_stations: - lf_r = LFRequest.LFRequest(base_url+"/port/1/%s/%s?fields=port,device,down"%(resource_id, sta_name)) - json_response = lf_r.getAsJson() - if json_response['interface']['down'] is 'false': - url = base_url+"/cli-json/set_port" - lf_r = LFRequest.LFRequest(url) - lf_r.addPostData(LFUtils.portDownRequest(resource_id, sta_name)) - print("setting %s down"%sta_name) - lf_r.jsonPost() - wait_for_these.append(sta_name) - LFUtils.waitUntilPortsAdminDown(resource_id, base_url, wait_for_these) - print("...ports are down") - sleep(4) - - - - print("Example 4: Modify stations to mode /a") - sleep(1) - for sta_name in desired_stations: - #lf_r = LFRequest.LFRequest(base_url+"/port/1/%s/%s"%(resource_id, sta_name)) - lf_r = LFRequest.LFRequest(base_url+"/cli-json/set_port") - lf_r.addPostData(LFUtils.portDownRequest(resource_id, sta_name)) - lf_r.jsonPost() - LFUtils.waitUntilPortsAdminDown(resource_id, base_url, desired_stations) - - for sta_name in desired_stations: - lf_r = LFRequest.LFRequest(base_url+"/cli-json/add_sta") - lf_r.addPostData({ - "shelf":1, - "resource": resource_id, - "radio": radio, - "sta_name": sta_name, - "mode": 1, # 802.11a see http://www.candelatech.com/lfcli_ug.php#add_sta - }) - print("using add_sta to set %s mode"%sta_name) - lf_r.jsonPost() - sleep(0.5) - - for sta_name in desired_stations: - lf_r = LFRequest.LFRequest(base_url+"/cli-json/set_port") - lf_r.addPostData(LFUtils.portUpRequest(resource_id, sta_name)) - lf_r.get() - LFUtils.waitUntilPortsAdminUp(resource_id, base_url, desired_stations) - print("...done") - sleep(4) - - - print("Example 5: change station encryption from wpa2 to wpa3...") - sleep(1) - for sta_name in desired_stations: - #lf_r = LFRequest.LFRequest(base_url+"/port/1/%s/%s"%(resource_id, sta_name)) - lf_r = LFRequest.LFRequest(base_url+"/cli-json/set_port") - lf_r.addPostData(LFUtils.portDownRequest(resource_id, sta_name)) - lf_r.get() - LFUtils.waitUntilPortsAdminDown(resource_id, base_url, desired_stations) - - for sta_name in desired_stations: - lf_r = LFRequest.LFRequest(base_url+"/cli-json/add_sta") - lf_r.addPostData({ - "shelf":1, - "resource": resource_id, - "radio": radio, - "sta_name": sta_name, - "mode": 0, # mode AUTO - "flags": 1099511627776, # sets use-wpa3 - "flags_mask": 1099511628800 # sets interest in use-wpa3, wpa2_enable (becomes zero) - }) - print("using add_sta to set %s wpa3"%sta_name) - lf_r.jsonPost() - sleep(0.5) - - for sta_name in desired_stations: - lf_r = LFRequest.LFRequest(base_url+"/cli-json/set_port") - lf_r.addPostData(LFUtils.portUpRequest(resource_id, sta_name)) - lf_r.get() - LFUtils.waitUntilPortsAdminUp(resource_id, base_url, desired_stations) - print("...done") - sleep(4) - - - print("Example 7: alter TX power on %s..."%radio) - # virtual stations do not have individual tx power states - sleep(1) - # see http://www.candelatech.com/lfcli_ug.php#set_wifi_radio - lf_r = LFRequest.LFRequest(base_url+"/cli-json/set_wifi_radio") - lf_r.addPostData({ - "shelf":1, - "resource":resource_id, - "radio":radio, - "mode":NA, - # tx power see: man 8 iwconfig, power is in dBm, auto or off - "txpower": "auto", - # meta flag tells lfclient to not check port before issuing command - "suppress_preexec_method": "true", - }) - lf_r.jsonPost() - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -if __name__ == "__main__": - main() diff --git a/py-json/old-examples/generic_cx.py b/py-json/old-examples/generic_cx.py deleted file mode 100755 index 46f886aa6..000000000 --- a/py-json/old-examples/generic_cx.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python3 -# flake8: noqa -""" -This script is out-dated, please see py-scripts/test_ipv4_variable_time.py -""" -import sys -import pprint -from pprint import pprint - -if sys.version_info[0] != 3: - print("This script requires Python 3") - exit() - -from LANforge.lfcli_base import LFCliBase - -class GenericCx(LFCliBase): - def __init__(self, lfclient_host, lfclient_port, debug_=False): - super().__init__(lfclient_host, lfclient_port, _debug=debug_) - - def createGenEndp(self, alias=None, shelf=1, resource=1, port=None, type="gen_generic"): - """ - @deprecated - - :param alias: - :param shelf: - :param resource: - :param port: - :param type: - :return: - """ - return self.create_gen_endp(alias=alias, shelf=shelf, resource=resource, port=port, type=type) - - def create_gen_endp(self, alias=None, shelf=1, resource=1, port=None, type="gen_generic"): - """ - :param alias: name of connection - :param shelf: shelf - :param resource: resource id - :param port: port - :param type: gen_generic is what firemod reports, just use this - :return: - """ - if port is None: - raise ValueError("createGenEndp: port required") - if type is None: - raise ValueError("createGenEndp: type required") - - data = { - "alias": alias, - "shelf": shelf, - "resource": resource, - "port": port, - "type": type - } - if self.debug: - pprint(data) - - self.json_post("cli-json/add_gen_endp", data, debug_=self.debug) - - def setFlags(self, endpName, flagName, val): - return self.set_flags(endpName, flagName, val) - - def set_flags(self, endpName, flagName, val): - data = { - "name": endpName, - "flag": flagName, - "val": val - } - self.json_post("cli-json/set_endp_flag", data, debug_=self.debug) - - def setCmd(self, endpName, cmd): - return self.set_cmd(endpName, cmd) - - def set_cmd(self, endpName, cmd): - data = { - "name": endpName, - "command": cmd - } - self.json_post("cli-json/set_gen_cmd", data, debug_=self.debug) diff --git a/py-json/old-examples/test_l4.py b/py-json/old-examples/test_l4.py deleted file mode 100755 index 82e3b8a3b..000000000 --- a/py-json/old-examples/test_l4.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/python3 -# flake8: noqa -import sys -import urllib - -if sys.version_info[0] != 3: - print("This script requires Python 3") - exit() - -import time -from time import sleep -from urllib import error -import pprint -import LANforge -from LANforge import LFRequest -from LANforge import LFUtils -from LANforge.LFUtils import NA - - -j_printer = pprint.PrettyPrinter(indent=2) -# typically you're using resource 1 in stand alone realm -resource_id = 1 - -def main(): - base_url = "http://localhost:8080" - json_post = "" - json_response = "" - - # see if there are old wanlinks to remove - json_post = LFRequest.LFRequest(base_url+"/layer4/list") - try: - json_response = json_post.getAsJson() - LFUtils.debug_printer.pprint(json_response) - - except urllib.error.HTTPError as error: - j_printer.pprint(error) - - add_l4_endp_url = base_url + "/cli-json/add_l4_endp"; - json_post = LFRequest.LFRequest(add_l4_endp_url) - json_post.addPostData({ - "shelf":1, - "resource":1, - "port":"sta00500", - "type":"l4_generic", - "timeout":2000, - "url_rate":600, - # this produces an error that should be listed in headers - "URL":"dl http://10.40.0.1/ /dev/null" - }) - json_response = json_post.jsonPost(True); - j_printer.pprint(json_response) - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -if __name__ == '__main__': - main() - -### -### \ No newline at end of file diff --git a/py-json/old-examples/wct-example.py b/py-json/old-examples/wct-example.py deleted file mode 100755 index 480c080e9..000000000 --- a/py-json/old-examples/wct-example.py +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/python3 -# flake8: noqa -''' -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - -# Example of how to operate a WCT instance using cli-socket. - -# This script is out-dated. Please refer to py-scripts/run_cv_scenario.py - -# - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -make sure pexpect is installed: -$ sudo yum install python3-pexpect -$ sudo yum install python3-xlsxwriter - -You might need to install pexpect-serial using pip: -$ pip3 install pexpect-serial -$ pip3 install XlsxWriter - -''' - -import sys -if sys.version_info[0] != 3: - print("This script requires Python 3") - exit() -import argparse -import logging -import time -from time import sleep -import pexpect -import xlsxwriter -import pprint -import LANforge -from LANforge import LFRequest -from LANforge import LFUtils -from LANforge.LFUtils import NA - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -def main(): - host = "ct524-debbie.jbr.candelatech.com" - base_url = "http://%s:8080"%host - resource_id = 1 # typically you're using resource 1 in stand alone realm - radio = "wiphy0" - start_id = 200 - end_id = 202 - padding_number = 10000 # the first digit of this will be deleted - ssid = "jedway-wpa2-x64-3-1" - passphrase = "jedway-wpa2-x64-3-1" - clisock = 3990 - cliprompt = 'lfgui# ' - - parser = argparse.ArgumentParser(description="test creating a station") - parser.add_argument("-m", "--host", type=str, help="json host to connect to") - parser.add_argument("-r", "--radio", type=str, help="radio to create a station on") - parser.add_argument("-a", "--start_id", type=int, help="starting station id") - parser.add_argument("-b", "--end_id", type=int, help="ending station id") - parser.add_argument("-s", "--ssid", type=str, help="station ssid") - parser.add_argument("-p", "--passwd", type=str, help="password for ssid") - - args = None - try: - args = parser.parse_args() - if (args.host is not None): - host = args.host, - baseurl = base_url = "http://%s:8080"%host - if (args.radio is not None): - radio = args.radio - if (args.start_id is not None): - start_id = args.start_id - if (args.end_id is not None): - end_id = args.end_id - if (args.ssid is not None): - ssid = args.ssid - if (args.passwd is not None): - passphrase = args.passwd - except Exception as e: - logging.exception(e) - usage() - exit(2) - - # station numbers are heavily manipulated strings, often using manual padding - # sta200 is not sta0200 nor sta00200, and we can format these numbers by adding - # a 1000 or 10000 to the station id, and trimming the first digit off - - j_printer = pprint.PrettyPrinter(indent=2) - json_post = "" - json_response = "" - found_stations = [] - lf_r = LFRequest.LFRequest(base_url+"/port/1/1/wiphy2") - wiphy0_json = lf_r.getAsJson() - if (wiphy0_json is None) or (wiphy0_json['interface'] is None): - print("Unable to find radio. Are we connected?") - exit(1) - - desired_stations = LFUtils.portNameSeries("sta", start_id, end_id, padding_number) - #LFUtils.debug_printer.pprint(desired_stations) - print("Example 1: will create stations %s"%(",".join(desired_stations))) - for sta_name in desired_stations: - url = base_url+"/port/1/%s/%s" % (resource_id, sta_name) - print("Ex 1: Checking for station : "+url) - lf_r = LFRequest.LFRequest(url) - json_response = lf_r.getAsJson(show_error=False) - if (json_response != None): - found_stations.append(sta_name) - - for sta_name in found_stations: - print("Ex 1: Deleting station %s ...."%sta_name) - lf_r = LFRequest.LFRequest(base_url+"/cli-form/rm_vlan") - lf_r.addPostData( { - "shelf":1, - "resource": resource_id, - "port": sta_name - }) - json_response = lf_r.formPost() - sleep(0.05) # best to give LANforge a few millis between rm_vlan commands - - LFUtils.waitUntilPortsDisappear(resource_id, base_url, found_stations) - - print("Ex 1: Next we create stations...") - #68727874560 was previous flags - for sta_name in desired_stations: - print("Ex 1: Next we create station %s"%sta_name) - lf_r = LFRequest.LFRequest(base_url+"/cli-form/add_sta") - lf_r.addPostData( LFUtils.staNewDownStaRequest(sta_name, resource_id=resource_id, radio=radio, ssid=ssid, passphrase=passphrase)) - lf_r.formPost() - sleep(0.1) - - LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations) - for sta_name in desired_stations: - sleep(1) - print("doing portSetDhcpDownRequest on "+sta_name) - lf_r = LFRequest.LFRequest(base_url+"/cli-form/set_port") - data = LFUtils.portDhcpUpRequest(resource_id, sta_name) - lf_r.addPostData(data) - lf_r.jsonPost() - - LFUtils.waitUntilPortsAppear(resource_id, base_url, desired_stations) - - # Now lets do some cli-socket scripting - gui_telnet = pexpect.spawn('telnet %s %s'%(host, clisock)) - if gui_telnet is None: - print ("Unable to telnet to %s:%s"%(host,clisock)); - exit(1) - - gui_telnet.expect('lfgui# ') - gui_telnet.sendline("cv create 'WiFi Capacity' 'wct'") - gui_telnet.expect('OK') - gui_telnet.sendline("cv load wct wct-wpa2-x64-two-loops") - gui_telnet.expect('OK') - gui_telnet.sendline("cv click wct 'Auto Save Report'") - gui_telnet.expect('OK') - gui_telnet.sendline("cv click wct Start") - - -# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -if __name__ == '__main__': - main() - - -#### -#### -#### From 0661756a73d2a9243e9e0d743faef33a69656c3a Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Thu, 3 Oct 2024 13:10:49 -0700 Subject: [PATCH 11/17] create_station_from_df.py: Deprecate script. See create_station.py Signed-off-by: Alex Gavin --- py-scripts/{ => scripts_deprecated}/create_station_from_df.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename py-scripts/{ => scripts_deprecated}/create_station_from_df.py (100%) diff --git a/py-scripts/create_station_from_df.py b/py-scripts/scripts_deprecated/create_station_from_df.py similarity index 100% rename from py-scripts/create_station_from_df.py rename to py-scripts/scripts_deprecated/create_station_from_df.py From 7b94e3530ea0c6b7194c3b58879c3f8616992929 Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 7 Oct 2024 18:41:02 -0700 Subject: [PATCH 12/17] setup_win_py.ps1: Archive script Signed-off-by: Alex Gavin --- {py-scripts => archive}/setup_win_py.ps1 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {py-scripts => archive}/setup_win_py.ps1 (100%) diff --git a/py-scripts/setup_win_py.ps1 b/archive/setup_win_py.ps1 similarity index 100% rename from py-scripts/setup_win_py.ps1 rename to archive/setup_win_py.ps1 From 20d2664c70b9fe624439003fe580eea0d248e668 Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 7 Oct 2024 18:41:34 -0700 Subject: [PATCH 13/17] install_win_py.ps1: Archive script Signed-off-by: Alex Gavin --- {py-scripts => archive}/install_win_py.ps1 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {py-scripts => archive}/install_win_py.ps1 (100%) diff --git a/py-scripts/install_win_py.ps1 b/archive/install_win_py.ps1 similarity index 100% rename from py-scripts/install_win_py.ps1 rename to archive/install_win_py.ps1 From c47a2915029f9b19892cca85397df454c6e4ea63 Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Thu, 3 Oct 2024 13:11:25 -0700 Subject: [PATCH 14/17] lf_we_can_wifi_capacity.py: Remove incomplete script Signed-off-by: Alex Gavin --- py-scripts/lf_we_can_wifi_capacity.py | 572 -------------------------- 1 file changed, 572 deletions(-) delete mode 100755 py-scripts/lf_we_can_wifi_capacity.py diff --git a/py-scripts/lf_we_can_wifi_capacity.py b/py-scripts/lf_we_can_wifi_capacity.py deleted file mode 100755 index 79657fd05..000000000 --- a/py-scripts/lf_we_can_wifi_capacity.py +++ /dev/null @@ -1,572 +0,0 @@ -#!/usr/bin/env python3 -# flake8: noqa - -""" -NAME: lf_we_can_wifi_capacity_test.py - -PURPOSE: - This program is used for running Wi-Fi capacity test on real clients (Phones). - The class will generate an output directory based on date and time in the /home/lanforge/html-reports/ . - -example: python3 lf_we_can_wifi_capacity.py --mgr 192.168.209.223 --port 8080 --upstream 1.1.eth1 --duration 30000 ---download_rate 210Mbps --upload_rate 210Mbps --protocol UDP-IPv4 --dut_model NETGEAR1287 --ssid_dut_2g NETGEAR_2.4G ---ssid_dut_5g NETGEAR_5G --lf_user lanforge --lf_password orangeunit --batch_size 3 --station 1.24.wlan0,1.19.wlan0,1.11.wlan0 - - -Note: To Run this script gui should be opened with - - path: cd LANforgeGUI_5.4.3 (5.4.3 can be changed with GUI version) - pwd (Output : /home/lanforge/LANforgeGUI_5.4.3) - ./lfclient.bash -cli-socket 3990 - - WE-CAN app should be installed on the phone and should be Connected to lanforge server. - -LICENSE: - Free to distribute and modify. LANforge systems must be licensed. - Copyright 2021 Candela Technologies Inc - -""" -import importlib -import os -import sys -import glob -import shutil -import math - -import pandas as pd - -if sys.version_info[0] != 3: - print("This script requires Python 3") - exit(1) - -import argparse -from lf_report import lf_report - -sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../"))) - -realm = importlib.import_module("py-json.realm") -Realm = realm.Realm -LFUtils = importlib.import_module("py-json.LANforge.LFUtils") - -cv_test_manager = importlib.import_module("py-json.cv_test_manager") -cv_test = cv_test_manager.cv_test -cv_add_base_parser = cv_test_manager.cv_add_base_parser -cv_base_adjust_parser = cv_test_manager.cv_base_adjust_parser -lf_graph = importlib.import_module("py-scripts.lf_graph") -lf_bar_graph = lf_graph.lf_bar_graph -lf_logger_config = importlib.import_module("py-scripts.lf_logger_config") -from lf_wifi_capacity_test import WiFiCapacityTest - - -class LfInteropWifiCapacity(Realm): - def __init__(self, - ssid=None, - security=None, - password=None, - sta_list=None, - upstream=None, - radio=None, - protocol=None, - host="localhost", - port=8080, - inp_download_rate=None, - inp_upload_rate=None, - batch_size=None, - dut_model=None, - ssid_dut_2g=None, - ssid_dut_5g=None, - duration=None, - resource=1, - use_ht160=False, - _debug_on=False, - _exit_on_error=False, - _exit_on_fail=False): - if sta_list is None: - sta_list = [] - super().__init__(lfclient_host=host, - lfclient_port=port), - self.upstream = upstream - self.host = host - self.port = port - self.ssid = ssid - self.ssid_dut_2g = ssid_dut_2g - self.ssid_dut_5g = ssid_dut_5g - self.dut_model = dut_model - self.protocol = protocol, - self.sta_list = sta_list - self.security = security - self.password = password - self.radio = radio - self.inp_download_rate = inp_download_rate - self.inp_upload_rate = inp_upload_rate - self.batch_size = batch_size - self.duration = duration - self.debug = _debug_on - self.station_profile = self.new_station_profile() - self.station_profile.lfclient_url = self.lfclient_url - self.station_profile.ssid = self.ssid - self.station_profile.ssid_pass = self.password - self.station_profile.security = self.security - self.station_profile.debug = self.debug - self.station_profile.use_ht160 = use_ht160 - - def get_folder_name(self): - cwd = os.getcwd() - list_of_files = glob.glob(cwd + "/*") # * means all if need specific format then *.csv - latest_file = max(list_of_files, key=os.path.getctime) - return latest_file - - def get_data(self): - resource_id_real, phone_name, mac_address, user_name, phone_radio, rx_rate, tx_rate, signal, ssid, channel, phone_radio_bandwidth \ - = self.get_resource_data() - folder_directory = self.get_folder_name() - rx_rate = [(i.split(" ")[0]) if (i.split(" ")[0]) != '' else '0' for i in rx_rate] - tx_rate = [(i.split(" ")[0]) if (i.split(" ")[0]) != '' else '0' for i in tx_rate] - print(resource_id_real, "\n", phone_name, "\n", mac_address, "\n", user_name, "\n", phone_radio, - "\n", rx_rate, "\n", tx_rate) - dataframe = pd.read_csv(folder_directory + "/csv-data/data-Combined_Mbps__60_second_running_average-1.csv", - header=1) - print(dataframe) - rx_tx_df = None - udp_download_rate = [] - tcp_download_rate = [] - udp_upload_rate = [] - tcp_upload_rate = [] - download_rate = [] - upload_rate = [] - resource_id = [] - if self.protocol[0] == "TCP and UDP IPv4": - for column in dataframe: - # for each resource id getting upload and Download Data - resource_id.append(column.split('.')[0]) - if not math.isnan(dataframe[column].loc[0]): - udp_download_rate.append(float("{:.2f}".format(dataframe[column].loc[0]))) - tcp_download_rate.append(float("{:.2f}".format(dataframe[column].loc[1]))) - udp_upload_rate.append(float("{:.2f}".format(dataframe[column].loc[2]))) - tcp_upload_rate.append(float("{:.2f}".format(dataframe[column].loc[3]))) - # Plotting Graph 01 - rx_tx_df = pd.DataFrame({ - "udp upload": udp_upload_rate, - "tcp upload": tcp_upload_rate, - "udp download": udp_download_rate, - "tcp download": tcp_download_rate, - }, index=[i for i in phone_name]) - - # Plotting Graph 03 - ap_signal_df = pd.DataFrame({ - "Signal ": signal, - "Device": phone_name, - }, index=[str("( " + phone_radio[i] + " )") for i in range(len(phone_name))]) - - udp_actual_rate = [float("{:.2f}".format(udp_download_rate[i] + udp_upload_rate[i])) for i in - range(len(udp_download_rate))] - tcp_actual_rate = [float("{:.2f}".format(tcp_download_rate[i] + tcp_upload_rate[i])) for i in - range(len(udp_download_rate))] - print(udp_actual_rate, "\n", tcp_actual_rate, "\n", rx_rate, "\n", tx_rate) - link_rate_df = pd.DataFrame({ - "Actual UDP": udp_actual_rate, - "Actual TCP": tcp_actual_rate, - "Link Rate(rx)": [int(i) for i in rx_rate], - "Link Rate(tx)": [int(i) for i in tx_rate], - }, index=[phone_name[i] for i in range(len(phone_name))]) - - # Plotting Graph 05 (User Name) - user_name_df = pd.DataFrame({ - "udp download": udp_download_rate, - "udp upload": udp_upload_rate, - "tcp upload": tcp_upload_rate, - "tcp download": tcp_download_rate, - }, index=[user_name[i] for i in range(len(tcp_download_rate))]) - - elif self.protocol[0] == "TCP-IPv4" or self.protocol[0] == "UDP-IPv4": - for column in dataframe: - # for each resource id getting upload and Download Data - resource_id.append(column.split('.')[0]) - if not math.isnan(dataframe[column].loc[0]): - download_rate.append(float("{:.2f}".format(dataframe[column].loc[0]))) - upload_rate.append(float("{:.2f}".format(dataframe[column].loc[1]))) - # rx_tx_df = pd.DataFrame({ - # "upload": upload_rate, - # "download": download_rate, - # }, index=[i for i in phone_name]) - - print("rx_rate: ", rx_rate, "tx_rate: ", tx_rate) - - down_rate = float("{:.2f}".format(int("".join([i for i in [i for i in self.inp_download_rate] if i.isdigit()]))/len(phone_name))) - up_rate = float("{:.2f}".format(int("".join([i for i in [i for i in self.inp_upload_rate] if i.isdigit()]))/len(phone_name))) - link_rate_df = pd.DataFrame({ - "Expected throughput Rx": [down_rate for i in range(int(self.batch_size))], - "Expected throughput Tx": [up_rate for i in range(int(self.batch_size))], - "Achieved throughput Rx": [download_rate[i] for i in range(int(self.batch_size))], - "Achieved throughput Tx": [upload_rate[i] for i in range(int(self.batch_size))], - }, index=[phone_name[i] for i in range(int(self.batch_size))]) - - link_rate_phone_df = pd.DataFrame({ - "Max Link rate Rx": [int(rx_rate[int(i)]) for i in range(int(self.batch_size))], - "Max Link rate Tx": [int(tx_rate[int(i)]) for i in range(int(self.batch_size))], - }, index=[phone_name[i] for i in range(int(self.batch_size))]) - - phone_data = [resource_id_real, phone_name, mac_address, user_name, phone_radio, rx_rate, tx_rate, signal, - ssid, channel, phone_radio_bandwidth] - self.generate_report(folder_directory, phone_data, rx_tx_df, link_rate_df, link_rate_phone_df) - - def generate_report(self, file_derectory, get_data, rx_tx_df, link_rate_df, link_rate_phone_df): - - number_of_devices = len(get_data[1]) - self.batch_size = int(self.batch_size[0]) - if int(self.batch_size) > number_of_devices: - print("[INPUT] Wrong Batch Size should less than or equal to ", number_of_devices) - exit(0) - resource_id = [get_data[0][i] for i in range(self.batch_size)] - phone_name = [get_data[1][i] for i in range(self.batch_size)] - mac_address = [get_data[2][i] for i in range(self.batch_size)] - user_name = [get_data[3][i] for i in range(self.batch_size)] - phone_radio = [get_data[4][i] for i in range(self.batch_size)] - rx_rate = [get_data[5][i] for i in range(self.batch_size)] - tx_rate = [get_data[6][i] for i in range(self.batch_size)] - signal = [get_data[7][i] for i in range(self.batch_size)] - ssid = [get_data[8][i] for i in range(self.batch_size)] - channel = [get_data[9][i] for i in range(self.batch_size)] - mode = [get_data[10][i] for i in range(self.batch_size)] - phone_radio_bandwidth = [get_data[10][i].split(" ")[-2] for i in range(self.batch_size)] - - # phone_radio_bandwidth = [i.split(" ")[-1] for i in phone_radio_bandwidth] - report = lf_report(_output_html="we-can-wifi-capacity.html", _output_pdf="we-can-wifi-capacity.pdf", - _results_dir_name="we-can wifi-capacity result") - - report_time_file = report.get_path_date_time() - shutil.copy(file_derectory + "/chart-0-print.png", report_time_file) - # shutil.copy(file_derectory + "/kpi-chart-1-print.png", report_time_file) - - report_path = report.get_path() - report_path_date_time = report.get_path_date_time() - - print(report_path_date_time) - print("path: {}".format(report_path)) - print("path_date_time: {}".format(report_path_date_time)) - - report.set_title("Lanforge Interop Wi-Fi Capacity Test report for Wi-Fi Client Devices") - report.build_banner() - - report.start_content_div() - report.set_text( - "

Objective:" + "

The LANforge Interop Wi-Fi capacity Test is designed " - "to measure the performance of an Access Point when handling different types of real " - "clients. The test allows the user to increase the number of stations in user defined " - "steps for each test iteration and measure the per station and the overall throughput," - " signal and link rates for each " - "trial. The expected behaviour is for the AP to be able to handle several stations " - "(within the limitations of the AP specs) and make sure all stations get a fair amount " - "of upstream and downstream throughput. An AP that scales well will not show a " - "significant over-all throughput decrease as more stations are added.") - report.build_date_time() - report.build_text() - report.end_content_div() - twog_count = 0 - fiveg_count = 0 - print(phone_radio) - for i in phone_radio: - if i == "2G": - twog_count += 1 - else: - fiveg_count += 1 - twog_fiveg_count = ("5G - stations = " + str(fiveg_count) + " : 2G - stations = " + str(twog_count)) - device_data = { - "No.of stations(2G & 5G)": [twog_fiveg_count], - "Traffic rate ": ["Total Upload - " + self.inp_upload_rate + ": Total Download - " + self.inp_download_rate], - "Total connected clients": [len(phone_name)], - "Failed clients": ["NA"], - - } - device_data = pd.DataFrame(device_data) - report.start_content_div() - report.set_table_title("

Real-Time UDP Throughput Chart\n" + "

Below chart shows the intended and " - "achieved throughput for station increments w.r.t time for " + str(self.protocol). - replace(')',' ').replace('(',' ').replace("'",' ').strip()) - report.build_table_title() - report.set_table_dataframe(device_data) - report.build_table() - report.end_content_div() - - data = { - "Resource ID": resource_id, - "Phone Name": phone_name, - "MAC Address": mac_address, - "User Name": user_name, - "Phone Radio": phone_radio, - "Rx link Rate (Mbps) ": rx_rate, - "Tx link Rate (Mbps)": tx_rate, - "Device type": ["Android" for i in range(len(tx_rate))], - "Channel": channel, - "Signal": signal, - "Mode": mode, - - } - # Real time chart - report.start_content_div() - report.build_chart_title("Real Time Chart") - report.build_chart_custom("chart-0-print.png", align='left',padding='15px',margin='5px 5px 2em 5px', - width='800px', height='500px') - report.end_content_div() - direction = "" - if self.inp_download_rate == '0Kbps' or self.inp_download_rate == '0Mbps' or self.inp_download_rate == '0Gbps': - direction = "Upload" - elif self.inp_upload_rate == '0Kbps' or self.inp_upload_rate == '0Mbps' or self.inp_upload_rate == '0Gbps': - direction = "Download" - else: - direction = "Upload and Download" - - device_performance = { - "Device Name": phone_name, - "Signal": signal, - "Connected SSID": ssid, - "Security": ["WPA2" for i in range(len(ssid))], - "Channel": channel, - "Mode": phone_radio, - "Rx Rate (Mbps)": rx_rate, - "Tx Rate (Mbps)": tx_rate, - "Bandwidth": phone_radio_bandwidth, - "Direction": [direction for i in range(len(ssid))], - "Traffic": [str(self.protocol).replace(')','').replace('(','').replace("'",'').strip() for i in range(len(ssid))], - - } - phone_details_pd = pd.DataFrame(data) - device_performance_pd = pd.DataFrame(device_performance) - - report.start_content_div() - report.set_table_title("

Individual Device Performance Chart:") - report.build_table_title() - report.set_table_dataframe(device_performance_pd) - report.build_table() - report.end_content_div() - - report.save_bar_chart("Real Client", "Rx/Tx (Mbps)", link_rate_df, "link_rate") - report.start_content_div() - # report.build_chart_title("Link Rate Chart") - # report.set_text("

This chart shows that the total Link rate we got during running the script for TCP and " - # "UDP traffic versus the real traffic we got for each phone in Mbps.") - report.build_chart_custom("link_rate.png", align='left', padding='15px', margin='0px 0px 0px 0px', - width='1200px', height='400px') - # report.build_text() - - report.build_chart_title("Signal Strength reported by the clients:") - report.set_text("
Chart shows the individual signal level for each connected device, measured from device to AP.") - report.build_text() - graph = lf_graph.lf_line_graph(_data_set=[[int(i) for i in signal]], - _xaxis_name="Phone Names ", - _yaxis_name="Signal(dbm)", - _xaxis_categories=phone_name, - _graph_image_name="rssi_signal", - _label=['RSSI Strength'], - _color=['blue'], - _xaxis_step=1, - _graph_title="Device to AP Signal Values", - _title_size=16, - _figsize=(18, 6), - _marker='o', - _legend_loc="best", - _legend_box=None, - _dpi=200) - graph_png = graph.build_line_graph() - report.set_graph_image(graph_png) - report.move_graph_image() - report.build_graph() - - report.save_bar_chart("Link Rate", "Rx/Tx (Mbps)", link_rate_phone_df, "link_rate_phone_df") - report.start_content_div() - report.build_chart_title("Link Rates (RX)") - report.set_text("
Chart describing the RX rate for each device model") - report.build_chart_custom("link_rate_phone_df.png", align='left', padding='15px', margin='0px 0px 0px 0px', - width='800px', height='400px') - report.build_text() - # graph1 = lf_graph.lf_bar_graph(_data_set=None, - # _xaxis_name="x-axis", - # _yaxis_name="y-axis", - # _xaxis_categories=None, - # _xaxis_label=None, - # _graph_title="", - # _title_size=16, - # _graph_image_name="image_name", - # _label=None, - # _color=None, - # _bar_width=0.25, - # _color_edge='grey', - # _font_weight='bold', - # _color_name=None, - # _figsize=(10, 5), - # _show_bar_value=False, - # _xaxis_step=1, - # _xticks_font=None, - # _xaxis_value_location=0, - # _text_font=None, - # _text_rotation=None, - # _grp_title="", - # _legend_handles=None, - # _legend_loc="best", - # _legend_box=None, - # _legend_ncol=1, - # _legend_fontsize=None, - # _dpi=96, - # _enable_csv=False) - test_info_df = pd.DataFrame({ - "Data": ["DUT Model", "2.4 Ghz SSID", "2.4 Ghz BSSID", "5 Ghz SSID", "5 Ghz BSSID", "6 Ghz SSID", - "6 Ghz BSSID", "Intended Rate", "No of Stations", "No of loops", "Traffic duration", - "Test duration"], - # need to make the Netgear WAC510 dynamic - "Value": [self.dut_model, self.ssid_dut_2g, "78:d2:94:4f:20:c5", self.ssid_dut_5g, "78:d2:94:4f:20:f3", "NA", - "NA", str(" ".split(self.inp_download_rate)[0] + " ".split(self.inp_upload_rate)[0]) + "Mbps", - len(phone_name), self.batch_size, str((int(self.duration) / 1000)) + " Sec", "2 Min"], - }) - - report.start_content_div() - report.set_table_title("

Test Information:") - report.build_table_title() - report.set_table_dataframe(test_info_df) - report.build_table() - report.end_content_div() - - report.start_content_div() - report.set_table_title("

Device Details") - report.build_table_title() - report.set_table_dataframe(phone_details_pd) - report.build_table() - report.set_text("

The above table shows a list of all the Real clients which are connected to LANForge " - "server in the tabular format which also show the various details of the real-client (phones) " - "such as phone name, MAC address, Username, Phone Radio, Rx link rate, Tx link rate and " - "Resource id.") - report.build_text() - report.end_content_div() - - report.build_footer() - html_file = report.write_html() - print("returned file {}".format(html_file)) - print(html_file) - report.write_pdf(_page_size='Legal', _orientation='Portrait') - - def get_resource_data(self): - resource_id_list = [] - phone_name_list = [] - mac_address = [] - user_name = [] - phone_radio = [] - rx_rate = [] - tx_rate = [] - signal = [] - ssid = [] - channel = [] - phone_radio_bandwidth = [] - eid_data = self.json_get("ports?fields=alias,mac,mode,Parent Dev,rx-rate,tx-rate,signal,ssid,channel") - for alias in eid_data["interfaces"]: - for i in alias: - if int(i.split(".")[1]) > 1 and alias[i]["alias"] == 'wlan0': - resource_id_list.append(i.split(".")[1]) - resource_hw_data = self.json_get("/resource/" + i.split(".")[0] + "/" + i.split(".")[1]) - # Getting MAC address - mac = alias[i]["mac"] - - rx = alias[i]["rx-rate"] - tx = alias[i]["tx-rate"] - rx_rate.append(rx) - tx_rate.append(tx) - signal.append(alias[i]["signal"]) - ssid.append(alias[i]["ssid"]) - channel.append(alias[i]["channel"]) - # Getting username - user = resource_hw_data['resource']['user'] - user_name.append(user) - # Getting user Hardware details/Name - hw_name = resource_hw_data['resource']['hw version'].split(" ") - name = " ".join(hw_name[0:2]) - phone_name_list.append(name) - mac_address.append(mac) - if int(i.split(".")[1]) > 1 and alias[i]["alias"] == 'wlan0' and alias[i]["parent dev"] == 'wiphy0': - phone_radio_bandwidth.append(alias[i]['mode']) - # Mapping Radio Name in human readable format - if 'a' not in alias[i]['mode'] or "20" in alias[i]['mode']: - phone_radio.append('2G') - elif 'AUTO' in alias[i]['mode']: - phone_radio.append("AUTO") - else: - phone_radio.append('2G/5G') - return resource_id_list, phone_name_list, mac_address, user_name, phone_radio, rx_rate, tx_rate, signal, ssid, channel, phone_radio_bandwidth - - -def main(): - parser = argparse.ArgumentParser( - prog="we_can_wifi_capacity_test.py", - formatter_class=argparse.RawTextHelpFormatter, - description=""" - ./we_can_wifi_capacity_test.py --mgr localhost --port 8080 --lf_user lanforge --lf_password lanforge \ - --instance_name wct_instance --config_name wifi_config --upstream 1.1.eth1 --batch_size 1 --loop_iter 1 \ - --protocol UDP-IPv4 --duration 6000 --pull_report --stations 1.1.sta0000,1.1.sta0001 \ - --create_stations --radio wiphy0 --ssid test-ssid --security open --paswd [BLANK] \ - """) - - cv_add_base_parser(parser) # see cv_test_manager.py - - parser = argparse.ArgumentParser(description="Netgear AP DFS Test Script") - parser.add_argument('--mgr', type=str, help='host name', default="localhost") - parser.add_argument('--port', type=str, help='port number', default="8080") - parser.add_argument("--upstream", type=str, default="", - help="Upstream port for wifi capacity test ex. 1.1.eth1") - parser.add_argument("--batch_size", type=str, default="", - help="station increment ex. 1,2,3") - parser.add_argument("--protocol", type=str, default="", - help="Protocol ex.TCP-IPv4") - parser.add_argument("--lf_user", type=str, default="", - help="lanforge user name ex. root,lanforge") - parser.add_argument("--lf_password", type=str, default="", - help="lanforge user password ex. root,lanforge") - parser.add_argument("--duration", type=str, default="60000", - help="duration in ms. ex. 5000") - parser.add_argument("--download_rate", type=str, default="0Kbps", - help="Select requested download rate. Kbps, Mbps, Gbps units supported. Default is 0Kbps") - parser.add_argument("--upload_rate", type=str, default="0Kbps", - help="Select requested upload rate. Kbps, Mbps, Gbps units supported. Default is 0Kbps") - parser.add_argument("--dut_model", type=str, default="NA", - help="AP name and Model ") - parser.add_argument("--ssid_dut_2g", type=str, default="NA", - help="ssid name to be tested Ex. Netgear_2G") - parser.add_argument("--ssid_dut_5g", type=str, default="NA", - help="ssid name to be tested Ex. Netgear_5G") - parser.add_argument("--local_lf_report_dir", default="", - help="--local_lf_report_dir default '' put where dataplane script run from") - parser.add_argument("-s", "--stations", type=str, default="", - help="If specified, these stations will be used. If not specified, all available stations will be selected. Example: 1.1.sta001,1.1.wlan0,...") - parser.add_argument('--help_summary', action="store_true", help='Show summary of what this script does') - - args = parser.parse_args() - - help_summary='''\ -./lf_we_can_wifi_capacity.py is used for running Wi-Fi capacity test on real clients (Phones). -''' - if args.help_summary: - print(help_summary) - exit(0) - - WFC_Test = WiFiCapacityTest(lfclient_host=args.mgr, - lf_port=args.port, - ssh_port=22, - lf_user=args.lf_user, - lf_password=args.lf_password, - upstream=args.upstream, - batch_size=args.batch_size, - protocol=args.protocol, - duration=args.duration, - pull_report=True, - download_rate=args.download_rate, - upload_rate=args.upload_rate, - stations=args.stations, - local_lf_report_dir=args.local_lf_report_dir, - ) - WFC_Test.setup() - WFC_Test.run() - wifi_capacity = LfInteropWifiCapacity(host=args.mgr, port=args.port, protocol=args.protocol, - batch_size=args.batch_size, duration=args.duration,dut_model=args.dut_model, - inp_download_rate=args.download_rate, inp_upload_rate=args.upload_rate, - ssid_dut_2g=args.ssid_dut_2g, ssid_dut_5g=args.ssid_dut_5g,) - wifi_capacity.get_data() - - -if __name__ == "__main__": - main() From 1cf8c9f92fe07a2e8c3c4398dbff5163f88ccb55 Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 6 Jan 2025 10:27:00 -0800 Subject: [PATCH 15/17] gen_html_help.bash: Remove deprecated scripts Signed-off-by: Alex Gavin --- gen_html_help.bash | 2 -- 1 file changed, 2 deletions(-) diff --git a/gen_html_help.bash b/gen_html_help.bash index b67acc320..8f9524759 100755 --- a/gen_html_help.bash +++ b/gen_html_help.bash @@ -31,7 +31,6 @@ scripts=( py-scripts/create_l4.py py-scripts/create_macvlan.py py-scripts/create_qvlan.py - py-scripts/create_station_from_df.py py-scripts/create_station.py py-scripts/create_vap.py py-scripts/create_vr.py @@ -91,7 +90,6 @@ scripts=( py-scripts/lf_tr398v2_test.py py-scripts/lf_tr398v4_test.py py-scripts/lf_webpage.py - py-scripts/lf_we_can_wifi_capacity.py py-scripts/lf_wifi_capacity_test.py py-scripts/measure_station_time_up.py py-scripts/modify_station.py From dbe33dc8a0f834fc6ff34f34564b5887c0ee7c75 Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 6 Jan 2025 10:27:27 -0800 Subject: [PATCH 16/17] py-json: Remove deprecated/removed scripts from README Signed-off-by: Alex Gavin --- py-json/README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/py-json/README.md b/py-json/README.md index 8cf306e01..0f30527f9 100644 --- a/py-json/README.md +++ b/py-json/README.md @@ -52,7 +52,6 @@ Core communication files to LANforge | `cv_commands.py` | This is a library file used to create a chamber view scenario. import this file as showed in create_chamberview.py to create a scenario | | `cv_test_manager.py` | This script is working as library for chamberview tests. It holds different commands to automate test. | | `cv_test_reports.py` | Class: lanforge_reports Pulls reports from LANforge | -| `dataplane_test_profile.py` | Library to Run Dataplane Test: Using lf_cv_base class | | `dut_profile.py` | Class: DUTProfile (new_dut_profile) Use example: py-scripts/update_dut.py used to updates a Device Under Test (DUT) entry in the LANforge test scenario A common reason to use this would be to update MAC addresses in a DUT when you switch between different items of the same make/model of a DUT | | `fio_endp_profile.py` | Class: FIOEndpProfile (new_fio_endp_profile) Use example: py-scripts/test_fileio.py will create stations or macvlans with matching fileio endpoints to generate and verify fileio related traffic | | `gen_cxprofile.py` | Class: GenCXProfile (new_generic_endp_profile) Use example: test_generic.py will create stations and endpoints to generate traffic based on a command-line specified command type | @@ -120,8 +119,8 @@ Module defining the Realm class. `Realm` is a toolbox class that also serves as *`def waitUntilEndpsAppear()`: takes a list of endpoints and waits until they all disappear from the list of existing endpoints *deprecated method use def wait_until_endps_appear() instead* *`def wait_until_endps_appear()`: takes a list of endpoints and waits until they all appear in the list of existing endpoints - *`def waitUntilCxsAppear()`: takes a list of cross connects and waits until they all disappear from the list of existing cross connects - *deprecated method use def wait_until_cxs_appear() instead* + *`def waitUntilCxsAppear()`: takes a list of cross connects and waits until they all disappear from the list of existing cross connects + *deprecated method use def wait_until_cxs_appear() instead* *`def wait_until_cxs_appear()`: takes a list of cross connects and waits until they all disappear from the list of existing cross connects *`def station_map()`: request a map of stations via `/port/list` and alter the list to name based map of only stations *`def station_list()`: request a list of stations @@ -132,7 +131,7 @@ Module defining the Realm class. `Realm` is a toolbox class that also serves as * `sta10+` matches names with port numbers 10 or greater * `sta[10..20]` matches a range of stations including the range sta10 -- sta20 *`def name_to_eid()`: takes a name like `1.1.eth1` and returns it split into an array `[1, 1, "eth1"]` - *`def wait_for_ip()`: takes a list of stations and waits until they all have an ip address. Default wait time is 360 seconds, + *`def wait_for_ip()`: takes a list of stations and waits until they all have an ip address. Default wait time is 360 seconds, can take -1 as timeout argument to determine timeout based on mean ip acquisition time *`def get_curr_num_ips()`: returns the number of stations with an ip address *`def duration_time_to_seconds()`: returns an integer for a time string converted to seconds @@ -170,8 +169,6 @@ Module defining the Realm class. `Realm` is a toolbox class that also serves as ## realm_test.py ## Exercises realm.py -## show_ports.py ## -This simple example shows how to gather a digest of ports ## test_l4.py ## Example of how to use LFRequest to create a L4 endpoint ## wct-example.py ## From 20fa7f7250b26b6e8e6f01dadcc67c3ea0f63921 Mon Sep 17 00:00:00 2001 From: Alex Gavin Date: Mon, 6 Jan 2025 10:28:06 -0800 Subject: [PATCH 17/17] gen_html_help.bash: rm trailing whitespace Signed-off-by: Alex Gavin --- gen_html_help.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gen_html_help.bash b/gen_html_help.bash index 8f9524759..e3ed94494 100755 --- a/gen_html_help.bash +++ b/gen_html_help.bash @@ -1,7 +1,7 @@ #!/bin/bash # this script does not know where btbits/html lives in relation to your -# lanforge-scripts checkout directory. The location below is correct in +# lanforge-scripts checkout directory. The location below is correct in # the case where this script is executed from btbits/x64_btbits/server/lf-scripts # (eg, a server build). # DESTF=${1:-./scripts_ug.php} use for testing and local scripts_ug.ph generation in lanforge-scripts