VLAN's allow a network manager to logically segment a LAN into different broadcast domains. It allows simplified administration of the network with enhanced performance, reduced cost and greater security. Switchport configuration simplifies the VLAN-related setup of a port that is used to provide network connectivity to an external device (Access Port) or interconnect switch devices (Trunk Port), while still supporting traditional port setup (General Port). Private VLANs extend this concept to restrict layer 2 communication among endpoints while allowing access to certain network resources by categorizing an interface as either a host port, promiscuous port, promiscuous trunk, or isolated trunk.
VLAN OpEN API
This document provides a brief description of the VLAN OpEN API. The VLAN OpEN API allows processes outside of the EFOS main process (switchdrvr) access to VLAN Management services. It provides the following services:
- Iterate through all the VLANs in the switch.
- Create/Delete/Verify a VLAN in a switch.
- Check if a VLAN is statically configured in the switch.
- Get/Set the Port VLAN ID (PVID) of a switch interface.
- Get/Set an interface's tagging setting for a specific VLAN.
- Get/Set an interface's participation for a specific VLAN.
- Get an interface's participation status for a specific VLAN.
- Get the next VLAN which has a pending change or a pending deletion.
- Get/Set a name for a specific VLAN.
- Get/Set the Switchport configuration mode for a port.
- Get/Set the access VLAN ID for a port.
- Get/Set the native VLAN ID for a port.
- Set VLAN membership for a given interface.
- Get the VLAN list with allowed VLANs for the given mode and interface.
- Get the VLAN list with forbidden VLANs for the given mode and interface.
- Get the untagged VLAN list for the general mode and interface.
- Get the tagged VLAN list for the general mode and interface.
- Get the dynamically added VLAN list for the general mode and interface.
- Get the private VLAN mode for an interface.
- Get the private VLAN host mode and promiscuous mode associations for an interface.
- Get the private VLAN list of operational VLANs for an interface.
- Iterate through the private VLAN primary/secondary VLANs for a promiscuous or isolated trunk interface.
- Get the private VLAN native VLAN for a promiscuous or isolated trunk interface.
- Get the private VLAN list of normal VLANs carried by a promiscuous or isolated trunk interface.
- Add VLAN MAC association.
- Delete VLAN MAC association.
- Get VLAN MAC association details of an entry.
- get next VLAN MAC association details of a given mac address.
- Enable/Disable Auto-Trunk capability in the switch.
- Get the operational Auto-Trunk status for an interface.
- Get dot1q Max Supported VLANs.
- Get the max VLAN entries allowed.
- Get the number of static VLANs.
- Get the number of dynamic VLANs.
- Get the number of times a VLAN entry has been deleted from DOT1Q table.
- Get the tagging configuration for a member port.
- Gets the next VLAN ID.
- Get the Ingress Filtering configuration for a port.
- Set the Ingress Filtering configuration for a port.
- Get VLAN ingress filtering status per port.
- Get the Current Ingress Filtering configuration for a port.
- Get a list of VLANs an interface is a member of.
- Gets the number of packets that are not forwarded on the specified interface.
- Gets the VLAN type for the specified VLAN.
All 'Set' operations would affect the Switch behavior and configuration.
Example C Application vlan_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_example
vlan_example.c is a sample application that demonstrates the use of the VLAN OpEN APIs. The vlan_example is started from the command line. It exercises all the VLAN OpEN APIs with appropriate arguments to manage the VLAN component in the EFOS main process (switchdrvr).
application performs the following tests:
- Loops through all the existing VLANs in the switch.
- Configures, unconfigures and verifies VLANs in the switch.
- Checks static VLAN configuration in the switch.
- Tests Port VLAN ID (PVID) configuration of a switch interface.
- Checks an interface's tagging and participation setting for a specific VLAN.
- Fetches the next VLAN which has a pending change or a pending deletion.
- Configures/verifies name for a specific VLAN.
- Configures the Switchport configuration modes for a port.
- Configures/verifies the access and native VLAN ID for a port.
- Changes and verifies VLAN membership for a given interface.
- Fetches VLAN list with allowed and forbidden VLANs for the given mode and interface.
- Fetches untagged/tagged VLAN list for the general mode and interface.
- Checks the dynamically added VLAN list for the general mode and interface.
- Gets the private VLAN mode for an interface.
- Gets the private VLAN host mode and promiscuous mode associations for an interface.
- Gets the private VLAN list of operational VLANs for an interface.
- Iterates through the private VLAN primary/secondary VLANs for a promiscuous or isolated trunk interface.
- Gets the private VLAN native VLAN for a promiscuous or isolated trunk interface.
- Gets the private VLAN list of normal VLANs carried by a promiscuous or isolated trunk interface.
- Adds/deletes VLAN MAC association.
- Gets VLAN MAC association details of an entry.
- Fetches next VLAN MAC association details of a given mac address.
- Enables/Disables Auto-Trunk capability in the switch.
- Gets the operational Auto-Trunk status for an interface.
- Gets dot1q Max Supported VLANs.
- Gets the max VLAN entries allowed.
- Gets the number of static VLANs.
- Gets the number of dynamic VLANs.
- Gets the number of times a VLAN entry has been deleted from DOT1Q table.
- Gets the tagging configuration for a member port.
- Gets the next VLAN ID.
- Gets the Ingress Filtering configuration for a port.
- Sets the Ingress Filtering configuration for a port.
- Gets VLAN ingress filtering status per port.
- Gets the Current Ingress Filtering configuration for a port.
- Gets a list of VLANs an interface is a member of.
- Gets the number of packets that are not forwarded on the specified interface.
- Gets the VLAN type for the specified VLAN.
Example Python Application vlan_example
In addition to vlan_example.c, a python implementation has also been provided for demonstration purposes. This python vlan_example.py script essentially duplicates the vlan_example.c implementation.
Example Ruby Application vlan_example
In addition to vlan_example.c, a ruby implementation has also been provided for demonstration purposes. This ruby vlan_example.rb application essentially duplicates the vlan_example.c implementation.
Example C Application switchport_config_example
switchport_config_example
switchport_config_example.c is a sample application that demonstrates the use of the switchport related OpEN API functions. The switchport_config_example is started from the command line. It creates several VLANs to demonstrate how to set/get native VLAN, access VLAN, and allowed VLAN lists.
Example C Application pvlan_example
pvlan_example
pvlan_example.c is a sample application that demonstrates the use of the Private VLAN OpEN API functions. The pvlan_example is started from the command line. It shows several aspects of previously-created Private VLAN configuration information for a specified interface.
Usage: pvlan_example <test#> <interface> <arg1> <arg2> ...
- Test 1: Get PVLAN Interface Mode: pvlan_example 1 <interface>
- Test 2: Get PVLAN Interface Host Association: pvlan_example 2 <interface>
- Test 3: Get PVLAN Interface Promiscuous Association: pvlan_example 3 <interface>
- Test 4: Get PVLAN Interface Operational VLANs: pvlan_example 4 <interface>
- Test 5: List all PVLAN Interface Promiscuous Trunk Associations: pvlan_example 5 <interface>
- Test 6: List all PVLAN Interface Isolated Trunk Associations: pvlan_example 6 <interface>
- Test 7: Get PVLAN Interface Trunk Native VLAN: pvlan_example 7 <interface>
- Test 8: Get PVLAN Interface Trunk Normal VLANs: pvlan_example 8 <interface>
- Test 9: Test PVLAN OpEN APIs sanity: pvlan_example 9 <interface>
Note: For best results, please configure private VLANs in the switch prior to running this example.
Example C Application vlan_mac_example
vlan_mac_example
vlan_mac_example.c is a sample application that demonstrates the use of the MAC VLAN OpEN API functions. The vlan_mac_example is started from the command line. It shows several aspects of previously-created MAC VLAN configuration information for a specified interface.
Usage: vlan_mac_example <test#> <arg1> <arg2> ...
- Test 1: Add MAC association to VLAN: vlan_mac_example 1 <macAddress> <vlanId>
- Test 2: Delete MAC association to VLAN: vlan_mac_example 2 <macAddress>
- Test 3: Gets the vlan association of a given MAC: vlan_mac_example 3 <macAddress>
- Test 4: Gets the next vlan mac association of a given MAC: vlan_mac_example 4 <macAddress>
VLAN CLI/API Cross Reference