Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
Macros | Functions
CLI Text Based Configuration [OPENAPI_CLI_SCRIPT]

Macros

#define OPENAPI_CLI_MAX_STRING_LENGTH   255
 
#define OPENAPI_FILE_NAME_LENGTH_MAX   96
 

Functions

open_error_t openapiCliShowExecuteToFile (openapiClientHandle_t *client_handle, open_buffdesc *showCliCommand, open_buffdesc *fileName)
 Execute given show CLI command and redirect its output to the specified file. More...
 
open_error_t openapiFileNameMaxLengthGet (openapiClientHandle_t *client_handle, uint32_t *maxLen)
 Get the maximum file name length. More...
 
open_error_t openapiRunningCfgGenerate (openapiClientHandle_t *client_handle, open_buffdesc *txtCfgFile)
 Generate running configuration into specified file. More...
 
open_error_t openapiSaveConfig (openapiClientHandle_t *client_handle)
 Save running configuration into startup configuration file. More...
 
open_error_t openapiTxtCfgApply (openapiClientHandle_t *client_handle, open_buffdesc *txtCfgFile, open_buffdesc *outFile)
 Apply CLI text based configuration. More...
 
open_error_t openapiTxtCfgNDCApply (openapiClientHandle_t *client_handle, open_buffdesc *txtCfgFile, open_buffdesc *outFile)
 gracefully Apply CLI text based configuration More...
 
open_error_t openapiTxtCfgNDCGenerate (openapiClientHandle_t *client_handle, open_buffdesc *txtCfgFile, open_buffdesc *outFile)
 Generate configuration difference between running configuration and input configuration file. More...
 
open_error_t openapiTxtCfgValidate (openapiClientHandle_t *client_handle, open_buffdesc *txtCfgFile, open_buffdesc *outFile)
 Validate given configuration file. More...
 

Detailed Description

Function Documentation

open_error_t openapiCliShowExecuteToFile ( openapiClientHandle_t client_handle,
open_buffdesc showCliCommand,
open_buffdesc fileName 
)

Execute given show CLI command and redirect its output to the specified file.

Parameters
[in]client_handleClient handle from registration API
[in]showCliCommandShow CLI command Maximum value OPENAPI_CLI_MAX_STRING_LENGTH
[in]fileNameOutput file name Maximum value OPENAPI_FILE_NAME_LENGTH_MAX
Return values
OPEN_E_NONEif default configuration applied
OPEN_E_FAILif invalid file name is passed
OPEN_E_PARAMif invalid parameter is passed
OPEN_E_UNAVAILif CLI package is not enabled.

OpEN API Version: 1.7

Examples:
clitxtcfg_example.c.
open_error_t openapiFileNameMaxLengthGet ( openapiClientHandle_t client_handle,
uint32_t *  maxLen 
)

Get the maximum file name length.

Parameters
[in]client_handleClient handle from registration API
[out]maxLenMaximum length for a file name.
Return values
OPEN_E_NONEif file name maximum length is returned.
OPEN_E_PARAMif invalid parameter is passed.
Note
Calling this API will not change the running configuration of the switch.

OpEN API Version: 1.4

open_error_t openapiRunningCfgGenerate ( openapiClientHandle_t client_handle,
open_buffdesc txtCfgFile 
)

Generate running configuration into specified file.

Parameters
[in]client_handleClient handle from registration API
[in]txtCfgFileFile Name
-Maximum value OPENAPI_FILE_NAME_LENGTH_MAX
Return values
OPEN_E_NONEif default configuration applied
OPEN_E_FAILif invalid file name is passed
OPEN_E_PARAMif invalid parameter is passed
Note
Calling this API will not change the running configuration of the switch.

OpEN API Version: 1.4

Examples:
clitxtcfg_example.c.
open_error_t openapiSaveConfig ( openapiClientHandle_t client_handle)

Save running configuration into startup configuration file.

Parameters
[in]client_handleClient handle from registration API
Return values
OPEN_E_NONEif default configuration applied
OPEN_E_FAILif invalid file name is passed
OPEN_E_PARAMif invalid parameter is passed
Note
Calling this API will not change the running configuration of the switch. Saves the configuration to the switch and when switch reboots the saved configuration is applied.

OpEN API Version: 1.4

Examples:
clitxtcfg_example.c.
open_error_t openapiTxtCfgApply ( openapiClientHandle_t client_handle,
open_buffdesc txtCfgFile,
open_buffdesc outFile 
)

Apply CLI text based configuration.

Parameters
[in]client_handleClient handle from registration API
[in]txtCfgFileFile Name Maximum value OPENAPI_FILE_NAME_LENGTH_MAX
[in]outFileOutput File Name Maximum value OPENAPI_FILE_NAME_LENGTH_MAX
Return values
OPEN_E_NONEif default configuration applied
OPEN_E_FAILif invalid file name is passed
OPEN_E_PARAMif invalid parameter is passed
Note
Calling this API will change the running configuration of the switch.

OpEN API Version: 1.4

Examples:
clitxtcfg_example.c.
open_error_t openapiTxtCfgNDCApply ( openapiClientHandle_t client_handle,
open_buffdesc txtCfgFile,
open_buffdesc outFile 
)

gracefully Apply CLI text based configuration

Parameters
[in]client_handleClient handle from registration API
[in]txtCfgFileFile Name Maximum value OPENAPI_FILE_NAME_LENGTH_MAX
[in]outFileOutput File Name Maximum value OPENAPI_FILE_NAME_LENGTH_MAX
Return values
OPEN_E_NONEif default configuration applied
OPEN_E_FAILif invalid file name is passed
OPEN_E_PARAMif invalid parameter is passed
Note
Calling this API will change the running configuration of the switch.

OpEN API Version: 1.5

Examples:
clitxtcfg_example.c.
open_error_t openapiTxtCfgNDCGenerate ( openapiClientHandle_t client_handle,
open_buffdesc txtCfgFile,
open_buffdesc outFile 
)

Generate configuration difference between running configuration and input configuration file.

Parameters
[in]client_handleClient handle from registration API
[in]txtCfgFileFile Name Maximum value OPENAPI_FILE_NAME_LENGTH_MAX
[in]outFileOutput File Name Maximum value OPENAPI_FILE_NAME_LENGTH_MAX
Return values
OPEN_E_NONEif default configuration applied
OPEN_E_FAILif invalid file name is passed
OPEN_E_PARAMif invalid parameter is passed

OpEN API Version: 1.5

open_error_t openapiTxtCfgValidate ( openapiClientHandle_t client_handle,
open_buffdesc txtCfgFile,
open_buffdesc outFile 
)

Validate given configuration file.

Parameters
[in]client_handleClient handle from registration API
[in]txtCfgFileFile Name
-Maximum value OPENAPI_FILE_NAME_LENGTH_MAX
[in]outFileOutput File Name
-Maximum value OPENAPI_FILE_NAME_LENGTH_MAX
Return values
OPEN_E_NONEif the configuration is valid
OPEN_E_FAILif the configuration is invalid
OPEN_E_PARAMif invalid parameter is passed
OPEN_E_INTERNALif internal error has occurred
Note
Calling this API will not change the running configuration of the switch.

OpEN API Version: 1.4

Examples:
clitxtcfg_example.c.