38 #define DEFAULT_UNIT 0
39 #define DEFAULT_VLAN 1
40 #define MCAST_GROUP_ID 10
43 "Syntax: example_l2_multicast \n\r"
45 "Paramaters: None \n\r"
47 "Example: The following command is used to create a multicast group \n\r"
48 " and add or delete multicast members. \n\r"
49 " example_l2_multicast \n\r"
51 "Usage Guidelines: This program request the user to enter the following\n\r"
52 " parameters interactively \n\r"
53 " MAC address - Multicast group MAC address \n\r"
54 " port - Multicast group port members \n\r"
57 " 1) Add ports to the multicast group and verify that traffic \n\r"
58 " destined to Multicast MAC address is received by all \n\r"
59 " multicast group members. \n\r"
60 " 2) Remove a port from the multicast group and verify that \n\r"
61 " traffic destined to Multicast MAC address is not received \n\r"
62 " by removed multicast group member. \n\r"
63 " 3) Verify that traffic to unknown unicast MAC address is \n\r"
64 " received by all ports in the VLAN. \n\r"
80 int is_mc,
int dest_gport,
int dest_mcg)
93 l2_addr.
port = dest_gport;
136 int main(
int argc,
char *argv[])
149 if((argc != 1) || ((argc > 1) && (strcmp(argv[1],
"--help") == 0))) {
158 printf(
"\r\nFailed to initialize the system. Error: %s\r\n",
165 printf(
"\r\nFailed to apply default config on ports, rc = %d (%s).\r\n",
170 printf(
"Adding ports to default vlan.\r\n");
173 printf(
"\r\nFailed to add default ports. Error: %s\r\n",
179 printf(
"\r\nFailed to create multicast group. Error: %s\r\n",
184 printf(
"Enter multicast MAC address in xx:xx:xx:xx:xx:xx format "
185 "(Ex: 01:00:00:01:02:03): \n");
188 printf(
"\n\rInvalid MAC address entered.\n\r");
194 printf(
"\n\rFailed to parse input MAC address.\n\r");
201 printf(
"\n\rFailed to update FDB with multicast MAC address. "
207 printf(
"\r\nUser menu: Select one of the following options\r\n");
208 printf(
"1. Add port to multicast group\n");
209 printf(
"2. Remove port from multicast group\n");
210 #ifdef INCLUDE_DIAG_SHELL
211 printf(
"9. Launch diagnostic shell\n");
213 printf(
"0. Quit the application.\r\n");
217 printf(
"Invalid option entered. Please re-enter.\n");
225 printf(
"Enter multicast group member port number: \n");
228 printf(
"Invalid option entered. Please re-enter.\n");
237 printf(
"Failed to get encapsulation ID, Error: %d\r\n",
246 printf(
"\r\nFailed to add the port to multicast group. "
251 printf(
"Port %d is added to Multicast group successfully\n", port);
257 printf(
"Enter multicast group member port number: \n");
260 printf(
"Invalid option entered. Please re-enter.\n");
268 printf(
"\r\nFailed to remove the port from multicast group. "
273 printf(
"Port %d is removed from Multicast group "
274 "successfully\n", port);
278 #ifdef INCLUDE_DIAG_SHELL
281 opennsl_driver_shell();
288 printf(
"Exiting the application.\n");