#include <stdlib.h>
#include <unistd.h>
#include "rpcclt_openapi.h"
#include "proc_util.h"
#define OPENAPI_TITLE "802.1CB"
#define OPEN_IP6_ADDR_LENGTH 40
#define OPEN_MAC_ADDR_LENGTH 18
static void printAppMenu(char *name)
{
printf("Usage: %s <test#> <arg1> <arg2> ... \n", name);
printf("Test 1: Get the 802.1CB mode for a given VLAN: %s 1 <vlanID>\n", name);
printf("Test 2: Set the 802.1CB mode for a given VLAN: %s 2 <vlanID><mode: 0-disable/1-enable>\n", name);
printf("Test 3: Get the 802.1CB ARP/NDP forwarding mode for a given VLAN: %s 3 <vlanID>\n", name);
printf("Test 4: Set the 802.1CB ARP/NDP forwarding mode for a given VLAN: %s 4 <vlanID><mode: 0-disable/1-enable>\n", name);
printf("Test 5: Get the configured flow ID: %s 5 <buf><vlanID>\n", name);
printf("Test 6: Get the configured flow type: %s 6 <buf><vlanID>\n", name);
printf("Test 7: Set the flow type and ID of an existing macfilter: %s 7 <buf><vlanID><flowType: 1-initiator/2-transit><flowId: 1-1024>\n", name);
printf("Test 8: Get the 802.1CB RTAG mode for the specified interface: %s 8 <ifNum>\n", name);
printf("Test 9: Set the 802.1CB RTAG mode for the specified interface: %s 9 <ifNum><mode: 0-disable/1-enable>\n", name);
printf("Test 10: Clear all the 802.1CB statistics: %s 10\n", name);
printf("Test 11: Get the 802.1CB global statistics: %s 11\n", name);
printf("Test 12: Get the 802.1CB statistics for the specified interface: %s 12 <ifNum>\n", name);
printf("Test 13: Get the next valid 802.1CB interface: %s 13 <ifNum>\n", name);
printf("Test 14: Add an IPv4 classifier: %s 14 <srcAddr><srcMaskLen><dstAddr><dstMaskLen><flowType><flowId>\n", name);
printf("Test 15: Delete an IPv4 classifier: %s 15 <srcAddr><srcMaskLen><dstAddr><dstMaskLen>\n", name);
printf("Test 16: Get an IPv4 classifier: %s 16 <srcAddr><srcMaskLen><dstAddr><dstMaskLen>\n", name);
printf("Test 17: Get the next IPv4 classifier: %s 17 <srcAddr><srcMaskLen><dstAddr><dstMaskLen>\n", name);
printf("Test 18: Get the number of configured IPv4 classifiers: %s 18\n", name);
printf("Test 19: Get the status flag indicating whether IPv4 classifiers are installed in the hardware: %s 19\n", name);
printf("Test 20: Add an IPv6 classifier: %s 20 <srcAddr><srcMaskLen><dstAddr><dstMaskLen><flowType><flowId>\n", name);
printf("Test 21: Delete an IPv6 classifier: %s 21 <srcAddr><srcMaskLen><dstAddr><dstMaskLen>\n", name);
printf("Test 22: Get an IPv6 classifier: %s 22 <srcAddr><srcMaskLen><dstAddr><dstMaskLen>\n", name);
printf("Test 23: Get the next IPv6 classifier: %s 23 <srcAddr><srcMaskLen><dstAddr><dstMaskLen>\n", name);
printf("Test 24: Get the number of configured IPv6 classifiers: %s 24\n", name);
printf("Test 25: Get the status flag indicating whether IPv6 classifiers are installed in the hardware: %s 25\n", name);
printf("Test 26: Get the number of transit flows installed in the hardware: %s 26\n", name);
printf("Test 27: Get the number of initiator flows installed in the hardware: %s 27\n", name);
printf("Test 28: Get the number of MFDB entries associated with flows: %s 28\n", name);
printf("Test 29: Get the number of 802.1CB enabled VLANs: %s 29\n", name);
printf("Test 30: Get the next 802.1CB enabled VLAN: %s 30 <vid>\n", name);
printf("Test 31: Get the 802.1CB initiator flow and its status/statistics: %s 31 <flowId: 1-1024>\n", name);
printf("Test 32: Get the next 802.1CB initiator flow and its status/statistics: %s 32 <flowId>\n", name);
printf("Test 33: Get the 802.1CB transit flow and its status/statistics: %s 33 <flowId: 1-1024>\n", name);
printf("Test 34: Get the next 802.1CB transit flow and its status/statistics: %s 34 <flowId>\n", name);
printf("Test 35: Get the 802.1CB transit flow configuration: %s 35 <flowId>\n", name);
printf("Test 36: Set the history window size for an 802.1CB transit flow: %s 36 <flowId><historyWindow>\n", name);
printf("Test 37: Set the acceptance window size for an 802.1CB transit flow: %s 37 <flowId><acceptanceWindow>\n", name);
printf("Test 38: Set the age time for an 802.1CB transit flow: %s 38 <flowId><ageTime>\n", name);
printf("Test 39: Get the SA-MAC/VLAN flow association mode: %s 39\n", name);
printf("Test 40: Set the SA-MAC/VLAN flow association mode: %s 40 <mode: 0-disable/1-enable>\n", name);
printf("Test 41: Run API sanity checks: %s 41\n", name);
return;
}
{
{
printf("Bad return code trying to get the 802.1CB mode for a given VLAN. (result = %d)\n", result);
}
else
{
printf("%s mode on VLAN %u get: %s (%u). (result = %d)\n", OPENAPI_TITLE, vlanID,
(mode ==
OPEN_ENABLE)?
"Enabled":
"Disabled", mode, result);
}
return;
}
{
{
printf("Bad return code trying to set the 802.1CB mode for a given VLAN. (result = %d)\n", result);
}
else
{
printf("%s mode on VLAN %u set. (result = %d)\n", OPENAPI_TITLE, vlanID, result);
}
return;
}
{
{
printf("Bad return code trying to get the 802.1CB ARP/NDP forwarding mode for a given VLAN. (result = %d)\n", result);
}
else
{
printf("%s ARP/NDP forwarding mode on VLAN %u get: %s (%u). (result = %d)\n", OPENAPI_TITLE, vlanID,
(mode ==
OPEN_ENABLE)?
"Enabled":
"Disabled", mode, result);
}
return;
}
{
{
printf("Bad return code trying to set the 802.1CB ARP/NDP forwarding mode for a given VLAN. (result = %d)\n", result);
}
else
{
printf("%s ARP/NDP forwarding mode set. (result = %d)\n", OPENAPI_TITLE, result);
}
return;
}
{
uint32_t flowId = 0;
buffDesc.
pstart = macStr;
buffDesc.
size = (OPEN_MAC_ADDR_LEN*3);
{
printf("Bad return code trying to get the configured flow ID. (result = %d)\n", result);
}
else
{
printf("Filter mac=%s vlan=%u flow ID get: (%u). (result = %d)\n", macStr, vlanID, flowId, result);
}
return;
}
{
buffDesc.pstart = macStr;
buffDesc.size = (OPEN_MAC_ADDR_LEN*3);
{
printf("Bad return code trying to get the configured flow type. (result = %d)\n", result);
}
else
{
printf("Filter mac=%s vlan=%u flow type get: %s (%u). (result = %d)\n", macStr, vlanID,
}
return;
}
{
buffDesc.pstart = macStr;
buffDesc.size = (OPEN_MAC_ADDR_LEN*3);
{
printf("Bad return code trying to set the flow type and ID of an existing macfilter. (result = %d)\n", result);
}
else
{
printf("Filter mac=%s vlan=%u flow type and ID set. (result = %d)\n", macStr, vlanID, result);
}
return;
}
{
{
printf("Bad return code trying to get the 802.1CB RTAG mode on interface. (result = %d)\n", result);
}
else
{
printf("%s RTAG mode on interface %u get: %s (%u). (result = %d)\n",
OPENAPI_TITLE, ifNum, (mode ==
OPEN_ENABLE)?
"Enabled":
"Disabled", mode, result);
}
return;
}
{
{
printf("Bad return code trying to set the 802.1CB RTAG mode on interface. (result = %d)\n", result);
}
else
{
printf("%s RTAG mode on interface %u set. (result = %d)\n", OPENAPI_TITLE, ifNum , result);
}
return;
}
{
{
printf("Bad return code trying to clear all the 802.1CB statistics. (result = %d)\n", result);
}
else
{
printf("All %s statistics cleared. (result = %d)\n", OPENAPI_TITLE, result);
}
return;
}
{
{
printf("Bad return code trying to get the 802.1CB global statistics. (result = %d)\n", result);
}
else
{
printf("%s global statistics get: (%llu) (%llu) (%llu) (%llu) (result = %d)\n",
}
return;
}
{
{
printf("Bad return code trying to get the 802.1CB statistics on interface. (result = %d)\n", result);
}
else
{
printf("%s statistics on interface %u get: (%llu) (%llu) (%llu) (%llu) (result = %d)\n",
}
return;
}
{
uint32_t nextIfNum = 0;
{
printf("Bad return code trying to get the next valid 802.1CB interface. (result = %d)\n", result);
}
else
{
printf("Next valid %s interface get: %u. (result = %d)\n", OPENAPI_TITLE, nextIfNum, result);
}
return;
}
{
buffDesc.pstart = srcAddrStr;
buffDesc.size = OPEN_IP_ADDR_LENGTH;
{
printf("Bad return code trying to convert source IP address. (result = %d)\n", result);
return;
}
buffDesc.pstart = dstAddrStr;
buffDesc.size = OPEN_IP_ADDR_LENGTH;
{
printf("Bad return code trying to convert destination IP address. (result = %d)\n", result);
return;
}
&dstAddr, dstMaskLen, flowType, flowId)) !=
OPEN_E_NONE)
{
printf("Bad return code trying to add an IPv4 classifier. (result = %d)\n", result);
}
else
{
printf("IPv4 classifier added: %s (src) %s (dst) (result = %d)\n", srcAddrStr, dstAddrStr, result);
}
return;
}
void dot1cbIpv4ClassifierDelete(
openapiClientHandle_t *client_handle,
char *srcAddrStr, uint32_t srcMaskLen,
char *dstAddrStr, uint32_t dstMaskLen)
{
buffDesc.pstart = srcAddrStr;
buffDesc.size = OPEN_IP_ADDR_LENGTH;
{
printf("Bad return code trying to convert source IP address. (result = %d)\n", result);
return;
}
buffDesc.pstart = dstAddrStr;
buffDesc.size = OPEN_IP_ADDR_LENGTH;
{
printf("Bad return code trying to convert destination IP address. (result = %d)\n", result);
return;
}
{
printf("Bad return code trying to delete an IPv4 classifier. (result = %d)\n", result);
}
else
{
printf("IPv4 classifier deleted: %s (src) %s (dst) (result = %d)\n", srcAddrStr, dstAddrStr, result);
}
return;
}
void dot1cbIpv4ClassifierGet(
openapiClientHandle_t *client_handle,
char *srcAddrStr, uint32_t srcMaskLen,
char *dstAddrStr, uint32_t dstMaskLen)
{
uint32_t flowId = 0;
buffDesc.pstart = srcAddrStr;
buffDesc.size = OPEN_IP_ADDR_LENGTH;
{
printf("Bad return code trying to convert source IP address. (result = %d)\n", result);
return;
}
buffDesc.pstart = dstAddrStr;
buffDesc.size = OPEN_IP_ADDR_LENGTH;
{
printf("Bad return code trying to convert destination IP address. (result = %d)\n", result);
return;
}
&dstAddr, dstMaskLen, &flowType, &flowId)) !=
OPEN_E_NONE)
{
printf("Bad return code trying to get an IPv4 classifier. (result = %d)\n", result);
}
else
{
printf("IPv4 classifier flow type / ID get: %s (%u) / (%u) (result = %d)\n",
}
return;
}
void dot1cbIpv4ClassifierNextGet(
openapiClientHandle_t *client_handle,
char *srcAddrStr, uint32_t srcMaskLen,
char *dstAddrStr, uint32_t dstMaskLen)
{
uint32_t flowId = 0;
struct in_addr srcIpStr;
struct in_addr dstIpStr;
buffDesc.pstart = srcAddrStr;
buffDesc.size = OPEN_IP_ADDR_LENGTH;
{
printf("Bad return code trying to convert source IP address. (result = %d)\n", result);
return;
}
buffDesc.pstart = dstAddrStr;
buffDesc.size = OPEN_IP_ADDR_LENGTH;
{
printf("Bad return code trying to convert destination IP address. (result = %d)\n", result);
return;
}
&dstAddr, &dstMaskLen, &flowType, &flowId)) !=
OPEN_E_NONE)
{
printf("Bad return code trying to get the next IPv4 classifier. (result = %d)\n", result);
}
else
{
srcIpStr.s_addr = htonl(srcAddr.
addr.
ipv4);
dstIpStr.s_addr = htonl(dstAddr.addr.ipv4);
printf("Next IPv4 classifier get: %s (src) %s (dst) (result = %d)\n",
inet_ntoa(srcIpStr), inet_ntoa(dstIpStr), result);
}
return;
}
{
uint32_t value = 0;
{
printf("Bad return code trying to get the number of configured IPv4 classifiers. (result = %d)\n", result);
}
else
{
printf("Number of configured IPv4 classifiers get: %u (result = %d)\n", value, result);
}
return;
}
{
uint32_t value = 0;
{
printf("Bad return code trying to get the status flag indicating whether IPv4 classifiers are installed in the hardware. (result = %d)\n", result);
}
else
{
printf("IPv4 classifiers in hardware flag get: %s (%u). (result = %d)\n",
(value == 0)?"Not Installed":"Installed", value, result);
}
return;
}
{
buffDesc.pstart = srcAddrStr;
buffDesc.size = OPEN_IP6_ADDR_LENGTH;
{
printf("Bad return code trying to convert source IPv6 address. (result = %d)\n", result);
return;
}
buffDesc.pstart = dstAddrStr;
buffDesc.size = OPEN_IP6_ADDR_LENGTH;
{
printf("Bad return code trying to convert destination IPv6 address. (result = %d)\n", result);
return;
}
&(dstAddr.addr.ipv6), dstMaskLen, flowType, flowId)) !=
OPEN_E_NONE)
{
printf("Bad return code trying to add an IPv6 classifier. (result = %d)\n", result);
}
else
{
printf("IPv6 classifier added: %s (src) %s (dst) (result = %d)\n", srcAddrStr, dstAddrStr, result);
}
return;
}
void dot1cbIpv6ClassifierDelete(
openapiClientHandle_t *client_handle,
char *srcAddrStr, uint32_t srcMaskLen,
char *dstAddrStr, uint32_t dstMaskLen)
{
buffDesc.pstart = srcAddrStr;
buffDesc.size = OPEN_IP6_ADDR_LENGTH;
{
printf("Bad return code trying to convert source IPv6 address. (result = %d)\n", result);
return;
}
buffDesc.pstart = dstAddrStr;
buffDesc.size = OPEN_IP6_ADDR_LENGTH;
{
printf("Bad return code trying to convert destination IPv6 address. (result = %d)\n", result);
return;
}
{
printf("Bad return code trying to delete an IPv6 classifier. (result = %d)\n", result);
}
else
{
printf("IPv6 classifier deleted: %s (src) %s (dst) (result = %d)\n", srcAddrStr, dstAddrStr, result);
}
return;
}
void dot1cbIpv6ClassifierGet(
openapiClientHandle_t *client_handle,
char *srcAddrStr, uint32_t srcMaskLen,
char *dstAddrStr, uint32_t dstMaskLen)
{
uint32_t flowId = 0;
buffDesc.pstart = srcAddrStr;
buffDesc.size = OPEN_IP6_ADDR_LENGTH;
{
printf("Bad return code trying to convert source IPv6 address. (result = %d)\n", result);
return;
}
buffDesc.pstart = dstAddrStr;
buffDesc.size = OPEN_IP6_ADDR_LENGTH;
{
printf("Bad return code trying to convert destination IPv6 address. (result = %d)\n", result);
return;
}
&(dstAddr.addr.ipv6), dstMaskLen, &flowType, &flowId)) !=
OPEN_E_NONE)
{
printf("Bad return code trying to get an IPv6 classifier. (result = %d)\n", result);
}
else
{
printf("IPv6 classifier flow type / ID get: %s (%u) / (%u) (result = %d)\n",
}
return;
}
void dot1cbIpv6ClassifierNextGet(
openapiClientHandle_t *client_handle,
char *srcAddrStr, uint32_t srcMaskLen,
char *dstAddrStr, uint32_t dstMaskLen)
{
uint32_t flowId = 0;
buffDesc.pstart = srcAddrStr;
buffDesc.size = OPEN_IP6_ADDR_LENGTH;
{
printf("Bad return code trying to convert source IPv6 address. (result = %d)\n", result);
return;
}
buffDesc.pstart = dstAddrStr;
buffDesc.size = OPEN_IP6_ADDR_LENGTH;
{
printf("Bad return code trying to convert destination IPv6 address. (result = %d)\n", result);
return;
}
&(dstAddr.addr.ipv6), &dstMaskLen, &flowType, &flowId)) !=
OPEN_E_NONE)
{
printf("Bad return code trying to get the next IPv6 classifier. (result = %d)\n", result);
}
else
{
printf("Next IPv6 classifier get: %s (src) %s (dst) (result = %d)\n", srcAddrStr, dstAddrStr, result);
}
return;
}
{
uint32_t value = 0;
{
printf("Bad return code trying to get the number of configured IPv6 classifiers. (result = %d)\n", result);
}
else
{
printf("Number of configured IPv6 classifiers get: %u (result = %d)\n", value, result);
}
return;
}
{
uint32_t value = 0;
{
printf("Bad return code trying to get the status flag indicating whether IPv6 classifiers are installed in the hardware. (result = %d)\n", result);
}
else
{
printf("IPv6 classifiers in hardware flag get: %s (%u). (result = %d)\n",
(value == 0)?"Not Installed":"Installed", value, result);
}
return;
}
{
uint32_t value = 0;
{
printf("Bad return code trying to get the number of transit flows installed in the hardware. (result = %d)\n", result);
}
else
{
printf("Number of transit flows installed in the hardware get: %u (result = %d)\n", value, result);
}
return;
}
{
uint32_t value = 0;
{
printf("Bad return code trying to get the number of initiator flows installed in the hardware. (result = %d)\n", result);
}
else
{
printf("Number of initiator flows installed in the hardware get: %u (result = %d)\n", value, result);
}
return;
}
{
uint32_t value = 0;
{
printf("Bad return code trying to get the number of MFDB entries associated with flows. (result = %d)\n", result);
}
else
{
printf("Number of MFDB entries associated with flows get: %u (result = %d)\n", value, result);
}
return;
}
{
uint32_t value = 0;
{
printf("Bad return code trying to get the number of 802.1CB enabled VLANs. (result = %d)\n", result);
}
else
{
printf("Number of %s enabled VLANs get: %u (result = %d)\n", OPENAPI_TITLE, value, result);
}
return;
}
{
{
printf("Bad return code trying to get the next 802.1CB enabled VLAN. (result = %d)\n", result);
}
else
{
printf("Next %s enabled VLAN get: %u. (result = %d)\n", OPENAPI_TITLE, vid , result);
}
return;
}
{
uint32_t classifiers = 0;
uint32_t nextTxSequence = 0;
uint64_t txPackets = 0;
{
printf("Bad return code trying to get the 802.1CB initiator flow and its status/statistics. (result = %d)\n", result);
}
else
{
printf("%s initiator flow get: %u (flowID) %u (classifiers) %u (nextTxSequence) (result = %d)\n",
OPENAPI_TITLE, flowId, classifiers, nextTxSequence, result);
}
return;
}
{
uint32_t classifiers = 0;
uint32_t nextTxSequence = 0;
uint64_t txPackets = 0;
{
printf("Bad return code trying to get the next 802.1CB initiator flow and its status/statistics. (result = %d)\n", result);
}
else
{
printf("Next %s initiator flow get: %u (flowID) %u (classifiers) %u (nextTxSequence) (result = %d)\n",
OPENAPI_TITLE, flowId, classifiers, nextTxSequence, result);
}
return;
}
{
uint32_t classifiers = 0;
uint32_t lastRxSequence = 0;
uint64_t matchingPackets = 0;
uint64_t acceptedPackets = 0;
uint64_t duplicatePackets = 0;
{
printf("Bad return code trying to get the 802.1CB transit flow and its status/statistics. (result = %d)\n", result);
}
else
{
printf("%s transit flow get: %u (flowID) %u (classifiers) %u (lastRxSequence) (result = %d)\n",
OPENAPI_TITLE, flowId, classifiers, lastRxSequence, result);
}
return;
}
{
uint32_t classifiers = 0;
uint32_t lastRxSequence = 0;
uint64_t matchingPackets = 0;
uint64_t acceptedPackets = 0;
uint64_t duplicatePackets = 0;
{
printf("Bad return code trying to get the next 802.1CB transit flow and its status/statistics. (result = %d)\n", result);
}
else
{
printf("Next %s transit flow get: %u (flowID) %u (classifiers) %u (lastRxSequence) (result = %d)\n",
OPENAPI_TITLE, flowId, classifiers, lastRxSequence, result);
}
return;
}
{
uint32_t historyWindow = 0;
uint32_t acceptanceWindow = 0;
uint32_t ageTime = 0;
{
printf("Bad return code trying to get the 802.1CB transit flow configuration. (result = %d)\n", result);
}
else
{
printf("%s transit flow configuration get: %u (flowID) %u (historyWindow) %u (acceptanceWindow) %u (ageTime) (result = %d)\n",
OPENAPI_TITLE, flowId, historyWindow, acceptanceWindow, ageTime, result);
}
return;
}
void dot1cbApiTransitFlowHistoryWindowSizeSet(
openapiClientHandle_t *client_handle, uint32_t flowId, uint32_t historyWindow)
{
{
printf("Bad return code trying to set the history window size for an 802.1CB transit flow. (result = %d)\n", result);
}
else
{
printf("%s transit flow history window size set: %u (flowID) (result = %d)\n", OPENAPI_TITLE, flowId, result);
}
return;
}
void dot1cbApiTransitFlowAcceptanceWindowSizeSet(
openapiClientHandle_t *client_handle, uint32_t flowId, uint32_t acceptanceWindow)
{
{
printf("Bad return code trying to set the acceptance window size for an 802.1CB transit flow. (result = %d)\n", result);
}
else
{
printf("%s transit flow acceptance window size set: %u (flowID) (result = %d)\n", OPENAPI_TITLE, flowId, result);
}
return;
}
void dot1cbApiTransitFlowAgeTimeSet(
openapiClientHandle_t *client_handle, uint32_t flowId, uint32_t ageTime)
{
{
printf("Bad return code trying to set the age time for an 802.1CB transit flow. (result = %d)\n", result);
}
else
{
printf("%s transit flow age time set: %u (flowID) (result = %d)\n", OPENAPI_TITLE, flowId, result);
}
return;
}
{
{
printf("Bad return code trying to get the SA-MAC/VLAN flow association mode. (result = %d)\n", result);
}
else
{
printf("SA-MAC/VLAN flow association mode get: %s (%u). (result = %d)\n",
(mode ==
OPEN_ENABLE)?
"Enabled":
"Disabled", mode, result);
}
return;
}
{
{
printf("Bad return code trying to set the SA-MAC/VLAN flow association mode. (result = %d)\n", result);
}
else
{
printf("SA-MAC/VLAN flow association mode set. (result = %d)\n", result);
}
return;
}
{
uint32_t vid;
uint64_t txPackets;
uint32_t vlanID = 1;
uint32_t nextIfNum;
uint32_t dstMaskLen;
uint32_t ageTime;
uint64_t matchingPackets;
uint32_t historyWindow;
uint32_t srcMaskLen;
uint64_t duplicatePackets;
uint32_t ifNum = 1;
uint64_t acceptedPackets;
uint32_t classifiers;
uint32_t value;
uint32_t flowId;
uint32_t nextTxSequence;
uint32_t acceptanceWindow;
uint32_t lastRxSequence;
char buffer[128];
badBufdescPointer.pstart = (void *) NULL;
badBufdescPointer.size = sizeof(buffer);
badBufdescLen.pstart = buffer;
badBufdescPointer.size = 0;
buf.pstart = buffer;
buf.size = sizeof(buffer);
zeroLenBuf.pstart = buffer;
zeroLenBuf.size = 0;
printf("Testing Dot1cb OpEN APIs sanity:\n");
printf("Testing openapiDot1cbModeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("Testing openapiDot1cbForwardArpNdpModeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("Testing openapiFilterFlowIdGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("NULL buffdesc pstart argument 2:(result = %d)\n", result);
printf("buffdesc 0 length size argument 2:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("Testing openapiFilterFlowTypeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("NULL buffdesc pstart argument 2:(result = %d)\n", result);
printf("buffdesc 0 length size argument 2:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("Testing openapiDot1cbRtagModeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("Testing openapiDot1cbStatsClear():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1cbGlobalStatsGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiDot1cbIntfStatsGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("Testing openapiDot1cbIntfNextGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("Testing openapiDot1cbIpv4ClassifierGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("NULL argument 6:(result = %d)\n", result);
printf("NULL argument 7:(result = %d)\n", result);
printf("Testing openapiDot1cbIpv4ClassifierNextGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("NULL argument 5:(result = %d)\n", result);
printf("NULL argument 6:(result = %d)\n", result);
printf("NULL argument 7:(result = %d)\n", result);
printf("Testing openapiDot1cbIpv4ClassifierCountGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiDot1cbIpv4ClassifierInHardwareGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiDot1cbIpv6ClassifierGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("NULL argument 6:(result = %d)\n", result);
printf("NULL argument 7:(result = %d)\n", result);
printf("Testing openapiDot1cbIpv6ClassifierNextGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("NULL argument 5:(result = %d)\n", result);
printf("NULL argument 6:(result = %d)\n", result);
printf("NULL argument 7:(result = %d)\n", result);
printf("Testing openapiDot1cbIpv6ClassifierCountGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiDot1cbIpv6ClassifierInHardwareGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiDot1cbNumActiveTransitFlowsGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiDot1cbNumActiveInititatorFlowsGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiDot1cbNumMfdbClassifiersGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiDot1cbApiNumDot1cbVlansGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiDot1cbApiDot1cbEnabledVlanNextGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiDot1cbApiInitFlowGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("NULL argument 5:(result = %d)\n", result);
printf("Testing openapiDot1cbApiInitFlowNextGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("NULL argument 5:(result = %d)\n", result);
printf("Testing openapiDot1cbApiTransitFlowGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("NULL argument 5:(result = %d)\n", result);
printf("NULL argument 6:(result = %d)\n", result);
printf("NULL argument 7:(result = %d)\n", result);
printf("Testing openapiDot1cbApiTransitFlowNextGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("NULL argument 5:(result = %d)\n", result);
printf("NULL argument 6:(result = %d)\n", result);
printf("NULL argument 7:(result = %d)\n", result);
printf("Testing openapiDot1cbApiTransitFlowConfigGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("NULL argument 5:(result = %d)\n", result);
printf("Testing openapiDot1cbSaModeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
return;
}
int main(int argc, char **argv)
{
uint32_t testNum;
char switch_os_revision_string[100];
int show_help = 1;
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 Dot1cb 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)
{
dot1cbModeGet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 2:
if (argc == 4)
{
dot1cbModeSet(&clientHandle, atoi(argv[2]), atoi(argv[3]));
show_help = 0;
}
break;
case 3:
if (argc == 3)
{
dot1cbForwardArpNdpModeGet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 4:
if (argc == 4)
{
dot1cbForwardArpNdpModeSet(&clientHandle, atoi(argv[2]), atoi(argv[3]));
show_help = 0;
}
break;
case 5:
if (argc == 4)
{
filterFlowIdGet(&clientHandle, argv[2], atoi(argv[3]));
show_help = 0;
}
break;
case 6:
if (argc == 4)
{
filterFlowTypeGet(&clientHandle, argv[2], atoi(argv[3]));
show_help = 0;
}
break;
case 7:
if (argc == 6)
{
filterFlowTypeIdSet(&clientHandle, argv[2], atoi(argv[3]), atoi(argv[4]), atoi(argv[5]));
show_help = 0;
}
break;
case 8:
if (argc == 3)
{
dot1cbRtagModeGet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 9:
if (argc == 4)
{
dot1cbRtagModeSet(&clientHandle, atoi(argv[2]), atoi(argv[3]));
show_help = 0;
}
break;
case 10:
if (argc == 2)
{
dot1cbStatsClear(&clientHandle);
show_help = 0;
}
break;
case 11:
if (argc == 2)
{
dot1cbGlobalStatsGet(&clientHandle);
show_help = 0;
}
break;
case 12:
if (argc == 3)
{
dot1cbIntfStatsGet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 13:
if (argc == 3)
{
dot1cbIntfNextGet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 14:
if (argc == 8)
{
dot1cbIpv4ClassifierAdd(&clientHandle, argv[2], atoi(argv[3]), argv[4], atoi(argv[5]), atoi(argv[6]), atoi(argv[7]));
show_help = 0;
}
break;
case 15:
if (argc == 6)
{
dot1cbIpv4ClassifierDelete(&clientHandle, argv[2], atoi(argv[3]), argv[4], atoi(argv[5]));
show_help = 0;
}
break;
case 16:
if (argc == 6)
{
dot1cbIpv4ClassifierGet(&clientHandle, argv[2], atoi(argv[3]), argv[4], atoi(argv[5]));
show_help = 0;
}
break;
case 17:
if (argc == 6)
{
dot1cbIpv4ClassifierNextGet(&clientHandle, argv[2], atoi(argv[3]), argv[4], atoi(argv[5]));
show_help = 0;
}
break;
case 18:
if (argc == 2)
{
dot1cbIpv4ClassifierCountGet(&clientHandle);
show_help = 0;
}
break;
case 19:
if (argc == 2)
{
dot1cbIpv4ClassifierInHardwareGet(&clientHandle);
show_help = 0;
}
break;
case 20:
if (argc == 8)
{
dot1cbIpv6ClassifierAdd(&clientHandle, argv[2], atoi(argv[3]), argv[4], atoi(argv[5]), atoi(argv[6]), atoi(argv[7]));
show_help = 0;
}
break;
case 21:
if (argc == 6)
{
dot1cbIpv6ClassifierDelete(&clientHandle, argv[2], atoi(argv[3]), argv[4], atoi(argv[5]));
show_help = 0;
}
break;
case 22:
if (argc == 6)
{
dot1cbIpv6ClassifierGet(&clientHandle, argv[2], atoi(argv[3]), argv[4], atoi(argv[5]));
show_help = 0;
}
break;
case 23:
if (argc == 6)
{
dot1cbIpv6ClassifierNextGet(&clientHandle, argv[2], atoi(argv[3]), argv[4], atoi(argv[5]));
show_help = 0;
}
break;
case 24:
if (argc == 2)
{
dot1cbIpv6ClassifierCountGet(&clientHandle);
show_help = 0;
}
break;
case 25:
if (argc == 2)
{
dot1cbIpv6ClassifierInHardwareGet(&clientHandle);
show_help = 0;
}
break;
case 26:
if (argc == 2)
{
dot1cbNumActiveTransitFlowsGet(&clientHandle);
show_help = 0;
}
break;
case 27:
if (argc == 2)
{
dot1cbNumActiveInititatorFlowsGet(&clientHandle);
show_help = 0;
}
break;
case 28:
if (argc == 2)
{
dot1cbNumMfdbClassifiersGet(&clientHandle);
show_help = 0;
}
break;
case 29:
if (argc == 2)
{
dot1cbApiNumDot1cbVlansGet(&clientHandle);
show_help = 0;
}
break;
case 30:
if (argc == 3)
{
dot1cbApiDot1cbEnabledVlanNextGet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 31:
if (argc == 3)
{
dot1cbApiInitFlowGet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 32:
if (argc == 3)
{
dot1cbApiInitFlowNextGet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 33:
if (argc == 3)
{
dot1cbApiTransitFlowGet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 34:
if (argc == 3)
{
dot1cbApiTransitFlowNextGet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 35:
if (argc == 3)
{
dot1cbApiTransitFlowConfigGet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 36:
if (argc == 4)
{
dot1cbApiTransitFlowHistoryWindowSizeSet(&clientHandle, atoi(argv[2]), atoi(argv[3]));
show_help = 0;
}
break;
case 37:
if (argc == 4)
{
dot1cbApiTransitFlowAcceptanceWindowSizeSet(&clientHandle, atoi(argv[2]), atoi(argv[3]));
show_help = 0;
}
break;
case 38:
if (argc == 4)
{
dot1cbApiTransitFlowAgeTimeSet(&clientHandle, atoi(argv[2]), atoi(argv[3]));
show_help = 0;
}
break;
case 39:
if (argc == 2)
{
dot1cbSaModeGet(&clientHandle);
show_help = 0;
}
break;
case 40:
if (argc == 3)
{
dot1cbSaModeSet(&clientHandle, atoi(argv[2]));
show_help = 0;
}
break;
case 41:
if (argc == 2)
{
runSanity(&clientHandle);
show_help = 0;
}
break;
default:
break;
}
if (show_help == 1)
{
printAppMenu(argv[0]);
}
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Stopping Dot1cb API example application");
return 0;
}