#include <stdlib.h>
#include <unistd.h>
#include "rpcclt_openapi.h"
#include "proc_util.h"
void printDot1sAppMenu()
{
printf("Usage: dot1s_example <test#> <arg1> <arg2> ... \n");
printf("Test 1: Set Spanning Tree Operational Mode: dot1s_example 1 <mode> \n");
printf("Test 2: Get Spanning Tree Operational Mode: dot1s_example 2 \n");
printf("Test 3: Set Spanning Tree Interface BPDU Filter Mode: dot1s_example 3 <interface> <mode> \n");
printf("Test 4: Get Spanning Tree Interface BPDU Filter Mode: dot1s_example 4 <interface> \n");
printf("Test 5: Set Spanning Tree Interface BPDU Flood Mode: dot1s_example 5 <interface> <mode> \n");
printf("Test 6: Get Spanning Tree Interface BPDU Flood Mode: dot1s_example 6 <interface> \n");
printf("Test 7: Set Spanning Tree BPDU Guard Mode: dot1s_example 7 <mode> \n");
printf("Test 8: Get Spanning Tree BPDU Guard Mode: dot1s_example 8 \n");
printf("Test 9: Set Spanning Tree Configuration Name: dot1s_example 9 <name> \n");
printf("Test 10: Get Spanning Tree Configuration Name: dot1s_example 10 \n");
printf("Test 11: Set Spanning Tree Configuration Revision: dot1s_example 11 <revision> \n");
printf("Test 12: Get Spanning Tree Configuration Revision: dot1s_example 12 \n");
printf("Test 13: Set Spanning Tree Configuration Force Version: dot1s_example 13 <version> \n");
printf("Test 14: Get Spanning Tree Configuration Force Version: dot1s_example 14 \n");
printf("Test 15: Set Spanning Tree Interface Guard Mode: dot1s_example 15 <interface> <mode> \n");
printf("Test 16: Get Spanning Tree Interface Guard Mode: dot1s_example 16 <interface> \n");
printf("Test 17: Create Spanning Tree Instance: dot1s_example 17 <instance id> \n");
printf("Test 18: Delete Spanning Tree Instance: dot1s_example 18 <instance id> \n");
printf("Test 19: Get All Spanning Tree Instances: dot1s_example 19 \n");
printf("Test 20: Set Spanning Tree MST Instance Priority: dot1s_example 20 <instance id> <priority> \n");
printf("Test 21: Get Spanning Tree MST Instance Priority: dot1s_example 21 <instance id> \n");
printf("Test 22: Add Spanning Tree MST Instance - VLAN Association: dot1s_example 22 <instance id> <vlanid> \n");
printf("Test 23: Delete Spanning Tree MST Instance - VLAN Association: dot1s_example 23 <instance id> <vlanid> \n");
printf("Test 24: Get All VLANs associated with the Spanning Tree Instance: dot1s_example 24 <instance id> \n");
printf("Test 25: Get All Forwarding Database Ids associated with the Spanning Tree Instance: dot1s_example 25 <instance id> \n");
printf("Test 26: Set Spanning Tree Interface Mode: dot1s_example 26 <interface> <mode> \n");
printf("Test 27: Get Spanning Tree Interface Mode: dot1s_example 27 <interface> \n");
printf("Test 28: Get Spanning Tree Interface Forwarding State: dot1s_example 28 <interface> <instance id> \n");
printf("Test 29: Get Spanning Tree Interface Mode: dot1s_example 29 <interface> <instance id> \n");
printf("Test 30: Set Spanning Tree Interface Edge Port Mode: dot1s_example 30 <interface> <mode> \n");
printf("Test 31: Get Spanning Tree Interface Edge Port Mode: dot1s_example 31 <interface> \n");
printf("Test 32: Get Spanning Tree Interface Port Loop Inconsistent State: dot1s_example 32 <interface> <instance id> \n");
printf("Test 33: Get the Spanning Tree MST Bridge Identifier for a specific instance: dot1s_example 33 <instance id>\n");
printf("Test 34: Get the Spanning Tree MST Time since the last Topology Change for a specific instance: dot1s_example 34 <instance id>\n");
printf("Test 35: Get the Spanning Tree MST count of Topology Changes in a specific instance: dot1s_example 35 <instance id>\n");
printf("Test 36: Get if a topology change is in progress for any port assigned to a specific Spanning Tree MST instance: dot1s_example 36 <instance id>\n");
printf("Test 37: Get the Spanning Tree MST Designated Root Identifier in a specific instance: dot1s_example 37 <instance id>\n");
printf("Test 38: Get the Spanning Tree MST Designated Root Path Cost parameter in a specific instance: dot1s_example 38 <instance id>\n");
printf("Test 39: Get the Spanning Tree Port Root Port ID in a specific instance: dot1s_example 39 <instance id>\n");
printf("Test 40: Get the max age for the CIST: dot1s_example 40\n");
printf("Test 41: Get Max Hop count for the device: dot1s_example 41\n");
printf("Test 42: Get the Tx Hold count value for the device: dot1s_example 42\n");
printf("Test 43: Get the CIST Bridge Forward Delay: dot1s_example 43\n");
printf("Test 44: Get the CIST Hello Time for a specific port: dot1s_example 44 <interface>\n");
printf("Test 45: Get the CIST Bridge Hold Time: dot1s_example 45\n");
printf("Test 46: Get the CIST Regional Root Identifier: dot1s_example 46\n");
printf("Test 47: Get the CIST Regional Root Path Cost: dot1s_example 47\n");
printf("Test 48: Test Spanning Tree OpEN APIs sanity: dot1s_example 48 <interface> \n");
return;
}
{
{
printf("Bad return code trying to set Spanning Tree Operational Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Operational Mode set successfully \n");
}
return;
}
{
{
printf("Bad return code trying to get Spanning Tree Operational Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Operational Mode: %u \n", mode);
}
return;
}
{
{
printf("Bad return code trying to set Spanning Tree Interface BPDU Filter Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface BPDU Filter Mode set successfully \n");
}
return;
}
{
{
printf("Bad return code trying to get Spanning Tree Interface BPDU Filter Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface BPDU Filter Mode for interface %u: %u \n", ifNum, mode);
}
return;
}
{
{
printf("Bad return code trying to set Spanning Tree Interface BPDU Flood Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface BPDU Flood Mode set successfully \n");
}
return;
}
{
{
printf("Bad return code trying to get Spanning Tree Interface BPDU Flood Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface BPDU Flood Mode for interface %u: %u \n", ifNum, mode);
}
return;
}
{
{
printf("Bad return code trying to set Spanning Tree BPDU Guard Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree BPDU Guard Mode set successfully \n");
}
return;
}
{
{
printf("Bad return code trying to get Spanning Tree BPDU Guard Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree BPDU Guard Mode: %u \n", mode);
}
return;
}
{
char str[100];
memset(str, 0, sizeof(str));
strncpy(str, name, (sizeof(str) - 1));
buffDesc.
size = strlen(str) + 1;
{
printf("Bad return code trying to set Spanning Tree Configuration Name. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Configuration Name set successfully \n");
}
return;
}
{
char *str;
uint32_t dot1SMgmtStrLen;
{
printf("Bad return code. (result = %d)\n", result);
return;
}
if ((str = (char*)malloc(dot1SMgmtStrLen)) == NULL)
{
printf("Could not allocate memory.\n");
return;
}
memset(str, 0, dot1SMgmtStrLen);
buffDesc.pstart = str;
buffDesc.size = dot1SMgmtStrLen;
{
printf("Bad return code trying to get Spanning Tree Configuration Name. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Configuration Name: %s \n", str);
}
free(str);
return;
}
{
{
printf("Bad return code trying to set Spanning Tree Configuration Revision. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Configuration Revision set successfully \n");
}
return;
}
{
uint32_t revision;
{
printf("Bad return code trying to get Spanning Tree Configuration Revision. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Configuration Revision: %u \n", revision);
}
return;
}
{
{
printf("Bad return code trying to set Spanning Tree Force Version. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Force Version set successfully \n");
}
return;
}
{
uint32_t forceVersion;
{
printf("Bad return code trying to get Spanning Tree Force Version. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Force Version: %u \n", forceVersion);
}
return;
}
{
{
printf("Bad return code trying to set Spanning Tree Interface Guard Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface Guard Mode set successfully \n");
}
return;
}
{
{
printf("Bad return code trying to get Spanning Tree Interface Guard Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface Guard Mode for interface %u: %u \n", ifNum, mode);
}
return;
}
{
{
printf("Bad return code trying to configure Spanning Tree MST Instance. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST Instance set successfully \n");
}
return;
}
{
uint32_t currInstanceId, nextInstanceId;
{
printf("Bad return code trying to get the first Spanning Tree MST Instance. (result = %d)\n", result);
return;
}
else
{
printf("Spanning Tree MST Instances:\n");
printf("%u", currInstanceId);
}
{
printf(", %u", nextInstanceId);
currInstanceId = nextInstanceId;
}
printf("\n");
return;
}
void dot1SMSTInstancePrioritySet(
openapiClientHandle_t *clientHandle, uint32_t dot1sMSTInstance, uint32_t priority)
{
{
printf("Bad return code trying to set Spanning Tree Instance Priority. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Instance Priority set successfully \n");
}
return;
}
{
uint16_t priority;
{
printf("Bad return code trying to get Spanning Tree Instance Priority. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Instance Priority for instance %u: %u \n", dot1sMSTInstance, priority);
}
return;
}
{
uint32_t vlanMax;
{
if ((vlanId > vlanMax))
{
printf("Invalid VLAN id. The maximum id is %d.\n", vlanMax);
}
}
{
{
printf("Bad return code trying to configure Spanning Tree MST Instance - VLAN association. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST Instance - VLAN association set successfully \n");
}
}
return;
}
{
uint32_t currVLANId, nextVLANId;
{
printf("Bad return code trying to get the first Spanning Tree MST VLAN. (result = %d)\n", result);
return;
}
else
{
printf("Spanning Tree MST VLANs:\n");
printf("%u", currVLANId);
}
{
printf(", %u", nextVLANId);
currVLANId = nextVLANId;
}
printf("\n");
return;
}
{
uint32_t currFId, nextFId;
{
printf("Bad return code trying to get the first Spanning Tree MST Forwarding Database Id. (result = %d)\n", result);
return;
}
else
{
printf("Spanning Tree MST FIds:\n");
printf("%u", currFId);
}
{
printf(", %u", nextFId);
currFId = nextFId;
}
printf("\n");
return;
}
{
{
printf("Bad return code trying to set Spanning Tree Interface Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface Mode set successfully \n");
}
return;
}
{
{
printf("Bad return code trying to get Spanning Tree Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface Mode for interface %u: %u \n", ifNum, mode);
}
return;
}
void dot1SIntfPortFwdStateGet(
openapiClientHandle_t *clientHandle, uint32_t ifNum, uint32_t dot1sInstance)
{
{
printf("Bad return code trying to get Spanning Tree Port Forwarding State. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface Port Forwarding State for interface %u: %u \n", ifNum, dot1sPortFwdState);
}
return;
}
{
{
printf("Bad return code trying to get Spanning Tree Port Role. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Port Role for interface %u: %u \n", ifNum, dot1sPortRole);
}
return;
}
{
{
printf("Bad return code trying to set Spanning Tree Interface Edge Port Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface Edge Port Mode set successfully \n");
}
return;
}
{
{
printf("Bad return code trying to get Spanning Tree Interface Edge Port Mode. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface Edge Port Mode for interface %u: %u \n", ifNum, mode);
}
return;
}
void dot1SIntfPortLoopInconsistentStateGet(
openapiClientHandle_t *clientHandle, uint32_t ifNum, uint32_t dot1sInstance)
{
{
printf("Bad return code trying to get Spanning Tree Port Loop Inconsistent State. (result = %d)\n", result);
}
else
{
printf("Spanning Tree Interface Port Loop Inconsistent State for interface %u: %u \n", ifNum, loopInconsistentState);
}
return;
}
{
unsigned char *p = (unsigned char *) id;
snprintf(idStr, size, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
return idStr;
}
{
char idStr[25];
{
printf("Bad return code trying to get the Spanning Tree MST Bridge Identifier for a specific instance. (result = %d)\n", result);
}
else
{
printf("MST Instance Bridge Identifier for mstId %d: %s\n", mstId, idToStr(&id, idStr, sizeof(idStr)));
}
return;
}
{
uint32_t tVal;
{
printf("Bad return code trying to get the Spanning Tree MST Time since the last Topology Change for a specific instance. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST Time since the last Topology Change for mstId %d: %u seconds\n", mstId, tVal);
}
return;
}
{
uint32_t count;
{
printf("Bad return code trying to get the Spanning Tree MST count of Topology Changes in a specific instance. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST count of Topology Changes for mstId %d: %u\n", mstId, count);
}
return;
}
{
{
printf("Bad return code trying to get the Spanning Tree MST Topology Change state in a specific instance. (result = %d)\n", result);
}
else
{
printf(
"A topology change is %s for some port in the MST instance %d.\n", (state ==
OPEN_TRUE ?
"in progress":
"not in progress"), mstId);
}
return;
}
{
char idStr[25];
{
printf("Bad return code trying to get the Spanning Tree MST Designated Root Identifier in a specific instance. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST Designated Root Identifier for mstId %d: %s\n", mstId, idToStr(&id, idStr, sizeof(idStr)));
}
return;
}
{
uint32_t cost;
{
printf("Bad return code trying to get the Spanning Tree MST Designated Root Path Cost parameter in a specific instance. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST Designated Root path cost for mstId %d: %u\n", mstId, cost);
}
return;
}
{
uint32_t port;
{
printf("Bad return code trying to get the Spanning Tree MST Root Port ID in a specific instance. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST root port ID for mstId %d: %u\n", mstId, port);
}
return;
}
{
uint32_t age;
{
printf("Bad return code trying to get the max age for the CIST. (result = %d)\n", result);
}
else
{
printf("Max age for the CIST: %u\n", age);
}
return;
}
{
uint32_t count;
{
printf("Bad return code trying to get the Max Hop count for the bridge. (result = %d)\n", result);
}
else
{
printf("Max hop count for the bridge: %u\n", count);
}
return;
}
{
uint32_t count;
{
printf("Bad return code trying to get the Spanning Tree MST Tx Hold count for the bridge. (result = %d)\n", result);
}
else
{
printf("Tx hold count for the bridge: %u\n", count);
}
return;
}
{
uint32_t delay;
{
printf("Bad return code trying to get the Spanning Tree MST Bridge Forward Delay for the CIST. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST Bridge Forward Delay for the CIST: %u\n", delay);
}
return;
}
{
uint32_t helloTime;
{
printf("Bad return code trying to get the Spanning Tree MST Hello Time of a specific port for the CIST. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST Hello Time of port %u for the CIST: %u\n", ifNum, helloTime);
}
return;
}
{
uint32_t holdTime;
{
printf("Bad return code trying to get the Spanning Tree MST Bridge Hold Time for the CIST. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST Bridge Hold Time for the CIST: %u\n", holdTime);
}
return;
}
{
char idStr[25];
{
printf("Bad return code trying to get the Spanning Tree MST CIST Regional Root Identifier. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST CIST Regional Root Identifier: %s\n", idToStr(&rootId, idStr, sizeof(idStr)));
}
return;
}
{
uint32_t cost;
{
printf("Bad return code trying to get the Spanning Tree MST CIST Regional Root Path Cost. (result = %d)\n", result);
}
else
{
printf("Spanning Tree MST CIST Regional Root Path Cost: %u\n", cost);
}
return;
}
{
uint32_t invalidControlMode = 10;
uint32_t dot1SMgmtStrLen, strLen, dot1sConfigRev, instanceId, nextInstanceId;
uint32_t vlan, nextVlan, FId, nextFId;
uint16_t priority;
char *str;
uint32_t var1;
uint32_t mstid = 0;
uint32_t badMstid = 9999;
printf("Testing Spanning Tree OpEN APIs sanity:\n\n");
{
printf("Bad return code. (result = %d)\n", result);
return;
}
if ((str = (char*)malloc(dot1SMgmtStrLen)) == NULL)
{
printf("Could not allocate memory.\n");
return;
}
memset(str, 0, dot1SMgmtStrLen);
printf("Testing openapiDot1sMgmtStrLenGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid string type:(result = %d)\n", result);
printf("NULL String Length:(result = %d)\n", result);
printf("openapiDot1sMgmtStrLenGet() sanity successful\n\n");
printf("Testing openapiDot1SModeSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Control Mode:(result = %d)\n", result);
printf("openapiDot1SModeSet() sanity successful\n\n");
printf("Testing openapiDot1SModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiDot1SModeGet() sanity successful\n\n");
printf("Testing openapiDot1SIntfBPDUFilterModeSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Control Mode:(result = %d)\n", result);
printf("openapiDot1SIntfBPDUFilterModeSet() sanity successful\n\n");
printf("Testing openapiDot1SIntfBPDUFilterModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiDot1SIntfBPDUFloodModeSet() sanity successful\n\n");
printf("Testing openapiDot1SIntfBPDUFloodModeSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Control Mode:(result = %d)\n", result);
printf("openapiDot1SIntfBPDUFloodModeSet() sanity successful\n\n");
printf("Testing openapiDot1SIntfBPDUFloodModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiDot1SIntfBPDUFloodModeGet() sanity successful\n\n");
printf("Testing openapiDot1SBPDUGuardModeSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Control Mode:(result = %d)\n", result);
printf("openapiDot1SBPDUGuardModeSet() sanity successful\n\n");
printf("Testing openapiDot1SBPDUGuardModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiDot1SBPDUGuardModeGet() sanity successful\n\n");
printf("Testing openapiDot1SConfigNameSet():\n");
buffDesc.pstart = str;
buffDesc.size = dot1SMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Config Name:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL Config Name buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = dot1SMgmtStrLen + 10;
printf("NULL Config Name buffer length:(result = %d)\n", result);
printf("openapiDot1SConfigNameSet() sanity successful\n\n");
printf("Testing openapiDot1SConfigNameGet():\n");
buffDesc.pstart = str;
buffDesc.size = dot1SMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Config Name:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL Config Name buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL Config Name buffer length:(result = %d)\n", result);
printf("openapiDot1SConfigNameGet() sanity successful\n\n");
printf("Testing openapiDot1SConfigRevisionSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("openapiDot1SConfigRevisionSet() sanity successful\n\n");
printf("Testing openapiDot1SConfigRevisionGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Config Revision:(result = %d)\n", result);
printf("openapiDot1SConfigRevisionGet() sanity successful\n\n");
printf("Testing openapiDot1SForceVersionSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Force Version:(result = %d)\n", result);
printf("openapiDot1SForceVersionSet() sanity successful\n\n");
printf("Testing openapiDot1SForceVersionGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Force Version:(result = %d)\n", result);
printf("openapiDot1SForceVersionGet() sanity successful\n\n");
printf("Testing openapiDot1SIntfGuardModeSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Guard Mode:(result = %d)\n", result);
printf("openapiDot1SIntfGuardModeSet() sanity successful\n\n");
printf("Testing openapiDot1SIntfGuardModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Guard Mode:(result = %d)\n", result);
printf("openapiDot1SIntfGuardModeGet() sanity successful\n\n");
printf("Testing openapiDot1SMSTInstanceSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Action:(result = %d)\n", result);
printf("openapiDot1SMSTInstanceSet() sanity successful\n\n");
printf("Testing openapiDot1SMSTInstanceFirstGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Instance:(result = %d)\n", result);
printf("openapiDot1SMSTInstanceFirstGet() sanity successful\n\n");
printf("Testing openapiDot1SMSTInstanceNextGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Next Instance:(result = %d)\n", result);
printf("openapiDot1SMSTInstanceNextGet() sanity successful\n\n");
printf("Testing openapiDot1SMSTInstancePrioritySet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("openapiDot1SMSTInstancePrioritySet() sanity successful\n\n");
printf("Testing openapiDot1SMSTInstancePriorityGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Priority:(result = %d)\n", result);
printf("openapiDot1SMSTInstancePriorityGet() sanity successful\n\n");
printf("Testing openapiDot1SMSTInstanceVLANSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Action:(result = %d)\n", result);
printf("openapiDot1SMSTInstanceVLANSet() sanity successful\n\n");
printf("Testing openapiDot1SMSTInstanceFirstVLANGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL VLAN:(result = %d)\n", result);
printf("openapiDot1SMSTInstanceFirstVLANGet() sanity successful\n\n");
printf("Testing openapiDot1SMSTInstanceNextVLANGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Next Vlan:(result = %d)\n", result);
printf("openapiDot1SMSTInstanceNextVLANGet() sanity successful\n\n");
printf("Testing openapiDot1SMSTInstanceFirstFIdGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL FId:(result = %d)\n", result);
printf("openapiDot1SMSTInstanceFirstFIdGet() sanity successful\n\n");
printf("Testing openapiDot1SMSTInstanceNextFIdGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Next FId:(result = %d)\n", result);
printf("openapiDot1SMSTInstanceNextFIdGet() sanity successful\n\n");
printf("Testing openapiDot1SIntfModeSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiDot1SIntfModeSet() sanity successful\n\n");
printf("Testing openapiDot1SIntfModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiDot1SIntfModeGet() sanity successful\n\n");
printf("Testing openapiDot1SIntfModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiDot1SIntfModeGet() sanity successful\n\n");
printf("Testing openapiDot1SIntfPortFwdStateGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL FwdState:(result = %d)\n", result);
printf("openapiDot1SIntfPortFwdStateGet() sanity successful\n\n");
printf("Testing openapiDot1SIntfPortRoleGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL PortRole:(result = %d)\n", result);
printf("openapiDot1SIntfPortRoleGet() sanity successful\n\n");
printf("Testing openapiDot1SIntfEdgePortModeSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Control Mode:(result = %d)\n", result);
printf("openapiDot1SIntfEdgePortModeSet() sanity successful\n\n");
printf("Testing openapiDot1SIntfEdgePortModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiDot1SIntfEdgePortModeGet() sanity successful\n\n");
printf("Testing openapiDot1SIntfPortLoopInconsistentStateGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Loop Inconsistent State:(result = %d)\n", result);
printf("openapiDot1SIntfPortLoopInconsistentStateGet() sanity successful\n\n");
free(str);
mstid = 0;
printf("Testing openapiDot1sMSTInstanceBridgeIdentifierGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceBridgeIdentifierGet():\n");
printf("Invalid MST ID:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceBridgeIdentifierGet():\n");
printf("NULL argument 3:(result = %d)\n", result);
printf("openapiDot1sMSTInstanceBridgeIdentifierGet() sanity successful\n\n");
printf("Testing openapiDot1sMSTInstanceTimeSinceTopologyChangeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceTimeSinceTopologyChangeGet():\n");
printf("Invalid MST ID:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceTimeSinceTopologyChangeGet():\n");
printf("NULL argument 3:(result = %d)\n", result);
printf("openapiDot1sMSTInstanceTimeSinceTopologyChangeGet() sanity successful\n\n");
printf("Testing openapiDot1sMSTInstanceTopologyChangeCountGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceTopologyChangeCountGet():\n");
printf("Invalid MST ID:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceTopologyChangeCountGet():\n");
printf("NULL argument 3:(result = %d)\n", result);
printf("openapiDot1sMSTInstanceTopologyChangeCountGet() sanity successful\n\n");
printf("Testing openapiDot1sMSTInstanceTopologyChangeStateGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceTopologyChangeStateGet():\n");
printf("Invalid MST ID:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceTopologyChangeStateGet():\n");
printf("NULL argument 3:(result = %d)\n", result);
printf("openapiDot1sMSTInstanceTopologyChangeStateGet() sanity successful\n\n");
printf("Testing openapiDot1sMSTInstanceDesignatedRootIDGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceDesignatedRootIDGet():\n");
printf("Invalid MST ID:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceDesignatedRootIDGet():\n");
printf("NULL argument 3:(result = %d)\n", result);
printf("openapiDot1sMSTInstanceDesignatedRootIDGet() sanity successful\n\n");
printf("Testing openapiDot1sMSTInstanceRootPathCostGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceRootPathCostGet():\n");
printf("Invalid MST ID:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceRootPathCostGet():\n");
printf("NULL argument 3:(result = %d)\n", result);
printf("openapiDot1sMSTInstanceRootPathCostGet() sanity successful\n\n");
printf("Testing openapiDot1sMSTInstanceRootPortIDGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceRootPortIDGet():\n");
printf("Invalid MST ID:(result = %d)\n", result);
printf("Testing openapiDot1sMSTInstanceRootPortIDGet():\n");
printf("NULL argument 3:(result = %d)\n", result);
printf("openapiDot1sMSTInstanceRootPortIDGet() sanity successful\n\n");
printf("Testing openapiDot1sCISTMaxAgeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sCISTMaxAgeGet():\n");
printf("NULL argument 2:(result = %d)\n", result);
printf("openapiDot1sCISTMaxAgeGet() sanity successful\n\n");
printf("Testing openapiDot1sBridgeMaxHopGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sBridgeMaxHopGet():\n");
printf("NULL argument 2:(result = %d)\n", result);
printf("openapiDot1sBridgeMaxHopGet() sanity successful\n\n");
printf("Testing openapiDot1sBridgeTxHoldCountGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sBridgeTxHoldCountGet():\n");
printf("NULL argument 2:(result = %d)\n", result);
printf("openapiDot1sBridgeTxHoldCountGet() sanity successful\n\n");
printf("Testing openapiDot1sCISTRootFwdDelayGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sCISTRootFwdDelayGet():\n");
printf("NULL argument 2:(result = %d)\n", result);
printf("openapiDot1sCISTRootFwdDelayGet() sanity successful\n\n");
printf("Testing openapiDot1sCISTHelloTimeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sCISTHelloTimeGet():\n");
printf("Likely invalid interface number:(result = %d)\n", result);
printf("Testing openapiDot1sCISTHelloTimeGet():\n");
printf("NULL argument 3:(result = %d)\n", result);
printf("openapiDot1sCISTHelloTimeGet() sanity successful\n\n");
printf("Testing openapiDot1sCISTBridgeHoldTimeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sCISTBridgeHoldTimeGet():\n");
printf("NULL argument 2:(result = %d)\n", result);
printf("openapiDot1sCISTBridgeHoldTimeGet() sanity successful\n\n");
printf("Testing openapiDot1sCISTRegionalRootIDGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sCISTRegionalRootIDGet():\n");
printf("NULL argument 2:(result = %d)\n", result);
printf("openapiDot1sCISTRegionalRootIDGet() sanity successful\n\n");
printf("Testing openapiDot1sCISTRegionalRootPathCostGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("Testing openapiDot1sCISTRegionalRootPathCostGet():\n");
printf("NULL argument 2:(result = %d)\n", result);
printf("openapiDot1sCISTRegionalRootPathCostGet() sanity successful\n\n");
return;
}
int main(int argc, char **argv)
{
uint32_t testNum, arg1, arg2;
char switch_os_revision_string[100];
if (argc < 2)
{
printDot1sAppMenu();
exit(1);
}
testNum = atoi(argv[1]);
l7proc_crashlog_register();
{
printf("\nFailed to initialize RPC to OpEN. Exiting (result = %d)\n", result);
exit(2);
}
{
sleep(1);
}
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Starting Spanning Tree 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)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SModeSet(&clientHandle, arg1);
break;
case 2:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1SModeGet(&clientHandle);
break;
case 3:
if (argc != 4)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
dot1SIntfBPDUFilterModeSet(&clientHandle, arg1, arg2);
break;
case 4:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SIntfBPDUFilterModeGet(&clientHandle, arg1);
break;
case 5:
if (argc != 4)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
dot1SIntfBPDUFloodModeSet(&clientHandle, arg1, arg2);
break;
case 6:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SIntfBPDUFloodModeGet(&clientHandle, arg1);
break;
case 7:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SBPDUGuardModeSet(&clientHandle, arg1);
break;
case 8:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1SBPDUGuardModeGet(&clientHandle);
break;
case 9:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
dot1SConfigNameSet(&clientHandle, argv[2]);
break;
case 10:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1SConfigNameGet(&clientHandle);
break;
case 11:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SConfigRevisionSet(&clientHandle, arg1);
break;
case 12:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1SConfigRevisionGet(&clientHandle);
break;
case 13:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SForceVersionSet(&clientHandle, arg1);
break;
case 14:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1SForceVersionGet(&clientHandle);
break;
case 15:
if (argc != 4)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
dot1SIntfGuardModeSet(&clientHandle, arg1, arg2);
break;
case 16:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SIntfGuardModeGet(&clientHandle, arg1);
break;
case 17:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SMSTInstanceSet(&clientHandle, arg1, OPEN_ACTION_ADD);
break;
case 18:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SMSTInstanceSet(&clientHandle, arg1, OPEN_ACTION_DELETE);
break;
case 19:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1SMSTInstancesGet(&clientHandle);
break;
case 20:
if (argc != 4)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
dot1SMSTInstancePrioritySet(&clientHandle, arg1, arg2);
break;
case 21:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SMSTInstancePriorityGet(&clientHandle, arg1);
break;
case 22:
if (argc != 4)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
dot1SMSTInstanceVLANSet(&clientHandle, arg1, arg2, OPEN_ACTION_ADD);
break;
case 23:
if (argc != 4)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
dot1SMSTInstanceVLANSet(&clientHandle, arg1, arg2, OPEN_ACTION_DELETE);
break;
case 24:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SMSTInstanceVLANsGet(&clientHandle, arg1);
break;
case 25:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SMSTInstanceFIdsGet(&clientHandle, arg1);
break;
case 26:
if (argc != 4)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
dot1SIntfModeSet(&clientHandle, arg1, arg2);
break;
case 27:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SIntfModeGet(&clientHandle, arg1);
break;
case 28:
if (argc != 4)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
dot1SIntfPortFwdStateGet(&clientHandle, arg1, arg2);
break;
case 29:
if (argc != 4)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
dot1SIntfPortRoleGet(&clientHandle, arg1, arg2);
break;
case 30:
if (argc != 4)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
dot1SIntfEdgePortModeSet(&clientHandle, arg1, arg2);
break;
case 31:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SIntfEdgePortModeGet(&clientHandle, arg1);
break;
case 32:
if (argc != 4)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
dot1SIntfPortLoopInconsistentStateGet(&clientHandle, arg1, arg2);
break;
case 33:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1sMSTInstanceBridgeIdentifierGet(&clientHandle, arg1);
break;
case 34:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1sMSTInstanceTimeSinceTopologyChangeGet(&clientHandle, arg1);
break;
case 35:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1sMSTInstanceTopologyChangeCountGet(&clientHandle, arg1);
break;
case 36:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1sMSTInstanceTopologyChangeStateGet(&clientHandle, arg1);
break;
case 37:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1sMSTInstanceDesignatedRootIDGet(&clientHandle, arg1);
break;
case 38:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1sMSTInstanceRootPathCostGet(&clientHandle, arg1);
break;
case 39:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1sMSTInstanceRootPortIDGet(&clientHandle, arg1);
break;
case 40:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1sCISTMaxAgeGet(&clientHandle);
break;
case 41:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1sBridgeMaxHopGet(&clientHandle);
break;
case 42:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1sBridgeTxHoldCountGet(&clientHandle);
break;
case 43:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1sCISTRootFwdDelayGet(&clientHandle);
break;
case 44:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1sCISTHelloTimeGet(&clientHandle, arg1);
break;
case 45:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1sCISTBridgeHoldTimeGet(&clientHandle);
break;
case 46:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1sCISTRegionalRootIDGet(&clientHandle);
break;
case 47:
if (argc != 2)
{
printDot1sAppMenu();
exit(1);
}
dot1sCISTRegionalRootPathCostGet(&clientHandle);
break;
case 48:
if (argc != 3)
{
printDot1sAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
dot1SOpENAPIsTestSanity(&clientHandle, arg1);
break;
default:
printDot1sAppMenu();
break;
}
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Stopping Spanning Tree API example application");
return 0;
}