Open Ethernet Networking (OpEN) API Guide and Reference Manual
3.6.0.3
|
Image management provides the configuration of the images on a switch. These APIs are used to determine the presence of existing images and to provision the setting of their priority during bootup. There is also an API to upgrade switch with a locally available image.
This document provides a brief description of the code image management OpEN APIs. The code image management OpEN APIs allow processes outside of the ICOS main process (switchdrvr) access to image management services. It provides the following services:
All 'Set' operations may affect the Switch behavior and configuration.
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.
image_example.c is a sample application that demonstrates the use of the code image OpEN APIs. image_example is started from the command line and has the following usage syntax:
Usage: image_example <arg1> <arg2> ...
It exercises all the image configuration OpEN APIs with appropriate arguments to manage the images in the ICOS main process (switchdrvr). image_example exercises the Image OpEN APIs individually or in related sets based on how it is invoked. While most of the Image configuration OpEN APIs are pretty straightforward as is illustrated in image_example, the OpEN API for image upgrade may need extra attention. It's described in brief below.
Validate and Upgrade switch with a locally available image
openapiImageUpgrade() in image_example takes image path and image label as input parameters. image path is the absolute path in Linux (e.g., /tmp/image.stk) for an image that has been downloaded by some other means (e.g., over HTTP/HTTPS or over TFTP - outside the knowledge of FASTPATH and OpEN API). This step to download an image needs to be carried out before running this test. image label is to provide identifying string or label that is used to refer to each code image residing in the non-volatile memory of the switch, such as "active" and "backup". The intended label to pass on to this OpEN API is to be retrieved from switch through OpEN API openapiImageLabelsGet().
The following is a list and sequence of tests that constitutes Sanity Test suite in image_example.
CLI Command | OpEN API Reference |
---|---|
(Priv-User Mode)# update bootcode | openapiBootCodeUpdate() |
(Priv-User Mode)# boot system <imave> | openapiImageActivate() |
(Priv-User Mode)# delete <image> | openapiImageDelete() |
(Priv-User Mode)# filedescr <image> <text> | openapiImageDescrGet() openapiImageDescrSet() |
(Priv-User Mode)# show bootvar | openapiImageLabelIsValid() |
(Priv-User Mode)# show bootvar | openapiImageLabelsGet() |
(Priv-User Mode)# show bootvar | openapiImageNamesGet() |
(Priv-User Mode)# show hardware | openapiBootCodeVersion() |
Please note that the Bad return code as shown is deliberate.
# ./image_example 1
imageLabelsGet: activeLabel=active backupLabel=backup. imageLabelIsValid: imageLabel=active isValid=true. imageDescrGet: imageLabel=active imageDescr=This is the active image.. imageDescrSet: imageLabel=active imageDescr=testing. imageDescrSet: imageLabel=active imageDescr=This is the active image.. Using local unit number 1 imageNamesGet: activeImage=11.16.8.47 backupImage=none activatedImage=11.16.8.47. imageActivate: imageLabel=backup unit=1. imageDelete: imageLabel=backup unit=1. bootcodeUpdate: unit=1.