mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 03:07:56 +00:00
many outputs from Pandas dataframe and basic test data on output
This commit is contained in:
@@ -10,6 +10,7 @@ deletion_targets=()
|
|||||||
show_menu=1
|
show_menu=1
|
||||||
verbose=0
|
verbose=0
|
||||||
quiet=0
|
quiet=0
|
||||||
|
starting_dir="$PWD"
|
||||||
|
|
||||||
USAGE="$0 # Check for large files and purge many of the most inconsequencial
|
USAGE="$0 # Check for large files and purge many of the most inconsequencial
|
||||||
-a # automatic: disable menu and clean automatically
|
-a # automatic: disable menu and clean automatically
|
||||||
@@ -147,7 +148,8 @@ declare -A desc=(
|
|||||||
[k]="lf/ath10 files"
|
[k]="lf/ath10 files"
|
||||||
[l]="/var/log"
|
[l]="/var/log"
|
||||||
[m]="/mnt/lf files"
|
[m]="/mnt/lf files"
|
||||||
[r]="lf/report_data"
|
[n]="DNF cache"
|
||||||
|
[r]="/home/lanforge/report_data"
|
||||||
[t]="/var/tmp"
|
[t]="/var/tmp"
|
||||||
)
|
)
|
||||||
declare -A surveyors_map=(
|
declare -A surveyors_map=(
|
||||||
@@ -157,6 +159,7 @@ declare -A surveyors_map=(
|
|||||||
[k]="survey_ath10_files"
|
[k]="survey_ath10_files"
|
||||||
[l]="survey_var_log"
|
[l]="survey_var_log"
|
||||||
[m]="survey_mnt_lf_files"
|
[m]="survey_mnt_lf_files"
|
||||||
|
[n]="survey_dnf_cache"
|
||||||
[r]="survey_report_data"
|
[r]="survey_report_data"
|
||||||
[t]="survey_var_tmp"
|
[t]="survey_var_tmp"
|
||||||
)
|
)
|
||||||
@@ -168,53 +171,87 @@ declare -A cleaners_map=(
|
|||||||
[k]="clean_ath10_files"
|
[k]="clean_ath10_files"
|
||||||
[l]="clean_var_log"
|
[l]="clean_var_log"
|
||||||
[m]="clean_mnt_lf_files"
|
[m]="clean_mnt_lf_files"
|
||||||
|
[n]="clean_dnf_cache"
|
||||||
[r]="compress_report_data"
|
[r]="compress_report_data"
|
||||||
[t]="clean_var_tmp"
|
[t]="clean_var_tmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
kernel_to_relnum() {
|
||||||
|
local hunks=()
|
||||||
|
#echo "KERNEL RELNUM:[$1]"
|
||||||
|
IFS="." read -ra hunks <<< "$1"
|
||||||
|
IFS=
|
||||||
|
local tmpstr
|
||||||
|
local max_width=8
|
||||||
|
local last_len=0
|
||||||
|
local diff_len=0
|
||||||
|
local expandos=()
|
||||||
|
for i in 0 1 2; do
|
||||||
|
if (( $i < 2 )); then
|
||||||
|
expandos+=( $(( 100 + ${hunks[$i]} )) )
|
||||||
|
else
|
||||||
|
tmpstr="0000000000000${hunks[i]}"
|
||||||
|
last_len=$(( ${#tmpstr} - $max_width ))
|
||||||
|
expandos+=( ${tmpstr:$last_len:${#tmpstr}} )
|
||||||
|
#1>&2 echo "TRIMMED ${tmpstr:$last_len:${#tmpstr}}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
#local relnum="${expandos[0]}${expandos[1]}${expandos[2]}"
|
||||||
|
echo "${expandos[0]}${expandos[1]}${expandos[2]}"
|
||||||
|
}
|
||||||
|
|
||||||
clean_old_kernels() {
|
clean_old_kernels() {
|
||||||
note "Cleaning old kernels WIP"
|
note "Cleaning old kernels..."
|
||||||
local pkg
|
local pkg
|
||||||
local k_pkgs=()
|
local k_pkgs=()
|
||||||
local selected_k=()
|
local selected_k=()
|
||||||
local k_series=()
|
local k_series=()
|
||||||
# need to avoid most recent fedora kernel
|
# need to avoid most recent fedora kernel
|
||||||
|
if [ ! -x /usr/bin/rpm ]; then
|
||||||
if [ -x /usr/bin/rpm ]; then
|
note "Does not appear to be an rpm system."
|
||||||
local kern_pkgs=( $( rpm -qa 'kernel*' | sort -n ) )
|
return 0
|
||||||
local pkg
|
|
||||||
for pkg in "${kern_pkgs[@]}"; do
|
|
||||||
if [[ $pkg = kernel-tools-* ]] \
|
|
||||||
|| [[ $pkg = kernel-headers-* ]] \
|
|
||||||
|| [[ $pkg = kernel-devel-* ]] ; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
k_pkgs+=( $pkg )
|
|
||||||
done
|
|
||||||
for pkg in "${k_pkgs[@]}"; do
|
|
||||||
pkg=${pkg##kernel-modules-extra-}
|
|
||||||
pkg=${pkg##kernel-modules-}
|
|
||||||
pkg=${pkg##kernel-core-}
|
|
||||||
kernel_series=${pkg##kernel-}
|
|
||||||
#debug "K SER: $kernel_series"
|
|
||||||
if contains k_series $kernel_series; then
|
|
||||||
continue
|
|
||||||
else
|
|
||||||
k_series+=( $kernel_series )
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
IFS=$'\n' k_series=($(sort <<<"${k_series[*]}" | uniq)); unset IFS
|
|
||||||
for pkg in "${k_series[@]}"; do
|
|
||||||
debug "series $pkg"
|
|
||||||
done
|
|
||||||
if (( "${#k_series[@]}" > 1 )); then
|
|
||||||
local i=0
|
|
||||||
# lets try and avoid the last item assuming that is the most recent
|
|
||||||
for i in $( seq 0 $(( ${#k_series[@]} - 2 )) ); do
|
|
||||||
debug "item $i is ${k_series[$i]}"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
local ur=$( uname -r )
|
||||||
|
local current_relnum=$( kernel_to_relnum $ur )
|
||||||
|
local kern_pkgs=( $( rpm -qa 'kernel*' | sort ) )
|
||||||
|
local pkg
|
||||||
|
for pkg in "${kern_pkgs[@]}"; do
|
||||||
|
if [[ $pkg = kernel-tools-* ]] \
|
||||||
|
|| [[ $pkg = kernel-headers-* ]] \
|
||||||
|
|| [[ $pkg = kernel-devel-* ]] ; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
k_pkgs+=( $pkg )
|
||||||
|
done
|
||||||
|
for pkg in "${k_pkgs[@]}"; do
|
||||||
|
pkg=${pkg##kernel-modules-extra-}
|
||||||
|
pkg=${pkg##kernel-modules-}
|
||||||
|
pkg=${pkg##kernel-core-}
|
||||||
|
pkg=${pkg%.fc??.x86_64}
|
||||||
|
kernel_series=$( kernel_to_relnum ${pkg##kernel-} )
|
||||||
|
|
||||||
|
#debug "K SER: $kernel_series"
|
||||||
|
if contains k_series $kernel_series; then
|
||||||
|
continue
|
||||||
|
elif [[ x$current_relnum = x$kernel_series ]]; then
|
||||||
|
debug "avoiding current kernel [$kernel_series]"
|
||||||
|
else
|
||||||
|
k_series+=($kernel_series)
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
IFS=$'\n' k_series=($(sort <<<"${k_series[*]}" | uniq)); unset IFS
|
||||||
|
for pkg in "${k_series[@]}"; do
|
||||||
|
debug "series $pkg"
|
||||||
|
done
|
||||||
|
if (( "${#k_series[@]}" > 1 )); then
|
||||||
|
local i=0
|
||||||
|
# lets try and avoid the last item assuming that is the most recent
|
||||||
|
for i in $( seq 0 $(( ${#k_series[@]} - 2 )) ); do
|
||||||
|
debug "item $i is ${k_series[$i]}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
set +x
|
set +x
|
||||||
if (( ${#selected_k[@]} < 1 )); then
|
if (( ${#selected_k[@]} < 1 )); then
|
||||||
note "No kernels selected for removal"
|
note "No kernels selected for removal"
|
||||||
@@ -225,17 +262,40 @@ clean_old_kernels() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clean_core_files() {
|
clean_core_files() {
|
||||||
note "Cleaning core files WIP"
|
note "Cleaning core files..."
|
||||||
if (( $verbose > 0 )); then
|
if (( ${#core_files[@]} < 1 )); then
|
||||||
printf "%s\n" "${core_files[@]}"
|
debug "No core files ?"
|
||||||
|
return 0
|
||||||
fi
|
fi
|
||||||
|
local counter=0
|
||||||
|
for f in "${core_files[@]}"; do
|
||||||
|
echo -n "-"
|
||||||
|
rm -f "$f"
|
||||||
|
counter=$(( counter + 1 ))
|
||||||
|
if (( ($counter % 100) == 0 )); then
|
||||||
|
sleep 0.2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_lf_downloads() {
|
clean_lf_downloads() {
|
||||||
note "Clean LF downloads WIP"
|
if (( ${#lf_downloads[@]} < 1 )); then
|
||||||
if (( $verbose > 0 )); then
|
note "No /home/lanforge/downloads files to remove"
|
||||||
printf "%s\n" "${lf_downloads[@]}"
|
return 0
|
||||||
fi
|
fi
|
||||||
|
note "Clean LF downloads..."
|
||||||
|
if (( $verbose > 0 )); then
|
||||||
|
printf "Delete:[%s]\n" "${lf_downloads[@]}" | sort
|
||||||
|
fi
|
||||||
|
cd /home/lanforge/Downloads
|
||||||
|
for f in "${lf_downloads[@]}"; do
|
||||||
|
[[ "$f" = "/" ]] && echo "Whuuut? this is not good, bye." && exit 1
|
||||||
|
echo "Next:[$f]"
|
||||||
|
sleep 0.2
|
||||||
|
rm -f "$f"
|
||||||
|
done
|
||||||
|
cd "$starting_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_ath10_files() {
|
clean_ath10_files() {
|
||||||
@@ -246,13 +306,37 @@ clean_ath10_files() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clean_var_log() {
|
clean_var_log() {
|
||||||
note "Clean var log WIP"
|
note "Vacuuming journal..."
|
||||||
|
journalctl --vacuum-size 1M
|
||||||
|
if (( ${#var_log_files[@]} < 1 )); then
|
||||||
|
note "No notable files in /var/log to remove"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
local vee=""
|
||||||
if (( $verbose > 0 )); then
|
if (( $verbose > 0 )); then
|
||||||
printf "%s\n" "${var_log_files[@]}"
|
printf "%s\n" "${var_log_files[@]}"
|
||||||
|
vee="-v"
|
||||||
fi
|
fi
|
||||||
|
cd /var/log
|
||||||
|
while read file; do
|
||||||
|
if [[ $file = /var/log/messages ]]; then
|
||||||
|
echo "" > /var/log/messages
|
||||||
|
else
|
||||||
|
rm -f $vee "$file"
|
||||||
|
fi
|
||||||
|
done <<< "${var_log_files[@]}"
|
||||||
|
cd "$starting_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_mnt_fl_files() {
|
clean_dnf_cache() {
|
||||||
|
local yum="dnf"
|
||||||
|
which --skip-alias dnf &> /dev/null
|
||||||
|
(( $? < 0 )) && yum="yum"
|
||||||
|
debug "Purging $yum cache"
|
||||||
|
$yum clean all
|
||||||
|
}
|
||||||
|
|
||||||
|
clean_mnt_lf_files() {
|
||||||
note "clean mnt lf files WIP"
|
note "clean mnt lf files WIP"
|
||||||
if (( $verbose > 0 )); then
|
if (( $verbose > 0 )); then
|
||||||
printf "%s\n" "${mnt_lf_files[@]}"
|
printf "%s\n" "${mnt_lf_files[@]}"
|
||||||
@@ -270,9 +354,13 @@ compress_report_data() {
|
|||||||
clean_var_tmp() {
|
clean_var_tmp() {
|
||||||
note "clean var tmp"
|
note "clean var tmp"
|
||||||
if (( $verbose > 0 )); then
|
if (( $verbose > 0 )); then
|
||||||
printf "%s\n" "${var_tmp_files[@]}"
|
printf " %s\n" "${var_tmp_files[@]}"
|
||||||
|
sleep 1
|
||||||
fi
|
fi
|
||||||
rf -f "${var_tmp_files[@]}"
|
for f in "${var_tmp_files[@]}"; do
|
||||||
|
rf -f "$f"
|
||||||
|
sleep 0.2
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -289,26 +377,28 @@ core_files=()
|
|||||||
survey_core_files() {
|
survey_core_files() {
|
||||||
debug "Surveying core files"
|
debug "Surveying core files"
|
||||||
cd /
|
cd /
|
||||||
#set -x
|
|
||||||
mapfile -t core_files < <(ls /core* /home/lanforge/core* 2>/dev/null) 2>/dev/null
|
mapfile -t core_files < <(ls /core* /home/lanforge/core* 2>/dev/null) 2>/dev/null
|
||||||
if [[ $verbose = 1 ]]; then
|
if [[ $verbose = 1 ]] && (( ${#core_files[@]} > 0 )); then
|
||||||
printf "%s\n" "${core_files[@]}"
|
printf " %s\n" "${core_files[@]}" | head
|
||||||
fi
|
fi
|
||||||
if (( ${#core_files[@]} > 0 )); then
|
if (( ${#core_files[@]} > 0 )); then
|
||||||
totals[c]=$(du -hc "${core_files[@]}" | awk '/total/{print $1}')
|
totals[c]=$(du -hc "${core_files[@]}" | awk '/total/{print $1}')
|
||||||
fi
|
fi
|
||||||
#set +x
|
#set +x
|
||||||
[[ x${totals[c]} = x ]] && totals[c]=0
|
[[ x${totals[c]} = x ]] && totals[c]=0
|
||||||
|
cd "$starting_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
# downloads
|
# downloads
|
||||||
downloads=()
|
lf_downloads=()
|
||||||
survey_lf_downloads() {
|
survey_lf_downloads() {
|
||||||
debug "Surveying /home/lanforge downloads"
|
debug "Surveying /home/lanforge downloads"
|
||||||
cd /home/lanforge/Downloads || return 1
|
[ ! -d "/home/lanforge/Downloads" ] && note "No downloads folder " && return 0
|
||||||
mapfile -t downloads < <(ls *gz *z2 *-Installer.exe *firmware* kinst_* *Docs* 2>/dev/null)
|
cd /home/lanforge/Downloads
|
||||||
totals[d]=$(du -hc "${downloads[@]}" | awk '/total/{print $1}')
|
mapfile -t lf_downloads < <(ls *gz *z2 *-Installer.exe *firmware* kinst_* *Docs* 2>/dev/null)
|
||||||
|
totals[d]=$(du -hc "${lf_downloads[@]}" | awk '/total/{print $1}')
|
||||||
[[ x${totals[d]} = x ]] && totals[d]=0
|
[[ x${totals[d]} = x ]] && totals[d]=0
|
||||||
|
cd "$starting_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find ath10k crash residue
|
# Find ath10k crash residue
|
||||||
@@ -324,7 +414,8 @@ survey_ath10_files() {
|
|||||||
var_log_files=()
|
var_log_files=()
|
||||||
survey_var_log() {
|
survey_var_log() {
|
||||||
debug "Surveying var log"
|
debug "Surveying var log"
|
||||||
mapfile -t var_log_files < <(find /var/log -type f -size +10M 2>/dev/null)
|
mapfile -t var_log_files < <(find /var/log -type f -size +35M \
|
||||||
|
-not \( -path '*/journal/*' -o -path '*/sa/*' -o -path '*/lastlog' \) 2>/dev/null)
|
||||||
totals[l]=$(du -hc "${var_log_files}" 2>/dev/null | awk '/total/{print $1}' )
|
totals[l]=$(du -hc "${var_log_files}" 2>/dev/null | awk '/total/{print $1}' )
|
||||||
[[ x${totals[l]} = x ]] && totals[l]=0
|
[[ x${totals[l]} = x ]] && totals[l]=0
|
||||||
}
|
}
|
||||||
@@ -332,12 +423,10 @@ survey_var_log() {
|
|||||||
# stuff in var tmp
|
# stuff in var tmp
|
||||||
var_tmp_files=()
|
var_tmp_files=()
|
||||||
survey_var_tmp() {
|
survey_var_tmp() {
|
||||||
#set -x
|
|
||||||
debug "Surveying var tmp"
|
debug "Surveying var tmp"
|
||||||
mapfile -t var_tmp_files < <(find /var/tmp -type f 2>/dev/null)
|
mapfile -t var_tmp_files < <(find /var/tmp -type f 2>/dev/null)
|
||||||
totals[t]=$(du -sh "${var_tmp_files}" 2>/dev/null | awk '/total/{print $1}' )
|
totals[t]=$(du -sh "${var_tmp_files}" 2>/dev/null | awk '/total/{print $1}' )
|
||||||
[[ x${totals[t]} = x ]] && totals[t]=0
|
[[ x${totals[t]} = x ]] && totals[t]=0
|
||||||
#set +x
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find size of /mnt/lf that is not mounted
|
# Find size of /mnt/lf that is not mounted
|
||||||
@@ -350,6 +439,14 @@ survey_mnt_lf_files() {
|
|||||||
[[ x${totals[m]} = x ]] && totals[m]=0
|
[[ x${totals[m]} = x ]] && totals[m]=0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
survey_dnf_cache() {
|
||||||
|
local yum="dnf"
|
||||||
|
which --skip-alias dnf &> /dev/null
|
||||||
|
(( $? < 0 )) && yum="yum"
|
||||||
|
debug "Surveying $yum cache"
|
||||||
|
totals[n]=$(du -hc '/var/cache/{dnf,yum}' 2>/dev/null | awk '/total/{print $1}')
|
||||||
|
}
|
||||||
|
|
||||||
## Find size of /lib/modules
|
## Find size of /lib/modules
|
||||||
# cd /lib/modules
|
# cd /lib/modules
|
||||||
# mapfile -t usage_libmod < <(du -sh *)
|
# mapfile -t usage_libmod < <(du -sh *)
|
||||||
@@ -363,13 +460,12 @@ report_files=()
|
|||||||
survey_report_data() {
|
survey_report_data() {
|
||||||
debug "Surveying for lanforge report data"
|
debug "Surveying for lanforge report data"
|
||||||
cd /home/lanforge
|
cd /home/lanforge
|
||||||
#set -x
|
|
||||||
local fnum=$( find -type f -name '*.csv' 2>/dev/null | wc -l )
|
local fnum=$( find -type f -name '*.csv' 2>/dev/null | wc -l )
|
||||||
local fsiz=$( find -type f -name '*.csv' 2>/dev/null | xargs du -hc | awk '/total/{print $1}')
|
local fsiz=$( find -type f -name '*.csv' 2>/dev/null | xargs du -hc | awk '/total/{print $1}')
|
||||||
totals[r]="$fsiz"
|
totals[r]="$fsiz"
|
||||||
[[ x${totals[r]} = x ]] && totals[r]=0
|
[[ x${totals[r]} = x ]] && totals[r]=0
|
||||||
report_files=("CSV files: $fnum tt $fsiz")
|
report_files=("CSV files: $fnum tt $fsiz")
|
||||||
#set +x
|
cd "$starting_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -381,7 +477,7 @@ survey_areas() {
|
|||||||
note "Surveying..."
|
note "Surveying..."
|
||||||
for area in "${!surveyors_map[@]}"; do
|
for area in "${!surveyors_map[@]}"; do
|
||||||
if (( $quiet < 1 )) && (( $verbose < 1 )); then
|
if (( $quiet < 1 )) && (( $verbose < 1 )); then
|
||||||
note -n "#"
|
echo -n "#"
|
||||||
fi
|
fi
|
||||||
${surveyors_map[$area]}
|
${surveyors_map[$area]}
|
||||||
done
|
done
|
||||||
@@ -402,14 +498,27 @@ survey_areas
|
|||||||
disk_usage_report
|
disk_usage_report
|
||||||
|
|
||||||
if (( ${#core_files[@]} > 0 )); then
|
if (( ${#core_files[@]} > 0 )); then
|
||||||
note "Core Files detected:"
|
|
||||||
hr
|
hr
|
||||||
#printf ' %s\n' "${core_files[@]}"
|
note "${#core_files[@]} Core Files detected:"
|
||||||
for core in "${core_files[@]}"; do
|
filestr=""
|
||||||
file $core
|
declare -A core_groups
|
||||||
done
|
# set -e
|
||||||
|
# note that the long pipe at the bottom of the loop is the best way to get
|
||||||
|
# the system to operate with thousands of core files
|
||||||
|
while read group7; do
|
||||||
|
(( $verbose > 0 )) && echo -n '+'
|
||||||
|
group7="${group7%, *}"
|
||||||
|
group7="${group7//\'/}"
|
||||||
|
[[ ${core_groups[$group7]+_} != _ ]] && core_groups[$group7]=0
|
||||||
|
core_groups[$group7]=$(( ${core_groups[$group7]} + 1 ))
|
||||||
|
done < <(echo "${core_files[@]}" | xargs file | awk -F": " '/execfn:/{print $7}')
|
||||||
|
echo ""
|
||||||
|
echo "These types of core files were found:"
|
||||||
|
for group in "${!core_groups[@]}"; do
|
||||||
|
echo "${core_groups[$group]} files of $group"
|
||||||
|
done | sort -n
|
||||||
hr
|
hr
|
||||||
selections+=("c")
|
(( ${#core_files[@]} > 0 )) && selections+=("c")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#echo "Usage of /mnt: $usage_mnt"
|
#echo "Usage of /mnt: $usage_mnt"
|
||||||
@@ -426,7 +535,7 @@ fi
|
|||||||
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- #
|
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- #
|
||||||
# delete extra things now #
|
# delete extra things now #
|
||||||
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- #
|
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- #
|
||||||
#set -x
|
|
||||||
if contains "selections" "a" ; then
|
if contains "selections" "a" ; then
|
||||||
note "Automatic deletion will include: "
|
note "Automatic deletion will include: "
|
||||||
printf "%s\n" "${selections[@]}"
|
printf "%s\n" "${selections[@]}"
|
||||||
@@ -441,16 +550,19 @@ if contains "selections" "a" ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if (( ${#selections[@]} > 0 )) ; then
|
if (( ${#selections[@]} > 0 )) ; then
|
||||||
debug "Doing selected cleanup"
|
debug "Doing selected cleanup: "
|
||||||
|
printf " %s\n" "${selections[@]}"
|
||||||
|
sleep 1
|
||||||
for z in "${selections[@]}"; do
|
for z in "${selections[@]}"; do
|
||||||
debug "Will perform ${desc[$z]}"
|
debug "Performing ${desc[$z]}"
|
||||||
${cleaners_map[$z]}
|
${cleaners_map[$z]}
|
||||||
selections=("${selections[@]/$z}")
|
selections=("${selections[@]/$z}")
|
||||||
done
|
done
|
||||||
survey_areas
|
survey_areas
|
||||||
disk_usage_report
|
disk_usage_report
|
||||||
|
else
|
||||||
|
debug "No selections present"
|
||||||
fi
|
fi
|
||||||
set +x
|
|
||||||
|
|
||||||
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- #
|
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- #
|
||||||
# ask for things to remove if we are interactive #
|
# ask for things to remove if we are interactive #
|
||||||
@@ -466,8 +578,10 @@ while [[ $choice != q ]]; do
|
|||||||
echo " k) ath10k crash files ${totals[k]}"
|
echo " k) ath10k crash files ${totals[k]}"
|
||||||
echo " l) old /var/log files ${totals[l]}"
|
echo " l) old /var/log files ${totals[l]}"
|
||||||
echo " m) orphaned /mnt/lf files ${totals[m]}"
|
echo " m) orphaned /mnt/lf files ${totals[m]}"
|
||||||
|
echo " n) purge dnf/yum cache ${totals[n]}"
|
||||||
echo " r) compress .csv report files ${totals[r]}"
|
echo " r) compress .csv report files ${totals[r]}"
|
||||||
echo " t) clean /var/tmp ${totals[t]}"
|
echo " t) clean /var/tmp ${totals[t]}"
|
||||||
|
echo " q) quit"
|
||||||
read -p "[1-5] or q ? " choice
|
read -p "[1-5] or q ? " choice
|
||||||
|
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from generic_cx import GenericCx
|
|||||||
mgrURL = "http://localhost:8080/"
|
mgrURL = "http://localhost:8080/"
|
||||||
staName = "sta0"
|
staName = "sta0"
|
||||||
staNameUri = "port/1/1/" + staName
|
staNameUri = "port/1/1/" + staName
|
||||||
|
suppress_related = True
|
||||||
|
|
||||||
class ConnectTest(LFCliBase):
|
class ConnectTest(LFCliBase):
|
||||||
def __init__(self, lfhost, lfport):
|
def __init__(self, lfhost, lfport):
|
||||||
@@ -47,7 +47,7 @@ class ConnectTest(LFCliBase):
|
|||||||
if response["interface"] is not None:
|
if response["interface"] is not None:
|
||||||
print("removing old station")
|
print("removing old station")
|
||||||
removePort(1, staName, mgrURL)
|
removePort(1, staName, mgrURL)
|
||||||
waitUntilPortsDisappear(1, mgrURL, [staName])
|
waitUntilPortsDisappear(mgrURL, [staName])
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
url = "cli-json/add_sta"
|
url = "cli-json/add_sta"
|
||||||
@@ -56,14 +56,15 @@ class ConnectTest(LFCliBase):
|
|||||||
"resource": 1,
|
"resource": 1,
|
||||||
"radio": "wiphy0",
|
"radio": "wiphy0",
|
||||||
"sta_name": staName,
|
"sta_name": staName,
|
||||||
"ssid": "jedway-wpa2-x2048-5-1",
|
"ssid": "jedway-wpa2-x2048-4-4",
|
||||||
"key": "jedway-wpa2-x2048-5-1",
|
"key": "jedway-wpa2-x2048-4-4",
|
||||||
"mode": 0,
|
"mode": 0,
|
||||||
"mac": "xx:xx:xx:xx:*:xx",
|
"mac": "xx:xx:xx:xx:*:xx",
|
||||||
"flags": (0x400 + 0x20000 + 0x1000000000) # create admin down
|
"flags": (0x400 + 0x20000 + 0x1000000000) # create admin down
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(0.05)
|
wait_until_ports_appear(mgrURL, [staName], True)
|
||||||
|
time.sleep(8)
|
||||||
reqURL = "cli-json/set_port"
|
reqURL = "cli-json/set_port"
|
||||||
data = {
|
data = {
|
||||||
"shelf": 1,
|
"shelf": 1,
|
||||||
@@ -72,7 +73,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"current_flags": (0x1 + 0x80000000),
|
"current_flags": (0x1 + 0x80000000),
|
||||||
"interest": (0x2 + 0x4000 + 0x800000) # current, dhcp, down,
|
"interest": (0x2 + 0x4000 + 0x800000) # current, dhcp, down,
|
||||||
}
|
}
|
||||||
super().json_post(reqURL, data)
|
super().json_post(reqURL, data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
super().json_post("cli-json/set_port", portUpRequest(1, staName))
|
super().json_post("cli-json/set_port", portUpRequest(1, staName))
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"resource": 1,
|
"resource": 1,
|
||||||
"port": staName,
|
"port": staName,
|
||||||
"probe_flags": 1}
|
"probe_flags": 1}
|
||||||
super().json_post(reqURL, data)
|
super().json_post(reqURL, data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
waitUntilPortsAdminUp(1, mgrURL, [staName])
|
waitUntilPortsAdminUp(1, mgrURL, [staName])
|
||||||
|
|
||||||
@@ -121,11 +122,11 @@ class ConnectTest(LFCliBase):
|
|||||||
"url": "dl http://localhost/ /dev/null",
|
"url": "dl http://localhost/ /dev/null",
|
||||||
"proxy_port" : "NA"
|
"proxy_port" : "NA"
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
data = {
|
data = {
|
||||||
"endpoint": "all"
|
"endpoint": "all"
|
||||||
}
|
}
|
||||||
super().json_post("/cli-json/nc_show_endpoints", data)
|
super().json_post("/cli-json/nc_show_endpoints", data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
# create fileio endpoint
|
# create fileio endpoint
|
||||||
@@ -138,7 +139,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"type": "fe_nfs",
|
"type": "fe_nfs",
|
||||||
"directory": "/mnt/fe-test"
|
"directory": "/mnt/fe-test"
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
data = {
|
data = {
|
||||||
"endpoint": "all"
|
"endpoint": "all"
|
||||||
@@ -158,7 +159,7 @@ class ConnectTest(LFCliBase):
|
|||||||
data = {
|
data = {
|
||||||
"endpoint": "all"
|
"endpoint": "all"
|
||||||
}
|
}
|
||||||
super().json_post("/cli-json/nc_show_endpoints", data)
|
super().json_post("/cli-json/nc_show_endpoints", data, suppress_related_commands_=suppress_related)
|
||||||
|
|
||||||
# create redirects for wanlink
|
# create redirects for wanlink
|
||||||
url = "/cli-json/add_rdd"
|
url = "/cli-json/add_rdd"
|
||||||
@@ -168,7 +169,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"port": "rdd0",
|
"port": "rdd0",
|
||||||
"peer_ifname": "rdd1"
|
"peer_ifname": "rdd1"
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
|
|
||||||
url = "/cli-json/add_rdd"
|
url = "/cli-json/add_rdd"
|
||||||
data = {
|
data = {
|
||||||
@@ -177,7 +178,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"port": "rdd1",
|
"port": "rdd1",
|
||||||
"peer_ifname": "rdd0"
|
"peer_ifname": "rdd0"
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(.05)
|
time.sleep(.05)
|
||||||
|
|
||||||
# reset redirect ports
|
# reset redirect ports
|
||||||
@@ -187,7 +188,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"resource": 1,
|
"resource": 1,
|
||||||
"port": "rdd0"
|
"port": "rdd0"
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
|
|
||||||
url = "/cli-json/reset_port"
|
url = "/cli-json/reset_port"
|
||||||
data = {
|
data = {
|
||||||
@@ -195,7 +196,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"resource": 1,
|
"resource": 1,
|
||||||
"port": "rdd1"
|
"port": "rdd1"
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(.05)
|
time.sleep(.05)
|
||||||
|
|
||||||
# create wanlink endpoints
|
# create wanlink endpoints
|
||||||
@@ -208,7 +209,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"latency": 20,
|
"latency": 20,
|
||||||
"max_rate": 1544000
|
"max_rate": 1544000
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
|
|
||||||
url = "/cli-json/add_wl_endp"
|
url = "/cli-json/add_wl_endp"
|
||||||
data = {
|
data = {
|
||||||
@@ -219,12 +220,12 @@ class ConnectTest(LFCliBase):
|
|||||||
"latency": 30,
|
"latency": 30,
|
||||||
"max_rate": 1544000
|
"max_rate": 1544000
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(.05)
|
time.sleep(.05)
|
||||||
data = {
|
data = {
|
||||||
"endpoint": "all"
|
"endpoint": "all"
|
||||||
}
|
}
|
||||||
super().json_post("/cli-json/nc_show_endpoints", data)
|
super().json_post("/cli-json/nc_show_endpoints", data, suppress_related_commands_=suppress_related)
|
||||||
|
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
@@ -246,7 +247,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"tx_endp": "l4Test",
|
"tx_endp": "l4Test",
|
||||||
"rx_endp": "NA"
|
"rx_endp": "NA"
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(.05)
|
time.sleep(.05)
|
||||||
|
|
||||||
# create fileio cx
|
# create fileio cx
|
||||||
@@ -257,7 +258,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"tx_endp": "fioTest",
|
"tx_endp": "fioTest",
|
||||||
"rx_endp": "NA"
|
"rx_endp": "NA"
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(.05)
|
time.sleep(.05)
|
||||||
|
|
||||||
# create generic cx
|
# create generic cx
|
||||||
@@ -268,7 +269,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"tx_endp": "genTest1",
|
"tx_endp": "genTest1",
|
||||||
"rx_endp": "genTest2"
|
"rx_endp": "genTest2"
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(.05)
|
time.sleep(.05)
|
||||||
|
|
||||||
# create wanlink cx
|
# create wanlink cx
|
||||||
@@ -279,12 +280,12 @@ class ConnectTest(LFCliBase):
|
|||||||
"tx_endp": "wlan0",
|
"tx_endp": "wlan0",
|
||||||
"rx_endp": "wlan1"
|
"rx_endp": "wlan1"
|
||||||
}
|
}
|
||||||
super().json_post(url, data)
|
super().json_post(url, data, suppress_related_commands_=suppress_related)
|
||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
data = {
|
data = {
|
||||||
"endpoint": "all"
|
"endpoint": "all"
|
||||||
}
|
}
|
||||||
super().json_post("/cli-json/nc_show_endpoints", data)
|
super().json_post("/cli-json/nc_show_endpoints", data, suppress_related_commands_=suppress_related)
|
||||||
|
|
||||||
cxNames = ["testTCP", "testUDP", "CX_l4Test", "CX_fioTest", "CX_genTest1", "CX_wlan0"]
|
cxNames = ["testTCP", "testUDP", "CX_l4Test", "CX_fioTest", "CX_genTest1", "CX_wlan0"]
|
||||||
|
|
||||||
@@ -451,7 +452,7 @@ class ConnectTest(LFCliBase):
|
|||||||
"resource": 1,
|
"resource": 1,
|
||||||
"port": staName
|
"port": staName
|
||||||
}
|
}
|
||||||
super().json_post(reqURL, data)
|
super().json_post(reqURL, data, suppress_related_commands_=suppress_related)
|
||||||
|
|
||||||
endpNames = ["testTCP-A", "testTCP-B",
|
endpNames = ["testTCP-A", "testTCP-B",
|
||||||
"testUDP-A", "testUDP-B",
|
"testUDP-A", "testUDP-B",
|
||||||
|
|||||||
@@ -1,88 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#This bash script aims to automate the test process of all Candela Technologies's test_* scripts in the lanforge-scripts directory. The script can be run 2 ways and may include (via user input) the "start_num" and "stop_num" variables to select which tests should be run.
|
|
||||||
# OPTION ONE: ./test_all_scripts.sh : this command runs all the scripts in the array "testCommands"
|
|
||||||
# OPTION TWO: ./test_all_scripts.sh 4 5 : this command runs py-script commands (in testCommands array) that include the py-script options beginning with 4 and 5 (inclusive) in case function ret_case_num.
|
|
||||||
#Variables
|
|
||||||
NUM_STA=4
|
|
||||||
SSID_USED="jedway-wpa2-x2048-5-3"
|
|
||||||
PASSWD_USED="jedway-wpa2-x2048-5-3"
|
|
||||||
RADIO_USED="wiphy1"
|
|
||||||
SECURITY="wpa2"
|
|
||||||
|
|
||||||
START_NUM=0
|
|
||||||
CURR_TEST_NUM=0
|
|
||||||
CURR_TEST_NAME="BLANK"
|
|
||||||
STOP_NUM=9
|
|
||||||
|
|
||||||
#Test array
|
|
||||||
testCommands=("./example_security_connection.py --num_stations $NUM_STA --ssid jedway-r8000-36 --passwd jedway-r8000-36 --radio $RADIO_USED --security wpa "
|
|
||||||
"./example_security_connection.py --num_stations $NUM_STA --ssid $SSID_USED --passwd $SSID_USED --radio $RADIO_USED --security wpa2"
|
|
||||||
"./example_security_connection.py --num_stations $NUM_STA --ssid jedway-wep-48 --passwd jedway-wep-48 --radio $RADIO_USED --security wep"
|
|
||||||
"./example_security_connection.py --num_stations $NUM_STA --ssid jedway-wpa3-1 --passwd jedway-wpa3-1 --radio $RADIO_USED --security wpa3"
|
|
||||||
"./test_ipv4_connection.py --radio wiphy2 --num_stations $NUM_STA --ssid $SSID_USED --passwd $PASSWD_USED --security $SECURITY --debug --upstream_port eth1"
|
|
||||||
"./test_generic.py --mgr localhost --mgr_port 4122 --radio $RADIO_USED --ssid $SSID_USED --passwd $PASSWD_USED --num_stations $NUM_STA --type lfping --dest 10.40.0.1 --security $SECURITY"
|
|
||||||
"./test_generic.py --mgr localhost --mgr_port 4122 --radio $RADIO_USED --ssid $SSID_USED --passwd $PASSWD_USED --num_stations $NUM_STA --type speedtest --speedtest_min_up 20 --speedtest_min_dl 20 --speedtest_max_ping 150 --security $SECURITY"
|
|
||||||
"./test_ipv4_l4_urls_per_ten.py --upstream_port eth1 --radio $RADIO_USED --num_stations $NUM_STA --security $SECURITY --ssid $SSID_USED --passwd $PASSWD_USED --num_tests 1 --requests_per_ten 600 --target_per_ten 600"
|
|
||||||
"./test_ipv4_l4_wifi.py --upstream_port eth1 --radio wiphy0 --num_stations $NUM_STA --security $SECURITY --ssid jedway-wpa2-x2048-4-4 --passwd jedway-wpa2-x2048-4-4 --test_duration 3m"
|
|
||||||
"./test_ipv4_l4.py --radio wiphy3 --num_stations 4 --security wpa2 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --url \"dl http://10.40.0.1 /dev/null\" --test_duration 2m --debug"
|
|
||||||
"./test_ipv4_variable_time.py --radio wiphy1 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --mode 4 --ap 00:0e:8e:ff:86:e6 --test_duration 30s --output_format excel"
|
|
||||||
"./test_ipv4_variable_time.py --radio wiphy1 --ssid jedway-wpa2-x2048-4-1 --passwd jedway-wpa2-x2048-4-1 --security wpa2 --mode 4 --ap 00:0e:8e:ff:86:e6 --test_duration 30s --output_format csv"
|
|
||||||
)
|
|
||||||
declare -A name_to_num
|
|
||||||
name_to_num=(
|
|
||||||
["example_security_connection"]=1
|
|
||||||
["test_ipv4_connection"]=2
|
|
||||||
["test_generic"]=3
|
|
||||||
["test_ipv4_l4_urls_per_ten"]=4
|
|
||||||
["test_ipv4_l4_wifi"]=5
|
|
||||||
["test_ipv4_l4"]=6
|
|
||||||
["test_variable_time"]=7
|
|
||||||
)
|
|
||||||
|
|
||||||
function blank_db() {
|
|
||||||
echo "Loading blank scenario..." >>~/test_all_output_file.txt
|
|
||||||
./scenario.py --load BLANK >>~/test_all_output_file.txt
|
|
||||||
#check_blank.py
|
|
||||||
}
|
|
||||||
function echo_print() {
|
|
||||||
echo "Beginning $CURR_TEST_NAME test..." >>~/test_all_output_file.txt
|
|
||||||
}
|
|
||||||
function run_test() {
|
|
||||||
for i in "${testCommands[@]}"; do
|
|
||||||
CURR_TEST_NAME=${i%%.py*}
|
|
||||||
CURR_TEST_NAME=${CURR_TEST_NAME#./*}
|
|
||||||
CURR_TEST_NUM="${name_to_num[$CURR_TEST_NAME]}"
|
|
||||||
echo "$CURR_TEST_NAME $CURR_TEST_NUM"
|
|
||||||
|
|
||||||
if (( $CURR_TEST_NUM > $STOP_NUM )) || (( $STOP_NUM == $CURR_TEST_NUM )) && (( $STOP_NUM != 0 )); then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if (( $CURR_TEST_NUM > $START_NUM )) || (( $CURR_TEST_NUM == $START_NUM )); then
|
|
||||||
echo_print
|
|
||||||
echo "$i"
|
|
||||||
[[ x$DEBUG != x ]] && sleep 2
|
|
||||||
eval $i >>~/test_all_output_file.txt
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo $CURR_TEST_NAME failure
|
|
||||||
[[ x$DEBUG != x ]] && exit 1
|
|
||||||
else
|
|
||||||
echo $CURR_TEST_NAME success
|
|
||||||
fi
|
|
||||||
if [[ "${CURR_TEST_NAME}" = @(example_wpa_connection|example_wpa2_connection|example_wpa3_connection|example_wep_connection) ]]; then
|
|
||||||
blank_db
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
function check_args() {
|
|
||||||
if [ ! -z $1 ]; then
|
|
||||||
START_NUM=$1
|
|
||||||
fi
|
|
||||||
if [ ! -z $2 ]; then
|
|
||||||
STOP_NUM=$2
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
true >~/test_all_output_file.txt
|
|
||||||
check_args $1 $2
|
|
||||||
run_test
|
|
||||||
#test generic and fileio are for macvlans
|
|
||||||
@@ -175,15 +175,25 @@ python3 ./test_ipv4_l4_urls_per_ten.py
|
|||||||
--test_duration 2m
|
--test_duration 2m
|
||||||
--debug
|
--debug
|
||||||
''')
|
''')
|
||||||
required = parser.add_argument_group('required arguments')
|
required = None
|
||||||
optional = parser.add_argument_group('optional arguments')
|
for agroup in parser._action_groups:
|
||||||
parser.add_argument('--requests_per_ten', help='--requests_per_ten number of request per ten minutes', default=600)
|
if agroup.title == "required arguments":
|
||||||
parser.add_argument('--num_tests', help='--num_tests number of tests to run. Each test runs 10 minutes', default=1)
|
required = agroup
|
||||||
parser.add_argument('--url', help='--url specifies upload/download, address, and dest',default="dl http://10.40.0.1 /dev/null")
|
#if required is not None:
|
||||||
parser.add_argument('--test_duration', help='duration of test',default="2m")
|
|
||||||
parser.add_argument('--target_per_ten', help='--target_per_ten target number of request per ten minutes. test will check for 90 percent this value',default=600)
|
optional = None
|
||||||
optional.add_argument('--mode',help='Used to force mode of stations')
|
for agroup in parser._action_groups:
|
||||||
optional.add_argument('--ap',help='Used to force a connection to a particular AP')
|
if agroup.title == "optional arguments":
|
||||||
|
optional = agroup
|
||||||
|
|
||||||
|
if optional is not None:
|
||||||
|
optional.add_argument('--requests_per_ten', help='--requests_per_ten number of request per ten minutes', default=600)
|
||||||
|
optional.add_argument('--num_tests', help='--num_tests number of tests to run. Each test runs 10 minutes', default=1)
|
||||||
|
optional.add_argument('--url', help='--url specifies upload/download, address, and dest',default="dl http://10.40.0.1 /dev/null")
|
||||||
|
optional.add_argument('--test_duration', help='duration of test',default="2m")
|
||||||
|
optional.add_argument('--target_per_ten', help='--target_per_ten target number of request per ten minutes. test will check for 90 percent this value',default=600)
|
||||||
|
optional.add_argument('--mode',help='Used to force mode of stations')
|
||||||
|
optional.add_argument('--ap',help='Used to force a connection to a particular AP')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
num_sta = 2
|
num_sta = 2
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ import datetime
|
|||||||
|
|
||||||
|
|
||||||
class IPV4VariableTime(LFCliBase):
|
class IPV4VariableTime(LFCliBase):
|
||||||
def __init__(self, host, port, ssid, security, password, sta_list, name_prefix, upstream, radio,
|
def __init__(self, ssid, security, password, sta_list, name_prefix, upstream, radio,
|
||||||
|
host="localhost", port=8080,
|
||||||
side_a_min_rate=56, side_a_max_rate=0,
|
side_a_min_rate=56, side_a_max_rate=0,
|
||||||
side_b_min_rate=56, side_b_max_rate=0,
|
side_b_min_rate=56, side_b_max_rate=0,
|
||||||
number_template="00000", test_duration="5m", use_ht160=False,
|
number_template="00000", test_duration="5m", use_ht160=False,
|
||||||
@@ -169,7 +170,6 @@ class IPV4VariableTime(LFCliBase):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
lfjson_port = 8080
|
|
||||||
|
|
||||||
parser = LFCliBase.create_basic_argparse(
|
parser = LFCliBase.create_basic_argparse(
|
||||||
prog='test_ipv4_variable_time.py',
|
prog='test_ipv4_variable_time.py',
|
||||||
@@ -192,11 +192,20 @@ Generic command layout:
|
|||||||
--test_duration 2m
|
--test_duration 2m
|
||||||
--debug
|
--debug
|
||||||
''')
|
''')
|
||||||
required = parser.add_argument_group('required arguments')
|
required = None
|
||||||
required.add_argument('--security', help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >', required=True)
|
for agroup in parser._action_groups:
|
||||||
parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
|
if agroup.title == "required arguments":
|
||||||
parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
|
required = agroup
|
||||||
parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m")
|
#if required is not None:
|
||||||
|
|
||||||
|
optional = None
|
||||||
|
for agroup in parser._action_groups:
|
||||||
|
if agroup.title == "optional arguments":
|
||||||
|
optional = agroup
|
||||||
|
if optional is not None:
|
||||||
|
optional.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
|
||||||
|
optional.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
|
||||||
|
optional.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
num_sta = 2
|
num_sta = 2
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import pprint
|
|||||||
|
|
||||||
|
|
||||||
class TTLSTest(LFCliBase):
|
class TTLSTest(LFCliBase):
|
||||||
def __init__(self, host, port,
|
def __init__(self, host="localhost", port=8080,
|
||||||
ssid="[BLANK]",
|
ssid="[BLANK]",
|
||||||
security="wpa2",
|
security="wpa2",
|
||||||
password="[BLANK]",
|
password="[BLANK]",
|
||||||
@@ -203,10 +203,12 @@ class TTLSTest(LFCliBase):
|
|||||||
if (len(sta_list) == len(ip_map)) and (len(sta_list) == len(associated_map)):
|
if (len(sta_list) == len(ip_map)) and (len(sta_list) == len(associated_map)):
|
||||||
self._pass("PASS: All stations associated with IP", print_pass)
|
self._pass("PASS: All stations associated with IP", print_pass)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
self._fail("FAIL: Not all stations able to associate/get IP", print_fail)
|
self._fail("FAIL: Not all stations able to associate/get IP", print_fail)
|
||||||
print("sta_list", sta_list)
|
if self.debug:
|
||||||
print("ip_map", ip_map)
|
print("sta_list", sta_list)
|
||||||
print("associated_map", associated_map)
|
print("ip_map", ip_map)
|
||||||
|
print("associated_map", associated_map)
|
||||||
|
|
||||||
# notice that this does not actually generate traffic
|
# notice that this does not actually generate traffic
|
||||||
# please see test_ipv4_variable_time for example of generating traffic
|
# please see test_ipv4_variable_time for example of generating traffic
|
||||||
@@ -225,8 +227,6 @@ class TTLSTest(LFCliBase):
|
|||||||
debug=self.debug)
|
debug=self.debug)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
lfjson_host = "localhost"
|
|
||||||
lfjson_port = 8080
|
|
||||||
|
|
||||||
parser = LFCliBase.create_basic_argparse(
|
parser = LFCliBase.create_basic_argparse(
|
||||||
prog='test_ipv4_ttls.py',
|
prog='test_ipv4_ttls.py',
|
||||||
@@ -238,31 +238,43 @@ def main():
|
|||||||
test_ipv4_ttls.py:
|
test_ipv4_ttls.py:
|
||||||
--------------------
|
--------------------
|
||||||
Generic command layout:
|
Generic command layout:
|
||||||
python ./test_ipv4_ttls.py --upstream_port <port>
|
python ./test_ipv4_ttls.py
|
||||||
--radio <radio 0>
|
|
||||||
|
--upstream_port eth1
|
||||||
|
--radio wiphy0
|
||||||
--num_stations 3
|
--num_stations 3
|
||||||
--ssid ssid-wpa-1
|
--ssid ssid-wpa-1
|
||||||
--keyphrase ssid-wpa-1
|
--key ssid-wpa-1
|
||||||
--security <security type: wpa2, open, wpa3>
|
--security <security type: wpa2, open, wpa, wpa3>
|
||||||
--debug
|
--debug
|
||||||
|
|
||||||
''')
|
''')
|
||||||
required = parser.add_argument_group('required arguments')
|
required = None
|
||||||
required.add_argument('--security', help='WiFi Security protocol: < open | wep | wpa | wpa2 | wpa3 >', required=True)
|
for agroup in parser._action_groups:
|
||||||
parser.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
|
if agroup.title == "required arguments":
|
||||||
parser.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
|
required = agroup
|
||||||
parser.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m")
|
#if required is not None:
|
||||||
parser.add_argument('--key-mgmt', help="--key-mgt: { %s }"%", ".join(realm.wpa_ent_list()), default="WPA-EAP")
|
|
||||||
parser.add_argument('--wpa_psk', help='wpa-ent pre shared key', default="[BLANK]")
|
optional = None
|
||||||
parser.add_argument('--eap', help='--eap eap method to use', default="TTLS")
|
for agroup in parser._action_groups:
|
||||||
parser.add_argument('--identity', help='--identity eap identity string', default="testuser")
|
if agroup.title == "optional arguments":
|
||||||
parser.add_argument('--ttls_passwd', help='--ttls_passwd eap password string', default="testpasswd")
|
optional = agroup
|
||||||
parser.add_argument('--ttls_realm', help='--ttls_realm 802.11u home realm to use', default="localhost.localdomain")
|
|
||||||
parser.add_argument('--domain', help='--domain 802.11 domain to use', default="localhost.localdomain")
|
if optional is not None:
|
||||||
parser.add_argument('--hessid', help='--hessid 802.11u HESSID (MAC addr format/peer for WDS)', default="00:00:00:00:00:01")
|
optional.add_argument('--a_min', help='--a_min bps rate minimum for side_a', default=256000)
|
||||||
parser.add_argument('--ieee80211w', help='--ieee80211w <disabled(0),optional(1),required(2)', default='1')
|
optional.add_argument('--b_min', help='--b_min bps rate minimum for side_b', default=256000)
|
||||||
parser.add_argument('--use_hs20', help='use HotSpot 2.0', default=False)
|
optional.add_argument('--test_duration', help='--test_duration sets the duration of the test', default="5m")
|
||||||
parser.add_argument('--enable_pkc', help='enable opportunistic PMKSA WPA2 key caching', default=False)
|
optional.add_argument('--key-mgmt', help="--key-mgt: { %s }"%", ".join(realm.wpa_ent_list()), default="WPA-EAP")
|
||||||
|
optional.add_argument('--wpa_psk', help='wpa-ent pre shared key', default="[BLANK]")
|
||||||
|
optional.add_argument('--eap', help='--eap eap method to use', default="TTLS")
|
||||||
|
optional.add_argument('--identity', help='--identity eap identity string', default="testuser")
|
||||||
|
optional.add_argument('--ttls_passwd', help='--ttls_passwd eap password string', default="testpasswd")
|
||||||
|
optional.add_argument('--ttls_realm', help='--ttls_realm 802.11u home realm to use', default="localhost.localdomain")
|
||||||
|
optional.add_argument('--domain', help='--domain 802.11 domain to use', default="localhost.localdomain")
|
||||||
|
optional.add_argument('--hessid', help='--hessid 802.11u HESSID (MAC addr format/peer for WDS)', default="00:00:00:00:00:01")
|
||||||
|
optional.add_argument('--ieee80211w', help='--ieee80211w <disabled(0),optional(1),required(2)', default='1')
|
||||||
|
optional.add_argument('--use_hs20', help='use HotSpot 2.0', default=False)
|
||||||
|
optional.add_argument('--enable_pkc', help='enable opportunistic PMKSA WPA2 key caching', default=False)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
num_sta = 2
|
num_sta = 2
|
||||||
if (args.num_stations is not None) and (int(args.num_stations) > 0):
|
if (args.num_stations is not None) and (int(args.num_stations) > 0):
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ D_MODE="${HL}/LANforgeGUI_${verNum}/DAEMON_MODE"
|
|||||||
trap do_sigint HUP
|
trap do_sigint HUP
|
||||||
trap do_sigint ABRT
|
trap do_sigint ABRT
|
||||||
trap do_sigint INT
|
trap do_sigint INT
|
||||||
trap do_sigint KILL
|
# trap do_sigint KILL # cannot be trapped
|
||||||
trap do_sigint PIPE
|
trap do_sigint PIPE
|
||||||
trap do_sigint QUIT
|
trap do_sigint QUIT
|
||||||
trap do_sigint SEGV
|
trap do_sigint SEGV
|
||||||
@@ -129,7 +129,7 @@ touch "$NO_AUTO"
|
|||||||
pgrep java &>/dev/null && killall -9 java
|
pgrep java &>/dev/null && killall -9 java
|
||||||
touch $GUIUpdate
|
touch $GUIUpdate
|
||||||
touch $ST
|
touch $ST
|
||||||
if [ ! -z "SKIP_INSTALL" ] && [ x$SKIP_INSTALL = x1 ]; then
|
if [ ! -z "$SKIP_INSTALL" ] && [ x$SKIP_INSTALL = x1 ]; then
|
||||||
echo "skipping installation" | tee -a $GUIUpdate
|
echo "skipping installation" | tee -a $GUIUpdate
|
||||||
else
|
else
|
||||||
echo "doing installation"
|
echo "doing installation"
|
||||||
|
|||||||
Reference in New Issue
Block a user