Open Ethernet Networking (OpEN) API Guide and Reference Manual  3.13.1.2
stacking_example.c
/*********************************************************************
*
* Copyright 2016-2023 Broadcom.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
**********************************************************************
*
* @filename stacking_example.c
*
* @purpose Stack Configuration OpEN APIs Example
*
* @component OpEN
*
* @note
*
* @create 02/03/2016
*
* @end
*
**********************************************************************/
#include <stdlib.h>
#include <unistd.h>
#include "rpcclt_openapi.h"
#include "proc_util.h"
#include "openapi_common.h"
/*
OpEN API set functions are processed asynchronously. There may be some
delay between when the set function call returns and when the system
state is updated to reflect the change. These parameters control how
long the test code retries the get functions to retrieve a change.
*/
/***************************************************************/
void printStackingAppMenu()
{
printf("Usage: stacking_example <test#> <arg1> <arg2> ... \n");
printf("Test 1: Get the next member of the current stack: stacking_example 1 <start-unit> \n");
printf("Test 2: Get the manager's unit number: stacking_example 2 \n");
printf("Test 3: Get the unit's status: stacking_example 3 <unit> \n");
printf("Test 4: Get the unit's management status: stacking_example 4 <unit> \n");
printf("Test 5: Get the configured and standby unit number and admin mode in the stack: stacking_example 5 \n");
printf("Test 6: Get the unit's model identifier string and pre-configured model identifier string assigned by HPC: stacking_example 6 <unit> \n");
printf("Test 7: Get the unit's version of code in flash: stacking_example 7 <unit> \n");
printf("Test 8: Get the unit's running version of code: stacking_example 8 <unit> \n");
printf("Test 9: Get the unit's hardware and admin management preference: stacking_example 9 <unit> \n");
printf("Test 10: Get the unit's type and index: stacking_example 10 <unit> \n");
printf("Test 11: Get unit description that corresponds to the index provided: stacking_example 11 <unit-type-index> \n");
printf("Test 12: Get stack firmware synchronization status of member unit: stacking_example 12 <unit> \n");
printf("Test 13: Get stack firmware synchronization status: stacking_example 13 \n");
printf("Test 14: Get stack firmware synchronization last attempt status: stacking_example 14 <unit> \n");
printf("Test 15: Get active template id of the stack unit: stacking_example 15 <unit> \n");
printf("Test 16: Get description of specified template id: stacking_example 16 <template-id> \n");
printf("Test 17: Get the unit's up time in seconds: stacking_example 17 <unit> \n");
printf("Test 18: Get the unit's serial number: stacking_example 18 <unit> \n");
printf("Test 19: Get the unit's service tag: stacking_example 19 <unit> \n");
printf("Test 20: Get the unit's model identifier string assigned by HPC: stacking_example 20 <unit> \n");
printf("Test 21: Verify unit number: stacking_example 21 <unit> \n");
printf("Test 22: Get the maximum stacking unit number: stacking_example 22 \n");
printf("Test 23: Get unit type identifier that corresponds to the index provided: stacking_example 23 <unit-type-index> \n");
printf("Test 24: Get unit type identifier that corresponds to the next index: stacking_example 24 <unit-type-index> \n");
printf("Test 25: Create a new unit record for unit: stacking_example 25 <unit> <unit-type-index> <synch-mode> \n");
printf("Test 26: Remove a unit only if it is not an active member of the stack: stacking_example 26 <unit> \n");
printf("Test 27: Transfers the management function from the current unit to another: stacking_example 27 <target-unit> \n");
printf("Test 28: Get QOS configuration for all front-panel stacking ports stack port: stacking_example 28 \n");
printf("Test 29: Set QOS configuration for all front-panel stacking ports stack port: stacking_example 29 <fps-qos-mode> \n");
printf("Test 30: Set the unit as standby in the stack: stacking_example 30 <standby-unit> <standby-admin-mode> \n");
printf("Test 31: Get stacking mode configuration for a front-panel stack port: stacking_example 31 <unit> <slot> <port> \n");
printf("Test 32: Set stacking mode configuration for a front-panel stack port: stacking_example 32 <unit> <slot> <port> <stack-port-mode> \n");
printf("Test 33: Verify slot number: stacking_example 33 <unit> <slot> \n");
printf("Test 34: List available slot(s) on given unit: stacking_example 34 <unit> \n");
printf("Test 35: Verify the slot is full: stacking_example 35 <unit> <slot> \n");
printf("Test 36: Get the admin mode of slot: stacking_example 36 <unit> <slot> \n");
printf("Test 37: Set the admin mode of slot: stacking_example 37 <unit> <slot> <admin mode> \n");
printf("Test 38: Get the power of slot: stacking_example 38 <unit> <slot> \n");
printf("Test 39: Set the power mode of slot: stacking_example 39 <unit> <slot> <power mode> \n");
printf("Test 40: Get the card type: stacking_example 40 <unit> <slot> \n");
printf("Test 41: Get model id and description of configured card: stacking_example 41 <unit> <slot> \n");
printf("Test 42: Get model id and description of inserted card: stacking_example 42 <unit> <slot> \n");
printf("Test 43: Verify the slot is pluggable: stacking_example 43 <unit> <slot> \n");
printf("Test 44: Verify the slot is power down: stacking_example 44 <unit> <slot> \n");
printf("Test 45: Transfer arbitrary file from mgmr to member unit: stacking_example 45 <unit/-1> <src_file> <dst_file> \n");
printf("Test 46: Get running speed for a front-panel stack port: stacking_example 46 <unit> <slot> <port> \n");
printf("Test 47: Get configured speed for a front-panel stack port: stacking_example 47 <unit> <slot> <port> \n");
printf("Test 48: Set speed configuration for a front-panel stack port: stacking_example 48 <unit> <slot> <port> <stack-port-speed> \n");
printf("Test 49: Get the unit index of the local unit: stacking_example 49\n");
printf("Test 50: Get the unit model identifier: stacking_example 50 <unit>\n");
printf("Test 51: Get default template id for selected unit type index: stacking_example 51\n");
printf("Test 52: Get management preference of the unit index: stacking_example 52 <unit>\n");
printf("Test 53: Get the first member of the current stack: stacking_example 53\n");
printf("Test 54: Get the unit system identifier key: stacking_example 54 <unit>\n");
printf("Test 55: Set the admin management preference: stacking_example 55 <unit> <admin pref>\n");
printf("Test 56: Initiate a warm failover to the backup unit: stacking_example 56\n");
printf("Test 57: Administratively enable or disable nonstop forwarding: stacking_example 57 <1/0>\n");
printf("Test 58: Get the administrative status of nonstop forwarding: stacking_example 58\n");
printf("Test 59: Get the reason for the last restart: stacking_example 59\n");
printf("Test 60: Convert a startup reason to a string: stacking_example 60 <reason number>\n");
printf("Test 61: Convert a run config status to a string: stacking_example 61 <config status>\n");
printf("Test 62: Get the age of the configuration on the backup unit: stacking_example 62\n");
printf("Test 63: Get the status of copying the running config to the backup unit: stacking_example 63\n");
printf("Test 64: Next running config copy to backup , if a copy is scheduled: stacking_example 64\n");
printf("Test 65: Get this unit's nonstop forwarding support: stacking_example 65 <unit>\n");
printf("Test 66: Get stack status information and display: stacking_example 66 <unit>\n");
printf("Test 67: Change a unit's number: stacking_example 67 <unit> <new unit>\n");
printf("Test 68: Erase the startup-config file on other connected units: stacking_example 68\n");
printf("Test 69: Erase the factory-defaults file on other connected units: stacking_example 69\n");
printf("Test 70: Set unit user description: stacking_example 70 <unit> <description>\n");
printf("Test 71: Get unit user description: stacking_example 71 <unit>\n");
printf("Test 72: Get stack firmware synchronication mode: stacking_example 72\n");
printf("Test 73: Set stack firmware synchronication mode: stacking_example 73 <0/1>\n");
printf("Test 74: Get stack firmware synchronication trap mode: stacking_example 74\n");
printf("Test 75: Set stack firmware synchronication trap mode: stacking_example 75 <0/1>\n");
printf("Test 76: Get stack firmware synchronication downgrade mode: stacking_example 76\n");
printf("Test 77: Set stack firmware synchronication downgrade mode: stacking_example 77 <mode>\n");
printf("Test 78: Set the mode of sample collection, size of sample: stacking_example 78 <mode> <size>\n");
printf("Test 79: Clear the sampling information of unit status: stacking_example 79 <unit>\n");
printf("Test 80: Reset stack config on a unit: stacking_example 80 <unit>\n");
printf("Test 82: Erase the DHCP client configuration file on the stand-by unit: stacking_example 82\n");
printf("Test 83: Clear stack counters for all stack ports: stacking_example 83\n");
printf("Test 84: Determine if a given port is stack capable: stacking_example 84\n");
printf("Test 85: Set hash mode configuration for all HG trunks: stacking_example 85 <mode>\n");
printf("Test 86: Get the hash mode configuration for all HG trunks: stacking_example 86\n");
printf("Test 87: To check if the hash mode is configurable: stacking_example 87 <mode>\n");
printf("Test 88: Get the unit's stored Debian rootfs sync status: stacking_example 88 <unit>\n");
return;
}
/*****************************************************************/
void stackSpmStackPortCountersClear(openapiClientHandle_t *clientHandle)
{
open_error_t result;
if ((result = openapiSpmStackPortCountersClear(clientHandle)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Success\n");
}
return;
}
/*****************************************************************/
void stackUnitMgrStackMemberGetNext(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
uint32_t nextUnit = 0;
if ((result = openapiUnitMgrStackMemberGetNext(clientHandle, unit, &nextUnit)) != OPEN_E_NONE)
{
printf("Bad return code trying to get next member of the current stack. (result = %d)\n", result);
}
else
{
printf("Next member of the current stack: %d\n", nextUnit);
}
return;
}
/*****************************************************************/
void stackUnitMgrNumberGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
uint32_t unit = 0;
if ((result = openapiUnitMgrNumberGet(clientHandle, &unit)) != OPEN_E_NONE)
{
printf("Bad return code trying to get manager's unit number. (result = %d)\n", result);
}
else
{
printf("Manager's unit number: %d\n", unit);
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitStatusGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
if ((result = openapiUnitMgrUnitStatusGet(clientHandle, unit, &status)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit's status. (result = %d)\n", result);
}
else
{
switch (status)
{
printf("Status for unit (%d): Ok\n", unit);
break;
printf("Status for unit (%d): Unsupported\n", unit);
break;
printf("Status for unit (%d): Code Mismatch\n", unit);
break;
printf("Status for unit (%d): Configuration Mismatch\n", unit);
break;
printf("Status for unit (%d): SDM Mismatch\n", unit);
break;
printf("Status for unit (%d): Unit Not Present\n", unit);
break;
printf("Status for unit (%d): Code Update\n", unit);
break;
printf("Status for unit (%d): STM Mismatch\n", unit);
break;
default:
break;
}
}
return;
}
/*****************************************************************/
void stackUnitMgrMgmtUnitStatusGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
if ((result = openapiUnitMgrMgmtUnitStatusGet(clientHandle, unit, &mgmtStatus)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit's management status. (result = %d)\n", result);
}
else
{
switch (mgmtStatus)
{
printf("Management status for unit (%d): Enable\n", unit);
break;
printf("Management status for unit (%d): Disable\n", unit);
break;
printf("Management status for unit (%d): Unassigned\n", unit);
break;
default:
break;
}
}
return;
}
/*****************************************************************/
void stackUnitMgrStandbyGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
uint32_t configUnit = 0;
uint32_t standbyUnit = 0;
OPEN_BOOL_t standbyAdminMode = OPEN_FALSE;
if ((result = openapiUnitMgrStandbyGet(clientHandle, &configUnit, &standbyUnit, &standbyAdminMode)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit numbers and admin mode for standby unit. (result = %d)\n", result);
}
else
{
printf("Configured Unit : %d\n", configUnit);
printf("Standby Unit : %d\n", standbyUnit);
if (standbyAdminMode == OPEN_TRUE)
{
printf("Admin mode of Standby Unit (%d) is Enable\n", standbyUnit);
}
else
{
printf("Admin mode of Standby Unit (%d) is Disable\n", standbyUnit);
}
}
return;
}
/*****************************************************************/
void stackUnitMgrModelIdentifierGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
open_buffdesc modelId, preconfigModelId;
char bufModelId[512] = {0};
char bufPreconfigModelId[512] = {0};
modelId.pstart = bufModelId;
modelId.size = sizeof(bufModelId);
preconfigModelId.pstart = bufPreconfigModelId;
preconfigModelId.size = sizeof(bufPreconfigModelId);
if ((result = openapiUnitMgrModelIdentifierGet(clientHandle, unit, &modelId, &preconfigModelId)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit numbers and admin mode for standby unit. (result = %d)\n", result);
}
else
{
printf("Model identifier : %s\nPreconfigured model identifier : %s\n", (char *)modelId.pstart, (char *)preconfigModelId.pstart);
}
return;
}
/*****************************************************************/
void stackUnitMgrDetectCodeVerFlashGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
open_revision_data_t codeVersion;
if ((result = openapiUnitMgrDetectCodeVerFlashGet(clientHandle, unit, &codeVersion)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit's version code in flash. (result = %d)\n", result);
}
else
{
printf("Release : %d\nVersion : %d\nMaintenance Level : %d\nBuild Parts : %d\n", codeVersion.release, codeVersion.version, codeVersion.maint_level, codeVersion.build_num);
}
return;
}
/*****************************************************************/
void stackUnitMgrDetectCodeVerRunningGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
open_revision_data_t codeVersion;
if ((result = openapiUnitMgrDetectCodeVerRunningGet(clientHandle, unit, &codeVersion)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit's running version of code. (result = %d)\n", result);
}
else
{
printf("Release : %d\nVersion : %d\nMaintenance Level : %d\nBuild Parts : %d\n", codeVersion.release, codeVersion.version, codeVersion.maint_level, codeVersion.build_num);
}
return;
}
/*****************************************************************/
void printMgmtPref(OPEN_BOOL_t type, uint32_t unit, OPEN_USMDB_UNITMGR_MGMTPREF_t pref)
{
if (type == OPEN_TRUE)
{
printf("Hardware ");
}
else
{
printf("Admin ");
}
switch (pref)
{
printf("management preference for unit (%d): Disable\n", unit);
break;
printf("management preference for unit (%d): Unassigned\n", unit);
break;
default:
printf("management preference for unit (%d): %d\n", unit, pref);
break;
}
}
/*****************************************************************/
void stackUnitMgrMgmtPrefGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
if ((result = openapiUnitMgrMgmtPrefGet(clientHandle, unit, &hwPref, &adminPref)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit's hardware and admin management preference. (result = %d)\n", result);
}
else
{
printMgmtPref(OPEN_TRUE, unit, hwPref);
printMgmtPref(OPEN_FALSE, unit, adminPref);
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitTypeGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
uint32_t unitType = 0;
uint32_t unitTypeIndex = 0;
if ((result = openapiUnitMgrUnitTypeGet(clientHandle, unit, &unitType, &unitTypeIndex)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit's type and index. (result = %d)\n", result);
}
else
{
printf("Unit type : 0x%x\nUnit type index : %d\n", unitType, unitTypeIndex);
}
return;
}
/*****************************************************************/
void stackUnitMgrSupportedDescriptionGet(openapiClientHandle_t *clientHandle, uint32_t unitTypeIndex)
{
open_error_t result;
open_buffdesc unitDescr;
char bufUnitDescr[512] = {0};
unitDescr.pstart = bufUnitDescr;
unitDescr.size = sizeof(bufUnitDescr);
if ((result = openapiUnitMgrSupportedDescriptionGet(clientHandle, unitTypeIndex, &unitDescr)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit description that corresponds to the index provided. (result = %d)\n", result);
}
else
{
printf("Description for unit index (%d): %s\n", unitTypeIndex, (char *)unitDescr.pstart);
}
return;
}
/*****************************************************************/
void stackUnitMgrStackFirmwareSyncMemberStatusGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
if ((result = openapiUnitMgrStackFirmwareSyncMemberStatusGet(clientHandle, unit, &firmwareSyncStatus)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the stack firmware synchronization status of member unit. (result = %d)\n", result);
}
else
{
switch (firmwareSyncStatus)
{
printf("Stack firmware synchronization status of member unit(%d) : In Progress\n", unit);
break;
default:
printf("Stack firmware synchronization status of member unit(%d) : No Action\n", unit);
break;
}
}
return;
}
/*****************************************************************/
void stackUnitMgrStackFirmwareSyncStatusGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
if ((result = openapiUnitMgrStackFirmwareSyncStatusGet(clientHandle, &firmwareSyncStatus)) != OPEN_E_NONE)
{
if (result == OPEN_E_UNAVAIL)
{
printf("Feature is not supported.\n");
}
else
{
printf("Bad return code trying to get the stack firmware synchronization status. (result = %d)\n", result);
}
}
else
{
switch (firmwareSyncStatus)
{
printf("Stack firmware synchronization status : In Progress\n");
break;
default:
printf("Stack firmware synchronization status : No Action\n");
break;
}
}
return;
}
/*****************************************************************/
void stackUnitMgrStackFirmwareSyncMemberLastAttemptStatusGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
uint32_t lastAttemptStatus = 0;
if ((result = openapiUnitMgrStackFirmwareSyncMemberLastAttemptStatusGet(clientHandle, unit, &lastAttemptStatus)) != OPEN_E_NONE)
{
if (result == OPEN_E_UNAVAIL)
{
printf("Feature is not supported.\n");
}
else
{
printf("Bad return code trying to get the stack firmware synchronization last attempt status of member unit. (result = %d)\n", result);
}
}
else
{
switch (lastAttemptStatus)
{
printf("Stack firmware synchronization last attempt status of member unit(%d) : Success\n", unit);
break;
printf("Stack firmware synchronization last attempt status of member unit(%d) : Failure\n", unit);
break;
printf("Stack firmware synchronization last attempt status of member unit(%d) : Min boot code version not present\n", unit);
break;
default:
printf("Stack firmware synchronization last attempt status of member unit(%d) : None\n", unit);
break;
}
}
return;
}
/*****************************************************************/
void stackStmUnitActiveTemplateIdGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
uint32_t templateId = 0;
if ((result = openapiStmUnitActiveTemplateIdGet(clientHandle, unit, &templateId)) != OPEN_E_NONE)
{
if (result == OPEN_E_UNAVAIL)
{
printf("Feature is not supported.\n");
}
else
{
printf("Bad return code trying to get the active template id of the stack unit. (result = %d)\n", result);
}
}
else
{
printf("Active template id of the stack unit(%d) : %d\n", unit, templateId);
}
return;
}
/*****************************************************************/
void stackStmTemplateDescriptionGet(openapiClientHandle_t *clientHandle, uint32_t templateId)
{
open_error_t result;
open_buffdesc templateDescr;
char bufTemplateDescr[512] = {0};
templateDescr.pstart = bufTemplateDescr;
templateDescr.size = sizeof(bufTemplateDescr);
if ((result = openapiStmTemplateDescriptionGet(clientHandle, templateId, &templateDescr)) != OPEN_E_NONE)
{
if (result == OPEN_E_UNAVAIL)
{
printf("Feature is not supported.\n");
}
else
{
printf("Bad return code trying to get the description of specified template id. (result = %d)\n", result);
}
}
else
{
printf("Description of template id(%d): %s\n", templateId, (char *)templateDescr.pstart);
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitUpTimeGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
uint32_t upTime = 0;
if ((result = openapiUnitMgrUnitUpTimeGet(clientHandle, unit, &upTime)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit's up time in seconds. (result = %d)\n", result);
}
else
{
printf("Uptime in seconds for unit(%d) : %d\n", unit, upTime);
}
return;
}
/*****************************************************************/
void stackUnitMgrSerialNumberGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
open_buffdesc serialNumber;
char bufSerialNumber[512] = {0};
serialNumber.pstart = bufSerialNumber;
serialNumber.size = sizeof(bufSerialNumber);
if ((result = openapiUnitMgrSerialNumberGet(clientHandle, unit, &serialNumber)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit's serial number. (result = %d)\n", result);
}
else
{
printf("Serial Number for unit (%d): %s\n", unit, (char *)serialNumber.pstart);
}
return;
}
/*****************************************************************/
void stackUnitMgrServiceTagGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
open_buffdesc serviceTag;
char bufServiceTag[512] = {0};
serviceTag.pstart = bufServiceTag;
serviceTag.size = sizeof(bufServiceTag);
if ((result = openapiUnitMgrServiceTagGet(clientHandle, unit, &serviceTag)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit's service tag. (result = %d)\n", result);
}
else
{
printf("Service Tag for unit (%d): %s\n", unit, (char *)serviceTag.pstart);
}
return;
}
/*****************************************************************/
void stackUnitMgrPreconfigModelIdGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
open_buffdesc modelId;
char bufModelId[512] = {0};
modelId.pstart = bufModelId;
modelId.size = sizeof(bufModelId);
if ((result = openapiUnitMgrPreconfigModelIdGet(clientHandle, unit, &modelId)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit's pre-configured model identifier. (result = %d)\n", result);
}
else
{
printf("Pre-configured model identifier for unit (%d): %s\n", unit, (char *)modelId.pstart);
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitIsValid(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
if ((result = openapiUnitMgrUnitIsValid(clientHandle, unit, &isValid)) != OPEN_E_NONE)
{
printf("Bad return code trying to verify valid unit. (result = %d)\n", result);
}
else
{
if (isValid == OPEN_TRUE)
{
printf("Unit (%d) is Valid\n", unit);
}
else
{
printf("Unit (%d) is Invalid\n", unit);
}
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitMaxGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
uint32_t unit = 0;
if ((result = openapiUnitMgrUnitMaxGet(clientHandle, &unit)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the maximum stacking unit number. (result = %d)\n", result);
}
else
{
printf("Maximum stacking unit number: %d\n", unit);
}
return;
}
/*****************************************************************/
void stackUnitMgrSupportedUnitIdGet(openapiClientHandle_t *clientHandle, uint32_t unitTypeIndex)
{
open_error_t result;
uint32_t unitType = 0;
if ((result = openapiUnitMgrSupportedUnitIdGet(clientHandle, unitTypeIndex, &unitType)) != OPEN_E_NONE)
{
printf("Bad return code trying to get unit type identifier that corresponds to the index provided. (result = %d)\n", result);
}
else
{
printf("Unit type identifier for index (%d): 0x%x\n", unitTypeIndex, unitType);
}
return;
}
/*****************************************************************/
void stackUnitMgrSupportedUnitIdNextGet(openapiClientHandle_t *clientHandle, uint32_t unitTypeIndex)
{
open_error_t result;
uint32_t nextUnitTypeIndex = 0;
uint32_t unitType = 0;
if ((result = openapiUnitMgrSupportedUnitIdNextGet(clientHandle, unitTypeIndex, &nextUnitTypeIndex, &unitType)) != OPEN_E_NONE)
{
printf("Bad return code trying to get unit type identifier that corresponds to the next index. (result = %d)\n", result);
}
else
{
printf("Unit type identifier for next index (%d): 0x%x\n", nextUnitTypeIndex, unitType);
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitCreate(openapiClientHandle_t *clientHandle, uint32_t unit,
uint32_t unitTypeIndex, OPEN_BOOL_t synchMode)
{
open_error_t result;
if ((result = openapiUnitMgrUnitCreate(clientHandle, unit, unitTypeIndex, synchMode)) != OPEN_E_NONE)
{
printf("Bad return code trying to create a new unit record for unit. (result = %d)\n", result);
}
else
{
printf("New unit record created successfully for unit(%d).\n", unit);
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitDelete(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
if ((result = openapiUnitMgrUnitDelete(clientHandle, unit)) != OPEN_E_NONE)
{
if (result == OPEN_E_ERROR)
{
printf("Failed to remove. Unit (%d) is an active member of the stack.\n", unit);
}
else
{
printf("Bad return code trying to remove a unit. (result = %d)\n", result);
}
}
else
{
printf("Unit (%d) removed successfully.\n", unit);
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitTransfer(openapiClientHandle_t *clientHandle, uint32_t targetUnit)
{
open_error_t result;
if ((result = openapiUnitMgrUnitTransfer(clientHandle, targetUnit)) != OPEN_E_NONE)
{
printf("Bad return code trying to transfers the management function from the current unit to another. (result = %d)\n", result);
}
else
{
printf("Unit (%d) transfer successful.\n", targetUnit);
}
return;
}
/*****************************************************************/
void stackSpmFpsConfigQosModeGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
OPEN_CONTROL_t fpsQosMode = 0;
if ((result = openapiSpmFpsConfigQosModeGet(clientHandle, &fpsQosMode)) != OPEN_E_NONE)
{
if (result == OPEN_E_UNAVAIL)
{
printf("Feature is not supported.\n");
}
else
{
printf("Bad return code trying to get QOS configuration for all front-panel stacking ports stack port. (result = %d)\n", result);
}
}
else
{
if (fpsQosMode == OPEN_ENABLE)
{
printf("QOS Mode for all front-panel stacking ports stack port: Enable.\n");
}
else
{
printf("QOS Mode for all front-panel stacking ports stack port: Disable.\n");
}
}
return;
}
/*****************************************************************/
void stackSpmFpsConfigQosModeSet(openapiClientHandle_t *clientHandle, OPEN_CONTROL_t fpsQosMode)
{
open_error_t result;
if ((result = openapiSpmFpsConfigQosModeSet(clientHandle, fpsQosMode)) != OPEN_E_NONE)
{
if (result == OPEN_E_UNAVAIL)
{
printf("Feature is not supported.\n");
}
else
{
printf("Bad return code trying to Set QOS configuration for all front-panel stacking ports stack port. (result = %d)\n", result);
}
}
else
{
printf("QOS Mode set successfully.\n");
}
return;
}
/*****************************************************************/
void stackUnitMgrStandbySet(openapiClientHandle_t *clientHandle, uint32_t standbyUnit,
OPEN_BOOL_t standbyAdminMode)
{
open_error_t result;
if ((result = openapiUnitMgrStandbySet(clientHandle, standbyUnit, standbyAdminMode)) != OPEN_E_NONE)
{
printf("Bad return code trying to set the unit as standby in the stack. (result = %d)\n", result);
}
else
{
printf("Unit (%d) set as standby in the stack successfully.\n", standbyUnit);
}
return;
}
/*****************************************************************/
void stackSpmFpsConfigStackingModeGet(openapiClientHandle_t *clientHandle, uint32_t unit,
uint32_t slot, uint32_t port)
{
open_error_t result;
OPEN_BOOL_t stackPortMode = OPEN_FALSE;
if ((result = openapiSpmFpsConfigStackingModeGet(clientHandle, unit, slot, port, &stackPortMode)) != OPEN_E_NONE)
{
if (result == OPEN_E_UNAVAIL)
{
printf("Feature is not supported.\n");
}
else
{
printf("Bad return code trying to get stacking mode configuration for a front-panel stack port. (result = %d)\n", result);
}
}
else
{
if (stackPortMode == OPEN_TRUE)
{
printf("Stacking mode configuration for a front-panel stack port is Enable.\n");
}
else
{
printf("Stacking mode configuration for a front-panel stack port is Disable.\n");
}
}
return;
}
/*****************************************************************/
void stackSpmFpsConfigStackingModeSet(openapiClientHandle_t *clientHandle, uint32_t unit,
uint32_t slot, uint32_t port, OPEN_BOOL_t stackPortMode)
{
open_error_t result;
if ((result = openapiSpmFpsConfigStackingModeSet(clientHandle, unit, slot, port, stackPortMode)) != OPEN_E_NONE)
{
if (result == OPEN_E_UNAVAIL)
{
printf("Feature is not supported.\n");
}
else
{
printf("Bad return code trying to set stacking mode configuration for a front-panel stack port. (result = %d)\n", result);
}
}
else
{
printf("Stacking mode configuration for a front-panel stack port set successfully.\n");
}
return;
}
/*****************************************************************/
void stackSlotGet(openapiClientHandle_t *clientHandle, uint32_t unit, uint32_t slot)
{
open_error_t result;
if ((result = openapiSlotGet(clientHandle, unit, slot, &isValid)) != OPEN_E_NONE)
{
printf("Bad return code trying to verify slot is available. (result = %d)\n", result);
}
else
{
if (isValid == OPEN_TRUE)
{
printf("Slot (%d) is available on Unit (%d)\n", slot, unit);
}
else
{
printf("Slot (%d) is not available on Unit (%d)\n", slot, unit);
}
}
return;
}
/*****************************************************************/
void stackUnitDbEntrySlotsGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
uint32_t size, i;
uint32_t bufSlot[3] = {0};
slot.pstart = bufSlot;
slot.size = sizeof(bufSlot);
if ((result = openapiUnitDbEntrySlotsGet(clientHandle, unit, &size, &slot)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the unit's slots. (result = %d)\n", result);
}
else
{
for(i = 0; i < size; i++)
{
printf("Slot (%d) is available on Unit (%d)\n", bufSlot[i], unit);
}
}
return;
}
/*****************************************************************/
void stackSlotIsFullGet(openapiClientHandle_t *clientHandle, uint32_t unit, uint32_t slot)
{
open_error_t result;
if ((result = openapiSlotIsFullGet(clientHandle, unit, slot, &isValid)) != OPEN_E_NONE)
{
printf("Bad return code trying to verify slot is full. (result = %d)\n", result);
}
else
{
if (isValid == OPEN_TRUE)
{
printf("Slot (%d) is full\n", slot);
}
else
{
printf("Slot (%d) is not full\n", slot);
}
}
return;
}
/*****************************************************************/
void stackSlotAdminModeGet(openapiClientHandle_t *clientHandle, uint32_t unit, uint32_t slot)
{
open_error_t result;
uint32_t mode = 0;
if ((result = openapiSlotAdminModeGet(clientHandle, unit, slot, &mode)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the slot's admin mode. (result = %d)\n", result);
}
else
{
printf("Admin Mode for Slot(%d) : %s\n", slot, (mode == OPEN_ENABLE ? "Enabled" : "Disabled"));
}
return;
}
/*****************************************************************/
void stackSlotAdminModeSet(openapiClientHandle_t *clientHandle, uint32_t unit, uint32_t slot, OPEN_CONTROL_t mode)
{
open_error_t result;
if ((result = openapiSlotAdminModeSet(clientHandle, unit, slot, mode)) != OPEN_E_NONE)
{
printf("Bad return code trying to set the slot's admin mode. (result = %d)\n", result);
}
else
{
printf("Admin Mode for Slot(%d) : %s is set\n", slot, (mode == OPEN_ENABLE ? "Enabled" : "Disabled"));
}
return;
}
/*****************************************************************/
void stackSlotPowerModeGet(openapiClientHandle_t *clientHandle, uint32_t unit, uint32_t slot)
{
open_error_t result;
uint32_t mode = 0;
if ((result = openapiSlotPowerModeGet(clientHandle, unit, slot, &mode)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the slot's power mode. (result = %d)\n", result);
}
else
{
printf("Power Mode for Slot(%d) : %s\n", slot, (mode == OPEN_ENABLE ? "Enabled" : "Disabled"));
}
return;
}
/*****************************************************************/
void stackSlotPowerModeSet(openapiClientHandle_t *clientHandle, uint32_t unit, uint32_t slot, OPEN_CONTROL_t mode)
{
open_error_t result;
if ((result = openapiSlotPowerModeSet(clientHandle, unit, slot, mode)) != OPEN_E_NONE)
{
printf("Bad return code trying to set the slot's power mode. (result = %d)\n", result);
}
else
{
printf("Power Mode for Slot(%d) : %s is set\n", slot, (mode == OPEN_ENABLE ? "Enabled" : "Disabled"));
}
return;
}
/*****************************************************************/
void stackCardTypeGet(openapiClientHandle_t *clientHandle, uint32_t unit, uint32_t slot)
{
open_error_t result;
uint32_t configured, inserted;
if ((result = openapiCardTypeGet(clientHandle, unit, slot, &configured, &inserted)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the slot's card type. (result = %d)\n", result);
}
else
{
printf("Configured card id for slot (%d): 0x%x (%d)\n", slot, configured, configured);
printf("Inserted card id for slot (%d): 0x%x (%d)\n", slot, inserted, inserted);
}
return;
}
/*****************************************************************/
void stackCardSupportedConfiguredCardInfoGet(openapiClientHandle_t *clientHandle, uint32_t unit, uint32_t slot)
{
open_error_t result;
open_buffdesc modelId;
char bufModelId[256] = {0};
char bufDesc[256] = {0};
uint32_t configured, inserted;
if ((result = openapiCardTypeGet(clientHandle, unit, slot, &configured, &inserted)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the slot's card type. (result = %d)\n", result);
return;
}
modelId.pstart = bufModelId;
modelId.size = sizeof(bufModelId);
desc.pstart = bufDesc;
desc.size = sizeof(bufDesc);
if ((result = openapiCardSupportedCardModelIdGet(clientHandle, configured, &modelId)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the card's model identifier. (result = %d)\n", result);
}
else
{
printf("Model identifier for configured card (0x%x): %s\n", configured, bufModelId);
}
if ((result = openapiCardSupportedCardDescriptionGet(clientHandle, configured, &desc)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the card's description. (result = %d)\n", result);
}
else
{
printf("Description for configured card (0x%x): %s\n", configured, bufDesc);
}
return;
}
/*****************************************************************/
void stackCardSupportedInsertedCardInfoGet(openapiClientHandle_t *clientHandle, uint32_t unit, uint32_t slot)
{
open_error_t result;
open_buffdesc modelId;
char bufModelId[256] = {0};
char bufDesc[256] = {0};
uint32_t configured, inserted;
if ((result = openapiCardTypeGet(clientHandle, unit, slot, &configured, &inserted)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the slot's card type. (result = %d)\n", result);
return;
}
modelId.pstart = bufModelId;
modelId.size = sizeof(bufModelId);
desc.pstart = bufDesc;
desc.size = sizeof(bufDesc);
if ((result = openapiCardSupportedCardModelIdGet(clientHandle, inserted, &modelId)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the card's model identifier. (result = %d)\n", result);
}
else
{
printf("Model identifier for inserted card (0x%x): %s\n", inserted, bufModelId);
}
if ((result = openapiCardSupportedCardDescriptionGet(clientHandle, inserted, &desc)) != OPEN_E_NONE)
{
printf("Bad return code trying to get the card's description. (result = %d)\n", result);
}
else
{
printf("Description for inserted card (0x%x): %s\n", inserted, bufDesc);
}
return;
}
/*****************************************************************/
void stackSlotSupportedPluggableGet(openapiClientHandle_t *clientHandle, uint32_t unit, uint32_t slot)
{
open_error_t result;
if ((result = openapiSlotSupportedPluggableGet(clientHandle, unit, slot, &isValid)) != OPEN_E_NONE)
{
printf("Bad return code trying to verify slot is pluggable. (result = %d)\n", result);
}
else
{
if (isValid == OPEN_TRUE)
{
printf("Slot (%d) is pluggable\n", slot);
}
else
{
printf("Slot (%d) is not pluggable\n", slot);
}
}
return;
}
/*****************************************************************/
void stackSlotSupportedPowerdownGet(openapiClientHandle_t *clientHandle, uint32_t unit, uint32_t slot)
{
open_error_t result;
if ((result = openapiSlotSupportedPowerdownGet(clientHandle, unit, slot, &isValid)) != OPEN_E_NONE)
{
printf("Bad return code trying to verify slot is power down. (result = %d)\n", result);
}
else
{
if (isValid == OPEN_TRUE)
{
printf("Slot (%d) is power down\n", slot);
}
else
{
printf("Slot (%d) is not power down\n", slot);
}
}
return;
}
/*****************************************************************/
void stackCopyFile(openapiClientHandle_t *clientHandle, uint32_t unit,
char *srcFileName, char *dstFileName)
{
open_error_t result;
open_buffdesc buffDescSrcFileName;
open_buffdesc buffDescDstFileName;
buffDescSrcFileName.pstart = srcFileName;
buffDescSrcFileName.size = strlen(srcFileName) + 1;
buffDescDstFileName.pstart = dstFileName;
buffDescDstFileName.size = strlen(dstFileName) + 1;
result = openapiCdaTransferFile(clientHandle, unit, &buffDescSrcFileName, &buffDescDstFileName);
if (result != OPEN_E_NONE)
{
printf("Bad return code trying to verify slot is power down. (result = %d)\n", result);
}
else
{
printf("ok\n");
}
return;
}
/*****************************************************************/
char* getStackPortSpeed(OPEN_STACK_SPEED_t stackPortSpeed)
{
switch (stackPortSpeed)
{
return "10G";
return "25G";
return "40G";
return "50G";
return "100G";
default:
return "Unknown";
}
return "";
}
/*****************************************************************/
void stackSpmFpsStackingRunningSpeedGet(openapiClientHandle_t *clientHandle, uint32_t unit,
uint32_t slot, uint32_t port)
{
open_error_t result;
if ((result = openapiSpmFpsStackingRunningSpeedGet(clientHandle, unit, slot, port,
&stackPortSpeed)) != OPEN_E_NONE)
{
if (OPEN_E_UNAVAIL == result)
{
printf("Feature is not supported.\n");
}
else
{
printf("Bad return code trying to get stacking speed configuration for a "
"front-panel stack port. (result = %d) for interface: %u/%u/%u\n",
result, unit, slot, port);
}
}
else
{
printf("Interface: %u/%u/%u\n",unit, slot, port);
printf("Stacking Running Speed: %s(%d)\n",
getStackPortSpeed(stackPortSpeed), stackPortSpeed);
}
return;
}
/*****************************************************************/
void stackSpmFpsConfigStackingSpeedGet(openapiClientHandle_t *clientHandle, uint32_t unit,
uint32_t slot, uint32_t port)
{
open_error_t result;
if ((result = openapiSpmFpsStackingConfigSpeedGet(clientHandle, unit, slot, port,
&stackPortSpeed)) != OPEN_E_NONE)
{
if (OPEN_E_UNAVAIL == result)
{
printf("Feature is not supported.\n");
}
else
{
printf("Bad return code trying to get stacking speed configuration for a "
"front-panel stack port. (result = %d) for interface: %u/%u/%u\n",
result, unit, slot, port);
}
}
else
{
printf("Interface: %u/%u/%u\n",unit, slot, port);
printf("Stacking Configured Speed: %s(%d)\n",
getStackPortSpeed(stackPortSpeed), stackPortSpeed);
}
return;
}
/*****************************************************************/
void stackSpmFpsConfigStackingSpeedSet(openapiClientHandle_t *clientHandle, uint32_t unit,
uint32_t slot, uint32_t port,
uint32_t stackPortSpeed)
{
open_error_t result;
if ((result = openapiSpmFpsStackingConfigSpeedSet(clientHandle, unit, slot,
port, stackPortSpeed)) != OPEN_E_NONE)
{
if (result == OPEN_E_UNAVAIL)
{
printf("Feature is not supported.\n");
}
else
{
printf("Bad return code trying to set stacking speed %s (%d) configuration "
"for a front-panel stack port: %u/%u/%u. (result = %d)\n",
getStackPortSpeed(stackPortSpeed), stackPortSpeed, unit, slot, port, result);
}
}
else
{
printf("Stacking speed %s(%d) configuration for a front-panel stack port:%u/%u/%u is "
"set successfully.\n", getStackPortSpeed(stackPortSpeed), stackPortSpeed,
unit, slot, port);
}
return;
}
/*****************************************************************/
/*****************************************************************/
void stackUnitMgrSupportedLocalUnitIndexGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
uint32_t unit;
if ((result = openapiUnitMgrSupportedLocalUnitIndexGet(clientHandle, &unit)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get the unit index of the local unit: %d\n", unit);
}
return;
}
/*****************************************************************/
void stackUnitMgrSupportedModelGet(openapiClientHandle_t *clientHandle, uint32_t unit_index)
{
open_buffdesc unitDescr;
open_error_t result;
char buf[256];
unitDescr.pstart = buf;
unitDescr.size = sizeof(buf);
if ((result = openapiUnitMgrSupportedModelGet(clientHandle,
unit_index, &unitDescr)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get the supported unit model identifier for unit index %d : %s\n",
unit_index, buf);
}
return;
}
/*****************************************************************/
void stackUnitMgrSupportedStmDefaultTemplateIdGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
uint32_t id;
unit, &id)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get the default template id for unit %d : %d\n", unit, id);
}
return;
}
/*****************************************************************/
void stackUnitMgrSupportedMgmtPrefGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
uint32_t pref;
if ((result = openapiUnitMgrSupportedMgmtPrefGet(clientHandle,
unit, &pref)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get the management preference of unit %d : %d\n", unit, pref);
}
return;
}
/*****************************************************************/
void stackUnitMgrStackMemberGetFirst(openapiClientHandle_t *clientHandle)
{
open_error_t result;
uint32_t unit;
if ((result = openapiUnitMgrStackMemberGetFirst(clientHandle, &unit)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get the first member of the current stack: %d\n", unit);
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitIdKeyGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
char buf[256];
key.pstart = buf;
key.size = sizeof(buf);
if ((result = openapiUnitMgrUnitIdKeyGet(clientHandle,
unit, &key)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get the unit system identifier key of unit %d : %s\n", unit, buf);
}
return;
}
/*****************************************************************/
void stackUnitMgrAdminMgmtPrefSet(openapiClientHandle_t *clientHandle,
uint32_t unit, uint32_t adminPref)
{
open_error_t result;
if ((result = openapiUnitMgrAdminMgmtPrefSet(clientHandle,
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Set the admin management preference of unit %d : %d\n", unit, adminPref);
}
return;
}
/*****************************************************************/
void stackFailoverInitiate(openapiClientHandle_t *clientHandle)
{
open_error_t result;
printf("Disabled in examples\n");
return;
if ((result = openapiFailoverInitiate(clientHandle)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Initiated the failover\n");
}
return;
}
/*****************************************************************/
void stackUnitMgrNsfAdminSet(openapiClientHandle_t *clientHandle, uint32_t nsf)
{
open_error_t result;
if ((result = openapiUnitMgrNsfAdminSet(clientHandle,
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Administratively enable or disable nonstop forwarding : %d\n", nsf);
}
return;
}
/*****************************************************************/
void stackUnitMgrNsfAdminGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
if ((result = openapiUnitMgrNsfAdminGet(clientHandle, &nsf)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Administrative status of nonstop forwarding : %d\n", nsf);
}
return;
}
/*****************************************************************/
void stackUnitMgrStartupReasonGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
if ((result = openapiUnitMgrStartupReasonGet(clientHandle, &r)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get the reason for the last restart : %d\n", r);
}
return;
}
/*****************************************************************/
void stackUnitMgrStartupReasonStrGet(openapiClientHandle_t *clientHandle, uint32_t r)
{
open_error_t result;
char buf[256];
descr.pstart = buf;
descr.size = sizeof(buf);
if ((result = openapiUnitMgrStartupReasonStrGet(clientHandle,
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get the reason string for the last restart : %s\n", buf);
}
return;
}
/*****************************************************************/
void stackUnitMgrRunCfgStatusString(openapiClientHandle_t *clientHandle, uint32_t s)
{
open_error_t result;
char buf[256];
descr.pstart = buf;
descr.size = sizeof(buf);
if ((result = openapiUnitMgrRunCfgStatusString(clientHandle,
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Convert a run config status %d to a string : %s\n", s, buf);
}
return;
}
/*****************************************************************/
void stackUnitMgrConfigAgeOnBackup(openapiClientHandle_t *clientHandle)
{
open_error_t result;
uint32_t age;
if ((result = openapiUnitMgrConfigAgeOnBackup(clientHandle, &age)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get the age of the configuration on the backup unit : %d\n", age);
}
return;
}
/*****************************************************************/
void stackUnitMgrRunCfgStatusGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
if ((result = openapixUnitMgrRunCfgStatusGet(clientHandle, &sts)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Status of copying the running config to the backup unit : %d\n", sts);
}
return;
}
/*****************************************************************/
void stackUnitMgrNsfSupportGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
open_error_t result;
if ((result = openapiUnitMgrNsfSupportGet(clientHandle, unit, &nsf)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get unit's nonstop forwarding support of unit %d : %d\n", unit, nsf);
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitStatusInfoGet(openapiClientHandle_t *clientHandle, uint32_t unit)
{
openUnitStatusInfo_t *status_info;
open_error_t result;
const char *mode_str;
int i;
if ((result = openapiUnitMgrUnitStatusInfoGet(clientHandle, unit, &unit_info)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
switch (unit_info.sampleMode)
{
mode_str = "Cumulative Summing";
break;
mode_str = "History";
break;
default:
printf("Invalid Sampling configured: %d\n", unit_info.sampleMode);
return;
}
/* print the header */
printf("stack Unit %d Status\n", unit);
printf("Sampling Mode: %s\n", mode_str);
if (OPEN_UNIT_STATUS_SAMPLEMODE_HISTORY == unit_info.sampleMode)
{
printf("Sample Size: %d\n", unit_info.sampleSize);
}
printf("Unit Current Average Min Max Dropped\n");
printf("--------------------------------------\n");
for (i = 1; i < 9; i++)
{
status_info = &unit_info.status_info[i];
if (!status_info->isValid)
{
continue;
}
printf ("%-2d %-4d %-4d %-4d %-4d %-4u\r\n",
status_info->unit,
status_info->curTimeOffset,
status_info->avgTimeOffset,
status_info->minTimeOffset,
status_info->maxTimeOffset,
status_info->lostMsgs);
}
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitNumberChange(openapiClientHandle_t *clientHandle,
uint32_t unit, uint32_t new)
{
open_error_t result;
if ((result = openapiUnitMgrUnitNumberChange(clientHandle, unit, new)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Change a unit's number from %d to %d\n", unit, new);
}
return;
}
/*****************************************************************/
void stackUnitMgrEraseStartupConfig(openapiClientHandle_t *clientHandle)
{
open_error_t result;
if ((result = openapiUnitMgrEraseStartupConfig(clientHandle)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Erase success\n");
}
return;
}
/*****************************************************************/
void stackUnitMgrEraseFactoryDefaults(openapiClientHandle_t *clientHandle)
{
open_error_t result;
if ((result = openapiUnitMgrEraseFactoryDefaults(clientHandle)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Erase success\n");
}
return;
}
/*****************************************************************/
void stackUnitMgrUserDescriptionSet(openapiClientHandle_t *clientHandle,
uint32_t unit, char *desc)
{
open_error_t result;
descr.pstart = desc;
descr.size = strlen(desc);
if ((result = openapiUnitMgrUserDescriptionSet(clientHandle, unit,
&descr)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Set unit user description unit %d desc %s\n", unit, desc);
}
return;
}
/*****************************************************************/
void stackUnitMgrUserDescriptionGet(openapiClientHandle_t *clientHandle,
uint32_t unit)
{
open_error_t result;
char buf[256];
descr.pstart = buf;
descr.size = sizeof(buf);
if ((result = openapiUnitMgrUserDescriptionGet(clientHandle, unit,
&descr)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get unit user description unit %d desc %s\n", unit, buf);
}
return;
}
/*****************************************************************/
void stackUnitMgrStackFirmwareSyncModeGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
if ((result = openapiUnitMgrStackFirmwareSyncModeGet(clientHandle, &mode)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get firmware synchronication mode: %d\n", mode);
}
return;
}
/*****************************************************************/
void stackUnitMgrStackFirmwareSyncModeSet(openapiClientHandle_t *clientHandle, uint32_t mode)
{
open_error_t result;
if ((result = openapiUnitMgrStackFirmwareSyncModeSet(clientHandle,
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Set firmware synchronication mode: %d\n", mode);
}
return;
}
/*****************************************************************/
void stackUnitMgrStackFirmwareSyncTrapModeGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
if ((result = openapiUnitMgrStackFirmwareSyncModeGet(clientHandle, &mode)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get firmware synchronication trap mode: %d\n", mode);
}
return;
}
/*****************************************************************/
void stackUnitMgrStackFirmwareSyncTrapModeSet(openapiClientHandle_t *clientHandle, uint32_t mode)
{
open_error_t result;
if ((result = openapiUnitMgrStackFirmwareSyncTrapModeSet(clientHandle,
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Set firmware synchronication trap mode: %d\n", mode);
}
return;
}
/*****************************************************************/
void stackUnitMgrStackFirmwareSyncAllowDowngradeModeGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
&mode)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Get firmware synchronication downgrade mode: %d\n", mode);
}
return;
}
/*****************************************************************/
void stackUnitMgrStackFirmwareSyncAllowDowngradeModeSet(openapiClientHandle_t *clientHandle, uint32_t mode)
{
open_error_t result;
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Set firmware synchronication downgrade mode: %d\n", mode);
}
return;
}
/*****************************************************************/
void stackUnitMgrSampleModeSet(openapiClientHandle_t *clientHandle, uint32_t mode, uint32_t size)
{
open_error_t result;
if ((result = openapiUnitMgrSampleModeSet(clientHandle, mode,
size)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Set mode of sample collection: %d, size of sample: %d\n", mode, size);
}
return;
}
/*****************************************************************/
void stackUnitMgrUnitStatusClear(openapiClientHandle_t *clientHandle,
uint32_t unit)
{
open_error_t result;
if ((result = openapiUnitMgrUnitStatusClear(clientHandle, unit)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Success clear the sampling information of unit status\n");
}
return;
}
/*****************************************************************/
void stackUnitMgrStackConfigReset(openapiClientHandle_t *clientHandle,
uint32_t unit)
{
open_error_t result;
if ((result = openapiUnitMgrStackConfigReset(clientHandle, unit)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Success reset stack config\n");
}
return;
}
/*****************************************************************/
void stackUnitMgrEraseDhcpClientConfigFile(openapiClientHandle_t *clientHandle,
uint32_t all, char *desc)
{
open_error_t result;
descr.pstart = desc;
descr.size = strlen(desc);
if ((result = openapiUnitMgrEraseDhcpClientConfigFile(clientHandle,
(OPEN_BOOL_t)all, &descr)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Success erase the DHCP Client configuration file\n");
}
return;
}
/*****************************************************************/
void stackStackTrunkHashModeGet(openapiClientHandle_t *clientHandle)
{
open_error_t result;
uint32_t mode;
if ((result = openapiStackTrunkHashModeGet(clientHandle, &mode)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Success, get hash mode configuration: %d\n", mode);
}
return;
}
/*****************************************************************/
void stackStackTrunkHashModeSet(openapiClientHandle_t *clientHandle, uint32_t mode)
{
open_error_t result;
if ((result = openapiStackTrunkHashModeSet(clientHandle, mode)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Success, set hash mode configuration: %d\n", mode);
}
return;
}
/*****************************************************************/
void stackStackIsTrunkHashModeConfigurable(openapiClientHandle_t *clientHandle,
uint32_t mode)
{
open_error_t result;
OPEN_BOOL_t valid;
if ((result = openapiStackIsTrunkHashModeConfigurable(clientHandle, mode,
&valid)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Hash mode %d is configurable ? valid: %d\n", mode, valid);
}
return;
}
/*****************************************************************/
void stackUnitMgrDebianRootfsStatusGet(openapiClientHandle_t *clientHandle,
uint32_t unit)
{
open_error_t result;
if ((result = openapiUnitMgrDebianRootfsStatusGet(clientHandle, unit,
&sts)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Rootfs status of unit %d is: %d\n", unit, sts);
}
return;
}
/*****************************************************************/
void stackSpmIsPortStackCapable(openapiClientHandle_t *clientHandle,
uint32_t intIfNum)
{
open_error_t result;
OPEN_BOOL_t valid;
if ((result = openapiSpmIsPortStackCapable(clientHandle, intIfNum,
&valid)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Intf %d is stack capable ? valid: %d\n", intIfNum, valid);
}
return;
}
/*****************************************************************/
void stackUnitMgrNextConfigCopyTime(openapiClientHandle_t *clientHandle)
{
open_error_t result;
uint32_t time;
if ((result = openapiUnitMgrNextConfigCopyTime(clientHandle,
&time)) != OPEN_E_NONE)
{
printf("Bad return code. (result = %d)\n", result);
}
else
{
printf("Wait time: %d\n", time);
}
return;
}
/***************************************************************/
int main(int argc, char **argv)
{
openapiClientHandle_t clientHandle;
open_error_t result;
uint32_t testNum;
open_buffdesc switch_os_revision;
char switch_os_revision_string[100];
uint32_t arg1, arg2, arg3, arg4;
if (argc < 2)
{
printStackingAppMenu();
exit(1);
}
testNum = atoi(argv[1]);
l7proc_crashlog_register();
/* Register with OpEN */
if ((result = openapiClientRegister("stacking_example", &clientHandle)) != OPEN_E_NONE)
{
printf("\nFailed to initialize RPC to OpEN. Exiting (result = %d)\n", result);
exit(2);
}
/* RPC call can fail until server starts. Keep trying */
while (openapiConnectivityCheck(&clientHandle) != OPEN_E_NONE)
{
sleep(1);
}
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Starting Stacking API example application");
printf("\n");
switch_os_revision.pstart = switch_os_revision_string;
switch_os_revision.size = sizeof(switch_os_revision_string);
if (openapiNetworkOSVersionGet(&clientHandle, &switch_os_revision) == OPEN_E_NONE)
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)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrStackMemberGetNext(&clientHandle, arg1);
break;
case 2:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrNumberGet(&clientHandle);
break;
case 3:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrUnitStatusGet(&clientHandle, arg1);
break;
case 4:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrMgmtUnitStatusGet(&clientHandle, arg1);
break;
case 5:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrStandbyGet(&clientHandle);
break;
case 6:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrModelIdentifierGet(&clientHandle, arg1);
break;
case 7:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrDetectCodeVerFlashGet(&clientHandle, arg1);
break;
case 8:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrDetectCodeVerRunningGet(&clientHandle, arg1);
break;
case 9:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrMgmtPrefGet(&clientHandle, arg1);
break;
case 10:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrUnitTypeGet(&clientHandle, arg1);
break;
case 11:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrSupportedDescriptionGet(&clientHandle, arg1);
break;
case 12:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrStackFirmwareSyncMemberStatusGet(&clientHandle, arg1);
break;
case 13:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrStackFirmwareSyncStatusGet(&clientHandle);
break;
case 14:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrStackFirmwareSyncMemberLastAttemptStatusGet(&clientHandle, arg1);
break;
case 15:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackStmUnitActiveTemplateIdGet(&clientHandle, arg1);
break;
case 16:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackStmTemplateDescriptionGet(&clientHandle, arg1);
break;
case 17:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrUnitUpTimeGet(&clientHandle, arg1);
break;
case 18:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrSerialNumberGet(&clientHandle, arg1);
break;
case 19:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrServiceTagGet(&clientHandle, arg1);
break;
case 20:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrPreconfigModelIdGet(&clientHandle, arg1);
break;
case 21:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrUnitIsValid(&clientHandle, arg1);
break;
case 22:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrUnitMaxGet(&clientHandle);
break;
case 23:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrSupportedUnitIdGet(&clientHandle, arg1);
break;
case 24:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrSupportedUnitIdNextGet(&clientHandle, arg1);
break;
case 25:
if (argc != 5)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
arg3 = atoi(argv[4]);
stackUnitMgrUnitCreate(&clientHandle, arg1, arg2, (OPEN_BOOL_t)arg3);
break;
case 26:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrUnitDelete(&clientHandle, arg1);
break;
case 27:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrUnitTransfer(&clientHandle, arg1);
break;
case 28:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackSpmFpsConfigQosModeGet(&clientHandle);
break;
case 29:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackSpmFpsConfigQosModeSet(&clientHandle, (OPEN_CONTROL_t)arg1);
break;
case 30:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackUnitMgrStandbySet(&clientHandle, arg1, arg2);
break;
case 31:
if (argc != 5)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
arg3 = atoi(argv[4]);
stackSpmFpsConfigStackingModeGet(&clientHandle, arg1, arg2, arg3);
break;
case 32:
if (argc != 6)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
arg3 = atoi(argv[4]);
arg4 = atoi(argv[5]);
stackSpmFpsConfigStackingModeSet(&clientHandle, arg1, arg2, arg3, (OPEN_BOOL_t)arg4);
break;
case 33:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackSlotGet(&clientHandle, arg1, arg2);
break;
case 34:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitDbEntrySlotsGet(&clientHandle, arg1);
break;
case 35:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackSlotIsFullGet(&clientHandle, arg1, arg2);
break;
case 36:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackSlotAdminModeGet(&clientHandle, arg1, arg2);
break;
case 37:
if (argc != 5)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
arg3 = atoi(argv[4]);
stackSlotAdminModeSet(&clientHandle, arg1, arg2, arg3);
break;
case 38:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackSlotPowerModeGet(&clientHandle, arg1, arg2);
break;
case 39:
if (argc != 5)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
arg3 = atoi(argv[4]);
stackSlotPowerModeSet(&clientHandle, arg1, arg2, arg3);
break;
case 40:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackCardTypeGet(&clientHandle, arg1, arg2);
break;
case 41:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackCardSupportedConfiguredCardInfoGet(&clientHandle, arg1, arg2);
break;
case 42:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackCardSupportedInsertedCardInfoGet(&clientHandle, arg1, arg2);
break;
case 43:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackSlotSupportedPluggableGet(&clientHandle, arg1, arg2);
break;
case 44:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackSlotSupportedPowerdownGet(&clientHandle, arg1, arg2);
break;
case 45:
if (argc != 5)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackCopyFile(&clientHandle, arg1, argv[3], argv[4]);
break;
case 46:
if (argc != 5)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
arg3 = atoi(argv[4]);
stackSpmFpsStackingRunningSpeedGet(&clientHandle, arg1, arg2, arg3);
break;
case 47:
if (argc != 5)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
arg3 = atoi(argv[4]);
stackSpmFpsConfigStackingSpeedGet(&clientHandle, arg1, arg2, arg3);
break;
case 48:
if (argc != 6)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
arg3 = atoi(argv[4]);
arg4 = atoi(argv[5]);
stackSpmFpsConfigStackingSpeedSet(&clientHandle, arg1, arg2, arg3, arg4);
break;
case 49:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrSupportedLocalUnitIndexGet(&clientHandle);
break;
case 50:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrSupportedModelGet(&clientHandle, arg1);
break;
case 51:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrSupportedStmDefaultTemplateIdGet(&clientHandle, arg1);
break;
case 52:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrSupportedMgmtPrefGet(&clientHandle, arg1);
break;
case 53:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrStackMemberGetFirst(&clientHandle);
break;
case 54:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrUnitIdKeyGet(&clientHandle, arg1);
break;
case 55:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackUnitMgrAdminMgmtPrefSet(&clientHandle, arg1, arg2);
break;
case 56:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackFailoverInitiate(&clientHandle);
break;
case 57:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrNsfAdminSet(&clientHandle, arg1);
break;
case 58:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrNsfAdminGet(&clientHandle);
break;
case 59:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrStartupReasonGet(&clientHandle);
break;
case 60:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrStartupReasonStrGet(&clientHandle, arg1);
break;
case 61:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrRunCfgStatusString(&clientHandle, arg1);
break;
case 62:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrConfigAgeOnBackup(&clientHandle);
break;
case 63:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrRunCfgStatusGet(&clientHandle);
break;
case 64:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrNextConfigCopyTime(&clientHandle);
break;
case 65:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrNsfSupportGet(&clientHandle, arg1);
break;
case 66:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrUnitStatusInfoGet(&clientHandle, arg1);
break;
case 67:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackUnitMgrUnitNumberChange(&clientHandle, arg1, arg2);
break;
case 68:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrEraseStartupConfig(&clientHandle);
break;
case 69:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrEraseFactoryDefaults(&clientHandle);
break;
case 70:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrUserDescriptionSet(&clientHandle, arg1, argv[3]);
break;
case 71:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrUserDescriptionGet(&clientHandle, arg1);
break;
case 72:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrStackFirmwareSyncModeGet(&clientHandle);
break;
case 73:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrStackFirmwareSyncModeSet(&clientHandle, arg1);
break;
case 74:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrStackFirmwareSyncTrapModeGet(&clientHandle);
break;
case 75:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrStackFirmwareSyncTrapModeSet(&clientHandle, arg1);
break;
case 76:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackUnitMgrStackFirmwareSyncAllowDowngradeModeGet(&clientHandle);
break;
case 77:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrStackFirmwareSyncAllowDowngradeModeSet(&clientHandle, arg1);
break;
case 78:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
arg2 = atoi(argv[3]);
stackUnitMgrSampleModeSet(&clientHandle, arg1, arg2);
break;
case 79:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrUnitStatusClear(&clientHandle, arg1);
break;
case 80:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrStackConfigReset(&clientHandle, arg1);
break;
case 82:
if (argc != 4)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrEraseDhcpClientConfigFile(&clientHandle, arg1, argv[3]);
break;
case 83:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackSpmStackPortCountersClear(&clientHandle);
break;
case 84:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackSpmIsPortStackCapable(&clientHandle, arg1);
break;
case 85:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackStackTrunkHashModeSet(&clientHandle, arg1);
break;
case 86:
if (argc != 2)
{
printStackingAppMenu();
exit(1);
}
stackStackTrunkHashModeGet(&clientHandle);
break;
case 87:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackStackIsTrunkHashModeConfigurable(&clientHandle, arg1);
break;
case 88:
if (argc != 3)
{
printStackingAppMenu();
exit(1);
}
arg1 = atoi(argv[2]);
stackUnitMgrDebianRootfsStatusGet(&clientHandle, arg1);
break;
default:
printStackingAppMenu();
break;
}
/* Log goodbye message with OpEN */
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Stopping Stacking API example application");
(void) openapiClientTearDown(&clientHandle);
return 0;
}