.. _clixon_cli: .. sectnum:: :start: 9 :depth: 3 *** CLI *** .. image:: cli1.jpg :width: 80% Overview ======== The Clixon CLI provides an interactive command-line interface to a user. Each usage instantiates a new process which communicates via NETCONF with the backend daemon over an IPC socket. The Clixon CLI uses `CLIgen `__, an interactive interpreter of commands. Syntax is given as *cli-specifications* which specify callbacks defined in plugins. For details on CLIgen syntax and behavior, please consult the `CLIgen tutorial `_. Clixon comes with a generated CLI, the `autocli`_, where all configuration-related syntax is generated from YANG. You can also create a completely manually-made CLI. The CLI depends on the following: * *Clixon-config*: The Clixon config-file contains initial CLI configuration, such as where to find cli-specs, plugins and autocli configuration. * *Cli-specs*: CLI specification files written in `CLIgen `_ syntax. * *Plugins*: Dynamic loadable plugin files loaded at startup. Callbacks from cli-spec files are resolved and need to exist as symbols either in the Clixon libs or in the plugin file. The following example from the `main example `_. First, a cli-spec file containing two commands:: set("Set configuration symbol") @datamodel, cli_auto_set(); show("Show a particular state of the system") configuration("Show configuration"), cli_show_config("candidate", "default", "/"); example("Callback example") ("any number"), mycallback("myarg"); In the CLI, these generate CLI commands such as:: set interfaces interface eth9 show config example 23 The effect of typing the commands above is calling callbacks, either library functions in Clixon libs(``cli_show_config()``), or application-defined in a plugin(``mycallback()``) In this way, a designer writes cli command specifications which invokes C-callbacks. If there are no appropriate callbacks the designer must write a new callback function. Example usage ------------- The following example shows an auto-cli session from the `main example `_ how to add an interface in candidate, validate and commit it to running, then look at it as xml and cli and finally delete it:: clixon_cli -f /usr/local/etc/clixon/example.xml user@host> set interfaces interface eth9 ? description enabled ipv4 ipv6 link-up-down-trap-enable type user@host> set interfaces interface eth9 type ex:eth user@host> validate user@host> commit user@host> show configuration xml eth9 ex:eth true user@host> show configuration cli set interfaces interface eth9 set interfaces interface eth9 type ex:eth set interfaces interface eth9 enabled true user@host> delete interfaces interface eth9 Command-line options -------------------- The `clixon_cli` client has the following command-line options: -h Help -V Show version and exit -D Debug level -f Clixon config file -E Extra configuration directory -l