93 #define DEFAULT_UNIT 0
96 "Syntax: example_vxlan \n\r"
98 "Paramaters: None. \n\r"
100 "Usage Guidelines: None. \n\r";
220 { 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0 },
221 { 0x00, 0x00, 0x00, 0x00, 0x00, 0xf1 },
222 { 0x01, 0x00, 0x5E, 0x01, 0x01, 0x14 }
227 #define MY_MAC {0x00, 0x0c, 0x00, 0x02, 0x00, 0x00}
262 {{0x20, 0x00, 0x00, 0x00, 0xcd, 0x1d},
MY_MAC, 0xAA000011, 0,
275 int portmap[100] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
289 printf(
"Error in getting the chip info, Error = %s\n",
opennsl_errmsg(rv));
303 printf(
"device is not QMX\n");
323 printf(
"%s key: ", type);
326 printf(
"SIP: masked ");
327 }
else if (tunnel_term->
sip_mask == 0xFFFFFFFF) {
329 printf(
"/0x%08x ", tunnel_term->
sip_mask);
332 printf(
"DIP: masked ");
333 }
else if (tunnel_term->
dip_mask == 0xFFFFFFFF) {
335 printf(
"/0x%08x ", tunnel_term->
dip_mask);
338 printf(
"RIF: 0x%08x ", tunnel_term->
tunnel_if);
375 printf(
"Error, Failed to add L2 entry, Error %s\n",
opennsl_errmsg(rv));
380 printf(
"l2 entry: fid = %d ", vid);
382 printf(
" dest-port 0x%08x \n", port);
402 int *
ports,
int *cud,
int nof_mc_entries,
int is_egress)
407 for (i = 0; i < nof_mc_entries; i++) {
412 printf(
"Failed to add egress multicast entry, port %d encap_id: %d, Error %s\n", ports[i],
421 printf(
"Error, opennsl_multicast_ingress_add: port %d encap_id: %d \n",
444 int sys_port,
int gport,
uint8 is_egress)
451 printf(
"Failed to get multicast encapsulation ID for Multicast group 0x%08x"
452 " phy_port: 0x%08x gport: 0x%08x, Error %s\n",
458 &encap_id, 1, is_egress);
460 printf(
"Failed to add multicast entry for mc_group_id: 0x%08x "
461 "phy_port: 0x%08x gport: 0x%08x, Error %s \n",
488 printf(
"Failed to add a port to vswitch, Error %s\n",
opennsl_errmsg(rv));
492 printf(
"add access port 0x%08x to vswitch %d (0x%08x) \n\r", gport, vsi, vsi);
498 printf(
"Failed to add a port to multicast group, phy_port: 0x%08x "
499 "gport: 0x%08x, Error %s\n", phy_port, gport,
opennsl_errmsg(rv));
503 printf(
"add access port 0x%08x to multicast in unit %d\n", gport, unit);
527 printf(
"Failed to get encapsulation ID for mc_group_id: 0x%08x "
528 "phy_port: 0x%08x vlan_port: 0x%08x, Error %s \n",
535 printf(
"Failed to delete phy_port: 0x%08x from multicast group ID %d, Error %s\n",
539 printf (
"Deleted phy_port: 0x%08x, encap_id:0x%08x from multicast group with ID: 0x%08x\n",
546 printf(
"Failed to remove port 0x%08x from vsi 0x%08x, Error %s\n",
551 printf(
"Removed port 0x%08x from vswitch 0x%08x\n\r", vlan_port, vsi);
579 printf(
"Failed to opensl vlan(%d), Error %s", vlan,
opennsl_errmsg(rv));
585 printf(
"Created vlan:%d \n", vlan);
614 printf(
"Failed to add port(0x%08x) to vlan %d, Error %s\n",
617 printf(
"Added port %d (0x%08x) to vlan %d\n", port, port, vlan);
632 int unit,
int network_port,
int access_port)
658 int unit,
int *mc_group_id,
int extra_flags)
673 printf(
"Failed to create multicast group with ID %d, Error %s\n",
679 printf(
"Created egress mc_group %d (0x%x) \n", *mc_group_id, *mc_group_id);
681 printf(
"Created ingress mc_group %d (0x%x) \n", *mc_group_id, *mc_group_id);
717 l3egid = l3_egress->
fec_id;
721 printf(
"Failed to create egress egress object, Error %s\n",
opennsl_errmsg(rv));
725 l3_egress->
fec_id = l3egid;
729 printf(
"VLAN:%d created FEC-id = 0x%08x, ", l3eg.
vlan,
737 printf(
"mac-address: %02x:%02x:%02x:%02x:%02x:%02x",
775 int is_urpf_mode_per_rif = 0;
776 int enable_public = 0;
799 printf(
"Failed to add L2 station, Error %s\n",
opennsl_errmsg(rv));
835 printf(
"intf 0x%x already exist, just replacing\n",
845 printf(
"Failed to create L3 interface, Error %s\n",
opennsl_errmsg(rv));
851 l3_ing_if.
vrf = l3_intf->
vrf;
853 if (l3_intf->
rpf_valid && !is_urpf_mode_per_rif) {
880 printf(
"Failed to create L3 ingress interface, Error %s\n",
opennsl_errmsg(rv));
887 (
"created ingress interface = %d, on vlan = %d in unit %d, vrf = %d, skip_mymac:%d ",
889 printf(
"mac: %02x:%02x:%02x:%02x:%02x:%02x\n\r",
914 memset(&intf, 0,
sizeof(intf));
916 intf.
vsi = provider_vlan;
923 printf(
"Failed to create L3 interface, Error %s\n",
opennsl_errmsg(rv));
948 ip_tunnel_term.
dip = ip_tunnel_info.
sip;
949 ip_tunnel_term.
dip_mask = 0xFFFFFFFF;
950 ip_tunnel_term.
sip = ip_tunnel_info.
dip;
951 ip_tunnel_term.
sip_mask = 0xFFFFFFFF;
957 printf(
"Failed to create tunnel terminator, Error %s\n",
opennsl_errmsg(rv));
960 printf(
"created tunnel terminator = 0x%08x \n", ip_tunnel_term.
tunnel_id);
963 *in_tunnel_gport_p = ip_tunnel_term.
tunnel_id;
990 ip_tunnel.
dip = ip_tunnel_info.
dip;
991 ip_tunnel.
sip = ip_tunnel_info.
sip;
993 ip_tunnel.
ttl = ip_tunnel_info.
ttl;
995 ip_tunnel.
vlan = tunnel_vlan;
999 ip_tunnel.
dscp = ip_tunnel_info.
dscp;
1004 printf(
"Failed to add IP tunnel, Error %s\n",
opennsl_errmsg(rv));
1007 printf(
"Created IP tunnel on intf : 0x%08x ", tunnel_itf);
1021 printf(
"created tunnel initiator gport : 0x%08x vlan : %d "
1022 "g_vxlan.tunnel_init_intf_id : 0x%08x\n", *tunnel_gportp,
1041 int unit,
int tunnel_vlan,
1053 memset(&l3eg1, 0,
sizeof(l3eg1));
1057 l3eg1.
vlan = tunnel_vlan;
1063 printf(
"Failed to create L3 egress object, Error %s\n",
opennsl_errmsg(rv));
1068 *tunnel_fec_p = l3eg1.
fec_id;
1070 printf(
"Created FEC-id = 0x%08x\n", *tunnel_fec_p);
1104 printf(
"Failed to create tunnel initiator, Error %s\n",
opennsl_errmsg(rv));
1125 memset(vxlan_port_add, 0,
sizeof(*vxlan_port_add));
1146 int sys_port,
int gport,
uint8 is_egress)
1155 (
"Failed to vxlan encapsulation ID for mc_group_id: 0x%08x "
1156 "phy_port: 0x%08x gport: 0x%08x, Error %s\n",
1163 printf(
"The multicast entry already exists \n");
1166 printf(
"Failed to update ingress multicast group for mc_group_id: 0x%08x "
1167 "phy_port: 0x%08x encap_id: 0x%08x, Error %s\n",
1171 printf(
"Added sys_port %d to mc_group_id %d encap_id: 0x%08x\n", sys_port, mc_group_id, encap_id);
1212 printf(
"Failed to add vxlan port, Error %s\n",
opennsl_errmsg(rv));
1219 printf(
"vxlan port created, vxlan_port_id: 0x%08x \n",
1221 printf(
"vxlan port is config with:\n");
1222 printf(
" ip in tunnel termination gport:0x%08x \n", vxlan_port_add->
in_tunnel);
1224 printf(
" FEC entry (contains ip tunnel encapsulation information):0x%08x \n",
1227 printf(
" ip tunnel initiator gport:0x%08x\n", vxlan_port_add->
out_tunnel);
1229 printf(
" vpn: 0x%08x\n\r", vxlan_port_add->
vpn);
1230 printf(
" vxlan lif orientation: network_group_id = %d\n\r", vxlan_port_add->
network_group_id);
1236 printf(
"Failed to add vxlan port to multicast group, Error %s\n",
opennsl_errmsg(rv));
1240 printf(
"add vxlan-port 0x%08x to VPN flooding group %d (0x%08x)\n\r",
1258 if (vx_info !=
NULL) {
1259 memcpy(&g_vxlan, vx_info,
sizeof(g_vxlan));
1274 memcpy(vx_info, &g_vxlan,
sizeof(g_vxlan));
1290 int mc_group_id = vpn;
1296 printf(
"Failed to create multicast group, Error %s\n",
opennsl_errmsg(rv));
1305 vpn_config.
vpn = vpn;
1309 vpn_config.
vnid = vni;
1316 printf(
"Failed to create vxlan vpn, Error %s\n",
opennsl_errmsg(rv));
1320 printf(
"Created vpn %d (0x%08x)\n\r", vpn, vpn);
1343 vport1.
port = in_port;
1351 printf(
"Failed to create vlan_port filter, Error %s\n",
opennsl_errmsg(rv));
1357 (
"Add vlan-port-id: 0x%08x in-port: %d (0x%08x) match_vlan: %d "
1358 "egress_vlan: %d match_inner_vlan: %d\n\r", vport1.
vlan_port_id,
1389 int vxlan_port_flags = 0;
1402 printf(
"Parameters \n");
1403 printf(
"Ports (Network: %d, Access: %d)\n", network_port, access_port);
1404 printf(
"Vlans (Provider:%d Tunnel:%d Access:%d)\n",
1408 printf(
"VPN: %d VNI: %d(0x%x)\n", vpn_id, g_vxlan.
vni, g_vxlan.
vni);
1421 printf(
"Failed to initialize vxlan, Error %s\n",
opennsl_errmsg(rv));
1430 printf(
"Failed to open vpn %d, Error %s\n", vpn_id,
opennsl_errmsg(rv));
1436 printf(
"Failed to create VLAN inLIF 0x%08x, Error %s\n", g_vxlan.
vlan_inLif,
1443 printf(
"Failed to add inLif to VSI or adding access port to multicast "
1452 printf(
"Failed to build tunnel initiator network_port %d, Error %s\n",
1460 printf(
"Failed to create FEC, network_port %d, Error %s\n",
1465 printf(
"out-tunnel gport-id: 0x%08x FEC-id:0x%08x\n\r",
1474 printf(
"Failed to build tunnel termination, Error %s\n",
opennsl_errmsg(rv));
1481 printf(
"Failed to create L3 interface on provider VLAN, Error %s\n",
opennsl_errmsg(rv));
1496 vxlan_port_add.
flags = vxlan_port_flags;
1500 printf(
"Failed to add vxlan tunnel, in_gport=0x%08x --> out_intf=0x%08x, "
1509 printf(
"vxlan port created, vxlan_port_id: 0x%08x \n", g_vxlan.
vxlan_gport);
1515 printf(
"Failed to update FDB for vlan %d port 0x%08x, Error %s\n",
1522 printf(
"Failed to update FDB for vlan %d port 0x%08x, Error %s\n",
1536 printf(
"Failed to FDB with multicast entry, Error %s\n",
opennsl_errmsg(rv));
1561 if(strcmp(argv[0],
"gdb") == 0)
1566 if((argc != (index + 1)) || ((argc > (index + 1)) && (strcmp(argv[index + 1],
"--help") == 0))) {
1572 printf(
"Initializing the switch device.\r\n");
1576 printf(
"\r\nFailed to initialize the switch device. Error %s\r\n",
1584 printf(
"\r\nFailed to apply default config on ports, rv = %d (%s).\r\n",
1589 printf(
"\r\nUser menu: Select one of the following options\r\n");
1590 printf(
"1. Configure VxLAN segment\n");
1591 #ifdef INCLUDE_DIAG_SHELL
1592 printf(
"9. Launch diagnostic shell\n");
1594 printf(
"0. Quit the application\n");
1598 printf(
"Invalid option entered. Please re-enter.\n");
1606 printf(
"a. Enter Access port number\n");
1609 printf(
"Invalid option entered. Please re-enter.\n");
1613 printf(
"b. Enter Network port number\n");
1616 printf(
"Invalid option entered. Please re-enter.\n");
1620 printf(
"c. Enter VPN ID (Ex: 9216)\n");
1623 printf(
"Invalid option entered. Please re-enter.\n");
1630 printf(
"\r\nVxLAN configuration has failed.\n");
1634 printf(
"\r\nVxLAN configuration is done successfully\n");
1638 #ifdef INCLUDE_DIAG_SHELL
1641 opennsl_driver_shell();
1648 printf(
"Exiting the application.\n");