opConfig distinguishes between five different stages for the application of a config set. You can provide any number or of commands for each of the stages; the
command stage must contain one or more commands.
A stage definition consists of a list of command strings which are sent to the device in sequence, one line at a time, exactly as they're given.
- opConfig treats the 'pseudo-commands'
__enter__specially, and leaves or enters configuration mode.
Note that there are two "_" on each side of the command. These special commands can be handy for rollback commandsrolling back changes, if your particular rollback command requires to be performed outside of configuration mode.
- Any command that starts with a single "_" is treated as a macro invocation, with optional arguments.
Macros have to be defined suitably in your device personality's "phrasebook", and they differ from plain individual commands in that macros can define sequences of send-expect-prompt steps.
This is how limited multi-step interaction with a device is possible.
For example, the default Cisco phrasebook as shipped with opConfig defines the macro
reload_in, to be used in a command like
"_reload_in 15". This would configure a Cisco IOS device for a forced reboot in N minutes. This has to be done using a macro because setting up the
reloadoperation requires confirmation. There is also a macro called
reloadwhich, when triggered by the command "
_reload" would restart your device.