-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathsetup_env.bash
executable file
·261 lines (236 loc) · 10.9 KB
/
setup_env.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#!/bin/bash
# Setup python environment variable and pip environment variable like
# export PYTHON=/usr/bin/python3
# export PIP=/usr/bin/pip3
#sh setup_env.bash -t tip_2x -d all -n "Shivam Thakur" -o TIP -e [email protected] -i "TIP OpenWIFI 2.X Library"
set -e
helpFunction()
{
echo "Open Wifi CICD Test Automation Installation"
echo "Usage: $0 -t target -d device "
echo -e "\t-t Target SDK (AP and/or controller Library) eg. tip_2x"
echo -e "\t-n Author Name eg. Shivam Thakur"
echo -e "\t-o Organization eg. tip_2x"
echo -e "\t-e Author Email Address eg. tip_2x"
echo -e "\t-i Description Info eg. tip_2x"
echo -e "\t-d Test Device Name eg. lanforge | perfecto | all"
echo
echo -e "Required environment variables:"
echo -e "\tPYTHON - full path to Python3 executable (minimal version is 3.8). Example value - /usr/bin/python3"
echo -e "\tPIP - full path to PIP3 executable. Example value - /usr/bin/pip3"
exit 1 # Exit script after printing help
}
[[ -z ${PYTHON+x} ]] && echo "You must set the variable PYTHON in order to use this script." && echo && helpFunction && exit 1
[[ -z ${PIP+x} ]] && echo "You must set the variable PIP in order to use this script." && echo && helpFunction && exit 1
while getopts "t:n:o:e:i:d:" opt
do
case "$opt" in
t ) target="$OPTARG" ;;
n ) author="$OPTARG" ;;
o ) org="$OPTARG" ;;
e ) email="$OPTARG" ;;
i ) description="$OPTARG" ;;
d ) device="$OPTARG" ;;
? ) helpFunction ;; # Print helpFunction in case parameter is non-existent
esac
done
# Print helpFunction in case parameters are empty
if [ -z "$target" ] || [ -z "$author" ] || [ -z "$org" ] || [ -z "$email" ] || [ -z "$description" ] || [ -z "$device" ]
then
echo "Some or all of the parameters are empty";
helpFunction
fi
# Begin script in case all parameters are correct
echo "Target SDK for " "$target"
echo "$device"
# Check Python version and pip version
if ! hash $PYTHON; then
echo "python is not installed"
exit 1
fi
x=$($PYTHON -V)
echo $x
ver=$([[ "$x" =~ "Python 3" ]] && echo "38")
echo $ver
#ver=$($PYTHON -V 2>&1 | sed 's/.* \([0-9]\).\([0-9]\).*/\1\2/')
if [ "$ver" -lt "38" ]; then
echo "This script requires python 3.8 or greater"
exit 1
fi
if [ "$device" == "lanforge" ] || [ "$device" == "all" ]
then
if [ ! -d ../wlan-lanforge-scripts ]
then
cd ..
git clone https://github.com/Telecominfraproject/wlan-lanforge-scripts
cd wlan-lanforge-scripts
git checkout WIFI-1321-create-a-lan-forge-pip-module
cd ../wlan-testing/
fi
if [ -d ../wlan-lanforge-scripts ]
then
cd ../wlan-lanforge-scripts
if [ -d ../lanforge_scripts ]
then
$PIP uninstall ../lanforge_scripts/dist/*.whl
rm -rf ../lanforge_scripts
fi
bash to_pip.sh
$PIP install ../lanforge_scripts/dist/*.whl #--force-reinstall
echo "Installed LANforge PIP Module"
cd ../wlan-testing/
mkdir -p ~/.pip
echo "[global]" > ~/.pip/pip.conf
echo "index-url = https://pypi.org/simple" >> ~/.pip/pip.conf
echo "extra-index-url = https://tip-read:[email protected]/artifactory/api/pypi/tip-wlan-python-pypi-local/simple" >> ~/.pip/pip.conf
$PIP install -r requirements.txt
rm -f tests/imports.py
touch tests/imports.py
if [ $target == "tip_2x" ]
then
cd libs/tip_2x
$PYTHON setup.py bdist_wheel
$PIP install dist/*.whl --force-reinstall
cd ../../
fi
x=$(whoami)
echo -e "\"\"\"\nRegistered Target Imports\n\"\"\"\nimport sys\nimport importlib\n\nsys.path.append('/usr/local/bin')\n\nsys.path.append('/home/$x/.local//bin/')\n\nsys.path.append('/home/$x/.local/lib/python3.8/site-packages/')\n\n" >> tests/imports.py
echo -e "########################################################################################################################" >> tests/imports.py
echo -e "\"\"\"
Target Name:$target
Author Name:$author
Organization:$org
Register ID:1
Email:$email
description:$description
\"\"\"" >> tests/imports.py
echo -e "
try:
target = importlib.import_module(\"tip_2x\")
target = target.tip_2x
except ImportError as e:
print(e)
sys.exit(\"Python Import Error: \" + str(e))
" >> tests/imports.py
echo -e "########################################################################################################################" >> tests/imports.py
echo -e "########################################################################################################################" >> tests/imports.py
echo -e "\"\"\"
Target Name:lanforge_scripts
Author Name:$author
Organization:$org
Register ID:2
Email:$email
description:Candela LANforge Based Library
\"\"\"" >> tests/imports.py
echo -e "
try:
lanforge_libs = importlib.import_module(\"lanforge_scripts.lf_libs.lf_libs\")
lf_libs = lanforge_libs.lf_libs
scp_file = lanforge_libs.SCP_File
lanforge_tests = importlib.import_module(\"lanforge_scripts.lf_libs.lf_tests\")
lf_tests = lanforge_tests.lf_tests
except ImportError as e:
print(e)
sys.exit(\"Python Import Error: \" + str(e))
" >> tests/imports.py
echo -e "########################################################################################################################" >> tests/imports.py
cd libs/perfecto_interop
$PYTHON setup.py bdist_wheel
$PIP install dist/*.whl --force-reinstall
cd ../../
echo -e "########################################################################################################################" >> tests/imports.py
echo -e "\"\"\"
Target Name:perfecto_interop
Author Name:$author
Organization:$org
Register ID:2
Email:$email
description:Perfecto Based Interop Library
\"\"\"" >> tests/imports.py
echo -e "
try:
perfecto_interop = importlib.import_module(\"perfecto_interop\")
android_tests = perfecto_interop.android_tests
ios_tests = perfecto_interop.ios_tests
except ImportError as e:
print(e)
sys.exit(\"Python Import Error: \" + str(e))
" >> tests/imports.py
echo -e "########################################################################################################################" >> tests/imports.py
fi
fi
WLAN_TESTING_PATH=$(pwd)"/tests/"
echo $WLAN_TESTING_PATH
rm -f tests/pytest.ini
touch tests/pytest.ini
echo -e "[pytest]
python_files = test_*.py setup_*.py
norecursedirs = .svn _build tmp*
addopts= --junitxml=test_everything.xml
log_format = %(asctime)s %(levelname)s %(message)s
log_date_format = %Y-%m-%d %H:%M:%S
;norecursedirs=out build
num_stations=1
testpaths =
$WLAN_TESTING_PATH
# Cloud SDK settings
sdk-customer-id=2
#fIRMWARE Option
firmware=0
# Radius Settings
radius_server_ip=192.168.200.75
radius_port=1812
radius_secret=testing123
# Testrail Info
tr_url=https://telecominfraproject.testrail.com
tr_pass=Open$Wifi123
tr_project_id=WLAN
tr_prefix=TIP_
milestone=29
filterwarnings=ignore::UserWarning
markers =
; Test Suites, It Contains
ow_sanity_lf: OpenWifi Sanity Test Plan
ow_performance_lf: OpenWifi Performance Test Plan
ow_sanity_interop: OpenWifi Sanity with Interop
; Test Suites, It Contains
client_connect_tests: Client Connect Test Cases with bridge|nat|vlan modes across 2.4|5|6 GHz bands with Various Encryptions
client_connectivity_tests: Client Connectivity Test Cases with bridge|nat|vlan modes across 2.4|5|6 GHz bands with Various Encryptions
dfs_tests: Dynamic Frequency Selection Test Cases
multi_psk_tests: Multi PSK Test Cases
rate_limiting_tests: Rate Limiting Test Cases
dvlan_tests: Dynamic VLAN Test Cases
dynamic_qos_tests: Dynamic QOS Test Cases
multi_vlan_tests: Multi VLAN Combination based Test Cases
client_scale_tests: Client Capacity Tests with maximum possible Stations bridge|nat|vlan 2.4|5|6 GHz Bands
peak_throughput_tests: Single Client Peak Performance Test with various Bandwidths across 2.4|5|6 GHz Bands with various Client Types
dataplane_tests: Single Client Throughput Test with various pkt sizes with UL|DL|BI with AC|AX Client Types across 2.4|5|6 GHz Bands
multi_band_tests: Multi Band Performance Test on bridge|nat|vlan mode with Single Client on each of the 2.4|5|6 GHz Bands
rate_vs_range_tests: Rate verses Range Tests with Various Combinations bridge|nat|vlan 2.4|5|6 GHz Bands
rate_vs_orientation_tests: Rate verses Orientation Tests with Various Combinations bridge|nat|vlan 2.4|5|6 GHz Bands
rx_sensitivity_tests: Receiver Sensitivity Tests with Various Combinations bridge|nat|vlan 2.4|5|6 GHz Bands
spatial_consistency_tests: Spatial Consistency Tests with Various Combinations bridge|nat|vlan 2.4|5|6 GHz Bands
multi_assoc_disassoc_tests: Multi Association and Disassociation Tests with Various Combinations bridge|nat|vlan 2.4|5|6 GHz Bands
multi_station_performance_tests: Multi Station Performance Tests with Various Combinations bridge|nat|vlan 2.4|5|6 GHz Bands
mu_mimo_performance_tests: Multi User MIMO Tests with Various Combinations bridge|nat|vlan 2.4|5|6 GHz Bands
ofdma_tests: OFDMA Tests with Various Combinations bridge|nat|vlan 2.4|5|6 GHz Bands
; Supported Markers
bridge: Use this marker to run bridge mode tests in each of the above test plans/suites
nat: Use this marker to run nat mode tests in each of the above test plans/suites
vlan: Use this marker to run vlan mode tests in each of the above test plans/suites
twog: Use this marker to run 2.4 GHz tests in each of the above test plans/suites
fiveg: Use this marker to run 5 GHz tests in each of the above test plans/suites
sixg: Use this marker to run 6 GHz tests in each of the above test plans/suites
open: Use this marker to run open Encryption tests in each of the above test plans/suites
wpa: Use this marker to run wpa Encryption tests in each of the above test plans/suites
wpa2_personal: Use this marker to run wpa2_personal Encryption tests in each of the above test plans/suites
wpa3_personal: Use this marker to run wpa3_personal Encryption tests in each of the above test plans/suites
wpa3_personal_mixed: Use this marker to run wpa3_personal_mixed Encryption tests in each of the above test plans/suites
wpa_wpa2_personal_mixed: Use this marker to run wpa_wpa2_personal_mixed Encryption tests in each of the above test plans/suites
wpa_enterprise: Use this marker to run wpa_enterprise Encryption tests in each of the above test plans/suites
wpa2_enterprise: Use this marker to run wpa2_enterprise Encryption tests in each of the above test plans/suites
wpa3_enterprise: Use this marker to run wpa3_enterprise Encryption tests in each of the above test plans/suites
wpa_wpa2_enterprise_mixed: Use this marker to run wpa_wpa2_enterprise_mixed Encryption tests in each of the above test plans/suites
wpa3_enterprise_mixed: Use this marker to run wpa3_enterprise_mixed Encryption tests in each of the above test plans/suites
" >> tests/pytest.ini