access_mode = ["interface GigabitEthernet {}",
"switchport mode access",
"switchport access vlan {}",
"Description {}",
"No shutdown"]
trunk_mode = ["interface GigabitEthernet {}",
"switchport mode trunk",
"switchport trunk allowed vlan {}",
"Description {}",
"No shutdown"]
interface = input("Enter interface number: ")
vlan = int(input("Enter vlan number: "))
desc = input("Enter description of interface: ")
operation = input(""""Please choose switch mode on interface:
Access Trunk
1 2
""")
if vlan > int(4096):
print("Вы указали неверный номер влана!")
return
if operation == "Access" or operation == "1":
print("-" * 35)
print("\n".join(access_mode).format(interface, vlan, desc))
print("-" * 35)
if operation == "Trunk" or operation == "2":
print("-" * 35)
print("\n".join(trunk_mode).format(interface, vlan, desc))
print("-" * 35)