Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.6.0.3
Port MAC Locking

Port MAC Locking OpEN API

This document provides a brief description of the Port MAC Locking (PML) OpEN API. PML is a security feature which can be used to limit access to an interface based on MAC addresses.

The API provides the following services:

Example C Application pml_example

pml_example.c is a sample application that exercises the APIs provided by the PML OpEN APIs.

Usage: ./pml_example <test#> <arg1> <arg2> ...

Test 1: get the global admin mode: ./pml_example 1
Test 2: get whether interface is valid PML interface: ./pml_example 2 <intf>
Test 3: get the mode for a valid PML interface: ./pml_example 3 <intf>
Test 4: get the dynamic limit for a valid PML interface: ./pml_example 4 <intf>
Test 5: get the static limit for a valid PML interface: ./pml_example 5 <intf>
Test 6: get the violation trap mode for a valid PML interface: ./pml_example 6 <intf>
Test 7: get the violation D-Disable mode for a valid PML interface: ./pml_example 7 <intf>
Test 8: get the sticky mode for a valid PML interface: ./pml_example 8 <intf>
Test 9: run negative tests: ./pml_example 9 <intf>

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. A minimal run uses the -i argument to specify an interface. The various data about that interface (for each supported priority) is output by the application.

PML CLI/API Cross Reference

The mapping between the OpEN APIs and CLI commands is shown below.

CLI Command OpEN API Functions
show port-security openapiPmlGlobalAdminModeGet
show port-security slot/port openapiPmlIntfDynamicLimitGet
openapiPmlIntfStaticLimitGet
openapiPmlIntfViolationTrapModeGet
openapiPmlIntfViolationDDisableModeGet
openapiPmlIntfStickyModeGet