#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "rpcclt_openapi.h"
#include "proc_util.h"
static void printAppMenu(char *name)
{
printf("Usage: %s <test#> <arg1> <arg2> ... \n", name);
printf("Test 1: Get the administrative mode of the router for given VRF: %s 1 <vrfName>\n", name);
printf("Test 2: Set the administrative mode of the router for given VRF: %s 2 <vrfName> <mode>\n", name);
printf("Test 3: Get the dynamic renewal mode of IPv6 neighbors in a given VRF: %s 3 <vrfName>\n", name);
printf("Test 4: Set the dynamic renewal mode of IPv6 neighbors in a given VRF: %s 4 <vrfName> <mode>\n", name);
printf("Test 5: Get the NUD backoff-multiple value set for calculation of timeouts for NS transmissions during NUD for a given VRF: %s 5 <vrfName>\n", name);
printf("Test 6: Set the NUD backoff-multiple value for calculation of timeouts for NS transmissions during NUD for a given VRF: %s 6 <vrfName> <val>\n", name);
printf("Test 7: Get the maximum unicast neighbor solicitations sent during NUD for a given VRF: %s 7 <vrfName>\n", name);
printf("Test 8: Set the maximum unicast neighbor solicitations sent during NUD for a given VRF: %s 8 <vrfName> <val>\n", name);
printf("Test 9: Get the maximum multicast neighbor solicitations sent during NUD for a given VRF: %s 9 <vrfName>\n", name);
printf("Test 10: Set the maximum multicast neighbor solicitations sent during NUD for a given VRF: %s 10 <vrfName> <val>\n", name);
printf("Test 11: Get the rate limit value set for the unresolved IPv6 data packets coming to CPU: %s 11\n", name);
printf("Test 12: Set the rate limit value for the unresolved IPv6 data packets coming to CPU: %s 12 <val>\n", name);
printf("Test 13: Get the default IPv6 router TTL value for a given VRF: %s 13 <vrfName>\n", name);
printf("Test 14: Set the default IPv6 router TTL value for a given VRF: %s 14 <vrfName> <val>\n", name);
printf("Test 15: Get the administrative state of a given interface: %s 15 <ifNum>\n", name);
printf("Test 16: Get the operational state of a given interface: %s 16 <ifNum>\n", name);
printf("Test 17: Set the administrative state of a given interface: %s 17 <ifNum> <mode>\n", name);
printf("Test 18: Get the IPv6 AutoState mode of a given interface: %s 18 <ifNum>\n", name);
printf("Test 19: Set the IPv6 AutoState mode of a given interface: %s 19 <ifNum> <mode>\n", name);
printf("Test 20: Determine if IPv6 interface exists: %s 20 <ifNum>\n", name);
printf("Test 21: Determine if the interface is valid for participation in the IPv6 component: %s 21 <ifNum>\n", name);
printf("Test 22: Determine if the interface is valid to be configured with an IPv6 neighbor: %s 22 <ifNum>\n", name);
printf("Test 23: Get the IPv6 MTU of a given interface: %s 23 <ifNum>\n", name);
printf("Test 24: Get the IPv6 effective MTU of a given interface: %s 24 <ifNum>\n", name);
printf("Test 25: Set the IPv6 MTU of a given interface: %s 25 <ifNum> <val>\n", name);
printf("Test 26: Get the interface bandwidth of a given interface: %s 26 <ifNum>\n", name);
printf("Test 27: Get the first valid interface for participation in IPv6 component: %s 27\n", name);
printf("Test 28: Get the next valid interface for participation in IPv6 component: %s 28 <prevIfNum>\n", name);
printf("Test 29: Get the maximum IP MTU that may be set on an interface: %s 29 <ifNum>\n", name);
printf("Test 30: Get IPv6 statistics for the given interface: %s 30 <intIfNum>\n", name);
printf("Test 31: Get IPv6 ICMP statistics for the given interface: %s 31 <intIfNum>\n", name);
printf("Test 32: Clear IPv6 statistics for the given interface: %s 32 <intIfNum>\n", name);
printf("Test 33: Get total of each IPv6 statistic on all interfaces: %s 33 \n", name);
printf("Test 34: Clear IPv6 statistics on all interfaces: %s 34 \n", name);
printf("Test 35: Get the IPv6 Route table: %s 35 <vrfName> <bestRouteOnly (0-Flase, 1-True)>\n", name);
printf("Test 36: Get the number of routes in the routing table: %s 36 <vrfName> <bestRouteOnly (0-Flase, 1-True)>\n", name);
printf("Test 37: Get the configured IPv6 addresses on the interface: %s 37 <intIfNum> <numAddr>\n", name);
printf("Test 38: Get the number of neighbor solicits configured to be set for duplicate address detection (DAD) on an interface: %s 38 <intIfNum>\n", name);
printf("Test 39: Set the number of neighbor solicits to be sent for duplicate address detection (DAD) on an interface: %s 39 <intIfNum> <val>\n", name);
printf("Test 40: Get the interval between IPv6 neighbor solicitation retransmissions on an interface: %s 40 <intIfNum>\n", name);
printf("Test 41: Set the interval between IPv6 neighbor solicitation retransmissions on an interface: %s 41 <intIfNum> <val>\n", name);
printf("Test 42: Get the amount of time that a remote IPv6 node is reachable: %s 42 <intIfNum>\n", name);
printf("Test 43: Set the amount of time that a remote IPv6 node is reachable: %s 43 <intIfNum> <val>\n", name);
printf("Test 44: Get the configured mode for ICMPv6 unreachable messages: %s 44 <intIfNum>\n", name);
printf("Test 45: Set the configured mode for ICMPv6 unreachable messages: %s 45 <intIfNum> <mode (0-Disable, 1-Enable)>\n", name);
printf("Test 46: Get the IPv6 address details: %s 46 <intIfNum> <ipv6Address>\n", name);
printf("Test 47: Get the IPv6 address details of all the entries: %s 47\n", name);
printf("Test 48: Get the IPv6 address prefix details: %s 48 <intIfNum> <ipv6Address> <pfxLen>\n", name);
printf("Test 49: Get the IPv6 addresses of the interface: %s 49 <intIfNum> <numAddr>\n", name);
printf("Test 50: Get the IPv6 address of the interface: %s 50 <intIfNum>\n", name);
printf("Test 51: Get the IPv6 neighbor entries: %s 51 <vrfName> <intIfNum>\n", name);
printf("Test 52: Flush the IPv6 neighbor entries: %s 52 <vrfName> <intIfNum>\n", name);
printf("Test 53: Get the static IPv6 routes from the routing table: %s 53\n", name);
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("ERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.
pstart = vrfNameStr;
vrfNameBufd.
size = strlen(vrfNameStr) + 1;
switch(result)
{
printf("\nThe IPv6 administrative mode of the router for given VRF is %u (1-Enabled, 0-Disabled).\n", adminMode);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the IPv6 administrative mode of the router for given VRF. (result = %d)\n", result);
break;
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("\nERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
if (1 < mode)
{
printf("\nERROR: Invalid mode value. Expected 0(for Disable) or 1(for Enable).\n");
return;
}
if (1 == mode)
{
}
switch(result)
{
printf("\nSuccessfully set the IPv6 administrative mode of the router for given VRF.\n");
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to set the IPv6 administrative mode of the router for given VRF. (result = %d)\n", result);
break;
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("\nERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
switch(result)
{
printf("\nThe dynamic renewal mode of IPv6 neighbors for default VRF is %u (1-Enabled, 0-Disabled).\n", adminMode);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the dynamic renewal mode of IPv6 neighbors in a given VRF. (result = %d)\n", result);
break;
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("\nERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
if (1 < mode)
{
printf("\nERROR: Invalid mode value. Expected 0(for Disable) or 1(for Enable).\n");
return;
}
if (1 == mode)
{
}
switch(result)
{
printf("\nSuccessfully set the dynamic renewal mode of IPv6 neighbors in the given VRF.\n");
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to set the dynamic renewal mode of IPv6 neighbors in a given VRF. (result = %d)\n", result);
break;
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
uint32_t val = 0;
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("\nERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
switch(result)
{
printf("\nThe NUD backoff-multiple value set for calculation of timeouts for NS transmissions during NUD for given VRF is %u.\n", val);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get NUD backoff-multiple value set for calculation of timeouts for NS transmissions during NUD for a given VRF. (result = %d)\n", result);
break;
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("\nERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
switch(result)
{
printf("\nSuccessfully set the NUD backoff-multiple value for calculation of timeouts for NS transmissions during NUD for the given VRF.\n");
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to set the NUD backoff-multiple value for calculation of timeouts for NS transmissions during NUD for given VRF. (result = %d)\n", result);
break;
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
uint32_t val = 0;
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("\nERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
switch(result)
{
printf("\nThe maximum unicast neighbor solicitations sent during NUD for the given VRF is %u.\n", val);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the maximum unicast neighbor solicitations sent during NUD for the given VRF. (result = %d)\n", result);
break;
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("\nERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
switch(result)
{
printf("\nSuccessfully set the maximum unicast neighbor solicitations sent during NUD for the given VRF.\n");
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to set the maximum unicast neighbor solicitations sent during NUD for the given VRF. (result = %d)\n", result);
break;
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
uint32_t val = 0;
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("\nERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
switch(result)
{
printf("\nThe maximum multicast neighbor solicitations sent during NUD for the given VRF is %u.\n", val);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the maximum multicast neighbor solicitations sent during NUD for the given VRF. (result = %d)\n", result);
break;
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("\nERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
switch(result)
{
printf("\nSuccessfully set the maximum multicast neighbor solicitations sent during NUD for the given VRF.\n");
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to set the maximum multicast neighbor solicitations sent during NUD for the given VRF. (result = %d)\n", result);
break;
}
return;
}
{
uint32_t val = 0;
switch(result)
{
printf("\nThe rate limit value set for the unresolved IPv6 data packets coming to CPU is %u.\n", val);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the rate limit value set for the unresolved IPv6 data packets coming to CPU. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf("\nSuccessfully set the rate limit value for the unresolved IPv6 data packets coming to CPU.\n");
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to set the rate limit value for the unresolved IPv6 data packets coming to CPU. (result = %d)\n", result);
break;
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
uint32_t val = 0;
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("\nERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
switch(result)
{
printf("\nThe default IPv6 router TTL value for the given VRF is %u.\n", val);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the default IPv6 router TTL value for the given VRF. (result = %d)\n", result);
break;
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
memset(vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("\nERROR: Invalid VRF name string.\n");
return;
}
strncpy(vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
switch(result)
{
printf("\nSuccessfully set the default IPv6 router TTL value for the given VRF.\n");
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to set the default IPv6 router TTL value for the given VRF. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf("\nThe IPv6 administrative state of a given interface is %u (1-Enabled, 0-Disabled).\n", adminMode);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the IPv6 administrative state of a given interface. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf("\nThe operational state of a given interface is %u (1-Enabled, 0-Disabled).\n", adminMode);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the operational state of a given interface. (result = %d)\n", result);
break;
}
return;
}
{
if (1 < mode)
{
printf("\n Invalid mode value. Expected 0(for Disable) or 1(for Enable).\n");
return;
}
if (1 == mode)
{
}
switch(result)
{
printf("\nSuccessfully set the IPv6 administrative state of the given interface.\n");
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to set the IPv6 administrative state of the given interface. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf("\nThe IPv6 AutoState mode of a given interface is %u (1-Enabled, 0-Disabled).\n", adminMode);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the IPv6 AutoState mode of a given interface. (result = %d)\n", result);
break;
}
return;
}
void ip6RtrIntfAutoStateModeSet(
openapiClientHandle_t *client_handle, uint32_t ifNum, uint32_t autoStateMode)
{
if (1 < autoStateMode)
{
printf("\nERROR: Invalid mode value. Expected 0(for Disable) or 1(for Enable).\n");
return;
}
if (1 == autoStateMode)
{
}
switch(result)
{
printf("\nSuccessfully set the IPv6 AutoState mode of the given interface.\n");
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to set the IPv6 AutoState mode of a given interface. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf("\nTRUE.\n");
break;
printf("\nFALSE.\n");
break;
default:
printf("\nERROR: Bad return code trying to determine if IPv6 interface exists. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf("\nTRUE.\n");
break;
printf("\nFALSE.\n");
break;
default:
printf("\nERROR: Bad return code trying to determine if the interface is valid for participation in the IPv6 component. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf("\nTRUE.\n");
break;
printf("\nFALSE.\n");
break;
default:
printf("\nERROR: Bad return code trying to determine if the interface is valid to be configured with an IPv6 neighbor. (result = %d)\n", result);
break;
}
return;
}
{
uint32_t val = 0;
switch(result)
{
printf("\nThe IPv6 MTU of the given interface is %u.\n", val);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the IPv6 MTU of a given interface. (result = %d)\n", result);
break;
}
return;
}
{
uint32_t val = 0;
switch(result)
{
printf("\nThe IPv6 effective MTU of the given interface is %u.\n", val);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the IPv6 effective MTU of a given interface. (result = %d)\n", result);
break;
}
return;
}
{
uint32_t val = 0;
switch(result)
{
printf("\nThe maximum IPv6 MTU that may be set on the given interface is %u.\n", val);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the maximum IPv6 MTU that may be set on the given interface. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf("\nSuccessfully set the IPv6 MTU of the given interface.\n");
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to set the IPv6 MTU of a given interface. (result = %d)\n", result);
break;
}
return;
}
{
uint32_t val = 0;
switch(result)
{
printf("\nThe interface bandwidth of a given interface is %u.\n", val);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the interface bandwidth of a given interface. (result = %d)\n", result);
break;
}
return;
}
{
uint32_t ifNum = 0;
switch(result)
{
printf("\nThe first valid interface for participation in IPv6 component is %u.\n", ifNum);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the first valid interface for participation in IPv6 component. (result = %d)\n", result);
break;
}
return;
}
{
uint32_t nextIfNum = 0;
switch(result)
{
printf("\nThe next valid interface for participation in IPv6 component is %u.\n", nextIfNum);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the next valid interface for participation in IPv6 component. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf ("\nIPv6 STATISTIC\n");
printf (
"Total Datagrams Received................................. %lu\n", ipv6IfStats.
ipv6IfStatsInReceives);
printf (
"Received Datagrams Locally Delivered..................... %lu\n", ipv6IfStats.
ipv6IfStatsInDelivers);
printf (
"Received Datagrams Discarded Due To Header Errors........ %lu\n", ipv6IfStats.
ipv6IfStatsInHdrErrors);
printf (
"Received Datagrams Discarded Due To MTU.................. %lu\n", ipv6IfStats.
ipv6IfStatsInTooBigErrors);
printf (
"Received Datagrams Discarded Due To No Route............. %lu\n", ipv6IfStats.
ipv6IfStatsInNoRoutes);
printf (
"Received Datagrams With Unknown Protocol................. %lu\n", ipv6IfStats.
ipv6IfStatsInUnknownProtos);
printf (
"Received Datagrams Discarded Due To Invalid Address...... %lu\n", ipv6IfStats.
ipv6IfStatsInAddrErrors);
printf (
"Received Datagrams Discarded Due To Truncated Data....... %lu\n", ipv6IfStats.
ipv6IfStatsInTruncatedPkts);
printf (
"Received Datagrams Discarded Other....................... %lu\n", ipv6IfStats.
ipv6IfStatsInDiscards);
printf (
"Received Datagrams Reassembly Required................... %lu\n", ipv6IfStats.
ipv6IfStatsReasmReqds);
printf (
"Datagrams Successfully Reassembled....................... %lu\n", ipv6IfStats.
ipv6IfStatsReasmOKs);
printf (
"Datagrams Failed To Reassemble........................... %lu\n", ipv6IfStats.
ipv6IfStatsReasmFails);
printf (
"Datagrams Forwarded...................................... %lu\n", ipv6IfStats.
ipv6IfStatsOutForwDatagrams);
printf (
"Datagrams Locally Transmitted............................ %lu\n", ipv6IfStats.
ipv6IfStatsOutRequests);
printf (
"Datagrams Transmit Failed................................ %lu\n", ipv6IfStats.
ipv6IfStatsOutDiscards);
printf (
"Datagrams Successfully Fragmented........................ %lu\n", ipv6IfStats.
ipv6IfStatsOutFragOKs);
printf (
"Datagrams Failed To Fragment............................. %lu\n", ipv6IfStats.
ipv6IfStatsOutFragFails);
printf (
"Fragments Created........................................ %lu\n", ipv6IfStats.
ipv6IfStatsOutFragCreates);
printf (
"Multicast Datagrams Received............................. %lu\n", ipv6IfStats.
ipv6IfStatsInMcastPkts);
printf (
"Multicast Datagrams Transmitted.......................... %lu\n", ipv6IfStats.
ipv6IfStatsOutMcastPkts);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the stats on interface. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf ("\nICMPv6 STATISTICS\n");
printf (
"Total ICMPv6 Messages Received........................... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInMsgs);
printf (
"ICMPv6 Messages With Errors Received..................... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInErrors);
printf (
"ICMPv6 Destination Unreachable Messages Received......... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInDestUnreachs);
printf (
"ICMPv6 Messages Prohibited Administratively Received..... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInAdminProhibs);
printf (
"ICMPv6 Time Exceeded Messages Received................... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInTimeExcds);
printf (
"ICMPv6 Parameter Problem Messages Received............... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInParmProblems);
printf (
"ICMPv6 Packet Too Big Messages Received.................. %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInPktTooBigs);
printf (
"ICMPv6 Echo Request Messages Received.................... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInEchos);
printf (
"ICMPv6 Echo Reply Messages Received...................... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInEchoReplies);
printf (
"ICMPv6 Router Solicit Messages Received.................. %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInRouterSolicits);
printf (
"ICMPv6 Router Advertisement Messages Received............ %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInRouterAdvertisements);
printf (
"ICMPv6 Neighbor Solicit Messages Received................ %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInNeighborSolicits);
printf (
"ICMPv6 Neighbor Advertisement Messages Received.......... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInNeighborAdvertisements);
printf (
"ICMPv6 Redirect Messages Received........................ %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInRedirects);
printf (
"ICMPv6 Group Membership Query Messages Received.......... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInGroupMembQueries);
printf (
"ICMPv6 Group Membership Response Messages Received....... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInGroupMembResponses);
printf (
"ICMPv6 Group Membership Reduction Messages Received...... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpInGroupMembReductions);
printf (
"Total ICMPv6 Messages Transmitted........................ %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutMsgs);
printf (
"ICMPv6 Messages Not Transmitted Due To Error............. %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutErrors);
printf (
"ICMPv6 Destination Unreachable Messages Transmitted...... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutDestUnreachs);
printf (
"ICMPv6 Messages Prohibited Administratively Transmitted.. %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutAdminProhibs);
printf (
"ICMPv6 Time Exceeded Messages Transmitted................ %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutTimeExcds);
printf (
"ICMPv6 Parameter Problem Messages Transmitted............ %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutParmProblems);
printf (
"ICMPv6 Packet Too Big Messages Transmitted............... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutPktTooBigs);
printf (
"ICMPv6 Echo Request Messages Transmitted................. %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutEchos);
printf (
"ICMPv6 Echo Reply Messages Transmitted................... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutEchoReplies);
printf (
"ICMPv6 Router Solicit Messages Transmitted............... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutRouterSolicits);
printf (
"ICMPv6 Router Advertisement Messages Transmitted......... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutRouterAdvertisements);
printf (
"ICMPv6 Neighbor Solicit Messages Transmitted............. %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutNeighborSolicits);
printf (
"ICMPv6 Neighbor Advertisement Messages Transmitted....... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutNeighborAdvertisements);
printf (
"ICMPv6 Redirect Messages Transmitted..................... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutRedirects);
printf (
"ICMPv6 Group Membership Query Messages Transmitted....... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutGroupMembQueries);
printf (
"ICMPv6 Group Membership Response Messages Transmitted.... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutGroupMembResponses);
printf (
"ICMPv6 Group Membership Reduction Messages Transmitted... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpOutGroupMembReductions);
printf (
"ICMPv6 Duplicate Address Detects......................... %lu\n", ipv6IfIcmpStats.
ipv6IfIcmpDupAddrDetects);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the stats on interface. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf("\nIPv6 Statistics are cleared on interface - %u.\n", intIfNum);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the stats on interface. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf ("\nIPv6 STATISTIC\n");
printf ("Total Datagrams Received................................. %lu\n", ipv6IfStats.ipv6IfStatsInReceives);
printf ("Received Datagrams Locally Delivered..................... %lu\n", ipv6IfStats.ipv6IfStatsInDelivers);
printf ("Received Datagrams Discarded Due To Header Errors........ %lu\n", ipv6IfStats.ipv6IfStatsInHdrErrors);
printf ("Received Datagrams Discarded Due To MTU.................. %lu\n", ipv6IfStats.ipv6IfStatsInTooBigErrors);
printf ("Received Datagrams Discarded Due To No Route............. %lu\n", ipv6IfStats.ipv6IfStatsInNoRoutes);
printf ("Received Datagrams With Unknown Protocol................. %lu\n", ipv6IfStats.ipv6IfStatsInUnknownProtos);
printf ("Received Datagrams Discarded Due To Invalid Address...... %lu\n", ipv6IfStats.ipv6IfStatsInAddrErrors);
printf ("Received Datagrams Discarded Due To Truncated Data....... %lu\n", ipv6IfStats.ipv6IfStatsInTruncatedPkts);
printf ("Received Datagrams Discarded Other....................... %lu\n", ipv6IfStats.ipv6IfStatsInDiscards);
printf ("Received Datagrams Reassembly Required................... %lu\n", ipv6IfStats.ipv6IfStatsReasmReqds);
printf ("Datagrams Successfully Reassembled....................... %lu\n", ipv6IfStats.ipv6IfStatsReasmOKs);
printf ("Datagrams Failed To Reassemble........................... %lu\n", ipv6IfStats.ipv6IfStatsReasmFails);
printf ("Datagrams Forwarded...................................... %lu\n", ipv6IfStats.ipv6IfStatsOutForwDatagrams);
printf ("Datagrams Locally Transmitted............................ %lu\n", ipv6IfStats.ipv6IfStatsOutRequests);
printf ("Datagrams Transmit Failed................................ %lu\n", ipv6IfStats.ipv6IfStatsOutDiscards);
printf ("Datagrams Successfully Fragmented........................ %lu\n", ipv6IfStats.ipv6IfStatsOutFragOKs);
printf ("Datagrams Failed To Fragment............................. %lu\n", ipv6IfStats.ipv6IfStatsOutFragFails);
printf ("Fragments Created........................................ %lu\n", ipv6IfStats.ipv6IfStatsOutFragCreates);
printf ("Multicast Datagrams Received............................. %lu\n", ipv6IfStats.ipv6IfStatsInMcastPkts);
printf ("Multicast Datagrams Transmitted.......................... %lu\n", ipv6IfStats.ipv6IfStatsOutMcastPkts);
printf ("\nICMPv6 STATISTICS\n");
printf ("Total ICMPv6 Messages Received........................... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInMsgs);
printf ("ICMPv6 Messages With Errors Received..................... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInErrors);
printf ("ICMPv6 Destination Unreachable Messages Received......... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInDestUnreachs);
printf ("ICMPv6 Messages Prohibited Administratively Received..... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInAdminProhibs);
printf ("ICMPv6 Time Exceeded Messages Received................... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInTimeExcds);
printf ("ICMPv6 Parameter Problem Messages Received............... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInParmProblems);
printf ("ICMPv6 Packet Too Big Messages Received.................. %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInPktTooBigs);
printf ("ICMPv6 Echo Request Messages Received.................... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInEchos);
printf ("ICMPv6 Echo Reply Messages Received...................... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInEchoReplies);
printf ("ICMPv6 Router Solicit Messages Received.................. %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInRouterSolicits);
printf ("ICMPv6 Router Advertisement Messages Received............ %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInRouterAdvertisements);
printf ("ICMPv6 Neighbor Solicit Messages Received................ %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInNeighborSolicits);
printf ("ICMPv6 Neighbor Advertisement Messages Received.......... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInNeighborAdvertisements);
printf ("ICMPv6 Redirect Messages Received........................ %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInRedirects);
printf ("ICMPv6 Group Membership Query Messages Received.......... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInGroupMembQueries);
printf ("ICMPv6 Group Membership Response Messages Received....... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInGroupMembResponses);
printf ("ICMPv6 Group Membership Reduction Messages Received...... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpInGroupMembReductions);
printf ("Total ICMPv6 Messages Transmitted........................ %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutMsgs);
printf ("ICMPv6 Messages Not Transmitted Due To Error............. %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutErrors);
printf ("ICMPv6 Destination Unreachable Messages Transmitted...... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutDestUnreachs);
printf ("ICMPv6 Messages Prohibited Administratively Transmitted.. %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutAdminProhibs);
printf ("ICMPv6 Time Exceeded Messages Transmitted................ %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutTimeExcds);
printf ("ICMPv6 Parameter Problem Messages Transmitted............ %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutParmProblems);
printf ("ICMPv6 Packet Too Big Messages Transmitted............... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutPktTooBigs);
printf ("ICMPv6 Echo Request Messages Transmitted................. %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutEchos);
printf ("ICMPv6 Echo Reply Messages Transmitted................... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutEchoReplies);
printf ("ICMPv6 Router Solicit Messages Transmitted............... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutRouterSolicits);
printf ("ICMPv6 Router Advertisement Messages Transmitted......... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutRouterAdvertisements);
printf ("ICMPv6 Neighbor Solicit Messages Transmitted............. %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutNeighborSolicits);
printf ("ICMPv6 Neighbor Advertisement Messages Transmitted....... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutNeighborAdvertisements);
printf ("ICMPv6 Redirect Messages Transmitted..................... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutRedirects);
printf ("ICMPv6 Group Membership Query Messages Transmitted....... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutGroupMembQueries);
printf ("ICMPv6 Group Membership Response Messages Transmitted.... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutGroupMembResponses);
printf ("ICMPv6 Group Membership Reduction Messages Transmitted... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpOutGroupMembReductions);
printf ("ICMPv6 Duplicate Address Detects......................... %lu\n", ipv6IfIcmpStats.ipv6IfIcmpDupAddrDetects);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the stats on interface. (result = %d)\n", result);
break;
}
return;
}
{
switch(result)
{
printf("\nIPv6 Statistics are cleared on all the interfaces.\n");
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the stats on interface. (result = %d)\n", result);
break;
}
return;
}
char *vrfName,
uint32_t bestRouteOnly)
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
uint32_t c = 1, i = 0;
char ipStr[80];
memset (vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("ERROR: Invalid VRF name string.\n");
return;
}
strncpy (vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
switch (result)
{
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the route table for a given VRF. (result = %d)\n", result);
break;
}
do
{
memset (ipStr, 0 , sizeof (ipStr));
(void) inet_ntop (AF_INET6, &(ipv6Route.
ip6Addr.
u.
addr8), ipStr,
sizeof (ipStr));
printf (
"\nRoute %-5u: %s/%d", c, ipStr, ipv6Route.
ip6PrefixLen);
printf ("\n nexthops:");
{
memset (ipStr, 0 , sizeof (ipStr));
ipStr, sizeof (ipStr));
{
}
else
{
printf ("\n %s", ipStr);
}
}
printf (
"\n preference: %u", ipv6Route.
pref);
printf (
"\n protocol: %u\n", ipv6Route.
protocol);
c++;
&ipv6Route, bestRouteOnly));
return;
}
char *vrfName,
uint32_t bestRouteOnly)
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
uint32_t count = 0;
memset (vrfNameStr, 0, sizeof(vrfNameStr));
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("ERROR: Invalid VRF name string.\n");
return;
}
strncpy (vrfNameStr, vrfName, sizeof(vrfNameStr) - 1);
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
switch (result)
{
printf ("\nTotal number of IPv6 routes for VRF \"%s\" : %u\n", vrfName, count);
break;
printf("\nERROR: Invalid argument passed.\n");
break;
default:
printf("\nERROR: Bad return code trying to get the route table for a given VRF. (result = %d)\n", result);
break;
}
return;
}
void ip6RtrCfgIntfAddressesGet(
openapiClientHandle_t *client_handle, uint32_t intIfNum, uint32_t numAddr)
{
uint32_t i = 0;
char ipStr[80];
uint32_t count = numAddr;
&count, &ipv6AddrList, &ipv6Mode,
{
printf("Bad return code trying to get the configured IPv6 addresses on the interface (result = %d)\n", result);
}
else
{
printf ("\n\nIPv6 Mode on intf-%u: %s", intIfNum,
printf ("\nConfig modes on intf-%u: %s %s\n", intIfNum,
printf ("\nNumber of address available on interface : %u", count);
printf ("\nInterface Addresses:");
for (i = 0; i < count; i++)
{
memset (ipStr, 0 , sizeof (ipStr));
(void) inet_ntop (AF_INET6, &(ipv6AddrList.
ipAddrList[i].u.addr8), ipStr,
sizeof (ipStr));
printf (
"\n %s/%u", ipStr, ipv6AddrList.
pLen[i]);
}
printf ("\n\n");
}
return;
}
{
uint32_t val = 0;
{
printf("Bad return code trying to get the number of neighbor solicits configured to be set for duplicate address detection (DAD) on an interface (result = %d)\n", result);
}
else
{
printf ("\nNumber of solicits to be sent for DAD on intf-%u is %u\n\n", intIfNum, val);
}
return;
}
{
{
printf("Bad return code trying to set the number of neighbor solicits to be sent for duplicate address detection (DAD) on an interface (result = %d)\n", result);
}
else
{
printf ("\n%u Solicits configured to be sent for DAD on intf-%u\n\n", val, intIfNum);
}
return;
}
{
uint32_t val = 0;
{
printf("Bad return code trying to get the interval between IPv6 neighbor solicitation retransmissions on an interface (result = %d)\n", result);
}
else
{
printf ("\nInterval between solicits for intf-%u is %u\n\n", intIfNum, val);
}
return;
}
{
{
printf("Bad return code trying to set the interval between IPv6 neighbor solicitation retransmissions on an interface (result = %d)\n", result);
}
else
{
printf ("\nInterval between solicits for intf-%u configured to %u\n\n", intIfNum, val);
}
return;
}
{
uint32_t val;
{
printf("Bad return code trying to get the amount of time that a remote IPv6 node is reachable (result = %d)\n", result);
}
else
{
printf ("\nTime for which remote node is reachable on intf-%u is %u\n\n", intIfNum, val);
}
return;
}
{
{
printf("Bad return code trying to set the amount of time that a remote IPv6 node is reachable (result = %d)\n", result);
}
else
{
printf ("\nTime for which remote node is reachable on intf-%u is configured to %u\n\n", intIfNum, val);
}
return;
}
{
{
printf("Bad return code trying to get the configured mode for ICMPv6 unreachable messages (result = %d)\n", result);
}
else
{
printf("\n ICMP Unreachable messages on intf-%u are %s\n\n",
intIfNum, (mode ==
OPEN_ENABLE) ?
"ENABLED" :
"DISABLED");
}
return;
}
{
{
printf("Bad return code trying to set the configured mode for ICMPv6 unreachable messages (result = %d)\n", result);
}
else
{
printf("\n ICMP Unreachable messages on intf-%u are configured to be %s\n\n",
intIfNum, (mode ==
OPEN_ENABLE) ?
"ENABLED" :
"DISABLED");
}
return;
}
{
uint32_t i = 0;
char ipStr[80];
i = inet_pton (AF_INET6, ipv6AddrString, (
void*)&(ipv6AddrEntry.
ipv6Address));
if ((0 == i) ||
(0 > i))
{
printf("Bad return code trying to convert ip address - %s.\n", ipv6AddrString);
}
{
printf("Bad return code trying to get the IPv6 address details. (result = %d)\n", result);
}
else
{
memset (ipStr, 0 , sizeof (ipStr));
(void) inet_ntop (AF_INET6, &(ipv6AddrEntry.
ipv6Address.u.addr8), ipStr,
sizeof (ipStr));
printf (
"\n\nAddress Configured on interface %u is %s/%u\n", ipv6AddrEntry.
ipv6IfIndex,
printf ("\n\n");
}
return;
}
{
char ipStr[80];
{
printf("Bad return code trying to get the IPv6 address details of the next entry. (result = %d)\n", result);
}
else
{
do {
printf (
"\n\nAddress Configured on interface %u :", ipv6AddrEntry.
ipv6IfIndex);
memset (ipStr, 0 , sizeof (ipStr));
(void) inet_ntop (AF_INET6, &(ipv6AddrEntry.
ipv6Address.u.addr8), ipStr,
sizeof (ipStr));
printf ("\n\n");
}
return;
}
void ipv6AddrPrefixEntryGet (
openapiClientHandle_t *client_handle, uint32_t intIfNum,
char* ipv6AddrString, uint32_t pfxLen)
{
char ipStr[80];
uint32_t i = 0;
i = inet_pton (AF_INET6, ipv6AddrString, (
void*)&(ipv6AddrPrefixEntry.
ipv6AddrPrefix));
if ((0 == i) ||
(0 > i))
{
printf("Bad return code trying to convert ip address - %s.\n", ipv6AddrString);
}
{
printf("Bad return code trying to get the IPv6 address prefix details. (result = %d)\n", result);
}
else
{
memset (ipStr, 0 , sizeof (ipStr));
(void) inet_ntop (AF_INET6,
ipStr, sizeof (ipStr));
printf ("\n\n Address configured on interface %u is %s/%u\n",
printf ("\n\n");
}
return;
}
{
uint32_t i = 0, count = numAddr;
char ipStr[80];
{
printf("Bad return code trying to get the IPv6 addresses of the interface. (result = %d)\n", result);
}
else
{
printf ("\n\nNumber of addresses configured on interface %u : %u", intIfNum, count);
for (i = 0; i < count; i++)
{
memset (ipStr, 0 , sizeof (ipStr));
(void) inet_ntop (AF_INET6,
&(addrList.
ipv6AddrList[i].
ipv6Addr.u.addr8),
ipStr, sizeof (ipStr));
printf (
"\n %u: %s/%u", i, ipStr, addrList.ipv6AddrList[i].
ipv6PrefixLen);
printf (
"\n state : %u", addrList.ipv6AddrList[i].
ipv6AddrState);
}
printf ("\n\n");
}
return;
}
{
char ipStr[80];
{
printf("Bad return code trying to get the IPv6 address of the interface. (result = %d)\n", result);
}
else
{
memset (ipStr, 0 , sizeof (ipStr));
(void) inet_ntop (AF_INET6, &(inetAddr.
addr.
ipv6.u.addr8), ipStr,
sizeof (ipStr));
printf ("\n\nPrimary address on the interface %u is %s\n\n", intIfNum, ipStr);
}
return;
}
{
uint32_t lastUpdate = 0;
uint32_t ipv6ScopeId = 0;
char ipStr[80];
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
char mac[18];
uint32_t ifIndex = intIfNum;
char nbrStateStr[32];
char ipv6TypeStr[32];
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("ERROR: Invalid VRF name string.\n");
return;
}
memset (vrfNameStr, 0, sizeof (vrfNameStr));
memset (nbrStateStr, 0, sizeof (nbrStateStr));
memset (ipv6TypeStr, 0, sizeof (ipv6TypeStr));
strncpy (vrfNameStr, vrfName, strlen(vrfName));
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
memset (mac, 0, 18);
macAddr.pstart = mac;
macAddr.size = 18;
&ipv6Addr, &macAddr,
&ifIndex, &ipv6Type,
&nbrState, &lastUpdate,
{
printf("Bad return code trying to get the IPv6 neighbor entries. (result = %d)\n", result);
}
else
{
do {
if (0 == intIfNum)
{
printf ("\n\n IPv6 Neighbors :");
ifIndex = 0;
}
else
printf ("\n\n IPv6 Neighbors on interface %u : ", intIfNum);
memset (ipStr, 0 , sizeof (ipStr));
(void) inet_ntop (AF_INET6, &(ipv6Addr.addr.ipv6.u.addr8), ipStr, sizeof (ipStr));
memset (nbrStateStr, 0, sizeof (nbrStateStr));
switch (nbrState)
{
snprintf(nbrStateStr, sizeof(nbrStateStr), "%s", "Reachable");
break;
snprintf(nbrStateStr, sizeof(nbrStateStr), "%s", "Stale");
break;
snprintf(nbrStateStr, sizeof(nbrStateStr), "%s", "Delay");
break;
snprintf(nbrStateStr, sizeof(nbrStateStr), "%s", "Probe");
break;
snprintf(nbrStateStr, sizeof(nbrStateStr), "%s", "Incomplete");
break;
snprintf(nbrStateStr, sizeof(nbrStateStr), "%s", "Unreachable");
break;
snprintf(nbrStateStr, sizeof(nbrStateStr), "%s", "Permanent");
break;
snprintf(nbrStateStr, sizeof(nbrStateStr), "%s", "Unknown");
default:
break;
}
memset (ipv6TypeStr, 0, sizeof (ipv6TypeStr));
switch (ipv6Type)
{
snprintf(ipv6TypeStr, sizeof(ipv6TypeStr), "%s", "Dynamic");
break;
snprintf(ipv6TypeStr, sizeof(ipv6TypeStr), "%s", "Static");
break;
snprintf(ipv6TypeStr, sizeof(ipv6TypeStr), "%s", "Local");
break;
default:
snprintf(ipv6TypeStr, sizeof(ipv6TypeStr), "%s", "Other");
break;
}
printf ("\n Neighbor address is %s", ipStr);
printf ("\n Mac address is %s", mac);
printf ("\n interface is %u", ifIndex);
printf ("\n scope id is %u", ipv6ScopeId);
printf ("\n type is %s(%u)", ipv6TypeStr, ipv6Type);
printf ("\n state is %s(%u)", nbrStateStr, nbrState);
printf (
"\n isRouter - %s", ((isRouter ==
OPEN_TRUE)?
"TRUE" :
"FALSE"));
printf ("\n time since last update %u", lastUpdate);
&ipv6Addr, &macAddr,
&ifIndex, &ipv6Type,
&nbrState, &lastUpdate,
&isRouter, &ipv6ScopeId));
printf ("\n\n");
}
return;
}
{
char vrfNameStr[OPEN_VRF_MAX_NAME_LEN + 1] = "";
if (OPEN_VRF_MAX_NAME_LEN < strlen(vrfName))
{
printf("ERROR: Invalid VRF name string.\n");
return;
}
memset (vrfNameStr, 0, sizeof (vrfNameStr));
strncpy (vrfNameStr, vrfName, strlen(vrfName));
vrfNameBufd.pstart = vrfNameStr;
vrfNameBufd.size = strlen(vrfNameStr) + 1;
{
printf("Bad return code trying to get the IPv6 address of the interface. (result = %d)\n", result);
}
else
{
printf("\n\nNeighbor are cleared.\n\n");
}
return;
}
{
char ipStr[80];
{
printf("Bad return code trying to get the next IPv6 route from the routing table. (result = %d)\n", result);
}
else
{
printf ("\n\n Static Routes configured :");
do {
memset (ipStr, 0 , sizeof (ipStr));
(void) inet_ntop (AF_INET6,
&(routeEntry.
ipv6RouteDest.u.addr8),
ipStr, sizeof (ipStr));
printf (
"\n %s/%u", ipStr, routeEntry.
ipv6RoutePfxLength);
memset (ipStr, 0 , sizeof (ipStr));
(void) inet_ntop (AF_INET6,
&(routeEntry.
ipv6RouteNextHop.u.addr8),
ipStr, sizeof (ipStr));
printf ("\n next hop is %s", ipStr);
printf (
"\n protocol is %u", routeEntry.
ipv6RouteProtocol);
printf (
"\n metric is %u", routeEntry.
ipv6Metric);
printf (
"\n weight is %u", routeEntry.
ipv6RouteWeight);
printf ("\n\n");
}
return;
}
int main(int argc, char **argv)
{
uint32_t testNum;
char switch_os_revision_string[100];
int show_help = 1;
uint32_t value = 0;
uint32_t ifNum = 0;
if (argc < 2)
{
printAppMenu(argv[0]);
return -1;
}
testNum = atoi(argv[1]);
l7proc_crashlog_register();
{
printf("\nFailed to initialize RPC to OpEN. Exiting (result = %d)\n", result);
return -1;
}
{
sleep(1);
}
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Starting IP6Map API example application");
printf("\n");
switch_os_revision.pstart = switch_os_revision_string;
switch_os_revision.size = sizeof(switch_os_revision_string);
printf("Network OS version = %s\n", switch_os_revision_string);
else
printf("Network OS version retrieve error\n");
printf("\n");
switch (testNum)
{
case 1:
if (argc == 3)
{
ip6VrRtrAdminModeGet(&client_handle, argv[2]);
show_help = 0;
}
break;
case 2:
if (argc == 4)
{
value = atoi(argv[3]);
ip6VrRtrAdminModeSet(&client_handle, argv[2], value);
show_help = 0;
}
break;
case 3:
if (argc == 3)
{
ip6VrNbrsDynRenewGet(&client_handle, argv[2]);
show_help = 0;
}
break;
case 4:
if (argc == 4)
{
value = atoi(argv[3]);
ip6VrNbrsDynRenewSet(&client_handle, argv[2], value);
show_help = 0;
}
break;
case 5:
if (argc == 3)
{
ip6VrNudBackoffMultipleGet(&client_handle, argv[2]);
show_help = 0;
}
break;
case 6:
if (argc == 4)
{
value = atoi(argv[3]);
ip6VrNudBackoffMultipleSet(&client_handle, argv[2], value);
show_help = 0;
}
break;
case 7:
if (argc == 3)
{
ip6VrNudMaxUnicastSolicitsGet(&client_handle, argv[2]);
show_help = 0;
}
break;
case 8:
if (argc == 4)
{
value = atoi(argv[3]);
ip6VrNudMaxUnicastSolicitsSet(&client_handle, argv[2], value);
show_help = 0;
}
break;
case 9:
if (argc == 3)
{
ip6VrNudMaxMcastSolicitsGet(&client_handle, argv[2]);
show_help = 0;
}
break;
case 10:
if (argc == 4)
{
value = atoi(argv[3]);
ip6VrNudMaxMcastSolicitsSet(&client_handle, argv[2], value);
show_help = 0;
}
break;
case 11:
if (argc == 2)
{
ip6UnresolvedRateLimitGet(&client_handle);
show_help = 0;
}
break;
case 12:
if (argc == 3)
{
value = atoi(argv[2]);
ip6UnresolvedRateLimitSet(&client_handle, value);
show_help = 0;
}
break;
case 13:
if (argc == 3)
{
ip6VrRtrDefaultTTLGet(&client_handle, argv[2]);
show_help = 0;
}
break;
case 14:
if (argc == 4)
{
value = atoi(argv[3]);
ip6VrRtrDefaultTTLSet(&client_handle, argv[2], value);
show_help = 0;
}
break;
case 15:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrIntfModeGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 16:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrIntfOperModeGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 17:
if (argc == 4)
{
ifNum = atoi(argv[2]);
value = atoi(argv[3]);
ip6RtrIntfModeSet(&client_handle, ifNum, value);
show_help = 0;
}
break;
case 18:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrIntfAutoStateModeGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 19:
if (argc == 4)
{
ifNum = atoi(argv[2]);
value = atoi(argv[3]);
ip6RtrIntfAutoStateModeSet(&client_handle, ifNum, value);
show_help = 0;
}
break;
case 20:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6IntfExists(&client_handle, ifNum);
show_help = 0;
}
break;
case 21:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6MapIntfIsValid(&client_handle, ifNum);
show_help = 0;
}
break;
case 22:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6MapNbrIntfIsValid(&client_handle, ifNum);
show_help = 0;
}
break;
case 23:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrIntfIpv6MtuGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 24:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrIntfIpv6EffectiveMtuGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 25:
if (argc == 4)
{
ifNum = atoi(argv[2]);
value = atoi(argv[3]);
ip6RtrIntfIpv6MtuSet(&client_handle, ifNum, value);
show_help = 0;
}
break;
case 26:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrIntfBandwidthGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 27:
if (argc == 2)
{
ip6MapIntfValidFirstGet(&client_handle);
show_help = 0;
}
break;
case 28:
if (argc == 3)
{
value = atoi(argv[2]);
ip6MapIntfValidNextGet(&client_handle, value);
show_help = 0;
}
break;
case 29:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrIntfMaxIpv6MtuGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 30:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ipv6IfStatsGet (&client_handle, ifNum);
show_help = 0;
}
break;
case 31:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ipv6IfIcmpStatsGet (&client_handle, ifNum);
show_help = 0;
}
break;
case 32:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ipv6IfStatsClear (&client_handle, ifNum);
show_help = 0;
}
break;
case 33:
if (argc == 2)
{
ipv6TotalStatsGet(&client_handle);
show_help = 0;
}
break;
case 34:
if (argc == 2)
{
ipv6TotalStatsClear(&client_handle);
show_help = 0;
}
break;
case 35:
if (argc == 4)
{
value = atoi(argv[3]);
ipv6RouteTableGet (&client_handle, argv[2], value);
show_help = 0;
}
break;
case 36:
if (argc == 4)
{
value = atoi(argv[3]);
ipv6RouteCountGet (&client_handle, argv[2], value);
show_help = 0;
}
break;
case 37:
if (argc == 4)
{
ifNum = atoi(argv[2]);
value = atoi(argv[3]);
ip6RtrCfgIntfAddressesGet (&client_handle, ifNum, value);
show_help = 0;
}
break;
case 38:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrDadTransmitsGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 39:
if (argc == 4)
{
ifNum = atoi(argv[2]);
value = atoi(argv[3]);
ip6RtrDadTransmitsSet(&client_handle, ifNum, value);
show_help = 0;
}
break;
case 40:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrNdNsIntervalGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 41:
if (argc == 4)
{
ifNum = atoi(argv[2]);
value = atoi(argv[3]);
ip6RtrNdNsIntervalSet(&client_handle, ifNum, value);
show_help = 0;
}
break;
case 42:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrNdReachableTimeGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 43:
if (argc == 4)
{
ifNum = atoi(argv[2]);
value = atoi(argv[3]);
ip6RtrNdReachableTimeSet(&client_handle, ifNum, value);
show_help = 0;
}
break;
case 44:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrIntfICMPUnreachablesModeGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 45:
if (argc == 4)
{
ifNum = atoi(argv[2]);
value = atoi(argv[3]);
ip6RtrIntfICMPUnreachablesModeSet(&client_handle, ifNum, value);
show_help = 0;
}
break;
case 46:
if (argc == 4)
{
ifNum = atoi(argv[2]);
ipv6AddrEntryGet (&client_handle, ifNum, argv[3]);
show_help = 0;
}
break;
case 47:
if (argc == 2)
{
ipv6AddrEntryGetNext (&client_handle);
show_help = 0;
}
break;
case 48:
if (argc == 5)
{
ifNum = atoi(argv[2]);
value = atoi(argv[4]);
ipv6AddrPrefixEntryGet (&client_handle, ifNum, argv[3], value);
show_help = 0;
}
break;
case 49:
if (argc == 4)
{
ifNum = atoi(argv[2]);
value = atoi(argv[3]);
ip6RtrIntfAddressesGet (&client_handle, ifNum, value);
show_help = 0;
}
break;
case 50:
if (argc == 3)
{
ifNum = atoi(argv[2]);
ip6RtrIntfAddressGet(&client_handle, ifNum);
show_help = 0;
}
break;
case 51:
if (argc == 4)
{
ifNum = atoi(argv[3]);
ipv6NbrTblEntryGet (&client_handle, argv[2], ifNum);
show_help = 0;
}
break;
case 52:
if (argc == 4)
{
ifNum = atoi(argv[3]);
ipv6NdpFlush (&client_handle, argv[2], ifNum);
show_help = 0;
}
break;
case 53:
if (argc == 2)
{
snmpIpv6StaticRouteGetNext (&client_handle);
show_help = 0;
}
break;
default:
break;
}
if (show_help == 1)
{
printAppMenu(argv[0]);
}
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Stopping IP6Map API example application");
return 0;
}