ventilaar
/
sdn-cursus
Archived
1
Fork 0

should work

This commit is contained in:
ventilaar 2021-11-18 10:49:02 +01:00
parent e2c09174ce
commit 6fec4b96da
1 changed files with 18 additions and 8 deletions

View File

@ -1,8 +1,5 @@
RSA_BITSIZE = 4096
MANAGEMENT_INTERFACE = 'GigabitEthernet 0/0/0'
test = {'HOSTNAME': 'kerk', 'DOMAIN': 'kerkhosting.lan', 'RSA_BITSIZE': RSA_BITSIZE, 'SSH_USERNAME': 'kekr',
'SSH_PASSWORD': 'kakr', 'ENABLE_PASSWORD': 'kork', 'MANAGEMENT_INTERFACE': MANAGEMENT_INTERFACE,
'MANAGEMENT_IP': '172.16.1.1', 'MANAGEMENT_MASK': '255.255.255.0'}
def generate_config(s):
@ -68,6 +65,7 @@ def ask_options():
return opt
def menu():
print(
f"{'_' * 64}\n"
@ -75,14 +73,26 @@ def menu():
f' SSH RSA key bitsize: {RSA_BITSIZE}\n'
f' Management interface: {MANAGEMENT_INTERFACE}\n'
f"{'_' * 64}\n"
f'q: quit\n'
f'g: generate config\n'
f"{'_' * 64}"
)
chosen = input('option: ')
def main():
menu()
print(generate_config(ask_options()))
if chosen == 'q':
exit()
elif chosen == 'g':
print(f"{'_' * 64}\n")
options = ask_options()
config = generate_config(options)
print(f"copy paste the config below to the router, this config wil be saved to: {options['HOSTNAME']}.conf")
print(f"{'_' * 64}\n")
print(config)
print(f"{'_' * 64}\n")
with open(f"{options['HOSTNAME']}.conf", 'w') as file:
file.writelines(config)
if __name__ == '__main__':
main()
menu()