forked from greearb/lanforge-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlf_snp_test.py
More file actions
executable file
·2925 lines (2615 loc) · 170 KB
/
lf_snp_test.py
File metadata and controls
executable file
·2925 lines (2615 loc) · 170 KB
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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
"""
NAME: lf_snp_test.py snp == Scaling and Performance
PURPOSE:
This program is to test an AP connected to a controller.
The AP name is configurable.
The controler with with a specific ap mode, wifi mode (2.4 Ghz or 5 Ghz),
Bandwidth (20,40,80,160) and TX power.
This currently only works with certain models of Cisco controllers.
The controller will configure the AP.
The Lanforge radios are configured for a specific client density, Packet type (TCP, UDP), Direction (download, upload) and Packet-size.
The transmission rate will be recorded and compared against the expected rate to determine pass or fail.
The results will be recorded in CSV file with the following data
AP, Band, wifi_mode, Bandwidth, encryption, ap mode, number of clients, packet type, direction, packet size, measured rx bytes, upload bits per second,
download bits per second.
unique test id, pass / fail, epoch time, and time.
TECHNICAL UNDERSTANDING:
LANForge Monitored Values Per Polling Interval
'rx bytes' - bytes transmitted
'rx rate' - bits per second
in DL direction: -B tx -> -A rx, (side_b_tx_min_bps) LANforge Eth endpoint transmits bytes (AP/DUT),
station endpoint (Wifi) LANForge receives them. station-end-rx-bps (bits per second) is download rx-bps (bits per second)
in UL direction: -A tx -> -B rx, (side_a_tx_min_bps) LANforge Eth endpoint receives bytes (AP/DUT),
station endpoint (Wifi) LANForge transmits them. ethernet-end-rx-bps (bits per second) is upload load rx-bps (bits per second)
configured bps (side_a_tx_min_bps and side_b_tx_min_bps) if lists not same lenght shorter list padded out with 256000 if upload and download selected.
NOTES:
1. The controller_client_densities are indpendent of the number of stations on a radio
2. The --side_a_tx_min_bps (download) and --side_b_tx_min_bps (upload) is used to set the rate
a. default 256000
The script is devided into parts:
1. Controller Class : CreateCtlr controller interface.
Configurable by script:
a. Band : a (5ghz) b (2.4ghz)
b. wifi_mode : supported modes based on radio
c. chan_5ghz and chan_24ghz
d. BW: Band width 20 40 80 160, 160 only supports (2x2) spatial streams
d. encryption : enable / disable, * encryption not supported
e. ap_mode : local / flex connect, * ap mode not supported
f. clients : number of clients set by controller_client_densities , radios much create associated number of stations Note: LANforge configuration
g. packet_type: lf_udp lf_tcp
h. traffic direction: upload / download
i. pdu: --side_a_min_pdu, --side_b_min_pdu Note: LANforge configuration
2. Traffic Generation Class : L3VariableTime
a. Creates and brings up stations/clients on radios
b. Measures connections
c. reports results
3. Scaling And Performance Main
a. Command parcing
b. Fixed Configuration Coded Into The Script
c. Script Controller Configurations
d. Script LANforge Configurations
e. Parameters Used For Testing
f. report generation
OUTPUT:
In /home/lanforge/report-data/<date>_Scaling_and_Performance or if not present in script directory under <date>_Scaling_and_Performance
html results , default .html
pdf results , default .pdf
csv results_snp_<date>.csv , results reflected in html and pdf files
csv details_snp_<date>.csv raw data
* radios and con
EXAMPLE:
Use --print_test_config at end of command to see test configuration
Test configurations take presidence to command line parameters
Using Coded Test Configuration --controller_test_1
./lf_snp_test.py --controller_ip 10.195.197.234 --controller_user admin --controller_passwd Milpitas@123
--controller_aps 'Vanc-e' --controller_series "9800" --endp_types 'lf_udp' --upstream_port eth2 --controller_prompt "Can-SnP-9120" --controller_test_1
--print_test_config
Using Coded Test Configuration --controller_test_1
./lf_snp_test.py --controller_ip 10.195.197.234 --controller_user admin --controller_passwd Milpitas@123
--controller_aps 'Vanc-e' --controller_series "9800" --endp_types 'lf_udp' --upstream_port eth2 --controller_prompt "Can-SnP-9120" --controller_test_1
--print_test_config
Using Coded Test Configuration:
./lf_snp_test.py -cc 192.168.100.112 -cu admin -cpw Cisco123 -cca APA453.0E7B.CF9C -cs "3504" --endp_types 'lf_udp' --upstream_port eth2 --controller_test_3
--controller_prompt "(Cisco Controller)"
--print_test_config
Using Commandline with defaults:
./lf_snp_test.py --controller_ip 192.168.100.112 --controller_user admin --controller_passwd Cisco123 --controller_aps APA453.0E7B.CF9C --controller_series "3504"
--controller_prompt "(Cisco Controller)" --radio "radio==1.wiphy0 stations==1 ssid==test_candela ssid_pw==[BLANK] security==open wifimode==auto"
--print_test_config
Using Commandline:
./lf_snp_test.py --controller_ip 192.168.100.112 --controller_user admin --controller_passwd Cisco123 --controller_aps APA453.0E7B.CF9C
--controller_series "3504" --upstream_port eth2 --controller_prompt "(Cisco Controller)" --controller_wifimode "a" --controller_chan_5ghz "36"
--radio "radio==1.wiphy0 stations==10 ssid==test_candela ssid_pw==[BLANK] security==open wifimode==ac" --controller_client_densities "10"
--print_test_config
Using Commandline: Setting --test_duration "20s" --polling_interval to 5s -ccd "2" (--controller_client_densities)
./lf_snp_test.py --controller_ip 192.168.100.112 --controller_user admin --controller_passwd Cisco123 --controller_aps APA453.0E7B.CF9C
--controller_series "3504" --upstream_port eth2 --controller_prompt "(Cisco Controller)" --controller_wifimode "auto" --controller_chan_5ghz "36"
--radio "radio==1.wiphy0 stations==2 ssid==test_candela ssid_pw==[BLANK] security==open wifimode==an" --controller_client_densities "2"
--print_test_config
SAMPLE TEST CONFIG: --controller_test_1 output from --print_test_config option
2021-04-21 05:43:25,040 __main__ INFO: USING: controller_test_1
2021-04-21 05:43:25,040 __main__ INFO: TEST CONFIG:
2021-04-21 05:43:25,040 __main__ INFO: controller_aps ('-cca' ,'--controller_aps'): ['vanc-e']
2021-04-21 05:43:25,040 __main__ INFO: controller_bands ('-ccf' ,'--controller_bands'): ['a', 'b']
2021-04-21 05:43:25,040 __main__ INFO: controller_wifimodes ('-cwm' ,'--controller_wifimodes'): ['an', 'anAX', 'anAC', 'abgn', 'bg']
2021-04-21 05:43:25,040 __main__ INFO: controller_chan_5ghzs ('-cc5','--controller_chan_5ghzs'): ['36']
2021-04-21 05:43:25,040 __main__ INFO: controller_chan_24ghzs ('-cc2','--controller_chan_24ghzs'): ['1']
2021-04-21 05:43:25,040 __main__ INFO: controller_chan_widths ('-ccw','--controller_chan_widths'): ['20', '40', '80']
2021-04-21 05:43:25,040 __main__ INFO: controller_tx_powers ('-ctp','--controller_tx_powers'): ['3']
2021-04-21 05:43:25,041 __main__ INFO: controller_ap_modes ('-cam','--controller_ap_modes'): ['local']
2021-04-21 05:43:25,041 __main__ INFO: controller_client_densities ('-ccd','--controller_client_densities'): ['1', '10', '50', '200']
2021-04-21 05:43:25,041 __main__ INFO: controller_packet_types ('-t', '--endp_types'): ['lf_udp', 'lf_tcp']
2021-04-21 05:43:25,041 __main__ INFO: controller_pdus ('-cps','--controller_pdus'): ['88', '512', '1370', '1518']
2021-04-21 05:43:25,041 __main__ INFO: controller_directions ('-cd', '--controller_directions'): ['upload', 'download']
2021-04-21 05:43:25,041 __main__ INFO: controller_data_encryptions ('-cde','--controller_data_encryptions') ['disable']
2021-04-21 05:43:25,041 __main__ INFO: controller_side_a_tx_min_bps ('-amr','--side_a_tx_min_bps'): 256000
2021-04-21 05:43:25,041 __main__ INFO: controller_side_b_tx_min_bps ('-bmr','--side_b_tx_min_bps'): 256000
2021-04-21 05:43:25,041 __main__ INFO: test duration ('-d','--test_duration'): 20s
2021-04-21 05:43:25,041 __main__ INFO: polling_interval ('-pi','--polling_interval'): 5s
2021-04-21 05:43:25,041 __main__ INFO: radios from coded config used
INCLUDE_IN_README
COPYRIGHT:
Copyright 2021 Candela Technologies Inc
License: Free to distribute and modify. LANforge systems must be licensed.
"""
import sys
import os
import importlib
import itertools
from pprint import pprint
import argparse
import time
import datetime
import subprocess
import csv
import random
import logging
import traceback
if sys.version_info[0] != 3:
print("This script requires Python 3")
exit(1)
from lf_report import lf_report
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
LFUtils = importlib.import_module("py-json.LANforge.LFUtils")
realm = importlib.import_module("py-json.realm")
Realm = realm.Realm
# lf_graph = importlib.import_module("py-scripts.lf_graph")
# lf_bar_graph = lf_graph.lf_bar_graph
FORMAT = '%(asctime)s %(name)s %(levelname)s: %(message)s'
# see https://stackoverflow.com/a/13306095/11014343
class FileAdapter(object):
def __init__(self, logger):
self.logger = logger
def write(self, data):
# NOTE: data can be a partial line, multiple lines
data = data.strip() # ignore leading/trailing whitespace
if data: # non-blank
self.logger.info(data)
def flush(self):
pass # leave it to logging to flush properly
################################################################################
#
# Controller Class : CreateCtlr controller interface
#
################################################################################
class CreateCtlr:
def __init__(self,
_scheme,
_port,
_series,
_ctlr,
_prompt,
_user,
_passwd,
_ap,
_band,
_chan_5ghz,
_chan_24ghz,
_chan_width,
_ap_mode,
_tx_power,
_wlan,
_cap_ctl_out):
self.scheme = _scheme
self.port = _port
self.series = _series
self.ctlr = _ctlr
self.prompt = _prompt
self.user = _user
self.passwd = _passwd
self.ap = _ap
self.band = _band
self.chan_5ghz = _chan_5ghz
self.chan_24ghz = _chan_24ghz
self.chan_width = _chan_width
self.ap_mode = _ap_mode
self.tx_power = _tx_power
self.wlan = _wlan
self.cap_ctl_out = _cap_ctl_out
self.client_density = 0
# show summary (to get AP) (3400/9800)
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 --action summary --series 9800 --log stdout
def controller_show_summary(self):
pss = ""
try:
logg.info("\
scheme: {} \
ctlr: {} \
port: {} \
prompt: {} \
user: {} \
passwd: {} \
AP: {} \
series: {} \
band: {} \
action: {}".format(
self.scheme,
self.ctlr,
self.port,
self.prompt,
self.user,
self.passwd,
self.ap,
self.series,
self.band,
"summary"))
ctl_output = subprocess.run(["../wifi_ctl_9800_3504.py",
"--scheme", self.scheme,
"--prompt", self.prompt,
"--port", self.port,
"-d", self.ctlr,
"-u", self.user,
"-p", self.passwd,
"-a", self.ap,
"--series", self.series,
"--band", self.band,
"--action", "summary"],
capture_output=self.cap_ctl_out,
check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
return pss
# show ap dot11 5ghz summary (band defaults to 5ghz) --band a
# show ap dot11 24ghz summary use --band b for 2.4 ghz
# action advanced (3400/9800)
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 --action advanced --series 9800 --log stdout
def controller_show_ap_summary(self):
pss = ""
try:
logg.info("\
scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user,
self.passwd, self.ap, self.series, self.band, "advanced"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--action", "advanced"],
capture_output=True, check=True)
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
return pss
# show wlan summary
def controller_show_wlan_summary(self):
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user,
self.passwd, self.ap, self.series, self.band, "show wlan summary"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--action", "show_wlan_summary"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# disable AP
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action disable --series 9800
def controller_disable_ap(self):
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user,
self.passwd, self.ap, self.series, self.band, "disable"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d",
self.ctlr, "-u", self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--action", "disable"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# disable wlan
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action disable_wlan --series 9800
def controller_disable_wlan(self):
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} wlan: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user,
self.passwd, self.ap, self.series, self.band, self.wlan, "disable_wlan"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--wlan", self.wlan, "--action",
"disable_wlan"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# disable network 5ghz
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action disable_network_5ghz --series 9800
def controller_disable_network_5ghz(self):
if self.series == "9800":
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user,
self.passwd, self.ap, self.series, self.band, "disable_network_5ghz"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--action", "disable_network_5ghz"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
else:
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {} value: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "cmd", "config 802.11a disable network"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--action", "cmd", "--value",
"config 802.11a disable network"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# disable network 24ghz
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action disable_network_24ghz --series 9800
def controller_disable_network_24ghz(self):
if self.series == "9800":
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user,
self.passwd, self.ap, self.series, self.band, "disable_network_24ghz"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--action", "disable_network_24ghz"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
else:
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {} value: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "cmd", "config 802.11b disable network"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--action", "cmd", "--value",
"config 802.11b disable network"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# set manual mode - Series 9800 must be set to manual mode
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action manual --series 9800
# ap name <AP NAME> dot11 5ghz radio role manual client-serving
def controller_role_manual(self):
if self.series == "9800":
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user,
self.passwd, self.ap, self.series, self.band, "manual"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--action", "manual"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
else:
logg.info(
"Check the controller scheme used attemping 9800 series on 3504 controller: {}".format(self.scheme))
# set manual mode - Series 9800 must be set to auto mode
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action auto --series 9800
# ap name <AP NAME> dot11 5ghz radio role manual client-serving
def controller_role_auto(self):
if self.series == "9800":
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user,
self.passwd, self.ap, self.series, self.band, "auto"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--action", "auto"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
else:
logg.info(
"Check the controller scheme used attemping 9800 series on 3504 controller: {}".format(self.scheme))
# test parameters summary (txPower 1-8)
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action txPower --value 5 --series 9800
def controller_set_tx_power(self):
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {} value {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "txPower", self.tx_power)) # TODO fix txPower to tx_power in wifi_ctl_9800_3504.py
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band,
"--action", "txPower", "--value", self.tx_power],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# set channel [36, 64, 100]
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action channel --value 36 --series 9800
# 9800 : ap name <AP> dot11 [5ghz | 24ghz] channel <channel>
# 3504 : (controller Controller) >config 802.11a channel ap APA453.0E7B.CF9C 52
def controller_set_channel(self):
try:
if self.band == "a":
controller_channel = self.chan_5ghz
else:
controller_channel = self.chan_24ghz
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {} value {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "channel", controller_channel))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band,
"--action", "channel", "--value", controller_channel],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# set bandwidth [20 40 80 160]
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action bandwidth --value 40 --series 9800
def controller_set_bandwidth(self):
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {} value {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "channel", self.chan_width))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band,
"--action", "channel", "--value", self.chan_width],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# create wlan
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action create_wlan --wlan "open-wlan" --wlanID 1 --series 9800
def controller_create_wlan(self):
if self.series == "9800":
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {} wlan {} wlanID {} wlanSSID {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "create_wlan", self.wlan, self.wlanID, self.wlanSSID))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band,
"--action", "create_wlan", "--wlan", self.wlan, "--wlanID", self.wlanID, "--wlanSSID",
self.wlanSSID],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
else:
logg.info(
"Check the controller_scheme used attemping 9800 series on 3504 controller: {}".format(self.scheme))
# create wireless tag policy --9800 series needs to have wireless tag policy set
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action wireless_tag_policy --series 9800
def controller_set_wireless_tag_policy(self):
if self.series == "9800":
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "wireless_tag_policy"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band,
"--action", "wireless_tag_policy"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
else:
logg.info(
"Check the controller_scheme used attemping 9800 series on 3504 controller: {}".format(self.scheme))
# enable wlan
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action enable_wlan --series 9800
def controller_enable_wlan(self):
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} wlan: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, self.wlan, "enable_wlan"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--wlan", self.wlan,
"--action", "enable_wlan"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# enable 5ghz
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action enable_network_5ghz --series 9800
def controller_enable_network_5ghz(self):
if self.series == "9800":
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "enable_network_5ghz"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band,
"--action", "enable_network_5ghz"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
else:
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {} value: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "cmd", "config 802.11a enable network"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--action", "cmd", "--value",
"config 802.11a enable network"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# enable 24ghz
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action enable_network_24ghz --series 9800
def controller_enable_network_24ghz(self):
if self.series == "9800":
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "enable_network_24ghz"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band,
"--action", "enable_network_24ghz"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
else:
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {} value: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "cmd", "config 802.11b enable network"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band, "--action", "cmd", "--value",
"config 802.11b enable network"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# enable (band a)
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action enable --series 9800
def controller_enable_ap(self):
try:
logg.info(
"scheme: {} ctlr: {} port: {} prompt: {} user: {} passwd: {} AP: {} series: {} band: {} action: {}".format(
self.scheme,
self.ctlr, self.port, self.prompt, self.user, self.passwd, self.ap, self.series,
self.band, "enable"))
ctl_output = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port,
"-d", self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--band", self.band,
"--action", "enable"],
capture_output=self.cap_ctl_out, check=True)
if self.cap_ctl_out:
pss = ctl_output.stdout.decode('utf-8', 'ignore')
logg.info(pss)
except subprocess.CalledProcessError as process_error:
logg.info(
"Command Error, Controller unable to communicate to AP or unable to communicate to controller error code: {} output {}".format(
process_error.returncode, process_error.output))
time.sleep(1)
exit(1)
# advanced (showes summary)
# ./wifi_ctl_9800_3504.py --scheme ssh -d 172.19.36.168 -p <controller_pw> --port 23 -a "9120-Chamber-1" --band a --action advanced --series 9800
def controller_show_ap_channel(self):
advanced = subprocess.run(
["../wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--prompt", self.prompt, "--port", self.port, "-d",
self.ctlr, "-u",
self.user, "-p", self.passwd,
"-a", self.ap, "--series", self.series, "--action", "ap_channel"], capture_output=True)
pss = advanced.stdout.decode('utf-8', 'ignore')
logg.info(pss)
if self.series == "9800":
if self.band == "a":
controller_channel = self.chan_5ghz
else:
controller_channel = self.chan_24ghz
for line in pss.splitlines():
search_str = self.ap
logg.info("line {}".format(line))
element_list = line.lstrip().split()
logg.info("element_list {}".format(element_list))
if line.lstrip().startswith(search_str):
logg.info("line {}".format(line))
element_list = line.lstrip().split()
logg.info("element_list {}".format(element_list))
# AP Name (0) mac (1) slot (2) Admin State [enable/disable] (3) Oper State [Up/Down] (4) Width (5) Txpwr (6,7) channel (8) mode (9)
logg.info("ap: {} slof {} channel {} chan_width {}".format(element_list[0], element_list[2],
element_list[8], element_list[5]))
if (str(controller_channel) in str(element_list[8])) and (
str(self.chan_width) in str(element_list[5])):
logg.info(
"ap {} configuration successful: channel {} in expected {} chan_width {} in expected {}".format(
element_list[0],
controller_channel,
element_list[8],
self.chan_width,
element_list[5]))
else:
logg.info("WARNING ap {} configuration: channel {} in expected {} chan_width {} in expected {}"
.format(element_list[0], controller_channel, element_list[8], self.chan_width,
element_list[5]))
break
else:
logg.info("checking for 802.11{}".format(self.band))
if self.band == "a":
controller_channel = self.chan_5ghz
else:
controller_channel = self.chan_24ghz
for line in pss.splitlines():
# logg.info("line {}".format(line))
search_str = "802.11{}".format(self.band)
if line.lstrip().startswith(search_str):
logg.info("line {}".format(line))
element_list = line.lstrip().split()
logg.info("element_list {}".format(element_list))
logg.info("ap: {} channel {} chan_width {}".format(self.ap, element_list[4], element_list[5]))
if (str(controller_channel) in str(element_list[4])) and (
str(self.chan_width) in str(element_list[5])):
logg.info("ap configuration successful: channel {} in expected {} chan_width {} in expected {}"
.format(controller_channel, element_list[4], self.chan_width, element_list[5]))
else:
logg.info("AP WARNING: channel {} expected {} chan_width {} expected {}"
.format(element_list[4], controller_channel, element_list[5], self.chan_width))
break
logg.info("configure ap {} channel {} chan_width {}".format(self.ap, self.channel, self.chan_width))
# Verify channel and channel width.
################################################################################
#
# End of Controller Class : controller interface
#
################################################################################
################################################################################
#
# Traffic Generation Class : L3VariableTime
#
################################################################################
class L3VariableTime(Realm):
def __init__(self,
args,
_scheme,
_port,
_series,
_ctlr,
_prompt,
_user,
_passwd,
_ap,
_ap_slot,
_band,
_chan_5ghz,
_chan_24ghz,
_chan_width,
_ap_mode,
_tx_power,
_client_density,