-
Notifications
You must be signed in to change notification settings - Fork 3
/
cc_module_9800_3504.py
1300 lines (1120 loc) · 50.3 KB
/
cc_module_9800_3504.py
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: cc_module_9800_3504.py
CLASSIFICATION: module
PURPOSE:
controller module for communicating to a cisco 9800 or 3504 controller
This module can be dynamically imported
SETUP:
None
EXAMPLE:
There is a unit test included to try sample command scenarios
./cc_module_9800_3504.py --scheme ssh --dest localhost --port 8887 --user admin --passwd Cisco123 --ap APA453.0E7B.CF9C --series 9800 --prompt "WLC1" --timeout 10 --band '5g'
./cc_module_9800_3504.py --scheme ssh --dest localhost --port 8887 --user admin --passwd Cisco123 --ap APA453.0E7B.CF9C --series 9800 --prompt "WLC1" --timeout 10 --band '24g'
./cc_module_9800_3504.py --scheme ssh --dest localhost --port 8887 --user admin --passwd Cisco123 --ap APCC9C.3EF1.1140 --series 9800 --prompt "WLC1" --timeout 10 --band '5g'
SUPPORT HISTORY:
2/25/2022 - adding 6E support
formula:
5GHz channel = (freq_mhz - 5180) / 5 + 36
6GHz channel = (freq_mhz - 5955) / 5 + 1
COPYRIGHT:
Copyright 2021 Candela Technologies Inc
License: Free to distribute and modify. LANforge systems must be licensed.
INCLUDE_IN_README
"""
import sys
if sys.version_info[0] != 3:
print("This script requires Python 3")
exit()
import argparse
import logging
import importlib
import os
import subprocess
from pprint import pformat
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../")))
logger = logging.getLogger(__name__)
lf_logger_config = importlib.import_module("py-scripts.lf_logger_config")
class create_controller_series_object:
def __init__(self,
scheme=None,
dest=None,
user=None,
passwd=None,
prompt=None,
series=None,
band=None,
ap=None,
ap_band_slot_24g=None,
ap_band_slot_5g=None,
ap_band_slot_6g=None,
ap_dual_band_slot_5g=None,
ap_dual_band_slot_6g=None,
port=None,
timeout=None,
pwd=None
):
if scheme is None:
raise ValueError('Controller scheme must be set: serial, ssh or telnet')
else:
self.scheme = scheme
if dest is None:
raise ValueError('Controller dest must be set: and IP or localhost')
else:
self.dest = dest
if user is None:
raise ValueError('Controller user must be set')
else:
self.user = user
if passwd is None:
raise ValueError('Controller passwd must be set')
else:
self.passwd = passwd
if prompt is None:
raise ValueError('Controller prompt must be set: WLC1')
else:
self.prompt = prompt
if series is None:
raise ValueError('Controller series must be set: 9800 or 3504')
else:
self.series = series
if ap is None:
raise ValueError('Controller AP must be set')
else:
self.ap = ap
# for backward compatiblity if the ap_band_clot is not passed in set to common defaults
# Also some APs do not support all bands
# TODO put in a check if the slots are not found.
if ap_band_slot_24g is None:
logger.warning("ap_band_slot_24g not configured using value of '0'")
self.ap_band_slot_24g = '0'
else:
self.ap_band_slot_24g = ap_band_slot_24g
if ap_band_slot_5g is None:
logger.warning("ap_band_slot_5g not configured using value of '1'")
self.ap_band_slot_5g = '1'
else:
self.ap_band_slot_5g = ap_band_slot_5g
if ap_band_slot_6g is None:
logger.warning("ap_band_slot_6g not configured using value of '2'")
self.ap_band_slot_6g = '2'
else:
self.ap_band_slot_6g = ap_band_slot_6g
if ap_dual_band_slot_5g is None:
logger.warning("ap_dual_band_slot_5g not configured using value of '2'")
self.ap_dual_band_slot_5g = '2'
else:
self.ap_dual_band_slot_5g = ap_dual_band_slot_5g
if ap_dual_band_slot_6g is None:
logger.warning("ap_dual_band_slot_6g not configured using value of '2'")
self.ap_dual_band_slot_6g = '2'
else:
self.ap_dual_band_slot_6g = ap_dual_band_slot_6g
if band is None:
raise ValueError('Controller band must be set')
else:
self.band = band
if port is None:
raise ValueError('Controller port must be set')
else:
self.port = port
if timeout is None:
logger.info("timeout not set default to 3 sec")
self.timeout = '3'
else:
self.timeout = timeout
self.bandwidth = None
self.wlan = None
self.wlanID = None
self.wlanSSID = None
self.security_key = None
self.wlanpw = None
self.tag_policy = None
self.policy_profile = None
self.ap_band_slot = None
self.tx_power = None
self.channel = None
self.bandwidth = None
self.action = None
self.value = None
self.command = []
self.command_extend = []
self.info = "Cisco 9800 Controller Series"
self.pwd = pwd
self.dtim = None
self.spatial_stream = None # default cannot be NONE for send command
self.mcs_tx_index = None # default cannot be NONE for send command
# TODO update the wifi_ctl_9800_3504 to use 24g, 5g, 6g
def convert_band(self):
if self.band == '24g':
self.band = '24g'
elif self.band == '5g':
self.band = '5g'
elif self.band == '6g':
self.band = '6g'
elif self.band == 'dual_band_5g':
self.band = 'dual_band_5g'
elif self.band == 'dual_band_6g':
self.band = 'dual_band_6g'
else:
logger.critical("band needs to be set 24g 5g 6g dual_band_5g, dual_band_6g")
raise ValueError("band needs to be set 24g 5g 6g dual_band_5g or dual_band_6g")
# TODO need to configure the slot
def set_ap_band_slot(self):
if self.band == '24g':
self.ap_band_slot = self.ap_band_slot_24g
elif self.band == '5g':
self.ap_band_slot = self.ap_band_slot_5g
# TODO need to support configuration
elif self.band == '6g':
self.ap_band_slot = self.ap_band_slot_6g
elif self.band == 'dual_band_5g':
self.ap_band_slot = self.ap_dual_band_slot_5g
elif self.band == 'dual_band_6g':
self.ap_band_slot = self.ap_dual_band_slot_6g
# if self.ap_band_slot is None:
# logger.critical("ap_band_slot_6g needs to be set to 2 or 3")
# raise ValueError("ap_band_slot_6g needs to be set to 2 or 3")
#
# TODO consolidate the command formats
def send_command(self):
# self.convert_band()
self.set_ap_band_slot()
logger.info("action {action}".format(action=self.action))
# set the ap_band_slot 24g = ap_band_slot 0 , 5g ap_band_slot = 1 / 2, 6g - ap_band_slot 2 / 3 so needs to be passed in
# Command base
if self.pwd is None:
self.command = ["./wifi_ctl_9800_3504.py", "--scheme", self.scheme, "--dest", self.dest,
"--user", self.user, "--passwd", self.passwd, "--prompt", self.prompt,
"--series", self.series, "--ap", self.ap, "--ap_band_slot", self.ap_band_slot, "--band", self.band, "--port", self.port,
"--timeout", self.timeout,
]
else:
self.command = [str(str(self.pwd) + "/wifi_ctl_9800_3504.py"), "--scheme", self.scheme, "--dest", self.dest,
"--user", self.user, "--passwd", self.passwd, "--prompt", self.prompt,
"--series", self.series, "--ap", self.ap, "--ap_band_slot", self.ap_band_slot, "--band", self.band, "--port", self.port,
"--timeout", self.timeout,
]
# Generate command
if self.action in ['cmd', 'txPower', 'channel', 'bandwidth']:
self.command_extend = ["--action", self.action, "--value", self.value]
self.command.extend(self.command_extend)
elif self.action in ["create_wlan", "create_wlan_wpa2", "create_wlan_wpa3", "dtim", "enable_ft_akm_ftpsk",
"enable_ftotd_akm_ftpsk", "enable_ft_akm_ftsae", "enable_ft_wpa3_dot1x",
"enable_ft_wpa3_dot1x_sha256", "show_client_macadd_detail", 'debug_wieless_mac',
'no_debug_wieless_mac', 'get_data_ra_trace_files', 'del_ra_trace_file']:
if self.action in ["create_wlan"]:
self.command_extend = ["--action", self.action, "--wlan", self.wlan,
"--wlanID", self.wlanID, "--wlanSSID", self.wlanSSID]
elif self.action in ["create_wlan_wpa2", "create_wlan_wpa3"]:
self.command_extend = ["--action", self.action, "--wlan", self.wlan,
"--wlanID", self.wlanID, "--wlanSSID", self.wlanSSID, "--security_key", self.security_key]
elif self.action in ["dtim"]:
self.command_extend = ["--action", self.action, "--wlan", self.wlan, "--value", self.value]
elif self.action in ["enable_ft_akm_ftpsk"]:
self.command_extend = ["--action", self.action, "--wlan", self.wlan, "--security_key", self.security_key]
elif self.action in ["enable_ft_akm_ftsae"]:
self.command_extend = ["--action", self.action, "--wlan", self.wlan, "--security_key",
self.security_key]
elif self.action in ["enable_ft_wpa3_dot1x"]:
self.command_extend = ["--action", self.action, "--wlan", self.wlan, "--security_key",
self.security_key]
elif self.action in ["enable_ft_wpa3_dot1x_sha256"]:
self.command_extend = ["--action", self.action, "--wlan", self.wlan, "--security_key",
self.security_key, "--value", self.value]
elif self.action in ["enable_ftotd_akm_ftpsk"]:
self.command_extend = ["--action", self.action, "--wlan", self.wlan, "--security_key",
self.security_key]
elif self.action in ["show_client_macadd_detail"]:
self.command_extend = ["--action", self.action, "--value", self.value]
elif self.action in ['debug_wieless_mac']:
self.command_extend = ["--action", self.action, "--value", self.value]
elif self.action in ['no_debug_wieless_mac']:
self.command_extend = ["--action", self.action, "--value", self.value]
elif self.action in ['get_data_ra_trace_files']:
self.command_extend = ["--action", self.action, "--value", self.value]
elif self.action in ['del_ra_trace_file']:
self.command_extend = ["--action", self.action, "--value", self.value]
self.command.extend(self.command_extend)
elif self.action in ["enable_wlan", "disable_wlan", "delete_wlan"]:
self.command_extend = ["--action", self.action, "--wlan", self.wlan]
self.command.extend(self.command_extend)
elif self.action in ["wireless_tag_policy"]:
self.command_extend = [
"--action",
self.action,
"--wlan",
self.wlan,
"--tag_policy",
self.tag_policy,
"--policy_profile",
self.policy_profile]
self.command.extend(self.command_extend)
elif self.action in ["ap_dot11_dot11ax_mcs_tx_index_spatial_stream", "no_ap_dot11_dot11ax_mcs_tx_index_spatial_stream"]:
self.command_extend = [
"--action", self.action,
"--spatial_stream", str(self.spatial_stream),
"--mcs_tx_index", str(self.mcs_tx_index)
]
self.command.extend(self.command_extend)
# possible need to look for exact command
elif self.action in ["summary", "show_radio", "no_logging_console", "line_console_0", "show_ap_wlan_summary", "show_wlan_summary", "show_wlan_id",
"advanced", "disable_operation_status",
"disable_network_dual_band_6ghz", "disable_network_dual_band_5ghz", "disable_network_6ghz", "disable_network_5ghz", "disable_network_24ghz",
"show_ap_bssid_dual_band_6g", "show_ap_bssid_dual_band_5g", "show_ap_bssid_6g", "show_ap_bssid_5g", "show_ap_bssid_24g",
"manual", "auto",
"enable_network_dual_band_6ghz", "enable_network_dual_band_5ghz", "enable_network_6ghz", "enable_network_5ghz", "enable_network_24ghz",
"enable_operation_status", "11r_logs", "enable_ft_akm_ftpsk", "enable_ftotd_akm_ftpsk",
"config_dual_band_mode", "dual_band_no_mode_shutdown", "dual_band_mode_shutdown",
"enable_ft_akm_ftsae", "enable_ft_wpa3_dot1x", "enable_ft_wpa3_dot1x_sha256",
"show_wireless_client_sumry", "show_client_macadd_detail", 'debug_wieless_mac',
'no_debug_wieless_mac', 'get_ra_trace_files','get_data_ra_trace_files','del_ra_trace_file',
]:
self.command_extend = ["--action", self.action]
self.command.extend(self.command_extend)
else:
logger.critical("action {action} not supported".format(action=self.action))
raise ValueError("action {action} not supported".format(action=self.action))
# logger.info(pformat(self.command))
logger.info(self.command)
# TODO change the subprocess.run to pOpen
summary_output = ''
print(self.command)
summary = subprocess.Popen(self.command, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in iter(summary.stdout.readline, ''):
logger.debug(line)
summary_output += line
# sys.stdout.flush() # please see comments regarding the necessity of this line
summary.wait()
logger.info(summary_output) # .decode('utf-8', 'ignore'))
# logger.info(advanced.stderr.decode('utf-8', 'ignore'))
return summary_output
# use to get the BSSID for wlan
def show_ap_config_slots(self):
logger.info("show ap config slots")
self.action = "cmd"
self.value = "show ap config slots"
summary = self.send_command()
return summary
# show wlan id <wlan ID>
def show_wlan_id(self):
logger.info("show ap config slots")
self.action = "cmd"
self.value = "show wlan id {wlanID}".format(wlanID=self.wlanID)
summary = self.send_command()
return summary
def config_dtim_dot11_dual_band_6ghz(self):
logger.info("dtim dot11 dual band 6ghz")
self.band = 'dual_band_6g'
self.action = "dtim"
self.value = self.dtim
summary = self.send_command()
return summary
def config_dtim_dot11_dual_band_5ghz(self):
logger.info("dtim dot11 dual band 5ghz")
self.band = 'dual_band_5g'
self.action = "dtim"
self.value = self.dtim
summary = self.send_command()
return summary
def config_dtim_dot11_6ghz(self):
logger.info("dtim dot11 6ghz")
self.band = '6g'
self.action = "dtim"
self.value = self.dtim
summary = self.send_command()
return summary
# DTIM Delivery Traffic Indication Message
def config_dtim_dot11_5ghz(self):
logger.info("dtim dot11 5ghz")
self.band = '5g'
self.action = "dtim"
self.value = self.dtim
summary = self.send_command()
return summary
# DTIM Delivery Traffic Indication Message
def config_dtim_dot11_24ghz(self):
logger.info("dtim dot11 24ghz")
self.band = '24g'
self.action = "dtim"
self.value = self.dtim
summary = self.send_command()
return summary
# NOTE: need to do _no_logging_console and line_console_0 at the beginning of every session
# to avoid unexpected log messages showing up
# this command will disable debug logging to the terminal which causes issues with pexpect
def no_logging_console(self):
logger.info("no_logging_console")
self.action = "no_logging_console"
summary = self.send_command()
return summary
# Note: needed to be set for tx power script
def line_console_0(self):
logger.info("line_console_0")
self.action = "line_console_0"
summary = self.send_command()
return summary
def show_controllers_dot11Radio_0(self):
logger.info("show radio")
self.action = "show_radio"
summary = self.send_command()
return summary
def show_ap_summary(self):
logger.info("show ap summary")
self.action = "summary"
summary = self.send_command()
return summary
def show_ap_bssid_dual_band_6ghz(self):
logger.info("show ap name wlan dot11 dual-band")
self.band = 'dual_band_6g'
self.action = "show_ap_bssid_dual_band_6g"
summary = self.send_command()
return summary
def show_ap_bssid_dual_band_5ghz(self):
logger.info("show ap name wlan dot11 dual-band")
self.band = 'dual_band_5g'
self.action = "show_ap_bssid_dual_band_5g"
summary = self.send_command()
return summary
def show_ap_bssid_6ghz(self):
logger.info("show ap name <AP NAME> wlan dot11 6ghz")
self.band = '6g'
self.action = "show_ap_bssid_6g"
summary = self.send_command()
return summary
def show_ap_bssid_5ghz(self):
logger.info("show ap name wlan dot11 5ghz")
self.band = '5g'
self.action = "show_ap_bssid_5g"
summary = self.send_command()
return summary
def show_ap_bssid_24ghz(self):
logger.info("show ap name wlan dot11 24ghz")
self.band = '24g'
self.action = "show_ap_bssid_24g"
summary = self.send_command()
return summary
def show_ap_wlan_dual_band_summary(self):
logger.info("show ap wlan summary")
self.action = "show_ap_wlan_summary"
summary = self.send_command()
return summary
def show_ap_wlan_summary(self):
logger.info("show ap wlan summary")
self.action = "show_ap_wlan_summary"
summary = self.send_command()
return summary
def show_wlan_summary(self):
logger.info("show_wlan_summary")
self.action = "show_wlan_summary"
summary = self.send_command()
return summary
# TODO clean up action advanced to ap_dot11_summary
def show_ap_dot11_dual_band_6gz_summary(self):
logger.info("show ap dot11 dual-band 6gz summary")
self.band = 'dual_band_6g'
self.action = "advanced"
summary = self.send_command()
return summary
def show_ap_dot11_dual_band_5gz_summary(self):
logger.info("show ap dot11 dual-band 5gz summary")
self.band = 'dual_band_5g'
self.action = "advanced"
summary = self.send_command()
return summary
def show_ap_dot11_6gz_summary(self):
logger.info("show ap dot11 6gz summary")
self.band = '6g'
self.action = "advanced"
summary = self.send_command()
return summary
def show_ap_dot11_5gz_summary(self):
logger.info("show ap dot11 5gz summary")
self.band = '5g'
self.action = "advanced"
summary = self.send_command()
return summary
def show_ap_dot11_24gz_summary(self):
logger.info("show ap dot11 24gz summary")
self.band = '24g'
self.action = "advanced"
summary = self.send_command()
return summary
def show_ap_dot11_dual_band_6gz_shutdown(self):
logger.info("ap name {name} dot11 dual-band 6ghz shutdown")
self.band = 'dual_band_6g'
self.action = "disable_operation_status"
summary = self.send_command()
return summary
def show_ap_dot11_dual_band_5gz_shutdown(self):
logger.info("ap name {name} dot11 dual-band 5ghz shutdown")
self.band = 'dual_band_5g'
self.action = "disable_operation_status"
summary = self.send_command()
return summary
def show_ap_dot11_6gz_shutdown(self):
logger.info("ap name {name} dot11 6ghz shutdown")
self.band = '6g'
self.action = "disable_operation_status"
summary = self.send_command()
return summary
def show_ap_dot11_5gz_shutdown(self):
logger.info("ap name {name} dot11 5ghz shutdown")
self.band = '5g'
self.action = "disable_operation_status"
summary = self.send_command()
return summary
def show_ap_dot11_24gz_shutdown(self):
logger.info("ap name {name} dot11 24ghz shutdown")
self.band = '24g'
self.action = "disable_operation_status"
summary = self.send_command()
return summary
def wlan_shutdown(self):
logger.info("wlan {wlan} shutdown wlanID {wlanID} wlanSSID {wlanSSID}".format(wlan=self.wlan, wlanID=self.wlanID, wlanSSID=self.wlanSSID))
self.action = "disable_wlan"
summary = self.send_command()
return summary
# TODO May need to check if 6g supported on AP ,
# or just send command and let controller show not supported.
def ap_dot11_dual_band_6ghz_shutdown(self):
logger.info("ap dot11 dual-band 6ghz shutdown")
self.band = 'dual_band_6g'
self.action = "disable_network_dual_band_6ghz"
summary = self.send_command()
return summary
def ap_dot11_dual_band_5ghz_shutdown(self):
logger.info("ap dot11 dual-band 5ghz shutdown")
self.band = 'dual_band_5g'
self.action = "disable_network_dual_band_5ghz"
summary = self.send_command()
return summary
def ap_dot11_6ghz_shutdown(self):
logger.info("ap dot11 6ghz shutdown")
self.band = '6g'
self.action = "disable_network_6ghz"
summary = self.send_command()
return summary
def ap_dot11_5ghz_shutdown(self):
logger.info("ap dot11 5ghz shutdown")
self.band = '5g'
self.action = "disable_network_5ghz"
summary = self.send_command()
return summary
def ap_dot11_24ghz_shutdown(self):
logger.info("wlan {wlan} shutdown".format(wlan=self.wlan))
self.band = '24g'
self.action = "disable_network_24ghz"
summary = self.send_command()
return summary
def ap_dot11_dual_band_6ghz_radio_role_manual_client_serving(self):
logger.info("ap name {ap_name} dot11 dual band 6ghz radio role manual client-serving".format(ap_name=self.ap))
self.band = 'dual_band_6g'
self.action = "manual"
summary = self.send_command()
return summary
def ap_dot11_dual_band_5ghz_radio_role_manual_client_serving(self):
logger.info("ap name {ap_name} dot11 dual band 5ghz radio role manual client-serving".format(ap_name=self.ap))
self.band = 'dual_band_5g'
self.action = "manual"
summary = self.send_command()
return summary
def ap_dot11_6ghz_radio_role_manual_client_serving(self):
logger.info("ap name {ap_name} dot11 6ghz radio role manual client-serving".format(ap_name=self.ap))
self.band = '6g'
self.action = "manual"
summary = self.send_command()
return summary
def ap_dot11_5ghz_radio_role_manual_client_serving(self):
logger.info("ap name {ap_name} dot11 5ghz radio role manual client-serving".format(ap_name=self.ap))
self.band = '5g'
self.action = "manual"
summary = self.send_command()
return summary
def ap_dot11_24ghz_radio_role_manual_client_serving(self):
logger.info("ap name {ap_name} dot11 24ghz radio role manual client-serving".format(ap_name=self.ap))
self.band = '24g'
self.action = "manual"
summary = self.send_command()
return summary
def ap_dot11_dual_band_6ghz_radio_role_auto(self):
logger.info("ap name {ap_name} dot11 dual band 6ghz radio role auto".format(ap_name=self.ap))
self.band = 'dual_band_6g'
self.action = "auto"
summary = self.send_command()
return summary
def ap_dot11_dual_band_5ghz_radio_role_auto(self):
logger.info("ap name {ap_name} dot11 dual band 5ghz radio role auto".format(ap_name=self.ap))
self.band = 'dual_band_5g'
self.action = "auto"
summary = self.send_command()
return summary
def ap_dot11_6ghz_radio_role_auto(self):
logger.info("ap name {ap_name} dot11 6ghz radio role auto".format(ap_name=self.ap))
self.band = '6g'
self.action = "auto"
summary = self.send_command()
return summary
def ap_dot11_5ghz_radio_role_auto(self):
logger.info("ap name {ap_name} dot11 5ghz radio role auto".format(ap_name=self.ap))
self.band = '5g'
self.action = "auto"
summary = self.send_command()
return summary
def ap_dot11_24ghz_radio_role_auto(self):
logger.info("ap name {ap_name} dot11 5ghz radio role auto".format(ap_name=self.ap))
self.band = '24g'
self.action = "auto"
summary = self.send_command()
return summary
# TODO check if this command is used
def config_dot11_5ghz_disable_network(self):
logger.info("config_dot11_5ghz_disable_network")
self.action = "cmd"
self.value = "config 802.11a disable network"
summary = self.send_command()
return summary
# TODO check if this command is used
def config_dot11_24ghz_disable_network(self):
logger.info("config_dot11_24ghz_disable_network")
self.action = "cmd"
self.value = "config 802.11b disable network"
summary = self.send_command()
return summary
# txPower
def config_dot11_dual_band_6ghz_tx_power(self):
logger.info("config_dot11_dual_band_6ghz_tx_power")
self.band = 'dual_band_6g'
self.action = "txPower"
self.value = "{tx_power}".format(tx_power=self.tx_power)
summary = self.send_command()
return summary
def config_dot11_dual_band_5ghz_tx_power(self):
logger.info("config_dot11_dual_band_5ghz_tx_power")
self.band = 'dual_band_5g'
self.action = "txPower"
self.value = "{tx_power}".format(tx_power=self.tx_power)
summary = self.send_command()
return summary
def config_dot11_6ghz_tx_power(self):
logger.info("config_dot11_6ghz_tx_power")
self.band = '6g'
self.action = "txPower"
self.value = "{tx_power}".format(tx_power=self.tx_power)
summary = self.send_command()
return summary
def config_dot11_5ghz_tx_power(self):
logger.info("config_dot11_5ghz_tx_power")
self.band = '5g'
self.action = "txPower"
self.value = "{tx_power}".format(tx_power=self.tx_power)
summary = self.send_command()
return summary
def config_dot11_24ghz_tx_power(self):
logger.info("config_dot11_24ghz_tx_power")
self.band = '24g'
self.action = "txPower"
self.value = "{tx_power}".format(tx_power=self.tx_power)
summary = self.send_command()
return summary
# set channel
def config_dot11_dual_band_6ghz_channel(self):
logger.info("config_dot11_dual_band_6ghz_channel {channel}".format(channel=self.channel))
self.band = 'dual_band_6g'
self.action = "channel"
self.value = "{channel}".format(channel=self.channel)
summary = self.send_command()
return summary
def config_dot11_dual_band_5ghz_channel(self):
logger.info("config_dot11_dual_band_5ghz_channel {channel}".format(channel=self.channel))
self.band = 'dual_band_5g'
self.action = "channel"
self.value = "{channel}".format(channel=self.channel)
summary = self.send_command()
return summary
def config_dot11_6ghz_channel(self):
logger.info("config_dot11_6ghz_channel {channel}".format(channel=self.channel))
self.band = '6g'
self.action = "channel"
self.value = "{channel}".format(channel=self.channel)
summary = self.send_command()
return summary
def config_dot11_5ghz_channel(self):
logger.info("config_dot11_5ghz_channel {channel}".format(channel=self.channel))
self.band = '5g'
self.action = "channel"
self.value = "{channel}".format(channel=self.channel)
summary = self.send_command()
return summary
def config_dot11_24ghz_channel(self):
logger.info("config_dot11_24ghz_channel {channel}".format(channel=self.channel))
self.band = '24g'
self.action = "channel"
self.value = "{channel}".format(channel=self.channel)
summary = self.send_command()
return summary
# set bandwidth
def config_dot11_dual_band_6ghz_channel_width(self):
logger.info("config_dot11_dual_band_6ghz_channel width {bandwidth}".format(bandwidth=self.bandwidth))
self.band = 'dual_band_6g'
self.action = "bandwidth"
self.value = "{bandwidth}".format(bandwidth=self.bandwidth)
summary = self.send_command()
return summary
def config_dot11_dual_band_5ghz_channel_width(self):
logger.info("config_dot11_dual_band_5ghz_channel width {bandwidth}".format(bandwidth=self.bandwidth))
self.band = 'dual_band_5g'
self.action = "bandwidth"
self.value = "{bandwidth}".format(bandwidth=self.bandwidth)
summary = self.send_command()
return summary
def config_dot11_6ghz_channel_width(self):
logger.info("config_dot11_6ghz_channel width {bandwidth}".format(bandwidth=self.bandwidth))
self.band = '6g'
self.action = "bandwidth"
self.value = "{bandwidth}".format(bandwidth=self.bandwidth)
summary = self.send_command()
return summary
def config_dot11_5ghz_channel_width(self):
logger.info("config_dot11_5ghz_channel width {bandwidth}".format(bandwidth=self.bandwidth))
self.band = '5g'
self.action = "bandwidth"
self.value = "{bandwidth}".format(bandwidth=self.bandwidth)
summary = self.send_command()
return summary
# TODO 24ghz is always 20 Mhz
def config_dot11_24ghz_channel_width(self):
logger.info("config_dot11_24ghz_channel width {bandwidth}".format(bandwidth=self.bandwidth))
self.band = '24g'
self.action = "bandwidth"
self.value = "{bandwidth}".format(bandwidth=self.bandwidth)
summary = self.send_command()
return summary
def ap_name_shutdown(self):
logger.info("ap name {ap} shutdown".format(ap=self.ap))
self.action = 'cmd'
self.value = "ap name {ap} shutdown".format(ap=self.ap)
summary = self.send_command()
return summary
def ap_name_no_shutdown(self):
logger.info("ap name {ap} no shutdown".format(ap=self.ap))
self.action = 'cmd'
self.value = "ap name {ap} no shutdown".format(ap=self.ap)
summary = self.send_command()
return summary
# delete_wlan (may need to get the wlan from the summary)
def config_no_wlan(self):
logger.info("config_no_wlan {wlan}".format(wlan=self.wlan))
self.action = "delete_wlan"
summary = self.send_command()
return summary
# configure open wlan , commands sent
# for command in [
# "no security ft",
# "no security ft adaptive",
# "no security wpa",
# "no security wpa wpa2",
# "no security wpa wpa1",
# "no security wpa wpa2 ciphers aes"
# "no security dot1x authentication-list",
# "no security wpa akm dot1x",
# "no shutdown"]:
def config_wlan_open(self):
logger.info("config_wlan wlan: Profile name {wlan} wlanID {wlanID} wlanSSID {wlanSSID}".format(
wlan=self.wlan, wlanID=self.wlanID, wlanSSID=self.wlanSSID))
self.action = "create_wlan"
summary = self.send_command()
return summary
# TODO ability to pass in psk
# configuration for wpa2, commands
# for command in [
# "assisted-roaming dual-list",
# "bss-transition dual-list",
# "radio policy dot11 24ghz",
# "radio policy dot11 5ghz",
# "security wpa psk set-key ascii 0 hello123",
# "no security wpa akm dot1x",
# "security wpa akm psk"
# "no shutdown"]:
# configure wpa2
def config_wlan_wpa2(self):
logger.info("config_wlan_wpa2 wlan: Profile name {wlan} wlanID {wlanID} wlanSSID {wlanSSID} security_key {security_key}".format(
wlan=self.wlan, wlanID=self.wlanID, wlanSSID=self.wlanSSID, security_key=self.security_key))
self.action = "create_wlan_wpa2"
summary = self.send_command()
return summary
# configuration for wpa3, commands
# for command in [
# "assisted-roaming dual-list"
# "radio policy dot11 6ghz"
# "no security ft adaptive"
# "no security wpa wpa2"
# "security wpa psk set-key ascii 0 hello123"
# "no security wpa akm dot1x"
# "security wpa akm sae"
# "security wpa akm sae pwe h2e"
# "security wpa wpa3"
# "security pmf mandatory"
# "no shutdown"]:
# configure wpa3
# TODO pass in
def config_wlan_wpa3(self):
logger.info("config_wlan_wpa3 wlan: Profile name {wlan} wlanID {wlanID} wlanSSID {wlanSSID}".format(
wlan=self.wlan, wlanID=self.wlanID, wlanSSID=self.wlanSSID))
self.action = "create_wlan_wpa3"
summary = self.send_command()
return summary
# config wireless tag policy and policy_profile
# this may need to be split up
# WCL1 : RM204-TB1 , WLC2 : RM204-TB2
# policy_profile = 'default-policy-profile'
# TODO remove hardcoded 'default-policy-profile' make configurable
def config_wireless_tag_policy_and_policy_profile(self):
logger.info("config_wireless_tag_policy: Profile name {wlan} tag policy {tag_policy} ".format(wlan=self.wlan, tag_policy=self.tag_policy))
self.action = "wireless_tag_policy"
summary = self.send_command()
return summary
# enable_wlan
def config_enable_wlan_send_no_shutdown(self):
logger.info(
"config_enable_wlan_send_no_shutdown: Profile name {wlan} wlanID {wlanID} wlanSSID {wlanSSID}".format(
wlan=self.wlan,
wlanID=self.wlanID,
wlanSSID=self.wlanSSID))
self.action = "enable_wlan"
summary = self.send_command()
return summary
# enable_network_dual_band_6ghz
def config_no_ap_dot11_dual_band_6ghz_shutdown(self):
logger.info(
"config_no_ap_dot11_dual_band_6ghz_shutdown (enable network dual band 6ghz): Profile name {wlan} wlanID {wlanID} wlanSSID {wlanSSID}".format(
wlan=self.wlan,
wlanID=self.wlanID,
wlanSSID=self.wlanSSID))
self.action = "enable_network_dual_band_6ghz"
summary = self.send_command()
return summary
# enable_dual_band_network_5ghz
def config_no_ap_dot11_dual_band_5ghz_shutdown(self):
logger.info(
"config_no_ap_dot11_dual_band_5ghz_shutdown (enable network dual band 5ghz): Profile name {wlan} wlanID {wlanID} wlanSSID {wlanSSID}".format(
wlan=self.wlan,
wlanID=self.wlanID,
wlanSSID=self.wlanSSID))
self.action = "enable_network_dual_band_5ghz"
summary = self.send_command()
return summary
# enable_network_6ghz
def config_no_ap_dot11_6ghz_shutdown(self):
logger.info(
"config_no_ap_dot11_6ghz_shutdown (enable network 6ghz): Profile name {wlan} wlanID {wlanID} wlanSSID {wlanSSID}".format(
wlan=self.wlan,
wlanID=self.wlanID,
wlanSSID=self.wlanSSID))
self.action = "enable_network_6ghz"
summary = self.send_command()
return summary
# enable_network_5ghz
def config_no_ap_dot11_5ghz_shutdown(self):
logger.info(
"config_no_ap_dot11_5ghz_shutdown (enable network 5ghz): Profile name {wlan} wlanID {wlanID} wlanSSID {wlanSSID}".format(
wlan=self.wlan,
wlanID=self.wlanID,
wlanSSID=self.wlanSSID))
self.action = "enable_network_5ghz"
summary = self.send_command()
return summary
# enable_network_24ghz
def config_no_ap_dot11_24ghz_shutdown(self):
logger.info(
"config_no_ap_dot11_24ghz_shutdown (enable network 24ghz): Profile name {wlan} wlanID {wlanID} wlanSSID {wlanSSID}".format(
wlan=self.wlan,
wlanID=self.wlanID,
wlanSSID=self.wlanSSID))
self.action = "enable_network_24ghz"
summary = self.send_command()
return summary
# dual-band mode shut down 6ghz
def ap_dot11_dual_band_mode_shutdown_6ghz(self):
self.band = 'dual_band_6g'
self.action = 'dual_band_mode_shutdown'
summary = self.send_command()
logger.info("ap name {ap} dot11 dual-band shutdown slot {slot} band 6ghz {band}".format(ap=self.ap, band=self.band, slot=self.ap_band_slot))
return summary
# dual-band mode shut down 5ghz
def ap_dot11_dual_band_mode_shutdown_5ghz(self):
self.band = 'dual_band_5g'
self.action = 'dual_band_mode_shutdown'
summary = self.send_command()
logger.info("ap name {ap} dot11 dual-band shutdown slot {slot} band 5ghz {band}".format(ap=self.ap, band=self.band, slot=self.ap_band_slot))
return summary
# dual-band mode shut down 6ghz
def ap_dot11_dual_band_no_mode_shutdown_6ghz(self):
self.band = 'dual_band_6g'
self.action = 'dual_band_no_mode_shutdown'
summary = self.send_command()
logger.info("ap name {ap} dot11 dual-band no mode shutdown slot {slot} band 6ghz {band}".format(ap=self.ap, band=self.band, slot=self.ap_band_slot))
return summary
# dual-band mode shut down 5ghz
def ap_dot11_dual_band_no_mode_shutdown_5ghz(self):
self.band = 'dual_band_5g'
self.action = 'dual_band_no_mode_shutdown'
summary = self.send_command()
logger.info("ap name {ap} dot11 dual-band no mode shutdown slot {slot} band 5ghz {band}".format(ap=self.ap, band=self.band, slot=self.ap_band_slot))
return summary
# dual-band change radio roll 6ghz