-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
33 lines (26 loc) · 897 Bytes
/
run.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
import sys
import argparse
from lib.NetBoxManager import NetboxManager
from config import Config
def main():
parser = argparse.ArgumentParser(description="Process Netbox data")
choice: list = [
'devices',
'interfaces',
'ip-address',
]
parser.add_argument('action', choices=choice, help='Action to perform: device, interfaces, or ip')
parser.add_argument('-f', '--file', help='Path to the CSV file', required=True)
args = parser.parse_args()
nb_manager = NetboxManager(
nb_url=Config.NetBox.URL,
nb_token=Config.NetBox.TOKEN
)
if args.action == 'devices':
nb_manager.process_devices(args.file)
elif args.action == 'interfaces':
nb_manager.process_interfaces(args.file)
elif args.action == 'ip':
nb_manager.process_ip_addresses(args.file)
if __name__ == "__main__":
main()