added main loop stuff
This commit is contained in:
parent
a1461e66ce
commit
8a47d63ede
|
@ -15,6 +15,8 @@ from pathlib import Path # python3 only
|
|||
env_path = Path('.') / '.env'
|
||||
load_dotenv(dotenv_path=env_path)
|
||||
|
||||
version = "1.00" # set a version to the program
|
||||
|
||||
# Define master switch details
|
||||
MASTER_SWITCH = {
|
||||
"ip": "23.169.120.2",
|
||||
|
@ -40,6 +42,7 @@ SWITCHES = [
|
|||
# Saved as tuple as these should only be read and not altered
|
||||
PROTECTED_VLANS = ("1")
|
||||
|
||||
# sync vlan function
|
||||
def sync_vlans(master_switch, switch):
|
||||
|
||||
# Establish SSH connection to master switch
|
||||
|
@ -121,6 +124,9 @@ def sync_vlans(master_switch, switch):
|
|||
master_client.close()
|
||||
switch_client.close()
|
||||
|
||||
# Loop through each switch and sync VLANs
|
||||
for switch in SWITCHES:
|
||||
sync_vlans(MASTER_SWITCH, switch)
|
||||
# Main loop
|
||||
if __name__ == "__main__":
|
||||
|
||||
# Loop through switches and run sync
|
||||
for switch in SWITCHES:
|
||||
sync_vlans(MASTER_SWITCH, switch)
|
Loading…
Reference in New Issue