#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: Sets the NSDP Admin Mode: %s 1 <mode>\n", name);
printf("Test 2: Get the NSDP Admin Mode: %s 2 \n", name);
printf("Test 3: Run API sanity checks: %s 3 \n", name);
return;
}
{
uint32_t mode;
printf("Testing NSDP OpEN APIs sanity:\n");
printf("Testing openapiNsdpModeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiNsdpModeSet():\n");
printf("NULL client handle:(result = %d)\n", result);
return;
}
{
{
printf("Bad return code trying to sets the NSDP Admin Mode. (result = %d)\n", result);
}
else
{
printf("NSDP mode is set to %d\n",mode);
}
return;
}
{
{
printf("Bad return code trying to get the NSDP Admin Mode. (result = %d)\n", result);
}
else
{
printf("Get's the NSDP mode as %d",*mode);
}
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 NSDP 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)
{
uint32_t mode;
mode = atoi(argv[2]);
nsdpModeSet(&clientHandle, mode);
show_help = 0;
}
break;
case 2:
if (argc == 2)
{
uint32_t mode = 0;
nsdpModeGet(&clientHandle, &mode);
show_help = 0;
}
break;
case 3:
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 NSDP API example application");
return 0;
}