Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
CLI Text Based Configuration

This document provides a brief description of the CLI Text Based Configuration OpEN APIs. The CLI Text Based Configuration OpEN APIs allows processes outside of the ICOS main process (switchdrvr) access to basic CLI Text Based Configuration services. It provides the following services:

Example C Applications

Initialization

In the main function, the sample application initializes the OpEN API RPC service by calling openapiClientRegister() and waits for the RPC service in switchdrvr to start. A Client Handle is returned by openapiClientRegister() which is used while invoking the OpEN APIs. The application then exercises the associated OpEN APIs and logs informational and/or error messages on the console. The example application runs to its completion and exits.

Example C Applications

clitxtcfg_example.c is a sample application that demonstrates the use of the Text Based Configuration OpEN APIs. clitxtcfg_example is started from the command line as clitxtcfg_example with appropriate options available. It then exercises the associated OpEN API with appropriate arguments to perform the intended action.

Sample Output (LiNe/LinuxHost platform)

# ./clitxtcfg_example -h
Usage: ./clitxtcfg_example [options]
  -a, <input_file> <output_file>   apply CLI configuration script
  -g, <input_file> <output_file>   generate running-config and writes to file
  -n, <input_file> <output_file>   gracefully apply CLI configuration script
  -s,                              save running-config to startup-config
  -v, <input_file> <output_file>   validate CLI configuration script
  -h, --help                       display this message
# ./clitxtcfg_example -a sampleCfg.txt sampleCfg.out
Successfully applied the configuration. (result = 0)
# ./clitxtcfg_example -n sampleCfg.txt sampleCfg.out
Gracefully applied the configuration. (result = 0)
# ./clitxtcfg_example -s
Successfully saved the configuration. (result = 0)
# ./clitxtcfg_example -g runningCfg.txt
Successfully generated the running configuration. (result = 0)
# ./clitxtcfg_example -v sampleCfg.txt sampleValidationOut.txt
Successfully validated the configuration. (result = 0)

Text Based Configuration CLI/API Cross Reference

CLI Command OpEN API Reference
(Config)#script apply <scriptname> openapiTxtCfgApply()
(Config)#show running-config openapiRunningCfgGenerate()
(Config)#write memory openapiSaveConfig()
(Config)#script validate <scriptname> openapiTxtCfgValidate()