December 2018
Intermediate to advanced
226 pages
4h 57m
English
In this example, we will use a switch case to identify the right set of configurations based upon certain input given by the user.
As a prerequisite understanding, the syntax of the exec-timeout command based upon OS is as follows:
#create a dictionary:config={ "IOS":"exec-timeout 15 0", "NXOS":"exec-timeout 15" }getchoice=input("Enter IOS type (IOS/NXOS) : ")if (getchoice == "IOS"): print (config.get("IOS"))if (getchoice == "NXOS"): print (config.get("NXOS"))
The sample output is as follows:
> Enter IOS type (IOS/NXOS) : IOS exec-timeout 15 0 >>> Enter IOS type (IOS/NXOS) : NXOS exec-timeout 15 >>>
In the preceding example, we have tackled ...
Read now
Unlock full access