Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
Events

This document provides a brief description and usage of the Events OpEN APIs.

Example C Application link_status_example

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.

link_status_example

link_status_example.c is a sample application that demonstrates the use of the Events OpEN APIs. link_status_example is started from the command line.

For informational purposes, this example application initially retrieves and displays the ICOS or Network OS version including the OPEN API Version. The maximum number of interfaces supported on the switch are then determined for which an interface table is created. This table is used to hold the link state for each available interface.

The application then registers to receive interface-change events. Events are checked and the interface table is updated every 5 seconds for the duration of the monitoring session. The default monitoring time is 60 seconds, the application also accepts via the command line a user defined monitor duration.

At the end of the monitoring duration, the interface table is displayed showing the internal interface number and name with its link status (up or down).

Example C Application vlan_status_example

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.

vlan_status_example

vlan_status_example.c is a sample application that demonstrates the use of the Events OpEN APIs. vlan_status_example is started from the command line.

For informational purposes, this example application initially retrieves and displays the ICOS or Network OS version including the OPEN API Version. A local VLAN table is created that is large enough to hold the available VLANs defined in the switch. This table is used to hold the available VLANs and their status (static or dynamic).

The application then registers to receive VLAN events. Events are checked and the VLAN table is updated every 5 seconds for the duration of the monitoring session. The default monitoring time is 60 seconds, the application also accepts via the command line a user defined monitor duration.

This application displays the existing VLANs and their status (static or dynamic) before and after the monitoring session.