-
Notifications
You must be signed in to change notification settings - Fork 0
/
aruba_ap_reboot
51 lines (39 loc) · 1.25 KB
/
aruba_ap_reboot
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
#!/usr/bin/env python3
import sys
import argparse
import json
import concurrent.futures
from constants import *
from utils import *
from aruba_query import *
requests.packages.urllib3.disable_warnings()
def main():
# CLI parser for the command
parser = argparse.ArgumentParser(description="Reboot Aruba AP")
# Get input from CLI
parser.add_argument(
"--mac",
help="Enter the MAC Address of the AP to reboot",
)
parser.add_argument(
"--name",
help="Enter the AP name to reboot",
)
# parse the arguments and print help if there are none
if len(sys.argv) == 1:
parser.print_help(sys.stderr)
sys.exit(1)
# read CLI into args
args = parser.parse_args()
query = ArubaQuery()
inventory = ArubaInventory()
arubapost = ArubaPost()
# get the api token for all controllers
with concurrent.futures.ThreadPoolExecutor() as executor:
for wc in MOBILITY_CONTROLLERS:
executor.submit(query.get_aruba_api_token, wc, PASSWORD, inventory)
with concurrent.futures.ThreadPoolExecutor() as executor:
for wc in MOBILITY_CONTROLLERS:
executor.submit(arubapost.reboot_ap, wc, inventory, query, args)
if __name__ == "__main__":
main()