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

This document provides a brief description of the Interface OpEN APIs. The Interface OpEN APIs allow processes outside of the ICOS main process (switchdrvr) access to Interface Management services. It provides the following services:

Example C Application interface_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.

interface_example

interface_example.c is a sample application that demonstrates the use of the Interface OpEN API. interface_example is started from the command line. It then exercises all the Interface OpEN APIs one by one with appropriate arguments to manage the Interface properties in the ICOS main process (switchdrvr). In addition, interface_example.c also demonstrates a way to interpret the mask returned from openapiIfCapabilitiesGet().

Sample Output (LiNe/LinuxHost platform)

# ./interface_example

Using physical interface 1, name 0/1
physical interface 1 get admin-state : ENABLE
physical interface 1 set admin-state : DISABLE
physical interface 1 speed UNKNOWN
physical interface 1 duplex mode UNKNOWN
physical interface 1 auto-negotiation mode : ENABLE
setting auto-negotiation to DISABLE on interface 1
Cannot set auto-negotiation on an unsupported interface. (result = -28)
physical interface 1 MTU size : 9216
physical interface 1 MTU size : 9216
MTU is equal to the set MTU
setting the max frame size to 8148
physical interface 1 MTU size : 8130
physical interface 1 max frame size : 8148
Max frame size is equal to the set max frame size
physical interface 1 mac-address : 00:10:18:7F:FC:C5
physical interface 1 description : test_port_1_description
setting the interface 1 description to test_port_1_description
physical interface 1 description : test_port_1_description
Physical interface 1 disable reason: 1 (OPEN_DISABLE_REASON_NONE)
Physical Interface 1 special port type designation: 1 (Normal port)
Physical interface 1 active media type: 1 (SFP+)
Physical interface 1 flow control status: INACTIVE

— interface statistic—
Physical interface 1 Time of last link state change: 0
Physical interface 1 Total number of octets: 0
Physical interface 1 Number of packets, delivered by this sub-layer to a higher sub-layer: 0
Physical interface 1 Number of inbound packets which were chosen to be discarded: 0
Physical interface 1 In errors counter: 0
Physical interface 1 Number of packets received via the interface
which were discarded because of an unknown or unsupported protocol: 0
Physical interface 1 Total number of octets transmitted out of the interface, including framing characters: 0
Physical interface 1 Total number of packets that higher-level protocols requested be transmitted: 0
Physical interface 1 Number of outbound packets which were chosen to be discarded: 0
Physical interface 1 Number of outbound packets which were chosen to be discarded: 0
Physical interface 1 Out errors counter: 0

Physical interface 1 is capable of following speeds:
---------------------------------------------—
Auto Negotiate
10 Mbps Half Duplex
10 Mbps Full Duplex
100 Mbps Half Duplex
100 Mbps Full Duplex
1000 Mbps Half Duplex
1000 Mbps Full Duplex

Interface CLI/API Cross Reference

CLI Command OpEN API Reference
(Interface-Config Mode)#
speed {{100|10} {half-duplex|full-duplex}|1000 full-duplex}
openapiIfSpeedSet()
openapiIfSpeedGet()
openapiIfDuplexModeGet()
(Interface-Config Mode)#
auto-negotiate
openapiIfAutoNegSet()
openapiIfAutoNegGet()
(Interface-Config Mode)#
[no]mtu <mtu-size>
openapiIfMtuSizeSet()
openapiIfMtuSizeGet()
(Interface-Config Mode)#
[no]shutdown diagnostic
openapiIfSoftShutdownStateSet()
openapiIfSoftShutdownStateGet()
(Interface-Config Mode)#
[no]description <string>
openapiIfDescrSet()
openapiIfDescrGet()
(Interface-Config Mode)#
[no]shutdown
openapiIfAdminStateSet()
openapiIfAdminStateGet()
(Priv-User Mode)#
show port description <interface>
openapiIfMacAddrGet()
(Priv-User Mode)#
show port <interface>
openapiIfSpecialPortTypeGet()
openapiIfOprStateGet()
(Priv-User Mode)#
show interfaces status <interface>
openapiIfActiveMediaTypeGet()
openapiIfPauseStatusGet()