#include <stdlib.h>
#include <unistd.h>
#include "rpcclt_openapi.h"
#include "proc_util.h"
void getPhysicalModes(uint64_t portCapability)
{
printf("------------------------------------------------\n");
if (((portCapability) & (OPEN_PHY_CAP_PORTSPEED_AUTO_NEG)) == (OPEN_PHY_CAP_PORTSPEED_AUTO_NEG))
{
printf("Auto Negotiate \n");
}
if (( portCapability) & (OPEN_PHY_CAP_PORTSPEED_HALF_10))
{
printf("10 Mbps Half Duplex \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_FULL_10))
{
printf("10 Mbps Full Duplex \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_HALF_100))
{
printf("100 Mbps Half Duplex \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_FULL_100))
{
printf("100 Mbps Full Duplex \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_HALF_1000))
{
printf("1000 Mbps Half Duplex \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_FULL_1000))
{
printf("1000 Mbps Full Duplex \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_FULL_2P5G))
{
printf("2.5 Gbps Full \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_FULL_5G))
{
printf("5 Gbps Full \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_FULL_10G))
{
printf("10 Gbps Full \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_FULL_20G))
{
printf("20 Gbps Full \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_FULL_25G))
{
printf("25 Gbps Full \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_FULL_40G))
{
printf("40 Gbps Full \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_FULL_50G))
{
printf("50 Gbps Full \n");
}
if ((portCapability) & (OPEN_PHY_CAP_PORTSPEED_FULL_100G))
{
printf("100 Gbps Full \n");
}
}
{
char *ret = "Unknown reason";
switch(reason)
{
case OPEN_DISABLE_REASON_NONE:
ret = "OPEN_DISABLE_REASON_NONE";
break;
case OPEN_DISABLE_REASON_UDLD:
ret = "OPEN_DISABLE_REASON_UDLD";
break;
case OPEN_DISABLE_REASON_STP:
ret = "OPEN_DISABLE_REASON_STP";
break;
case OPEN_DISABLE_REASON_BPDUGUARD:
ret = "OPEN_DISABLE_REASON_BPDUGUARD";
break;
case OPEN_DISABLE_REASON_BPDUSTORM:
ret = "OPEN_DISABLE_REASON_BPDUSTORM";
break;
case OPEN_DISABLE_REASON_DHCPSNOOPING:
ret = "OPEN_DISABLE_REASON_DHCPSNOOPING";
break;
case OPEN_DISABLE_REASON_ARPINSPECTION:
ret = "OPEN_DISABLE_REASON_ARPINSPECTION";
break;
case OPEN_DISABLE_REASON_STORMCONTROL_BCAST:
ret = "OPEN_DISABLE_REASON_STORMCONTROL_BCAST";
break;
case OPEN_DISABLE_REASON_STORMCONTROL_MCAST:
ret = "OPEN_DISABLE_REASON_STORMCONTROL_MCAST";
break;
case OPEN_DISABLE_REASON_STORMCONTROL_UCAST:
ret = "OPEN_DISABLE_REASON_STORMCONTROL_UCAST";
break;
case OPEN_DISABLE_REASON_XCEIVER:
ret = "OPEN_DISABLE_REASON_XCEIVER";
break;
case OPEN_DISABLE_REASON_XCEIVERPLUS:
ret = "OPEN_DISABLE_REASON_XCEIVERPLUS";
break;
case OPEN_DISABLE_REASON_LOOPPROTECT:
ret = "OPEN_DISABLE_REASON_LOOPPROTECT";
break;
case OPEN_DISABLE_REASON_PML:
ret = "OPEN_DISABLE_REASON_PML";
break;
case OPEN_DISABLE_REASON_DOS:
ret = "OPEN_DISABLE_REASON_DOS";
break;
case OPEN_DISABLE_REASON_LINK_FLAP:
ret = "OPEN_DISABLE_REASON_LINK_FLAP";
break;
case OPEN_DISABLE_REASON_AUTHMGR_AUTH_VIOLATION:
ret = "OPEN_DISABLE_REASON_AUTHMGR_AUTH_VIOLATION";
break;
default:
break;
}
return ret;
}
{
char *ret = "Unknown";
switch(specialPortType)
{
case OPEN_SPECIAL_PORT_TYPE_NORMAL:
ret = "Normal port";
break;
case OPEN_SPECIAL_PORT_TYPE_TRUNK_MEMBER:
ret = "Trunk member";
break;
case OPEN_SPECIAL_PORT_TYPE_MIRRORED_PORT:
ret = "Mirrored port";
break;
case OPEN_SPECIAL_PORT_TYPE_PROBE_PORT:
ret = "Probe port";
break;
case OPEN_SPECIAL_PORT_TYPE_L2TUNNEL_PORT:
ret = "L2 tunnel port";
break;
case OPEN_SPECIAL_PORT_TYPE_SERVICE_PORT:
ret = "Service port";
break;
default:
break;
}
return ret;
}
{
char *ret = "Unknown";
if (mediaType == OPEN_PORT_CABLE_MEDIA_TYPE_COPPER)
{
ret = "Copper";
}
else if (mediaType == OPEN_PORT_CABLE_MEDIA_TYPE_FIBER)
{
switch(moduleType)
{
ret = "None";
break;
ret = "SFP";
break;
ret = "SFP+";
break;
ret = "QSFP";
break;
ret = "Direct attach cable";
break;
ret = "XFP 10G plugin module (AX741)";
break;
ret = "Stacking module (AX742)";
break;
ret = "SFP+ plugin module (AX743)";
break;
ret = "CX4 plugin module (AX744)";
break;
ret = "Copper 10G plugin module (AX745)";
break;
default:
break;
}
}
return ret;
}
uint32_t interface, uint32_t *maskOffset)
{
{
printf("Bad return code trying to get the Configuration Mask Offset. "
"(result = %d)\n", result);
}
else
{
printf("Configuration mask offset for interface %d is %d\n", interface,
*maskOffset);
}
return;
}
uint32_t *ifIndex)
{
{
printf("Bad return code trying to returns the interface index associated "
"with the internal interface number. (result = %d)\n", result);
}
else
{
printf("Fetched interface index for interface %d is %d\n", interface,
*ifIndex);
}
return;
}
uint32_t *intfActiveState)
{
{
printf("Bad return code trying to set the Broadcast Storm Control Action "
"mode of an interface (result = %d)\n", result);
}
else
{
printf("Interface %d active state is %d\n", interface, *intfActiveState);
}
return;
}
{
char *ret = "Invalid";
switch (mode)
{
ret = "None";
break;
ret = "Single lane ports 10G";
break;
ret = "Single lane ports 25G";
break;
ret = "Dual lane ports 50G";
break;
ret = "Quad lane 40g ports";
break;
ret = "Quad lane 100g ports";
break;
ret = "Single 50GB port with dual lane";
break;
ret = "Dual 25GB ports";
break;
ret = "Single lane 10G ports";
break;
ret = "Single lane 25G ports";
break;
ret = "Single lane 50G ports";
break;
ret = "Quad lane 100g ports";
break;
ret = "Dual lane 100g ports";
break;
ret = "Quad lane 200g ports";
break;
ret = "Octalane 400g ports";
break;
case OPEN_EXPANDABLE_PORTMODE_LAST:
default:
break;
}
return ret;
}
{
uint32_t intfNum = 0;
char intfNameStr[OPENAPI_INTERFACE_LIST_MAX_LENGTH];
char peerIntfsStr[OPENAPI_INTERFACE_LIST_MAX_LENGTH];
uint32_t peerCount = 0;
memset(intfNameStr, 0, sizeof(intfNameStr));
intfName.
pstart = intfNameStr;
intfName.
size =
sizeof(intfNameStr);
memset(peerIntfsStr, 0, sizeof(peerIntfsStr));
peerIntfs.pstart = peerIntfsStr;
peerIntfs.size = sizeof(peerIntfsStr);
{
printf("\r\nExpandable ports are not supported.\r\n");
return;
}
printf("\r\nExpandable Port Configuration:\r\n");
do
{
memset(intfNameStr, 0, sizeof(intfNameStr));
intfName.size = sizeof(intfNameStr);
memset(peerIntfsStr, 0, sizeof(peerIntfsStr));
peerIntfs.size = sizeof(peerIntfsStr);
peerCount = 0;
{
printf("Bad return code trying to get interface name for interface %d. (result = %d).\n",
intfNum, result);
}
else
{
printf(" Expandable Interface:%s(%d)\r\n", intfNameStr, intfNum);
}
{
printf("Bad return code trying to get configured port mode for interface "
"%s (%d). (result = %d).\n",
intfNameStr, intfNum, result);
}
else
{
printf(" Configured Mode:%s(%d)\r\n", expPortModeStr(confPortMode), confPortMode);
}
{
printf("Bad return code trying to get operating port mode for interface "
"%s (%d). (result = %d).\n",
intfNameStr, intfNum, result);
}
else
{
printf(" Operating Mode:%s(%d)\r\n", expPortModeStr(runnPortMode), runnPortMode);
}
&peerIntfs, &peerCount))
{
printf(" Expanded option(s):%s (%d)\r\n", expPortModeStr(portMode), portMode);
printf(" Expanded interfaces:%s\r\n", peerIntfsStr);
printf(" Expanded interfaces count:%d\r\n", peerCount);
memset(peerIntfsStr, 0, sizeof(peerIntfsStr));
peerIntfs.size = sizeof(peerIntfsStr);
peerCount = 0;
}
printf("\r\n");
return;
}
{
uint32_t intfNum = 0;
char intfNameStr[OPENAPI_INTERFACE_LIST_MAX_LENGTH];
memset(intfNameStr, 0, sizeof(intfNameStr));
intfName.pstart = intfNameStr;
intfName.size = sizeof(intfNameStr);
{
printf("\r\nExpandable ports are not supported.\r\n");
return;
}
printf("\r\nSet port mode for expandable interface:%s(%d)\r\n", intfNameStr, intfNum);
{
printf("Bad return code trying to get interface name for interface %d. (result = %d).\n",
intfNum, result);
}
else
{
printf(" Expandable Interface:%s(%d)\r\n", intfNameStr, intfNum);
}
{
printf("Bad return code trying to get configured port mode for interface "
"%s (%d). (result = %d).\n",
intfNameStr, intfNum, result);
}
else
{
printf(" Current Configured Mode:%s(%d)\r\n", expPortModeStr(confPortMode), confPortMode);
}
{
printf("Bad return code trying to check if the port mode %s(%d) is supported "
"(result = %d).\n", expPortModeStr(newPortMode), newPortMode, result);
return;
}
else
{
{
printf("Expandable port mode %s(%d) is not supported.\r\n ", expPortModeStr(newPortMode), newPortMode);
return;
}
}
{
printf("Bad return code trying to set port mode %s(%d) for interface "
"%s (%d). (result = %d).\n", expPortModeStr(newPortMode), newPortMode,
intfNameStr, intfNum, result);
}
else
{
printf("Successfully configured the port Mode:%s(%d) on Interface %s (%d).\r\n",
expPortModeStr(newPortMode), newPortMode, intfNameStr, intfNum);
{
printf("Bad return code trying to get new configured port mode for interface "
"%s (%d). (result = %d).\n",
intfNameStr, intfNum, result);
}
else
{
printf(" New Configured Mode:%s(%d)\r\n", expPortModeStr(confPortMode), confPortMode);
}
}
return;
}
{
char *fecMode = "Invalid";
switch (mode)
{
fecMode = "Enable";
break;
fecMode = "Auto";
break;
fecMode = "CL74";
break;
fecMode = "CL91";
break;
fecMode = "RS544";
break;
fecMode = "RS272";
break;
fecMode = "RS206";
break;
fecMode = "RS108";
break;
fecMode = "RS545";
break;
fecMode = "RS304";
break;
fecMode = "RS544_2xN";
break;
fecMode = "RS272_2xN";
break;
fecMode = "NOFEC_50G";
break;
fecMode = "Disable";
break;
fecMode = "Not Available";
break;
default:
break;
}
return fecMode;
}
{
uint32_t intfNum = 0;
char intfNameStr[OPENAPI_INTERFACE_LIST_MAX_LENGTH];
uint64_t portCapability;
memset(intfNameStr, 0, sizeof(intfNameStr));
intfName.pstart = intfNameStr;
intfName.size = sizeof(intfNameStr);
{
memset(intfNameStr, 0, sizeof(intfNameStr));
intfName.size = sizeof(intfNameStr);
portCapability = 0;
((portCapability) & (OPEN_PHY_CAP_FEC_SUPPORT)))
{
printf("\r\n");
{
printf("Bad return code trying to get interface name for interface %d. (result = %d).\n",
intfNum, result);
}
else
{
printf("Interface:%s(%d)\r\n", intfNameStr, intfNum);
}
{
printf("Bad return code trying to get FEC mode for interface "
"%s (%d). (result = %d).\n",
intfNameStr, intfNum, result);
}
else
{
printf(" Configured Mode:%s(%d)\r\n", getFECModeStr(fecConfigMode), fecConfigMode);
printf(" Operational Mode:%s(%d)\r\n", getFECModeStr(fecOperMode), fecOperMode);
}
printf("\r\n");
}
}
return;
}
{
uint32_t intfNum = 0;
char intfNameStr[OPENAPI_INTERFACE_LIST_MAX_LENGTH];
uint64_t portCapability;
memset(intfNameStr, 0, sizeof(intfNameStr));
intfName.pstart = intfNameStr;
intfName.size = sizeof(intfNameStr);
{
memset(intfNameStr, 0, sizeof(intfNameStr));
intfName.size = sizeof(intfNameStr);
portCapability = 0;
((portCapability) & (OPEN_PHY_CAP_FEC_SUPPORT)))
{
printf("\r\n");
{
printf("Bad return code trying to get interface name for interface %d. (result = %d).\n",
intfNum, result);
}
else
{
printf("Interface:%s(%d)\r\n", intfNameStr, intfNum);
}
{
printf("Bad return code trying to set FEC mode for interface "
"%s (%d). (result = %d).\n",
intfNameStr, intfNum, result);
}
else
{
printf("FEC mode is set successfully for interface "
"%s (%d).\n", intfNameStr, intfNum);
{
printf("Bad return code trying to get FEC mode for interface "
"%s (%d). (result = %d).\n",
intfNameStr, intfNum, result);
}
else
{
printf(" Configured Mode:%s(%d)\r\n", getFECModeStr(fecConfigMode), fecConfigMode);
printf(" Operational Mode:%s(%d)\r\n", getFECModeStr(fecOperMode), fecOperMode);
}
}
printf("\r\n");
break;
}
}
return;
}
int
main (int argc, char **argv)
{
uint32_t IfNum, mtu, mtu2, efs;
char switch_os_revision_string[100];
char intfNameStr[256];
char buf[128];
OPEN_PORT_SPEEDS_t speed;
uint32_t duplex;
uint32_t autoneg;
uint32_t value = 0;
uint64_t portCapability;
uint32_t allIntfCount = 0, rxTimeout;
l7proc_crashlog_register ();
if ((result =
{
printf ("\nFailed to initialize RPC to OpEN. Exiting (result = %d)\n", result);
exit (2);
}
{
sleep (1);
}
L7PROC_LOGF (L7PROC_LOG_SEVERITY_INFO, 0, "Starting Interface 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("\nBad return code trying to get the count of all interfaces (result = %d)\n",
result);
}
else
{
printf ("Number of all interfaces: %u\n", allIntfCount);
}
printf ("\n");
{
printf("\nBad return code trying to get the socket receive timeout."
" (result = %d)\n", result);
}
else
{
printf ("Current socket receive timeout is : %u\n", rxTimeout);
}
{
printf("\nBad return code trying to set the socket receive timeout."
" (result = %d)\n", result);
}
else
{
printf ("Socket receive timeout set successfully.\n");
}
{
printf("\nBad return code trying to get the socket receive timeout."
" (result = %d)\n", result);
}
else
{
printf ("Socket receive timeout is : %u\n", rxTimeout);
}
{
printf("\nBad return code trying to set the socket receive timeout."
" (result = %d)\n", result);
}
else
{
printf ("Socket receive timeout set successfully.\n");
}
{
printf("\nBad return code trying to get the client RPC statistics."
" (result = %d)\n", result);
}
else
{
printf (
"Sent msg success count %u\n", stats.
msendok);
printf (
"Received msg success count %u\n", stats.
mrecvok);
printf (
"Nowait option usage count %u\n", stats.
mnowait);
printf (
"Failed msg send attempts %u\n", stats.
msendfail);
printf (
"Failed msg recv attempts %u\n", stats.
mrecvfail);
printf (
"Msg recv sequence number mismatch %u\n", stats.
mrecvseqerr);
printf (
"Truncated recv msgs %u\n", stats.
mrecvtrunc);
printf (
"Failed connection attempts %u\n", stats.
mconnfail);
}
printf ("\n");
do
{
{
printf(" Bad return code trying to get first physical interface. (result = %d)\n",result);
break;
}
intfName.pstart = intfNameStr;
intfName.size = sizeof(intfNameStr);
{
printf(" Bad return code trying to get first physical interface name. (result = %d)\n",result);
break;
}
printf("Using physical interface %d, name %s\n", IfNum, (char *)intfName.pstart);
{
printf(" Bad return code trying to get admin state physical interface. (result = %d)\n",result);
}
else
{
memset (buf, 0, sizeof(buf));
else sprintf(buf,"DISABLE");
printf("physical interface %d get admin-state : %s\n", IfNum, buf);
}
{
printf(" Bad return code trying to set admin state physical interface. (result = %d)\n",result);
}
{
printf(" Bad return code trying to get admin state physical interface. (result = %d)\n",result);
}
else
{
memset (buf, 0, sizeof(buf));
else sprintf(buf,"DISABLE");
printf("physical interface %d set admin-state : %s\n", IfNum, buf);
}
{
printf(" Bad return code trying to get speed of physical interface. (result = %d)\n",result);
}
else
{
memset (buf, 0, sizeof(buf));
switch (speed)
{
case OPEN_PORTCTRL_PORTSPEED_AUTO_NEG:
sprintf(buf,"AUTO");
break;
case OPEN_PORTCTRL_PORTSPEED_HALF_100TX:
sprintf(buf,"100 half");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_100TX:
sprintf(buf,"100 full");
break;
case OPEN_PORTCTRL_PORTSPEED_HALF_10T:
sprintf(buf,"10 half");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_10T:
sprintf(buf,"10 full");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_100FX:
sprintf(buf,"100 full");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_1000SX:
sprintf(buf,"1000 full");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_10GSX:
sprintf(buf,"10G full");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_40GSX:
sprintf(buf,"40G full");
break;
default:
sprintf(buf,"UNKNOWN");
break;
}
printf("physical interface %d speed %s\n",IfNum,buf);
}
{
printf(" Bad return code trying to get duplex mode of physical interface. (result = %d)\n",result);
}
else
{
memset (buf, 0, sizeof(buf));
switch (duplex)
{
case OPEN_PORT_DUPLEX_HALF:
sprintf(buf,"half-duplex");
break;
case OPEN_PORT_DUPLEX_FULL:
sprintf(buf,"full-duplex");
break;
case OPEN_PORT_DUPLEX_UNKNOWN:
sprintf(buf,"UNKNOWN");
break;
default:
sprintf(buf,"UNKNOWN");
break;
}
printf("physical interface %d duplex mode %s\n",IfNum,buf);
}
{
printf(" Bad return code trying to get auto-negotiation mode of physical interface. (result = %d)\n",result);
}
else
{
memset (buf, 0, sizeof(buf));
if (autoneg == OPEN_PORT_AUTO_NEG_ENABLE)
sprintf(buf,"ENABLE");
else if(autoneg == OPEN_PORT_AUTO_NEG_DISABLE)
sprintf(buf,"DISABLE");
else
sprintf(buf,"UNKNOWN");
printf("physical interface %d auto-negotiation mode : %s\n",IfNum,buf);
}
printf("setting auto-negotiation to DISABLE on interface %d \n",IfNum);
autoneg = OPEN_PORT_AUTO_NEG_DISABLE;
{
{
printf(" Cannot set auto-negotiation on an unsupported interface. (result = %d)\n", result);
}
else
{
printf(" Bad return code trying to set auto-negotiation mode of physical interface. (result = %d)\n",result);
}
}
else
{
sleep(5);
{
printf(" Bad return code trying to get auto-negotiation mode of physical interface. (result = %d)\n",result);
}
else
{
memset (buf, 0, sizeof(buf));
if (autoneg == OPEN_PORT_AUTO_NEG_ENABLE)
sprintf(buf,"ENABLE");
else if(autoneg == OPEN_PORT_AUTO_NEG_DISABLE)
sprintf(buf,"DISABLE");
else
sprintf(buf,"UNKNOWN");
printf("physical interface %d auto-negotiation mode : %s\n",IfNum,buf);
}
printf("setting the speed to 100M full-duplex on interface %d\n",IfNum);
speed = OPEN_PORTCTRL_PORTSPEED_FULL_100TX;
{
printf(" Bad return code trying to set speed of physical interface. (result = %d)\n",result);
}
else
{
sleep(5);
{
printf(" Bad return code trying to get speed of physical interface. (result = %d)\n",result);
}
else
{
memset (buf, 0, sizeof(buf));
switch (speed)
{
case OPEN_PORTCTRL_PORTSPEED_AUTO_NEG:
sprintf(buf,"AUTO");
break;
case OPEN_PORTCTRL_PORTSPEED_HALF_100TX:
sprintf(buf,"100 half");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_100TX:
sprintf(buf,"100 full");
break;
case OPEN_PORTCTRL_PORTSPEED_HALF_10T:
sprintf(buf,"10 half");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_10T:
sprintf(buf,"10 full");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_100FX:
sprintf(buf,"100 full");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_1000SX:
sprintf(buf,"1000 full");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_10GSX:
sprintf(buf,"10G full");
break;
case OPEN_PORTCTRL_PORTSPEED_FULL_40GSX:
sprintf(buf,"40G full");
break;
default:
sprintf(buf,"unknown");
break;
}
printf("physical interface %d speed %s\n",IfNum,buf);
}
}
}
{
printf("Bad return code trying to get ethernet frame size of physical interface. (result = %d)\n",result);
}
else
{
printf("physical interface %d ethernet header size : %d\n", IfNum, efs);
}
{
printf("Bad return code trying to get mtu size of physical interface. (result = %d)\n",result);
}
else
{
printf("physical interface %d MTU size : %d\n", IfNum, mtu);
}
mtu = 9216;
printf("setting the MTU to %d\n", mtu);
{
printf(" Bad return code trying to set mtu size of physical interface. (result = %d)\n",result);
}
else
{
sleep(5);
{
printf(" Bad return code trying to get mtu size of physical interface. (result = %d)\n",result);
}
else
{
printf("physical interface %d MTU size : %d\n",IfNum, mtu2);
printf("MTU is%sequal to the set MTU\n", (mtu == mtu2 ? " " : " not "));
}
}
mtu = 8148;
printf("setting the max frame size to %d\n", mtu);
{
printf(" Bad return code trying to set max frame size of physical interface. (result = %d)\n",result);
}
else
{
sleep(5);
{
printf(" Bad return code trying to get mtu size of physical interface. (result = %d)\n",result);
}
else
{
printf("physical interface %d MTU size : %d\n",IfNum,mtu2);
}
{
printf(" Bad return code trying to get max frame size of physical interface. (result = %d)\n",result);
}
else
{
printf("physical interface %d max frame size : %d\n", IfNum, mtu2);
printf("Max frame size is%sequal to the set max frame size\n", (mtu == mtu2 ? " " : " not "));
}
}
memset (buf, 0, sizeof(buf));
mac.pstart = buf;
mac.size = sizeof(buf);
{
printf(" Bad return code trying to get mac-address of physical interface. (result = %d)\n",result);
}
else
{
printf("physical interface %d mac-address : %s\n",IfNum,buf);
}
memset (buf, 0, sizeof(buf));
mac.pstart = buf;
mac.size = sizeof(buf);
{
printf(" Bad return code trying to get description of physical interface. (result = %d)\n",result);
}
else
{
printf("physical interface %d description : %s\n",IfNum,buf);
}
memset (buf, 0, sizeof(buf));
sprintf(buf,"test_port_%d_description",IfNum);
mac.pstart = buf;
mac.size = strlen(buf) + 1;
printf("setting the interface %d description to %s\n",IfNum,buf);
{
printf(" Bad return code trying to set description of physical interface. (result = %d)\n",result);
}
else
{
memset (buf, 0, sizeof(buf));
mac.pstart = buf;
mac.size = sizeof(buf);
{
printf(" Bad return code trying to get description of physical interface. (result = %d)\n",result);
}
else
{
printf("physical interface %d description : %s\n",IfNum,buf);
}
}
{
printf("Bad return code trying to get disable reason. result = %d\n", result);
}
else
{
printf("Physical interface %d disable reason: %d (%s)\n", IfNum, reason, reasonToStr(reason));
}
{
printf("Bad return code trying to get special port type. result = %d\n", result);
}
else
{
printf("Physical interface %d special port type designation: %d (%s)\n", IfNum, specialPortType, specialPortTypeToStr(specialPortType));
}
{
printf("Bad return code trying to get active media type. result = %d\n", result);
}
else if ((mediaType == OPEN_PORT_CABLE_MEDIA_TYPE_FIBER) &&
{
printf("Bad return code trying to get SFP type. result = %d\n", result);
}
else
{
printf("Physical interface %d active media type: %d (%s)\n", IfNum, mediaType, mediaTypeToStr(mediaType, moduleType));
}
{
printf("Bad return code trying to get pause status. result = %d\n", result);
}
else
{
memset (buf, 0, sizeof(buf));
{
sprintf(buf,"ACTIVE");
}
else
{
sprintf(buf,"INACTIVE");
}
printf("Physical interface %d flow control status: %s\n", IfNum, buf);
}
printf("--- interface statistic---\n");
sleep(2);
{
printf("Bad return code trying to get time of last link state change. result = %d\n", result);
}
else
{
printf("Physical interface %d Time of last link state change: %d\n", IfNum, value);
}
value = 0;
{
printf("Bad return code trying to get total number of octets. result = %d\n", result);
}
else
{
printf("Physical interface %d Total number of octets: %d\n", IfNum, value);
}
value = 0;
{
printf("Bad return code trying to get number of packets, delivered by this sub-layer to a higher sub-layer. result = %d\n", result);
}
else
{
printf("Physical interface %d Number of packets, delivered by this sub-layer to a higher sub-layer: %d\n", IfNum, value);
}
value = 0;
{
printf("Bad return code trying to get number of inbound packets which were chosen to be discarded. result = %d\n", result);
}
else
{
printf("Physical interface %d Number of inbound packets which were chosen to be discarded: %d\n", IfNum, value);
}
value = 0;
{
printf("Bad return code trying to get In errors counter. result = %d\n", result);
}
else
{
printf("Physical interface %d In errors counter: %d\n", IfNum, value);
}
value = 0;
{
printf("Bad return code trying to get number of packets received via the interface \nwhich were discarded because of an unknown or unsupported protocol. result = %d\n", result);
}
else
{
printf("Physical interface %d Number of packets received via the interface \nwhich were discarded because of an unknown or unsupported protocol: %d\n", IfNum, value);
}
value = 0;
{
printf("Bad return code trying to get total number of octets transmitted out of the interface, including framing characters. result = %d\n", result);
}
else
{
printf("Physical interface %d Total number of octets transmitted out of the interface, including framing characters: %d\n", IfNum, value);
}
value = 0;
{
printf("Bad return code trying to get total number of packets that higher-level protocols requested be transmitted. result = %d\n", result);
}
else
{
printf("Physical interface %d Total number of packets that higher-level protocols requested be transmitted: %d\n", IfNum, value);
}
value = 0;
{
printf("Bad return code trying to get number of outbound packets which were chosen to be discarded. result = %d\n", result);
}
else
{
printf("Physical interface %d Number of outbound packets which were chosen to be discarded: %d\n", IfNum, value);
}
value = 0;
{
printf("Bad return code trying to get number of outbound packets which were chosen to be discarded. result = %d\n", result);
}
else
{
printf("Physical interface %d Number of outbound packets which were chosen to be discarded: %d\n", IfNum, value);
}
value = 0;
{
printf("Bad return code trying to get out errors counter. result = %d\n", result);
}
else
{
printf("Physical interface %d Out errors counter: %d\n", IfNum, value);
}
{
printf("Bad return code trying to get port capabilities. result = %d\n", result);
}
else
{
printf("Physical interface %d is capable of following speeds: \n", IfNum);
getPhysicalModes(portCapability);
}
{
printf("Bad return code trying to get operational port state. result = %d\n", result);
}
else
{
memset (buf, 0, sizeof(buf));
{
snprintf(buf, sizeof(buf), "ENABLE");
}
{
snprintf(buf, sizeof(buf), "DISABLE");
}
else
{
snprintf(buf, sizeof(buf), "DIAG_DISABLE");
}
printf("Physical interface %d operational state %s\n", IfNum, buf);
}
configIdMaskOffsetGet(&clientHandle, IfNum, &value);
ifIndexGet(&clientHandle, IfNum, &value);
ifActiveStateGet(&clientHandle, IfNum, &value);
{
printf("Bad return code trying to get the link trap mode on interface %s(%d). "
"result = %d\n", intfNameStr, IfNum, result);
}
else
{
printf("Successfully fetched the link trap mode on interface %s(%d) Mode:%s.\n",
intfNameStr, IfNum, (linkTrapMode ==
OPEN_ENABLE) ?
"Enable" :
"Disable" );
}
{
printf("Bad return code trying to set the link trap mode on interface %s(%d). "
"result = %d\n", intfNameStr, IfNum, result);
}
else
{
printf("Successfully configured the link trap mode on interface %s(%d) Mode:%s.\n",
intfNameStr, IfNum, (linkTrapMode ==
OPEN_ENABLE) ?
"Enable" :
"Disable" );
}
{
printf("Bad return code trying to get the link trap mode on interface %s(%d). "
"result = %d\n", intfNameStr, IfNum, result);
}
else
{
printf("Successfully fetched the link trap mode on interface %s(%d) Mode:%s.\n",
intfNameStr, IfNum, (linkTrapMode ==
OPEN_ENABLE) ?
"Enable" :
"Disable" );
}
break;
}
while (0);
displayExpandablePortInfo(&clientHandle);
setGetExpandablePortMode(&clientHandle);
displayFECPortInfo(&clientHandle);
setGetFECPortInfo(&clientHandle);
L7PROC_LOGF (L7PROC_LOG_SEVERITY_INFO, 0,
"Stopping Interface API example application");
return 0;
}