#include <stdlib.h>
#include <unistd.h>
#include "rpcclt_openapi.h"
#include "proc_util.h"
#define STRNCAT(_dst, _src) \
strncat((_dst), (_src), sizeof((_dst))-strlen((_dst))-1)
void printLldpAppMenu()
{
printf("Usage: lldp_example <test#> <interface> <arg1> <arg2> ... \n");
printf("Test 1: Set LLDP Interface Transmit Mode: lldp_example 1 <interface> <tramsmit mode> \n");
printf("Test 2: Get LLDP Interface Transmit Mode: lldp_example 2 <interface> \n");
printf("Test 3: Set LLDP Interface Receive Mode: lldp_example 3 <interface> <receive mode> \n");
printf("Test 4: Get LLDP Interface Receive Mode: lldp_example 4 <interface> \n");
printf("Test 5: Set LLDP Interface TLV Transmit Mode: lldp_example 5 <interface> <TLV type> <transmit mode> \n");
printf("Test 6: Get LLDP Interface TLV Transmit Mode: lldp_example 6 <interface> \n");
printf("Test 7: Set LLDP Interface Notification Mode: lldp_example 7 <interface> <notification mode> \n");
printf("Test 8: Get LLDP Interface Notification Mode: lldp_example 8 <interface> \n");
printf("Test 9: Get LLDP Remote Device details: lldp_example 9 <interface> \n");
printf("Test 10: Get LLDP Local Device details: lldp_example 10 <interface> \n");
printf("Test 11: Get LLDP-MED interface administrative mode: lldp_example 11 <interface> \n");
printf("Test 12: Set LLDP-MED interface administrative mode: lldp_example 12 <interface> <mode> \n");
printf("Test 13: Get LLDP-MED interface config notification mode: lldp_example 13 <interface> \n");
printf("Test 14: Set LLDP-MED interface config notification mode: lldp_example 14 <interface> <mode> \n");
printf("Test 15: Get LLDP-MED interface TLVs enabled for transmision: lldp_example 15 <interface> \n");
printf("Test 16: Set LLDP-MED interface TLVs for transmision: lldp_example 16 <interface> \n");
printf("Test 17: Get LLDP-MED Remote Device data: lldp_example 17 <interface> \n");
printf("Test 18: Gets the 802.1AB global transmit interval: lldp_example 18 \n");
printf("Test 19: Sets the 802.1AB global transmit interval: lldp_example 19 <interval>\n");
printf("Test 20: Gets the 802.1AB global transmit hold muliplier: lldp_example 20 \n");
printf("Test 21: Sets the 802.1AB global transmit hold muliplier: lldp_example 21 <holdCount>\n");
printf("Test 22: Gets the 802.1AB global transmit reinit delay: lldp_example 22 \n");
printf("Test 23: Sets the 802.1AB global transmit reinit delay: lldp_example 23 <delay>\n");
printf("Test 24: Gets the 802.1AB global notification interval limit: lldp_example 24 \n");
printf("Test 25: Sets the 802.1AB global notification interval limit: lldp_example 25 <interval>\n");
printf("Test 26: Gets the fast start repeat count: lldp_example 26 \n");
printf("Test 27: Sets the fast start repeat count: lldp_example 27 <count>\n");
printf("Test 28: Gets the 802.1AB mgmt addr transmit mode for the specified interface: lldp_example 28 <interface>\n");
printf("Test 29: Sets the 802.1AB mgmt addr transmit mode for the specified interface: lldp_example 29 <interface> <mode>\n");
printf("Test 30: Gets the vlan id associated with a particular policy type: lldp_example 30 <interface> <policyAppType> \n");
printf("Test 31: Gets the tagged bit associated with a particular policy type: lldp_example 31 <interface> <policyAppType> \n");
printf("Test 32: Gets the priority associated with a particular policy type: lldp_example 32 <interface> <policyAppType> \n");
printf("Test 33: Gets the DSCP associated with a particular policy type: lldp_example 33 <ifNum> <policyAppType> \n");
printf("Test 34: Gets the first interface enable for LLDP receives: lldp_example 34 \n");
printf("Test 35: Gets the next valid interface enable for LLDP receives: lldp_example 35 <ifNum> \n");
printf("Test 36: Get remote port's auto negotiation capability: lldp_example 36 <ifNum> <remIndex> <timestamp>\n");
printf("Test 37: Get remote port's auto negotiation enabled status: lldp_example 37 <ifNum> <remIndex> <timestamp>\n");
printf("Test 38: Get remote port's auto negotiation advertized capability as a string: lldp_example 38 <ifNum> <remIndex> <timestamp>\n");
printf("Test 39: Get remote port's auto negotiation operational MAU Type: lldp_example 39 <ifNum> <remIndex> <timestamp> \n");
printf("Test 40: Get remote port's auto negotiation operational MAU in string format: lldp_example 40 <mauType> \n");
printf("Test 41: Get remote device's hardware revision: lldp_example 41 <ifNum> <remIndex> <timestamp> \n");
printf("Test 42: Get remote device's firmware revision: lldp_example 42 <ifNum> <remIndex> <timestamp> \n");
printf("Test 43: Get remote device's software revision: lldp_example 43 <ifNum> <remIndex> <timestamp> \n");
printf("Test 44: Get remote device's serial number: lldp_example 44 <ifNum> <remIndex> <timestamp> \n");
printf("Test 45: Get remote device's asset ID: lldp_example 45 <ifNum> <remIndex> <timestamp> \n");
printf("Test 46: Get remote device's PoE device type connected to this port: lldp_example 46 <ifNum> <remIndex> <timestamp>\n");
printf("Test 47: Get remote ports PSE power value in tenths of watts: lldp_example 47 <ifNum> <remIndex> <timestamp> \n");
printf("Test 48: Get remote ports PSE power source: lldp_example 48 <ifNum> <remIndex> <timestamp> \n");
printf("Test 49: Get remote ports PSE power priority: lldp_example 49 <ifNum> <remIndex> <timestamp> \n");
printf("Test 50: Get the location info received on this port for the given location subtype: lldp_example 50 <ifNum> <remIndex> <timestamp> <subType> \n");
printf("Test 51: Get the vlan id associated with a particular policy type: lldp_example 51 <ifNum> <remIndex> <timestamp> <policyAppType> \n");
printf("Test 52: Get the priority associated with a particular policy type: lldp_example 52 <ifNum> <remIndex> <timestamp> <policyAppType> \n");
printf("Test 53: Get the DSCP associated with a particular policy type: lldp_example 53 <ifNum> <remIndex> <timestamp> <policyAppType> \n");
printf("Test 54: Get the unknown bit associated with a particular policy type: lldp_example 54 <ifNum> <remIndex> <timestamp> <policyAppType> \n");
printf("Test 55: Get the tagged bit associated with a particular policy type: lldp_example 55 <ifNum> <remIndex> <timestamp> <policyAppType> \n");
printf("Test 56: Get the next unknown TLV entry for the indicated remote data entry: lldp_example 56 <ifNum> <remIndex> <timestamp> <tlvType> \n");
printf("Test 57: Determine if unknown TLV entry exists: lldp_example 57 <ifNum> <remIndex> <timestamp> <tlvType> \n");
printf("Test 58: Get the TLV info for the specified remote entry: lldp_example 58 <ifNum> <remIndex> <timestamp> <tlvType> \n");
printf("Test 59: Get the remote device's manufacturer's name: lldp_example 59 <ifNum> <remIndex> <timestamp> \n");
printf("Test 60: Get the remote device's model name: lldp_example 60 <ifNum> <remIndex> <timestamp> \n");
printf("Test 61: Get the remote port's PD power requirement: lldp_example 61 <ifNum> <remIndex> <timestamp> \n");
printf("Test 62: Get the remote port's PD power source: lldp_example 62 <ifNum> <remIndex> <timestamp> \n");
printf("Test 63: Get the remote port's PD power priority: lldp_example 63 <ifNum> <remIndex> <timestamp> \n");
printf("Test 64: Get the organizationally defined OUI for specified entry: lldp_example 64 <ifNum> <remIndex> <timestamp> <infoIndex> \n");
printf("Test 65: Get the organizationally defined subtype for specified entry: lldp_example 65 <ifNum> <remIndex> <timestamp> <infoIndex> \n");
printf("Test 66: Get a string representation for Chassis ID Subtype: lldp_example 66 <subtype> \n");
printf("Test 67: Get a string representation for port ID Subtype: lldp_example 67 <subtype> \n");
printf("Test 68: Get the port's auto negotiation capability: lldp_example 68 <ifNum>\n");
printf("Test 69: Get port's auto negotiation enabled status: lldp_example 69 <ifNum>\n");
printf("Test 70: Get port's auto negotiation advertized capability as a string: lldp_example 70 <ifNum>\n");
printf("Test 71: Get port's auto negotiation operational MAU Type: lldp_example 71 <ifNum>\n");
printf("Test 72: Get local device's MED Classification: lldp_example 72\n");
printf("Test 73: Test LLDP OpEN APIs sanity: lldp_example 73 <interface> \n");
return;
}
{
{
printf("Bad return code trying to set LLDP Interface Transmit Mode. (result = %d)\n", result);
}
else
{
printf("LLDP Interface Transmit Mode set successfully \n");
}
return;
}
{
{
printf("Bad return code trying to get LLDP Interface Transmit Mode. (result = %d)\n", result);
}
else
{
printf("LLDP Interface Transmit Mode for interface %u: %u \n", ifNum, lldpTxMode);
}
return;
}
{
{
printf("Bad return code trying to set LLDP Interface Receive Mode. (result = %d)\n", result);
}
else
{
printf("LLDP Interface Receive Mode set successfully \n");
}
return;
}
{
{
printf("Bad return code trying to get LLDP Interface Receive Mode. (result = %d)\n", result);
}
else
{
printf("LLDP Interface Receive Mode for interface %u: %u \n", ifNum, lldpRxMode);
}
return;
}
{
{
printf("Bad return code trying to set LLDP Interface TLV Transmit Mode. (result = %d)\n", result);
}
else
{
printf("LLDP Interface TLV Transmit Mode set successfully \n");
}
return;
}
{
uint32_t index;
{
{
printf("Bad return code trying to get LLDP Interface TLV Transmit Mode. (result = %d)\n", result);
return;
}
else
{
printf("Interface: %u, TLV type: %u, Transmit Mode: %u \n", ifNum, index, lldpTLVTxMode);
}
}
return;
}
{
{
printf("Bad return code trying to set LLDP Interface Notification Mode. (result = %d)\n", result);
}
else
{
printf("LLDP Interface Notification Mode set successfully \n");
}
return;
}
{
{
printf("Bad return code trying to get LLDP Interface Notification Mode. (result = %d)\n", result);
}
else
{
printf("LLDP Interface Notification Mode for interface %u: %u \n", ifNum, lldpNotMode);
}
return;
}
{
char *str = NULL;
uint32_t remIndex = 0;
uint32_t timeStamp = 0;
uint32_t ttl = 0;
uint8_t addrLen;
uint32_t strLen = 0;
uint32_t intfId = 0;
{
printf("Bad return code. (result = %d)\n", result);
return;
}
if ((str = (char*)malloc(strLen)) == NULL)
{
printf("Could not allocate memory.\n");
return;
}
printf("LLDP Remote Device details for interface %u\n", ifNum);
printf("============================================\n\n");
{
memset(str, 0, strLen);
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("Chassis Id Subtype: %u\n", chassisIdSubtype);
printf("Chassis Id: %s\n\n", str);
}
memset(str, 0, strLen);
portId.pstart = str;
portId.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("Port Id Subtype: %u\n", portIdSubtype);
printf("Port Id: %s\n\n", str);
}
memset(str, 0, strLen);
sysName.pstart = str;
sysName.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("System name: %s\n\n", str);
}
memset(str, 0, strLen);
sysDesc.pstart = str;
sysDesc.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("System Description: %s\n\n", str);
}
memset(str, 0, strLen);
portDesc.pstart = str;
portDesc.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("Port Description: %s\n\n", str);
}
memset(str, 0, strLen);
sysCapSupp.pstart = str;
sysCapSupp.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("System Capabilities Supported: %s\n\n", str);
}
memset(str, 0, strLen);
sysCapEnabled.pstart = str;
sysCapEnabled.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("System Capabilities Enabled: %s\n\n", str);
}
memset(str, 0, strLen);
mgmtAddress.pstart = str;
mgmtAddress.size = strLen;
addrLen = 0;
timeStamp, &addressFamily,
&mgmtAddress,
&addrLen, &subType, &intfId)
{
printf("Management Address Type: %u\n", addressFamily);
printf("Management Address: %s\n", str);
printf("Interface subtype : %u\n", subType);
printf("Interface ID : %u\n\n", intfId);
}
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("LLDP Neighbor TTL: %u\n\n", ttl);
}
}
free(str);
return;
}
{
uint32_t currIfNum, nextIfNum;
if (ifNum == 0)
{
currIfNum = ifNum;
{
lldpIntfRemoteDeviceDetailsGet(clientHandle, nextIfNum);
currIfNum = nextIfNum;
}
}
else
{
lldpIntfRemoteDeviceDetailsGet(clientHandle, ifNum);
}
return;
}
{
char *str = NULL;
uint32_t strLen = 0;
{
printf("Bad return code. (result = %d)\n", result);
return;
}
if ((str = (char*)malloc(strLen)) == NULL)
{
printf("Could not allocate memory.\n");
return;
}
printf("LLDP Local Device details for interface %u\n", ifNum);
printf("===========================================\n\n");
memset(str, 0, strLen);
chassisId.pstart = str;
chassisId.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("Chassis Id Subtype: %u\n", chassisIdSubtype);
printf("Chassis Id: %s\n\n", str);
}
memset(str, 0, strLen);
portId.pstart = str;
portId.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("Port Id Subtype: %u\n", portIdSubtype);
printf("Port Id: %s\n\n", str);
}
memset(str, 0, strLen);
sysName.pstart = str;
sysName.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("System name: %s\n\n", str);
}
memset(str, 0, strLen);
sysDesc.pstart = str;
sysDesc.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("System Description: %s\n\n", str);
}
memset(str, 0, strLen);
portDesc.pstart = str;
portDesc.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("Port Description: %s\n\n", str);
}
memset(str, 0, strLen);
sysCapSupp.pstart = str;
sysCapSupp.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("System Capabilities Supported: %s\n\n", str);
}
memset(str, 0, strLen);
sysCapEnabled.pstart = str;
sysCapEnabled.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("System Capabilities Enabled: %s\n\n", str);
}
memset(str, 0, strLen);
mgmtAddress.pstart = str;
mgmtAddress.size = strLen;
{
printf("Bad return code. (result = %d)\n\n", result);
}
else
{
printf("Management Address Type: %u\n", addressFamily);
printf("Management Address: %s\n\n", str);
}
free(str);
return;
}
{
{
printf("Bad return code trying to get LLDP-MED interface mode. (result = %d)\n", result);
}
else
{
printf("LLDP-MED interface mode for interface %u: %u \n", ifNum, mode);
}
return;
}
{
{
printf("Bad return code trying to set LLDP-MED mode on interface. (result = %d)\n", result);
}
else
{
printf("LLDP-MED mode set to %d on interface. (result = %d)\n", mode, result);
}
return;
}
{
{
printf("Bad return code trying to get LLDP-MED interface configuration notification mode. (result = %d)\n", result);
}
else
{
printf("LLDP-MED interface configuration notification mode for interface %u: %u \n", ifNum, mode);
}
return;
}
{
{
printf("Bad return code trying to set LLDP-MED configuration notification mode on interface. (result = %d)\n", result);
}
else
{
printf("LLDP-MED configuration notification mode set to %d on interface. (result = %d)\n", mode, result);
}
return;
}
{
char str[256];
memset(&cap, 0, sizeof(cap));
{
printf("Bad return code trying to get LLDP-MED interface TLVs enabled for transmision. (result = %d)\n", result);
}
else
{
memset(&str, 0, sizeof(str));
if (cap.
bitmap[1] & OPEN_LLDP_MED_CAP_CAPABILITIES_BITMASK)
{
STRNCAT(str, "0-CAPABILITIES ");
}
if (cap.bitmap[1] & OPEN_LLDP_MED_CAP_NETWORKPOLICY_BITMASK)
{
STRNCAT(str, "1-NETWORKPOLICY ");
}
if (cap.bitmap[1] & OPEN_LLDP_MED_CAP_LOCATION_BITMASK)
{
STRNCAT(str, "2-LOCATION ");
}
if (cap.bitmap[1] & OPEN_LLDP_MED_CAP_EXT_PSE_BITMASK)
{
STRNCAT(str, "3-EXTENDEDPSE ");
}
if (cap.bitmap[1] & OPEN_LLDP_MED_CAP_EXT_PD_BITMASK)
{
STRNCAT(str, "4-EXTENDEDPD ");
}
if (cap.bitmap[1] & OPEN_LLDP_MED_CAP_INVENTORY_BITMASK)
{
STRNCAT(str, "5-INVENTORY");
}
str[sizeof(str) - 1] = '\0';
printf("LLDP-MED interface TLVs enabled for transmision for interface %u: %s. \n", ifNum, str);
}
return;
}
{
memset(¤t_cap, 0, sizeof(current_cap));
memset(&test_cap, 0, sizeof(test_cap));
{
printf("Bad return code trying to get current LLDP-MED TLVs for transmision on interface. (result = %d)\n", result);
}
else
{
{
printf("Bad return code trying to set LLDP-MED TLVs for transmision on interface. (result = %d)\n", result);
}
else
{
{
printf("Bad return code trying to set LLDP-MED TLVs for transmision on interface. (result = %d)\n", result);
}
else
{
printf("Setting LLDP-MED TLVs for transmision on interface successful.\n");
}
}
}
return;
}
{
uint32_t remIndex = 0;
uint32_t timeStamp = 0;
char *str = NULL;
uint32_t strLen = 0;
uint32_t deviceClass;
{
printf("Bad return code from openapiLldpMedRemoteModelNameSizeGet(). (result = %d)\n", result);
return;
}
if ((str = malloc(strLen)) == NULL)
{
printf("Could not allocate memory.\n");
return;
}
printf("LLDP-MED Remote Device details for interface %u\n", ifNum);
printf("=================================================\n\n");
{
&supportedCapabilities, &enabledCapabilities)) !=
OPEN_E_NONE)
{
printf("Bad return code from openapiLldpMedRemoteCapabilitiesGet(). (result = %d)\n\n", result);
}
else
{
printf("Supported capabilities bitmap: 0x%02x%02x\n", supportedCapabilities.bitmap[0], supportedCapabilities.bitmap[1]);
printf("Enabled capabilities bitmap: 0x%02x%02x\n", enabledCapabilities.bitmap[0], enabledCapabilities.bitmap[1]);
}
{
printf("Bad return code from openapiLldpMedRemoteDeviceClassGet(). (result = %d)\n\n", result);
}
else
{
printf("Device class: %u\n", deviceClass);
}
memset(str, 0, strLen);
modelName.pstart = str;
modelName.size = strLen;
{
printf("Bad return code from openapiLldpMedRemoteModelNameGet(). (result = %d)\n\n", result);
}
else
{
printf("Model name: %s\n\n", str);
}
}
free(str);
return;
}
{
{
printf("Bad return code trying to get the 802.1AB global transmit interval."
" (result = %d)\n", result);
}
else
{
printf("802.1AB global transmit interval is %u.\n", *interval);
}
return;
}
{
{
printf("Bad return code trying to set the 802.1AB global transmit interval."
" (result = %d)\n", result);
}
else
{
printf("802.1AB global transmit interval set successfully.\n");
}
return;
}
{
{
printf("Bad return code trying to get the 802.1AB global transmit hold "
"muliplier. (result = %d)\n", result);
}
else
{
printf("802.1AB global transmit hold muliplier is %u.\n", *holdCount);
}
return;
}
{
{
printf("Bad return code trying to set the 802.1AB global transmit hold "
"muliplier. (result = %d)\n", result);
}
else
{
printf("802.1AB global transmit hold muliplier set successfully.\n");
}
return;
}
{
{
printf("Bad return code trying to get the 802.1AB global transmit reinit "
"delay. (result = %d)\n", result);
}
else
{
printf("802.1AB global transmit reinit delay is %u.\n", *delay);
}
return;
}
{
{
printf("Bad return code trying to set the 802.1AB global transmit reinit "
"delay. (result = %d)\n", result);
}
else
{
printf("802.1AB global transmit reinit delay set successfully.\n");
}
return;
}
uint32_t *interval)
{
{
printf("Bad return code trying to get the 802.1AB global notification "
"interval limit. (result = %d)\n", result);
}
else
{
printf("802.1AB global notification interval limit is %u.\n", *interval);
}
return;
}
uint32_t interval)
{
{
printf("Bad return code trying to set the 802.1AB global notification"
" interval limit. (result = %d)\n", result);
}
else
{
printf("802.1AB global notification interval limit set successfully.\n");
}
return;
}
uint32_t *count)
{
{
printf("Bad return code trying to get the fast start repeat count. "
"(result = %d)\n", result);
}
else
{
printf("Fast start repeat count value is %u.\n", *count);
}
return;
}
uint32_t count)
{
{
printf("Bad return code trying to set the fast start repeat count."
" (result = %d)\n", result);
}
else
{
printf("Fast start repeat count set successfully.\n");
}
return;
}
{
{
printf("Bad return code trying to get the 802.1AB mgmt addr transmit"
" mode for the specified interface. (result = %d)\n", result);
}
else
{
printf("802.1AB mgmt addr transmit mode is %u.\n", *mode);
}
return;
}
{
{
printf("Bad return code trying to set the 802.1AB mgmt addr transmit mode"
" for the specified interface. (result = %d)\n", result);
}
else
{
printf("802.1AB mgmt addr transmit mode set successfully.\n");
}
return;
}
uint32_t ifNum,
uint32_t *vlanId)
{
policyAppType, vlanId))
{
printf("Bad return code trying to get the vlan id associated with a"
" particular policy type. (result = %d)\n", result);
}
else
{
printf("Vlan id associated with a given policy type is %u.\n", *vlanId);
}
return;
}
uint32_t ifNum,
{
policyAppType, taggedStatus))
{
printf("Bad return code trying to get the tagged bit associated with a "
"particular policy type. (result = %d)\n", result);
}
else
{
printf("Tagged status for the given policy type is %u.\n", *taggedStatus);
}
return;
}
uint32_t ifNum,
uint32_t *priority)
{
policyAppType, priority))
{
printf("Bad return code trying to get the priority associated with a "
"particular policy type. (result = %d)\n", result);
}
else
{
printf("Priority associated with a given policy type is %u.\n", *priority);
}
return;
}
uint32_t ifNum,
uint32_t *dscp)
{
policyAppType, dscp))
{
printf("Bad return code trying to get the DSCP associated with a"
" particular policy type. (result = %d)\n", result);
}
else
{
printf("DSCP associated with given policy type is %u.\n", *dscp);
}
return;
}
{
{
printf("Bad return code trying to get LLDP first interface. (result = %d)\n",
result);
}
else
{
printf("First interface enabled for LLDP receives is %u. \n", *ifNum);
}
return;
}
uint32_t *nextIfNum)
{
{
printf("Bad return code trying to get LLDP next valid interface.(result = %d)\n",
result);
}
else
{
printf("Next valid interface enabled for LLDP receives is %u. \n", *nextIfNum);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
{
remIndex, timestamp,
isCapable))
{
printf("Bad return code trying to get remote port's auto negotiation "
"capability. (result = %d)\n", result);
}
else
{
printf("Remote port's auto negotiation capability is %u.\n", *isCapable);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
{
remIndex, timestamp,
{
printf("Bad return code trying to get remote port's auto negotiation enabled"
" status. (result = %d)\n", result);
}
else
{
printf("Remote port's auto negotiation enabled status is %u.\n", *isEnabled);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp,
{
unsigned short advertizedCap = 0;
remIndex, timestamp,
advrtCap))
{
printf("Bad return code trying to get remote port's auto negotiation "
"advertized capability as a string. (result = %d)\n", result);
}
else
{
memcpy((void *)&advertizedCap, advrtCap->pstart, sizeof(unsigned short));
printf("Remote port's auto negotiation advertized capability is %d.\n",
advertizedCap);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t *type)
{
remIndex, timestamp,
{
printf("Bad return code trying to get remote port's auto negotiation "
"operational MAU Type. (result = %d)\n", result);
}
else
{
printf("Remote port's auto negotiation operational MAU Type is %u.\n",
*type);
}
return;
}
uint32_t mauType,
{
mauType, mauString))
{
printf("Bad return code trying to get remote port's auto negotiation "
"operational MAU in string format. (result = %d)\n", result);
}
else
{
printf("Remote port's auto negotiation operational MAU is %s.\n",
(char *)mauString->pstart);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
{
timestamp, hardwareRev))
{
printf("Bad return code trying to get remote device's hardware revision."
" (result = %d)\n", result);
}
else
{
printf("Remote device's hardware revision is %s.\n", (char *)hardwareRev->pstart);
}
return;
}
uint32_t remIndex, uint32_t timestamp,
{
timestamp, firmwareRev))
{
printf("Bad return code trying to get remote device's firmware revision."
" (result = %d)\n", result);
}
else
{
printf("Remote device's firmware revision is %s.\n", (char *)firmwareRev->pstart);
}
return;
}
uint32_t remIndex, uint32_t timestamp,
{
timestamp, softwareRev))
{
printf("Bad return code trying to get remote device's software revision."
" (result = %d)\n", result);
}
else
{
printf("Remote device's software revision is %s.\n", (char *)softwareRev->pstart);
}
return;
}
uint32_t remIndex, uint32_t timestamp,
{
{
printf("Bad return code trying to get remote device's serial number."
" (result = %d)\n", result);
}
else
{
printf("Remote device's serial number is %s.\n", (char *)serialNum->pstart);
}
return;
}
uint32_t remIndex, uint32_t timestamp,
{
{
printf("Bad return code trying to get remote device's asset ID."
" (result = %d)\n", result);
}
else
{
printf("Remote device's asset ID is %s.\n", (char *)assetId->pstart);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t *deviceType)
{
timestamp, deviceType))
{
printf("Bad return code trying to get remote device's PoE device type connected"
" to this port. (result = %d)\n", result);
}
else
{
printf("Remote device's PoE device type is %u.\n", *deviceType);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t *powerAv)
{
remIndex, timestamp, powerAv))
{
printf("Bad return code trying to get remote ports PSE power value in tenths"
" of watts. (result = %d)\n", result);
}
else
{
printf("Remote ports PSE power value in tenths of watts is %u.\n", *powerAv);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t *powerSrcType)
{
remIndex, timestamp,
{
printf("Bad return code trying to get remote ports PSE power source."
" (result = %d)\n", result);
}
else
{
printf("Remote ports PSE power source is %u.\n", *powerSrcType);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t *powerPri)
{
remIndex, timestamp, powerPri))
{
printf("Bad return code trying to get remote ports PSE power priority."
" (result = %d)\n", result);
}
else
{
printf("Remote ports PSE power priority is %u.\n", *powerPri);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t subType,
{
timestamp, subType, locInfo))
{
printf("Bad return code trying to get the location info received on this"
" port for the given location subtype. (result = %d)\n", result);
}
else
{
printf("Location info received on this port is %s.\n", (char *)locInfo->pstart);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp,
uint32_t *vlanId)
{
remIndex, timestamp,
policyAppType, vlanId))
{
printf("Bad return code trying to get the vlan id associated with a"
" particular policy type. (result = %d)\n", result);
}
else
{
printf("Vlan id associated with a given policy type is %u.\n", *vlanId);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp,
uint32_t *priority)
{
remIndex, timestamp,
policyAppType, priority))
{
printf("Bad return code trying to get the priority associated with a "
"particular policy type. (result = %d)\n", result);
}
else
{
printf("Priority associated with a given policy type is %u.\n", *priority);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp,
uint32_t *dscp)
{
remIndex, timestamp,
policyAppType, dscp))
{
printf("Bad return code trying to get the DSCP associated with a "
"particular policy type. (result = %d)\n", result);
}
else
{
printf("Dscp associated with a given policy type is %u.\n", *dscp);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp,
{
remIndex, timestamp,
policyAppType, unknown))
{
printf("Bad return code trying to get the unknown bit associated "
"with a particular policy type. (result = %d)\n", result);
}
else
{
printf("Unknown bit associated with a given policy type is %u.\n", *unknown);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp,
{
remIndex, timestamp,
policyAppType, tagged))
{
printf("Bad return code trying to get the tagged bit associated with "
"a particular policy type. (result = %d)\n", result);
}
else
{
printf("Tagged bit associated with a given policy type is %u.\n", *tagged);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t tlvType,
uint32_t *nextTlvType)
{
remIndex, timestamp,
tlvType, nextTlvType))
{
printf("Bad return code trying to get the next unknown TLV entry for "
"the indicated remote data entry. (result = %d)\n", result);
}
else
{
printf("Next unknown TLV entry for the indicated remote data entry is %u.\n",
*nextTlvType);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t tlvType,
{
remIndex, timestamp, tlvType,
{
printf("Bad return code trying to determine if unknown TLV entry exists."
" (result = %d)\n", result);
}
else
{
printf("Unknwon TLV entry existance status is %u.\n", *isExists);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t tlvType,
{
remIndex, timestamp, tlvType,
{
printf("Bad return code trying to get the TLV info for the specified"
" remote entry. (result = %d)\n", result);
}
else
{
printf("TLV info for the specified remote entry is %s.\n",(char *) info->pstart);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
{
{
printf("Bad return code trying to get the remote device's manufacturer's"
" name. (result = %d)\n", result);
}
else
{
printf("Remote device's manufacturer's name is %s.\n",(char *) mfgName->pstart);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
{
remIndex, timestamp, modelName))
{
printf("Bad return code trying to get the remote device's model name."
" (result = %d)\n", result);
}
else
{
printf("Remote device's model name is %s.\n",(char *) modelName->pstart);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t *powerReq)
{
remIndex, timestamp, powerReq))
{
printf("Bad return code trying to get the remote port's PD power requirement."
" (result = %d)\n", result);
}
else
{
printf("Remote port's PD power requirement is %u.\n", *powerReq);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t *powerSrc)
{
remIndex, timestamp, powerSrc))
{
printf("Bad return code trying to get the remote port's PD power source."
" (result = %d)\n", result);
}
else
{
printf("Remote port's PD power source is %u.\n", *powerSrc);
}
return;
}
uint32_t ifNum, uint32_t remIndex,
uint32_t timestamp, uint32_t *powerPri)
{
remIndex, timestamp, powerPri))
{
printf("Bad return code trying to get the remote port's PD power priority."
" (result = %d)\n", result);
}
else
{
printf("Remote port's PD power priority is %u.\n", *powerPri);
}
return;
}
uint32_t remIndex, uint32_t timestamp, uint32_t infoIndex,
{
timestamp, infoIndex, oui))
{
printf("Bad return code trying to get the organizationally defined OUI"
" for specified entry. (result = %d)\n", result);
}
else
{
printf("Organizationally defined OUI for specified entry is %s.\n",
(char *) oui->pstart);
}
return;
}
uint32_t remIndex, uint32_t timestamp,
uint32_t infoIndex, uint32_t *subtype)
{
timestamp, infoIndex, subtype))
{
printf("Bad return code trying to get the organizationally defined subtype "
"for specified entry. (result = %d)\n", result);
}
else
{
printf("Organizationally defined subtype for specified entry is %u.\n",
*subtype);
}
return;
}
{
{
printf("Bad return code trying to get a string representation for Chassis"
" ID Subtype. (result = %d)\n", result);
}
else
{
printf("String representation for Chassis ID Subtype is %s.\n",
(char *) subtypeStr->pstart);
}
return;
}
{
{
printf("Bad return code trying to get a string representation for port ID "
"Subtype. (result = %d)\n", result);
}
else
{
printf("String representation for port ID Subtype is %s.\n",
(char *) subtypeStr->pstart);
}
return;
}
{
{
printf("Bad return code trying to get the port's auto negotiation"
" capability. (result = %d)\n", result);
}
else
{
printf("Port's auto negotiation capability is %u.\n", *isCapable);
}
return;
}
{
{
printf("Bad return code trying to get port's auto negotiation enabled status."
" (result = %d)\n", result);
}
else
{
printf("Port's auto negotiation enabled status is %u.\n", *isEnabled);
}
return;
}
{
unsigned short advertizedCap = 0;
advrtCap)) !=
{
printf("Bad return code trying to get port's auto negotiation advertized"
" capability as a string. (result = %d)\n", result);
}
else
{
memcpy((void *)&advertizedCap, advrtCap->pstart, sizeof(unsigned short));
printf("Port's auto negotiation advertized capability is %d.\n", advertizedCap);
}
return;
}
uint32_t ifNum, uint32_t *type)
{
{
printf("Bad return code trying to get port's auto negotiation operational"
" MAU Type. (result = %d)\n", result);
}
else
{
printf("Port's auto negotiation operational MAU Type is %u.\n", *type);
}
return;
}
uint32_t *deviceClass)
{
{
printf("Bad return code trying to get local device's MED Classification"
" (result = %d)\n", result);
}
else
{
printf("Local device's MED Classification is %u.\n", *deviceClass);
}
return;
}
{
uint32_t invalidControlMode = 10;
uint32_t lldpMgmtStrLen, strLen, ttl;
uint32_t invalidTLVType = 10;
uint32_t nextIfNum, remIndex, timeStamp;
char *str;
uint8_t addrLen;
uint32_t count;
uint32_t priority;
uint32_t dscp;
uint32_t interval;
uint32_t holdCount;
uint32_t vlanId;
uint32_t delay;
printf("Testing LLDP OpEN APIs sanity:\n\n");
{
printf("Bad return code. (result = %d)\n", result);
return;
}
if ((str = (char*)malloc(lldpMgmtStrLen)) == NULL)
{
printf("Could not allocate memory.\n");
return;
}
memset(str, 0, lldpMgmtStrLen);
printf("Testing openapiLldpMgmtStrLenGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL String Length:(result = %d)\n", result);
printf("openapiLldpMgmtStrLenGet() sanity successful\n\n");
printf("Testing openapiLldpIntfTransmitModeSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Control Mode:(result = %d)\n", result);
printf("openapiLldpIntfTransmitModeSet() sanity successful\n\n");
printf("Testing openapiLldpIntfTransmitModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiLldpIntfTransmitModeGet() sanity successful\n\n");
printf("Testing openapiLldpIntfReceiveModeSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Control Mode:(result = %d)\n", result);
printf("openapiLldpIntfReceiveModeSet() sanity successful\n\n");
printf("Testing openapiLldpIntfReceiveModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiLldpIntfReceiveModeGet() sanity successful\n\n");
printf("Testing openapiLldpIntfTLVTransmitModeSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid TLV type:(result = %d)\n", result);
printf("Invalid Control Mode:(result = %d)\n", result);
printf("openapiLldpIntfTLVTransmitModeSet() sanity successful\n\n");
printf("Testing openapiLldpIntfTLVTransmitModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiLldpIntfTLVTransmitModeGet() sanity successful\n\n");
printf("Testing openapiLldpIntfNotificationModeSet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Control Mode:(result = %d)\n", result);
printf("openapiLldpIntfNotificationModeSet() sanity successful\n\n");
printf("Testing openapiLldpIntfNotificationModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiLldpIntfNotificationModeGet() sanity successful\n\n");
printf("Testing openapiLldpIntfNextGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Next Interface Number:(result = %d)\n", result);
printf("openapiLldpIntfNextGet() sanity successful\n\n");
printf("Testing openapiLldpIntfRemoteDeviceNextGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Remote Index:(result = %d)\n", result);
printf("NULL Time Stamp:(result = %d)\n", result);
printf("openapiLldpIntfRemoteDeviceNextGet() sanity successful\n\n");
printf("Testing openapiLldpIntfRemoteDeviceChassisIdGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
&chassisIdSubtype, &buffDesc);
printf("NULL Client Handle:(result = %d)\n", result);
NULL, &buffDesc);
printf("NULL Chassis Id Subtype:(result = %d)\n", result);
&chassisIdSubtype, NULL);
printf("NULL Chassis Id:(result = %d)\n", result);
buffDesc.pstart = NULL;
&chassisIdSubtype, &buffDesc);
printf("NULL Chassis Id buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
&chassisIdSubtype, &buffDesc);
printf("NULL Chassis Id buffer length:(result = %d)\n", result);
printf("openapiLldpIntfRemoteDeviceChassisIdGet() sanity successful\n\n");
printf("Testing openapiLldpIntfRemoteDevicePortIdGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
&portIdSubtype, &buffDesc);
printf("NULL Client Handle:(result = %d)\n", result);
NULL, &buffDesc);
printf("NULL Port Id Subtype:(result = %d)\n", result);
&portIdSubtype, NULL);
printf("NULL Port Id:(result = %d)\n", result);
buffDesc.pstart = NULL;
&portIdSubtype, &buffDesc);
printf("NULL Port Id buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
&portIdSubtype, &buffDesc);
printf("NULL Port Id buffer length:(result = %d)\n", result);
printf("openapiLldpIntfRemoteDevicePortIdGet() sanity successful\n\n");
printf("Testing openapiLldpIntfRemoteDeviceSystemNameGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL System Name:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL System Name buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL System Name buffer length:(result = %d)\n", result);
printf("openapiLldpIntfRemoteDevicePortIdGet() sanity successful\n\n");
printf("Testing openapiLldpIntfRemoteDeviceSystemDescGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL System Description:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL System Description buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL System Description buffer length:(result = %d)\n", result);
printf("openapiLldpIntfRemoteDeviceSystemDescGet() sanity successful\n\n");
printf("Testing openapiLldpIntfRemoteDevicePortDescGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Port Description:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL Port Description buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL Port Description buffer length:(result = %d)\n", result);
printf("openapiLldpIntfRemoteDeviceSystemDescGet() sanity successful\n\n");
printf("Testing openapiLldpIntfRemoteDeviceSysCapSuppGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Supported Sys Capabilities:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL Supported Sys Capabilities buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL Supported Sys Capabilities buffer length:(result = %d)\n", result);
printf("openapiLldpIntfRemoteDeviceSysCapSuppGet() sanity successful\n\n");
printf("Testing openapiLldpIntfRemoteDeviceSysCapEnabledGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Enabled Sys Capabilities:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL Enabled Sys Capabilities buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL Enabled Sys Capabilities buffer length:(result = %d)\n", result);
printf("openapiLldpIntfRemoteDeviceSysCapEnabledGet() sanity successful\n\n");
printf("Testing openapiLldpIntfRemoteDeviceMgmtAddressNextGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
&addressFamily, &buffDesc, &addrLen);
printf("NULL Client Handle:(result = %d)\n", result);
NULL, &buffDesc, &addrLen);
printf("NULL Address Family:(result = %d)\n", result);
&addressFamily, &buffDesc, NULL);
printf("NULL Address Length:(result = %d)\n", result);
buffDesc.pstart = NULL;
&addressFamily, &buffDesc, &addrLen);
printf("NULL Address buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
&addressFamily, &buffDesc, &addrLen);
printf("NULL Address buffer length:(result = %d)\n", result);
printf("openapiLldpIntfRemoteDeviceMgmtAddressNextGet() sanity successful\n\n");
printf("Testing openapiLldpIntfRemoteDeviceTTLGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL TTL:(result = %d)\n", result);
printf("openapiLldpIntfRemoteDeviceTTLGet() sanity successful\n\n");
printf("Testing openapiLldpIntfLocalDeviceChassisIdGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Chassis Id Subtype:(result = %d)\n", result);
printf("NULL Chassis Id:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL Chassis Id buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL Chassis Id buffer length:(result = %d)\n", result);
printf("openapiLldpIntfLocalDeviceChassisIdGet() sanity successful\n\n");
printf("Testing openapiLldpIntfLocalDevicePortIdGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Port Id Subtype:(result = %d)\n", result);
printf("NULL Port Id:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL Port Id buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL Port Id buffer length:(result = %d)\n", result);
printf("openapiLldpIntfLocalDevicePortIdGet() sanity successful\n\n");
printf("Testing openapiLldpIntfLocalDeviceSystemNameGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL System Name:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL System Name buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL System Name buffer length:(result = %d)\n", result);
printf("openapiLldpIntfLocalDeviceSystemNameGet() sanity successful\n\n");
printf("Testing openapiLldpIntfLocalDeviceSystemDescGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL System Description:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL System Description buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL System Description buffer length:(result = %d)\n", result);
printf("openapiLldpIntfLocalDeviceSystemDescGet() sanity successful\n\n");
printf("Testing openapiLldpIntfLocalDevicePortDescGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Port Description:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL Port Description buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL Port Description buffer length:(result = %d)\n", result);
printf("openapiLldpIntfLocalDevicePortDescGet() sanity successful\n\n");
printf("Testing openapiLldpIntfLocalDeviceSysCapSuppGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Supported Sys Capabilities:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL Supported Sys Capabilities buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL Supported Sys Capabilities buffer length:(result = %d)\n", result);
printf("openapiLldpIntfLocalDeviceSysCapSuppGet() sanity successful\n\n");
printf("Testing openapiLldpIntfLocalDeviceSysCapEnabledGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Enabled Sys Capabilities:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL Enabled Sys Capabilities buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL Enabled Sys Capabilities buffer length:(result = %d)\n", result);
printf("openapiLldpIntfLocalDeviceSysCapEnabledGet() sanity successful\n\n");
printf("Testing openapiLldpIntfLocalDeviceMgmtAddressGet():\n");
buffDesc.pstart = str;
buffDesc.size = lldpMgmtStrLen;
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Address Family:(result = %d)\n", result);
buffDesc.pstart = NULL;
printf("NULL Address buffer:(result = %d)\n", result);
buffDesc.pstart = str;
buffDesc.size = 0;
printf("NULL Address buffer length:(result = %d)\n", result);
printf("openapiLldpIntfLocalDeviceMgmtAddressGet() sanity successful\n\n");
printf("Testing openapiLldpMedIntfModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Control Mode:(result = %d)\n", result);
printf("openapiLldpMedIntfModeGet() sanity successful\n\n");
printf("Testing openapiLldpMedIntfModeSet() on an LLDP-MED valid interface:\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Control Mode:(result = %d)\n", result);
printf("openapiLldpMedIntfModeSet() sanity successful on an LLDP-MED valid interface\n\n");
printf("Testing openapiLldpMedIntfConfigNotificationModeGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL Bool Mode:(result = %d)\n", result);
printf("openapiLldpMedIntfConfigNotificationModeGet() sanity successful\n\n");
printf("Testing openapiLldpMedIntfConfigNotificationModeSet() on an LLDP-MED valid interface:\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("Invalid Bool Mode:(result = %d)\n", result);
printf("openapiLldpMedIntfConfigNotificationModeSet() sanity successful on an LLDP-MED valid interface\n\n");
printf("Testing openapiLldpMedIntfTransmitTlvGet():\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL TLV:(result = %d)\n", result);
printf("openapiLldpMedIntfTransmitTlvGet() sanity successful\n\n");
printf("Testing openapiLldpMedIntfTransmitTlvSet() on an LLDP-MED valid interface:\n");
printf("NULL Client Handle:(result = %d)\n", result);
printf("NULL TLV:(result = %d)\n", result);
printf("openapiLldpMedIntfTransmitTlvSet() sanity successful on an LLDP-MED valid interface\n\n");
free(str);
printf("Testing openapiLldpTxIntervalGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiLldpTxIntervalSet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("less than minimum value argument 2:(result = %d)\n", result);
printf("greater than maximum value argument 2:(result = %d)\n", result);
printf("Testing openapiLldpTxHoldGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiLldpTxHoldSet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("less than minimum value argument 2:(result = %d)\n", result);
printf("greater than maximum value argument 2:(result = %d)\n", result);
printf("Testing openapiLldpTxReinitDelayGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiLldpTxReinitDelaySet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("less than minimum value argument 2:(result = %d)\n", result);
printf("greater than maximum value argument 2:(result = %d)\n", result);
printf("Testing openapiLldpNotificationIntervalGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiLldpNotificationIntervalSet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("less than minimum value argument 2:(result = %d)\n", result);
printf("greater than maximum value argument 2:(result = %d)\n", result);
printf("Testing openapiLldpXMedFastStartRepeatCountGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 2:(result = %d)\n", result);
printf("Testing openapiLldpXMedFastStartRepeatCountSet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("less than minimum value argument 2:(result = %d)\n", result);
printf("greater than maximum value argument 2:(result = %d)\n", result);
printf("Testing openapiLldpIntfTxMgmtAddrModeGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 3:(result = %d)\n", result);
printf("Testing openapiLldpXMedLocMediaPolicyVlanIDGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("Testing openapiLldpXMedLocMediaPolicyTaggedGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("Testing openapiLldpXMedLocMediaPolicyPriorityGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
printf("Testing openapiLldpXMedLocMediaPolicyDscpGet():\n");
printf("NULL client handle:(result = %d)\n", result);
printf("NULL argument 4:(result = %d)\n", result);
return;
}
int main(int argc, char **argv)
{
uint32_t ifNum, testNum, arg1, arg2, val, remIndex, timestamp, policyAppType;
char switch_os_revision_string[100];
char buf[256] = {0};
bufDesc.pstart = buf;
bufDesc.size = 256;
if (argc < 2)
{
printLldpAppMenu();
exit(1);
}
testNum = atoi(argv[1]);
if (argc > 2)
{
ifNum = atoi(argv[2]);
}
if ((argc > 4) && (testNum > 35) && (testNum < 66))
{
ifNum = atoi(argv[2]);
remIndex = atoi(argv[3]);
timestamp = atoi(argv[4]);
if (argc > 5)
{
policyAppType = atoi(argv[5]);
}
}
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 LLDP 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 != 4)
{
printLldpAppMenu();
exit(1);
}
arg1 = atoi(argv[3]);
lldpIntfTransmitModeSet(&clientHandle, ifNum, arg1);
break;
case 2:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpIntfTransmitModeGet(&clientHandle, ifNum);
break;
case 3:
if (argc != 4)
{
printLldpAppMenu();
exit(1);
}
arg1 = atoi(argv[3]);
lldpIntfReceiveModeSet(&clientHandle, ifNum, arg1);
break;
case 4:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpIntfReceiveModeGet(&clientHandle, ifNum);
break;
case 5:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
arg1 = atoi(argv[3]);
arg2 = atoi(argv[4]);
lldpIntfTLVTransmitModeSet(&clientHandle, ifNum, arg1, arg2);
break;
case 6:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpIntfTLVTransmitModeGet(&clientHandle, ifNum);
break;
case 7:
if (argc != 4)
{
printLldpAppMenu();
exit(1);
}
arg1 = atoi(argv[3]);
lldpIntfNotificationModeSet(&clientHandle, ifNum, arg1);
break;
case 8:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpIntfNotificationModeGet(&clientHandle, ifNum);
break;
case 9:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpIntfRemoteDevicesGet(&clientHandle, ifNum);
break;
case 10:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpIntfLocalDeviceGet(&clientHandle, ifNum);
break;
case 11:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpMedIntfModeGet(&clientHandle, ifNum);
break;
case 12:
if (argc != 4)
{
printLldpAppMenu();
exit(1);
}
arg1 = atoi(argv[3]);
lldpMedIntfModeSet(&clientHandle, ifNum, arg1);
break;
case 13:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpMedIntfConfigNotificationModeGet(&clientHandle, ifNum);
break;
case 14:
if (argc != 4)
{
printLldpAppMenu();
exit(1);
}
arg1 = atoi(argv[3]);
lldpMedIntfConfigNotificationModeSet(&clientHandle, ifNum, arg1);
break;
case 15:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpMedInterfaceTransmitTlvGet(&clientHandle, ifNum);
break;
case 16:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpMedInterfaceTransmitTlvSet(&clientHandle, ifNum);
break;
case 17:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemoteDeviceInfoGet(&clientHandle, ifNum);
break;
case 18:
if (argc != 2)
{
printLldpAppMenu();
exit(1);
}
lldpTxIntervalGet(&clientHandle, &val);
break;
case 19:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpTxIntervalSet(&clientHandle, atoi(argv[2]));
break;
case 20:
if (argc != 2)
{
printLldpAppMenu();
exit(1);
}
lldpTxHoldGet(&clientHandle, &val);
break;
case 21:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpTxHoldSet(&clientHandle, atoi(argv[2]));
break;
case 22:
if (argc != 2)
{
printLldpAppMenu();
exit(1);
}
lldpTxReinitDelayGet(&clientHandle, &val);
break;
case 23:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpTxReinitDelaySet(&clientHandle, atoi(argv[2]));
break;
case 24:
if (argc != 2)
{
printLldpAppMenu();
exit(1);
}
lldpNotificationIntervalGet(&clientHandle, &val);
break;
case 25:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpNotificationIntervalSet(&clientHandle, atoi(argv[2]));
break;
case 26:
if (argc != 2)
{
printLldpAppMenu();
exit(1);
}
lldpXMedFastStartRepeatCountGet(&clientHandle, &val);
break;
case 27:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpXMedFastStartRepeatCountSet(&clientHandle, atoi(argv[2]));
break;
case 28:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpIntfTxMgmtAddrModeGet(&clientHandle, ifNum, &status);
break;
case 29:
if (argc != 4)
{
printLldpAppMenu();
exit(1);
}
lldpIntfTxMgmtAddrModeSet(&clientHandle, ifNum, atoi(argv[3]));
break;
case 30:
if (argc != 4)
{
printLldpAppMenu();
exit(1);
}
lldpXMedLocMediaPolicyVlanIDGet(&clientHandle, ifNum, atoi(argv[3]),
&val);
break;
case 31:
if (argc != 4)
{
printLldpAppMenu();
exit(1);
}
lldpXMedLocMediaPolicyTaggedGet(&clientHandle, ifNum, atoi(argv[3]),
&status);
break;
case 32:
if (argc != 4)
{
printLldpAppMenu();
exit(1);
}
lldpXMedLocMediaPolicyPriorityGet(&clientHandle, ifNum, atoi(argv[3]),
&val);
break;
case 33:
if (argc != 4)
{
printLldpAppMenu();
exit(1);
}
lldpXMedLocMediaPolicyDscpGet(&clientHandle, ifNum, atoi(argv[3]),
&val);
break;
case 34:
if (argc != 2)
{
printLldpAppMenu();
exit(1);
}
lldpRemoteIntfFirstGet(&clientHandle, &val);
break;
case 35:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpRemoteIntfNextGet(&clientHandle, atoi(argv[2]),&val);
break;
case 36:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpdot3RemPortAutoNegSupportedGet(&clientHandle, ifNum, remIndex,
timestamp, &status);
break;
case 37:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpdot3RemPortAutoNegEnabledGet(&clientHandle, ifNum, remIndex,
timestamp, &status);
break;
case 38:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpdot3RemPortAutoNegAdvertizedCapGet(&clientHandle, ifNum,
remIndex, timestamp, &bufDesc);
break;
case 39:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpdot3RemPortAutoNegOperMauTypeGet(&clientHandle, ifNum,
remIndex, timestamp, &val);
break;
case 40:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpdot3RemPortAutoNegOperMauStringGet(&clientHandle, atoi(argv[2]),
&bufDesc);
break;
case 41:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemHardwareRevGet(&clientHandle, ifNum, remIndex, timestamp,
&bufDesc);
break;
case 42:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemFirmwareRevGet(&clientHandle, ifNum, remIndex, timestamp, &bufDesc);
break;
case 43:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemSoftwareRevGet(&clientHandle, ifNum, remIndex, timestamp, &bufDesc);
break;
case 44:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemSerialNumGet(&clientHandle, ifNum, remIndex, timestamp, &bufDesc);
break;
case 45:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemAssetIdGet(&clientHandle, ifNum, remIndex, timestamp, &bufDesc);
break;
case 46:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemPoeDeviceTypeGet(&clientHandle, ifNum, remIndex, timestamp,
&val);
break;
case 47:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemPoePSEPowerAvGet(&clientHandle, ifNum, remIndex, timestamp,
&val);
break;
case 48:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemPoePSEPowerSrcGet(&clientHandle, ifNum, remIndex, timestamp,
&val);
break;
case 49:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemPoePSEPowerPriGet(&clientHandle, ifNum, remIndex, timestamp, &val);
break;
case 50:
if (argc != 6)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemLocationInfoGet(&clientHandle, ifNum, remIndex, timestamp,
atoi(argv[5]), &bufDesc);
break;
case 51:
if (argc != 6)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemMediaPolicyVlanIdGet(&clientHandle, ifNum, remIndex, timestamp,
policyAppType, &val);
break;
case 52:
if (argc != 6)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemMediaPolicyPriorityGet(&clientHandle, ifNum, remIndex, timestamp,
policyAppType, &val);
break;
case 53:
if (argc != 6)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemMediaPolicyDscpGet(&clientHandle, ifNum, remIndex, timestamp,
policyAppType, &val);
break;
case 54:
if (argc != 6)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemMediaPolicyUnknownGet(&clientHandle, ifNum, remIndex, timestamp,
policyAppType, &status);
break;
case 55:
if (argc != 6)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemMediaPolicyTaggedGet(&clientHandle, ifNum, remIndex, timestamp,
policyAppType, &status);
break;
case 56:
if (argc != 6)
{
printLldpAppMenu();
exit(1);
}
lldpRemUnknownTLVEntryNextGet(&clientHandle, ifNum, remIndex, timestamp,
atoi(argv[5]), &val);
break;
case 57:
if (argc != 6)
{
printLldpAppMenu();
exit(1);
}
lldpRemUnknownTLVEntryIsExists(&clientHandle, ifNum, remIndex, timestamp,
atoi(argv[5]), &status);
break;
case 58:
if (argc != 6)
{
printLldpAppMenu();
exit(1);
}
char buf1[512] = {0};
bufDesc.pstart = buf1;
bufDesc.size = 512;
lldpRemUnknownTLVInfoGet(&clientHandle, ifNum, remIndex, timestamp,
atoi(argv[5]), &bufDesc);
break;
case 59:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemMfgNameGet(&clientHandle, ifNum, remIndex, timestamp, &bufDesc);
break;
case 60:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemModelNameGet(&clientHandle, ifNum, remIndex, timestamp, &bufDesc);
break;
case 61:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemPoePDPowerReqGet(&clientHandle, ifNum, remIndex, timestamp,
&val);
break;
case 62:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemPoePDPowerSrcGet(&clientHandle, ifNum, remIndex, timestamp,
&val);
break;
case 63:
if (argc != 5)
{
printLldpAppMenu();
exit(1);
}
lldpMedRemPoePDPowerPriGet(&clientHandle, ifNum, remIndex, timestamp,
&val);
break;
case 64:
if (argc != 6)
{
printLldpAppMenu();
exit(1);
}
lldpRemOrgDefOUIGet(&clientHandle, ifNum, remIndex, timestamp, atoi(argv[5]),
&bufDesc);
break;
case 65:
if (argc != 6)
{
printLldpAppMenu();
exit(1);
}
lldpRemOrgDefSubtypeGet(&clientHandle, ifNum, remIndex, timestamp,
atoi(argv[5]), &val);
break;
case 66:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpChassisIdSubtypeStringGet(&clientHandle, atoi(argv[2]), &bufDesc);
break;
case 67:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpPortIdSubtypeStringGet(&clientHandle, atoi(argv[2]), &bufDesc);
break;
case 68:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpdot3LocPortAutoNegSupportedGet(&clientHandle, ifNum, &status);
break;
case 69:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpdot3LocPortAutoNegEnabledGet(&clientHandle, ifNum, &status);
break;
case 70:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpdot3LocPortAutoNegAdvertizedCapGet(&clientHandle, ifNum, &bufDesc);
break;
case 71:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpdot3LocPortAutoNegOperMauTypeGet(&clientHandle, ifNum, &val);
break;
case 72:
if (argc != 2)
{
printLldpAppMenu();
exit(1);
}
lldpMedLocDeviceClassGet (&clientHandle, &val);
break;
case 73:
if (argc != 3)
{
printLldpAppMenu();
exit(1);
}
lldpOpENAPIsTestSanity(&clientHandle, ifNum);
break;
default:
printLldpAppMenu();
break;
}
L7PROC_LOGF(L7PROC_LOG_SEVERITY_INFO, 0, "Stopping LLDP API example application");
return 0;
}