mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 11:48:03 +00:00
Updating lf_wifi_fire.bash. Adds passphrase support for encryption. Fixed issue where previously created connections were not being deleted.
This commit is contained in:
@@ -9,7 +9,8 @@
|
|||||||
# -r Resource IP or hostname.
|
# -r Resource IP or hostname.
|
||||||
# -n Number of stations to create.
|
# -n Number of stations to create.
|
||||||
# -p Number of packets to send.
|
# -p Number of packets to send.
|
||||||
# -e Encryption type.
|
# -e Encryption type: open|wep|wpa|wpa2.
|
||||||
|
# -P Passphrase for when AP is encrypted.
|
||||||
# -w Which radio to use i.e wiphy0 wiphy1 etc.
|
# -w Which radio to use i.e wiphy0 wiphy1 etc.
|
||||||
# -s SSID for stations.
|
# -s SSID for stations.
|
||||||
# -A Transmit rate for non station side (Endpoint A) of connection.
|
# -A Transmit rate for non station side (Endpoint A) of connection.
|
||||||
@@ -17,7 +18,7 @@
|
|||||||
# -h Help information.
|
# -h Help information.
|
||||||
|
|
||||||
# Example usage:
|
# Example usage:
|
||||||
# ./examples.bash -m lf0350-1234 -r 1 -n 40 -p 10000 -a eth1 -e open -w wiphy0 -s test-SSID -A 56000 -B 2000000
|
# ./lf_wifi_fire.bash -m lf0350-1234 -r 1 -w wiphy0 -n 40 -s test-SSID -e wpa2 -P hello123 -a eth1 -A 56000 -B 2000000 -p 10000
|
||||||
|
|
||||||
# Station will always be endpoint B so only the name for endpoint A port is needed.
|
# Station will always be endpoint B so only the name for endpoint A port is needed.
|
||||||
|
|
||||||
@@ -31,11 +32,17 @@ resource=1
|
|||||||
num_stas=40
|
num_stas=40
|
||||||
num_packets=Infinite
|
num_packets=Infinite
|
||||||
encryption=open
|
encryption=open
|
||||||
|
passphrase=''
|
||||||
rate_A=1000000
|
rate_A=1000000
|
||||||
rate_B=1000000
|
rate_B=1000000
|
||||||
|
|
||||||
|
|
||||||
|
#other variables
|
||||||
|
first_sta=100
|
||||||
flag_radio=false
|
flag_radio=false
|
||||||
flag_ssid=false
|
flag_ssid=false
|
||||||
flag_port=false
|
flag_port=false
|
||||||
|
|
||||||
show_help="This script is an attempt to simplify the creation of stations and connections for said stations.
|
show_help="This script is an attempt to simplify the creation of stations and connections for said stations.
|
||||||
One UDP connection will be created for each station.
|
One UDP connection will be created for each station.
|
||||||
The number of stations, station SSID, encryption type, number of packets to send, and transmit rates
|
The number of stations, station SSID, encryption type, number of packets to send, and transmit rates
|
||||||
@@ -45,7 +52,8 @@ Required values are SSID, radio, and endpoint A port.
|
|||||||
-r Resource IP or hostname.
|
-r Resource IP or hostname.
|
||||||
-n Number of stations to create.
|
-n Number of stations to create.
|
||||||
-p Number of packets to send.
|
-p Number of packets to send.
|
||||||
-e Encryption type.
|
-e Encryption type: open|wep|wpa|wpa2.
|
||||||
|
-P Passphrase for when AP is encrypted.
|
||||||
-w Which radio to use i.e wiphy0 wiphy1 etc.
|
-w Which radio to use i.e wiphy0 wiphy1 etc.
|
||||||
-s SSID for stations.
|
-s SSID for stations.
|
||||||
-A Transmit rate for non station side (Endpoint A) of connection.
|
-A Transmit rate for non station side (Endpoint A) of connection.
|
||||||
@@ -53,11 +61,11 @@ Required values are SSID, radio, and endpoint A port.
|
|||||||
-h Help information.
|
-h Help information.
|
||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
./examples.bash -m lf0350-1234 -r 1 -n 40 -p 10000 -a eth1 -e open -w wiphy0 -s test-SSID -A 56000 -B 2000000
|
./lf_wifi_fire.bash -m lf0350-1234 -r 1 -w wiphy0 -n 40 -s test-SSID -e wpa2 -P hello123 -a eth1 -A 56000 -B 2000000 -p 10000
|
||||||
|
|
||||||
Station will always be endpoint B so only the name for endpoint A port is needed."
|
Station will always be endpoint B so only the name for endpoint A port is needed."
|
||||||
|
|
||||||
while getopts 'm:r:n:p:a:e:w:s:A:B:h' OPTION; do
|
while getopts 'm:r:n:p:a:e:P:w:s:A:B:h' OPTION; do
|
||||||
case "$OPTION" in
|
case "$OPTION" in
|
||||||
m)
|
m)
|
||||||
#manager
|
#manager
|
||||||
@@ -84,6 +92,10 @@ while getopts 'm:r:n:p:a:e:w:s:A:B:h' OPTION; do
|
|||||||
#encryption
|
#encryption
|
||||||
encryption="$OPTARG"
|
encryption="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
P)
|
||||||
|
#encryption passphrase
|
||||||
|
passphrase="$OPTARG"
|
||||||
|
;;
|
||||||
w)
|
w)
|
||||||
#radio
|
#radio
|
||||||
flag_radio=true
|
flag_radio=true
|
||||||
@@ -120,8 +132,6 @@ fi
|
|||||||
|
|
||||||
. $HOME/lanforge.profile
|
. $HOME/lanforge.profile
|
||||||
|
|
||||||
first_sta=100
|
|
||||||
last_sta=$((first_sta + num_stas - 1))
|
|
||||||
|
|
||||||
./lf_associate_ap.pl --mgr $mgr --resource $resource --action del_all_phy --port_del $radio
|
./lf_associate_ap.pl --mgr $mgr --resource $resource --action del_all_phy --port_del $radio
|
||||||
|
|
||||||
@@ -131,18 +141,10 @@ last_sta=$((first_sta + num_stas - 1))
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
./lf_associate_ap.pl --mgr $mgr --resource $resource \
|
./lf_associate_ap.pl --mgr $mgr --resource $resource \
|
||||||
--ssid $ssid --security $encryption \
|
--ssid $ssid --security $encryption --passphrase $passphrase \
|
||||||
--num_stations $num_stas --first_sta sta100 \
|
--num_stations $num_stas --first_sta "sta$first_sta" \
|
||||||
--first_ip DHCP --radio $radio --action add
|
--first_ip DHCP --radio $radio --action add
|
||||||
|
|
||||||
function del_cx(){
|
|
||||||
local cx=$1
|
|
||||||
|
|
||||||
./lf_firemod.pl --mgr $mgr --resource $resource --action delete_cx --cx_name $cx
|
|
||||||
./lf_firemod.pl --mgr $mgr --resource $resource --action delete_endp --endp_name "$cx-A"
|
|
||||||
./lf_firemod.pl --mgr $mgr --resource $resource --action delete_endp --endp_name "$cx-B"
|
|
||||||
}
|
|
||||||
|
|
||||||
function new_cx(){
|
function new_cx(){
|
||||||
local cx=$1
|
local cx=$1
|
||||||
local portA=$2
|
local portA=$2
|
||||||
@@ -165,14 +167,21 @@ function new_cx(){
|
|||||||
--cmd "set_endp_details $cx-B NA NA NA $num_packets" &>/dev/null
|
--cmd "set_endp_details $cx-B NA NA NA $num_packets" &>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in `seq $first_sta $last_sta`; do
|
# Delete all connections and endpoints that have 'bg' in the name
|
||||||
del_cx bg$i
|
cx_array=( `./lf_firemod.pl --mgr $mgr --resource $resource --action list_cx | awk '/bg/ { print $ 2 }' | sed 's/,$//'` )
|
||||||
done
|
for i in "${cx_array[@]}"
|
||||||
|
do
|
||||||
|
:
|
||||||
|
./lf_firemod.pl --mgr $mgr --resource $resource --action delete_cx --cx_name $i
|
||||||
|
./lf_firemod.pl --mgr $mgr --resource $resource --action delete_endp --endp_name "$i-A"
|
||||||
|
./lf_firemod.pl --mgr $mgr --resource $resource --action delete_endp --endp_name "$i-B"
|
||||||
|
done
|
||||||
|
|
||||||
./lf_firemod.pl --mgr $mgr --resource $resource --quiet yes --action do_cmd --cmd 'nc_show_endpoints all' &>/dev/null
|
./lf_firemod.pl --mgr $mgr --resource $resource --quiet yes --action do_cmd --cmd 'nc_show_endpoints all' &>/dev/null
|
||||||
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
|
last_sta=$((first_sta + num_stas - 1))
|
||||||
for i in `seq $first_sta $last_sta`; do
|
for i in `seq $first_sta $last_sta`; do
|
||||||
new_cx bg$i $port_A sta$i
|
new_cx bg$i $port_A sta$i
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user