OpenNSL API Guide and Reference Manual
Macros | Functions | Variables
example_vxlan.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sal/driver.h>
#include <opennsl/error.h>
#include <opennsl/l2.h>
#include <opennsl/switch.h>
#include <opennsl/vlan.h>
#include <opennsl/tunnel.h>
#include <opennsl/multicast.h>
#include <opennsl/vxlan.h>
#include <examples/util.h>

Go to the source code of this file.

Macros

#define DEFAULT_UNIT   0
 
#define DEFAULT_VLAN   1
 
#define FALSE   0
 
#define MAX_DIGITS_IN_CHOICE   5
 
#define TRUE   1
 
#define VXLAN_UDP_DEST_PORT   4789
 

Functions

int add_to_l2_table (int unit, opennsl_mac_t mac, opennsl_vpn_t vpn_id, int port)
 Add L2 entry based on the MAC, VPN and physical port.
 
int main (int argc, char *argv[])
 Main function for VxLAN application.
 
int vlan_create_add_port (int unit, int vid, int port)
 Create VLAN and add a port to it.
 

Variables

char example_usage []
 
int verbose = 3
 

Macro Definition Documentation

#define DEFAULT_UNIT   0

Definition at line 71 of file example_vxlan.c.

Referenced by main().

#define DEFAULT_VLAN   1

Definition at line 72 of file example_vxlan.c.

#define FALSE   0

Definition at line 86 of file example_vxlan.c.

#define MAX_DIGITS_IN_CHOICE   5

Definition at line 73 of file example_vxlan.c.

#define TRUE   1

Definition at line 85 of file example_vxlan.c.

#define VXLAN_UDP_DEST_PORT   4789

Definition at line 87 of file example_vxlan.c.

Function Documentation

int add_to_l2_table ( int  unit,
opennsl_mac_t  mac,
opennsl_vpn_t  vpn_id,
int  port 
)

Add L2 entry based on the MAC, VPN and physical port.

Parameters
unit[IN] Unit number
mac[IN] 802.3 MAC address
vpn_id[IN] VPN Identifier
port[IN] Port number
Returns
OPENNSL_E_XXX OpenNSL API return code

Definition at line 344 of file example_vxlan.c.

References opennsl_l2_addr_s::flags, OPENNSL_E_NONE, opennsl_l2_addr_add(), opennsl_l2_addr_t_init(), OPENNSL_L2_STATIC, opennsl_l2_addr_s::port, and port().

int main ( int  argc,
char *  argv[] 
)

Main function for VxLAN application.

Parameters
argc,argvcommands line arguments
Returns
OPENNSL_E_XXX OpenNSL API return code

Definition at line 748 of file example_vxlan.c.

References DEFAULT_UNIT, example_port_default_config(), example_read_user_choice(), example_usage, example_vxlan(), NULL, opennsl_driver_exit(), opennsl_driver_init(), OPENNSL_E_NONE, OPENNSL_E_PARAM, and opennsl_errmsg.

int vlan_create_add_port ( int  unit,
int  vid,
int  port 
)

Create VLAN and add a port to it.

Parameters
unit[IN] Unit number
vid[IN] VLAN Identifier
port[IN] Port number
Returns
OPENNSL_E_XXX OpenNSL API return code

Definition at line 370 of file example_vxlan.c.

References OPENNSL_IF_ERROR_RETURN, OPENNSL_PBMP_CLEAR, OPENNSL_PBMP_PORT_ADD, opennsl_vlan_create(), and opennsl_vlan_port_add().

Variable Documentation

char example_usage[]
Initial value:
=
"Syntax: example_vxlan \n\r"
" \n\r"
"Paramaters: None. \n\r"
" \n\r"
"Usage Guidelines: None. \n\r"

Definition at line 75 of file example_vxlan.c.

int verbose = 3

Definition at line 83 of file example_vxlan.c.