In this demonstration, we are showing you the IF/THEN statement menu and what it would be looking for and inputting into the SSH session. The switch we are connecting to for this example is a Cisco 2960X and we are pulling screenshots from an iPad pro 11 in a multitasking view.
First we are going to wait for the # symbol with the IF statement, which will show us that we are connected to the switch and the netool.io Pro is ready to push the THEN commands.
When the netool.io Pro detects the # we are going to tell the netool.io Pro to push the configure terminal command to the SSH session using the THEN statement.
Next, we are going to use the IF statement to detect that we are currently in configure mode so that we can run the interface command to get into interface syntax.
In this example, we are using the key ‘SWITCH_PORT’, this key will then use the detected port from LLDP or the port that is saved in the queue entry database inline of the command during processing.
Next, using the IF statement to detect the next line that has config-if)# shows that we are in the interface command so that we can run the shutdown command.
Next, we are going to look for config-if)# again on the next line so that we can run our THEN statement of “switchport mode access” putting the port into access mode.
At this point, we can just go line by line to configure each port. Now we are going to wait for the config-if)# to appear again on the next line and then we are going to push the command ‘switchport access vlan 3’.
Now let’s write to the switch, but we don’t want to add several more steps with exit commands so we are just going to do a ‘do write’ right from the interface command prompt.
Here is the final example of the IF/THEN statement we just created.