#include <stdlib.h>
#include <unistd.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: Set the value of the DiffServ administrative mode: %s 1 <mode>\n", name);
printf("Test 2: Gets admin mode of DiffServ administrative: %s 2\n", name);
printf("Test 3: Get size of the given group Table: %s 3 <diffTableGrpObj>\n", name);
printf("Test 4: Run API sanity checks: %s 4 \n", name);
return;
}
{
uint32_t size;
printf("Testing diffServConf OpEN APIs sanity:\n");
printf("Testing openapiDiffServGenAdminModeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiDiffServGenTableSizeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
return;
}
{
{
printf("Bad return code trying to set the value of the DiffServ administrative mode. (result = %d)\n", result);
}
else
{
printf("DiffServ administrative mode is successfully %s\n",
}
return;
}
{
{
printf("Bad return code trying to gets admin mode of DiffServ administrative. (result = %d)\n", result);
}
else
{
printf("DiffServ administrative mode is in %s mode\n",
}
return;
}
uint32_t *pSize)
{
{
printf("Bad return code trying to get size of the given group Table. (result = %d)\n", result);
}
else
{
printf("Size of the given group table object:%d is %d.\n",
diffTableGrpObj, *pSize);
}
return;
}
int main(int argc, char **argv)
{
uint32_t testNum;
char switch_os_revision_string[100];
int show_help = 1;
uint32_t size;
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 diffServConf 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)
{
mode = atoi(argv[2]);
diffServGenAdminModeSet(&client_handle, mode);
show_help = 0;
}
break;
case 2:
if (argc == 2)
{
diffServGenAdminModeGet(&client_handle, &mode);
show_help = 0;
}
break;
case 3:
if (argc == 3)
{
diffTableGrpObj = atoi(argv[2]);
diffServGenTableSizeGet(&client_handle, diffTableGrpObj, &size);
show_help = 0;
}
break;
case 4:
if (argc == 2)
{
runSanity(&client_handle);
show_help = 0;
}
break;
default:
break;
}
if (show_help == 1)
{
printAppMenu(argv[0]);
}
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Stopping diffServConf API example application");
return 0;
}