You can use the Embedded Event Manager to accomplish this. For example:
event manager applet no_shut_e_0_1
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "int e0/1"
action 4.0 cli command "no shut"
action 5.0 cli command "end"
action 6.0 cli command "write mem"
alias exec noshute_0_1 event manager run no_shut_e_0_1
Then, from exec mode, just run:
And interface e0/1 will be set administratively up. Note: the "alias exec" is not required, but it makes creating custom IOS commands easier. Without it, you would have to run "event manager run no_shut_e_0_1" each time you wanted to execute the applet.
However, this does not make use of returns codes as you asked about initially. Using return codes together with EEM is also possible. This gives you a way to intercept certain commands, and choose not to run them. For example, to intercept the command "show ip ospf neighbors" and not run it, do:
event manager applet no_ip_ospf_nei
event cli pattern "show ip ospf neighbor" sync yes
action 1.0 syslog msg "DANGER: CLI command $_cli_msg was attempted (but not executed)" priority critical
set 2.0 _exit_status 0
Now when "show ip ospf neighbor" is typed, EEM will intercept it, send out a critical syslog message, and ignore the command.
Question We run asr9001 with XR 6.1.3, and we have a very long delay to
login w/ SSH 1 or 2 to the device compare to IOS device. After
investigation, the there is 1s delay between the client KEXDH_INIT and
the server (XR) KEXDH_REPLY. After debug ssh serv...
Introduction The purpose of this document is to demonstrate the Open
Shortest Path First (OSPF) behavior when the V-bit (Virtual-link bit) is
present in a non-backbone area. The V-bit is signaled in Type-1 LSA only
if the router is the endpoint of one or ...
Hi, I am seeing quite a few issues with patch install and wanted to
share my experience and workaround to this. Login to admin via CLI, then
access root with the “shell” command Issue “df –h” and you’ll probably
see the following directory full or nearly ...