This document provides a brief description of the LoopProtect OpEN APIs. It provides the following services:
- Sets the loop protection global mode.
- Gets the loop protection global mode.
- Sets the transmission timer for the loop protection PDUs.
- Gets the transmission timer for the loop protection PDUs.
- Sets the maximum number of PDUs to be received on a port before action is taken.
- Gets the maximum number of PDUs to be received on a port before action is taken.
- Sets the transmission mode for the loop protection PDUs.
- Gets the transmission timer Mode for the loop protection PDUs.
- Sets the disable duration for the port.
- Gets the disable duration for the port.
- Sets the loop protection admin mode for the interface.
- Gets the loop protection admin mode for the interface.
- Sets the port action for the the specified interface.
- Gets the port action for the the specified interface.
- Sets the VLAN ID and the TPID to be used for detecting a loop on the specified interface.
- Gets the VLAN ID and the TPID used for detecting a loop on the specified interface.
- Clears statistics of the specified interface.
- Clears the statistics for all interfaces.
- Gets the loop Count for the specified interface.
- Gets the status of loop on the specified interface.
- Gets the port status. whether port is in D-Disable state due to loop protection.
- Gets the time since last loop occured for the specified interface.
- Gets the transmit loop count for the specified interface.
- Gets the receive loop count for the specified interface.
- Gets the status of an interface whether port is valid for configuration of loop protection.
- Gets the first interface that is valid for loop protection.
- Gets the next interface that is valid for loop protection.
Example C Application loop_protect_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.
loop_protect_example
loop_protect_example.c is a sample application that demonstrates the use of LoopProtect OpEN APIs. loop_protect_example is started from the command line and can be used to exercise the various APIs by specifying arguments on the command line.
Sample Output
- Usage: ./loop_protect_example <test#> <arg1> <arg2> ...
- Test 1: Sets the loop protection global mode: loop_protect_example 1 <adminMode>
- Test 2: Gets the loop protection global mode: loop_protect_example 2
- Test 3: Sets the transmission timer for the loop protection PDUs: loop_protect_example 3 <timerVal>
- Test 4: Gets the transmission timer for the loop protection PDUs: loop_protect_example 4
- Test 5: Sets the maximum number of PDUs to be received on a port before action is taken: loop_protect_example 5 <val>
- Test 6: Gets the maximum number of PDUs to be received on a port before action is taken: loop_protect_example 6
- Test 7: Sets the transmission mode for the loop protection PDUs: loop_protect_example 7 <ifNum> <mode>
- Test 8: Gets the transmission timer Mode for the loop protection PDUs: loop_protect_example 8 <ifNum>
- Test 9: Sets the disable duration for the port: loop_protect_example 9 <val>
- Test 10: Gets the disable duration for the port: loop_protect_example 10
- Test 11: Sets the loop protection admin mode for the interface: loop_protect_example 11 <ifNum> <mode>
- Test 12: Gets the loop protection admin mode for the interface: loop_protect_example 12 <ifNum>
- Test 13: Sets the port action for the the specified interface: loop_protect_example 13 <ifNum> <mode>
- Test 14: Gets the port action for the the specified interface: loop_protect_example 14 <ifNum>
- Test 15: Sets the VLAN ID and the TPID to be used for detecting a loop on the specified interface: loop_protect_example 15 <ifNum> <tpid> <vlanId>
- Test 16: Gets the VLAN ID and the TPID used for detecting a loop on the specified interface: loop_protect_example 16 <ifNum>
- Test 17: Clears statistics of the specified interface: loop_protect_example 17 <ifNum>
- Test 18: Clears the statistics for all interfaces: loop_protect_example 18
- Test 19: Gets the loop Count for the specified interface: loop_protect_example 19 <ifNum>
- Test 20: Gets the status of loop on the specified interface: loop_protect_example 20 <ifNum>
- Test 21: Gets the port status. whether port is in D-Disable state due to loop protection: loop_protect_example 21 <ifNum>
- Test 22: Gets the time since last loop occured for the specified interface: loop_protect_example 22 <ifNum> <needUtc>
- Test 23: Gets the transmit loop count for the specified interface: loop_protect_example 23 <ifNum>
- Test 24: Gets the receive loop count for the specified interface: loop_protect_example 24 <ifNum>
- Test 25: Gets the status of an interface whether port is valid for configuration of loop protection: loop_protect_example 25 <ifNum>
- Test 26: Gets the first interface that is valid for loop protection: loop_protect_example 26
- Test 27: Gets the next interface that is valid for loop protection: loop_protect_example 27 <ifNum>
LoopProtect CLI/API Cross Reference