NETWORK

本文提供了一个使用C语言实现的程序,用于检测网络链接是否断开,并获取本地主机的IP地址、MAC地址。通过调用系统命令`ifconfig`来检查网络状态,并使用socket编程获取IP地址、MAC地址和子网掩码。
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

/**********************************************************************
* 函数名称: GetNetStat
* 功能描述: 检测网络链接是否断开
* 输入参数: 
* 输出参数: 无
* 返 回 值: 正常链接1,断开返回-1
* 其它说明: 本程序需要超级用户权限才能成功调用ifconfig命令
***********************************************************************/ 
int GetNetStat( )
{
    char    buffer[BUFSIZ];
    FILE    *read_fp;
    int        chars_read;
    int        ret;
    
    memset( buffer, 0, BUFSIZ );
    read_fp = popen("ifconfig eth0 | grep RUNNING", "r");
    if ( read_fp != NULL ) 
    {
        chars_read = fread(buffer, sizeof(char), BUFSIZ-1, read_fp);
        if (chars_read > 0) 
        {
            ret = 1;
        }
        else
        {
            ret = -1;
        }
        pclose(read_fp);
    }
    else
    {
        ret = -1;
    }

    return ret;
}


int main()
{
    int i=0;
    i = GetNetStat();
    printf( "\nNetStat = %d\n", i );
    return 0;
}



#include <stdio.h>#include <sys/ioctl.h>#include <sys/socket.h>#include <sys/types.h>#include <netdb.h>#include <net/if.h>#include <arpa/inet.h>static int get_hostip(char *storeip){ int sfd, intr; struct ifreq buf[16]; struct ifconf ifc; sfd = socket (AF_INET, SOCK_DGRAM, 0); if (sfd < 0) return -1; ifc.ifc_len = sizeof(buf); ifc.ifc_buf = (caddr_t)buf; if (ioctl(sfd, SIOCGIFCONF, (char *)&ifc)) return -1; intr = ifc.ifc_len / sizeof(struct ifreq); while (intr-- > 0 && ioctl(sfd, SIOCGIFADDR, (char *)&buf[intr])); close(sfd); strcpy(storeip, inet_ntoa(((struct sockaddr_in*)(&buf[intr].ifr_addr))-> sin_addr));return 0;}


 /*获取mac地址*/

#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <net/if.h>
#include <string.h>
static int GetMacAddr(char *WhichEth, char *MacAdd)
{
	struct ifreq 	IfReq;
	int				sock;
	if (NULL == MacAdd || NULL == WhichEth){
		return -1;
	}
	if((sock = socket(AF_INET,SOCK_STREAM, 0)) < 0){
        perror("socket");
        return -2;
	}
	strcpy(IfReq.ifr_name, WhichEth);
	if(ioctl(sock,SIOCGIFHWADDR,&IfReq) < 0){
                perror("ioctl");
                return -3;
    }
	sprintf(MacAdd, "%02x:%02x:%02x:%02x:%02x:%02x",
                        (unsigned char)IfReq.ifr_hwaddr.sa_data[0],
                        (unsigned char)IfReq.ifr_hwaddr.sa_data[1],
                        (unsigned char)IfReq.ifr_hwaddr.sa_data[2],
                        (unsigned char)IfReq.ifr_hwaddr.sa_data[3],
                        (unsigned char)IfReq.ifr_hwaddr.sa_data[4],
                        (unsigned char)IfReq.ifr_hwaddr.sa_data[5]);
	return 0;
	
}


#include <arpa/inet.h>
#include <arpa/nameser.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <ctype.h>
#include <ctype.h>
#include <errno.h>
#include <netdb.h>
#include <resolv.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <net/if.h>  
int GetIpAddr(const char *EthName, char *IpAddr)
{
	int Ret 	= -1;
	int Fd		= 0;
	int Intrface = 0;
	struct ifconf Ifc;
	struct ifreq IfreqBuff[16];
	if (0 > (Fd = socket(AF_INET, SOCK_DGRAM, 0))){
		goto ERR_EXIT;
	}
	
	Ifc.ifc_len  = sizeof(IfreqBuff);
	Ifc.ifc_buf  = (caddr_t)IfreqBuff;
	
	if(0 > ioctl(Fd, SIOCGIFCONF, (char *)&Ifc)){
		goto ERR_EXIT;
	}
	
	Intrface = Ifc.ifc_len / sizeof(struct ifreq);
	
	while (Intrface-- > 0){
		if (strstr(IfreqBuff[Intrface].ifr_name, EthName)){
			if (0 > ioctl(Fd, SIOCGIFADDR, (char *)&IfreqBuff[Intrface])){
				goto ERR_EXIT;
			}
			//sprintf (IpAddr, "%s", inet_ntoa(((struct sockaddr_in *)(&IfreqBuff[Intrface].ifr_addr))->sin_addr));
			sprintf (IpAddr, "%s", inet_ntoa(((struct sockaddr_in *)(&IfreqBuff[Intrface].ifr_hwaddr))->sin_addr));
			//printf ("addr [%s]", IpAddr);
		}
					sprintf (IpAddr, "%s", inet_ntoa(((struct sockaddr_in *)(&IfreqBuff[Intrface].ifr_dstaddr))->sin_addr));
			printf ("addr [%s]", IpAddr);
	}
	
	return 0;
ERR_EXIT:
return -1;
}

int GetMaskAddr(const char *EthName, char *MaskAddr)
{
	int Ret 	= -1;
	int Fd		= 0;
	int Intrface = 0;
	struct ifconf Ifc;
	struct ifreq IfreqBuff[16];
	if (0 > (Fd = socket(AF_INET, SOCK_DGRAM, 0))){
		goto ERR_EXIT;
	}
	
	Ifc.ifc_len  = sizeof(IfreqBuff);
	Ifc.ifc_buf  = (caddr_t)IfreqBuff;
	
	if(0 > ioctl(Fd, SIOCGIFCONF, (char *)&Ifc)){
		goto ERR_EXIT;
	}
	
	Intrface = Ifc.ifc_len / sizeof(struct ifreq);
	
	while (Intrface-- > 0){
		if (strstr(IfreqBuff[Intrface].ifr_name, EthName)){
			if (0 > ioctl(Fd, SIOCGIFNETMASK, (char *)&IfreqBuff[Intrface])){// SIOCGIFADDR
				goto ERR_EXIT;
			}
			sprintf (MaskAddr, "%s", inet_ntoa(((struct sockaddr_in *)(&IfreqBuff[Intrface].ifr_netmask))->sin_addr));
		}
	}
	
	return 0;
ERR_EXIT:
return -1;
}
//¹ã²¥ SIOCGIFBRDADDR  
//ip SIOCGIFADDR
//×ÓÍøÑÚÂë  SIOCGIFNETMASK
//io = ioctl(sockfd, SIOCGIFHWADDR, (char *)buffer);
int main()
{
	char ip[20];
	char mask[20];
	GetIpAddr("eth0",ip);
	puts(ip);
	GetMaskAddr("eth0",mask);
	puts(mask);
}






精选资源
network
03-17
转成json格式,需要完整。Debug - HBA卡信息: {'@odata.context': '/redfish/v1/$metadata#NetworkAdapter.NetworkAdapter', '@odata.type': '#NetworkAdapter.v1_9_0.NetworkAdapter', '@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000', '@odata.etag': 'W/"A7F072DD"', '@Redfish.Settings': {'@odata.type': '#Settings.v1_3_3.Settings', 'SettingsObject': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000/Settings'}, 'SupportedApplyTimes': ['OnReset']}, 'Id': 'DE07B000', 'Name': 'Network Adapter', 'Manufacturer': 'Broadcom', 'Model': 'BCM57412', 'SKU': '10Gb 2-port SFP+ BCM57412 OCP3 Adapter', 'SerialNumber': 'VNM3400M6T', 'PartNumber': 'P26258-001', 'Status': {'Health': 'OK', 'State': 'Enabled'}, 'Ports': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000/Ports'}, 'NetworkDeviceFunctions': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000/NetworkDeviceFunctions'}, 'Metrics': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000/Metrics'}, 'Controllers': [{'FirmwarePackageVersion': '229.1.123.0', 'Links': {'PCIeDevices': [{'@odata.id': '/redfish/v1/Chassis/1/PCIeDevices/DE07B000'}]}, 'ControllerCapabilities': {'NetworkPortCount': 2, 'NetworkDeviceFunctionCount': 2, 'DataCenterBridging': {'Capable': True}, 'NPAR': {'NparCapable': True, 'NparEnabled': False}, 'VirtualizationOffload': {'SRIOV': {'SRIOVVEPACapable': True}, 'VirtualFunction': {'DeviceMaxCount': 128, 'MinAssignmentGroupSize': 8, 'NetworkPortMaxCount': 128}}}, 'PCIeInterface': {'LanesInUse': 8, 'MaxLanes': 8, 'MaxPCIeType': 'Gen3', 'PCIeType': 'Gen3'}}], 'LLDPEnabled': True, 'Actions': {'#NetworkAdapter.ResetSettingsToDefault': {'target': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000/Actions/NetworkAdapter.ResetSettingsToDefault', '@Redfish.OperationApplyTimeSupport': {'@odata.type': '#Settings.v1_3_3.OperationApplyTimeSupport', 'SupportedValues': ['OnReset']}}}} Debug - HBA卡信息: {'@odata.context': '/redfish/v1/$metadata#NetworkAdapter.NetworkAdapter', '@odata.type': '#NetworkAdapter.v1_9_0.NetworkAdapter', '@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000', '@odata.etag': 'W/"34EAB2A0"', '@Redfish.Settings': {'@odata.type': '#Settings.v1_3_3.Settings', 'SettingsObject': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000/Settings'}, 'SupportedApplyTimes': ['OnReset']}, 'Id': 'DE080000', 'Name': 'Network Adapter', 'Manufacturer': 'Broadcom', 'Model': 'BCM57412', 'SKU': '10Gb 2-port SFP+ BCM57412 Adapter', 'SerialNumber': 'VNM40109YH', 'PartNumber': 'P26261-001', 'Status': {'Health': 'OK', 'State': 'Enabled'}, 'Ports': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000/Ports'}, 'NetworkDeviceFunctions': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000/NetworkDeviceFunctions'}, 'Metrics': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000/Metrics'}, 'Controllers': [{'FirmwarePackageVersion': '229.1.123.0', 'Links': {'PCIeDevices': [{'@odata.id': '/redfish/v1/Chassis/1/PCIeDevices/DE080000'}]}, 'ControllerCapabilities': {'NetworkPortCount': 2, 'NetworkDeviceFunctionCount': 2, 'DataCenterBridging': {'Capable': True}, 'NPAR': {'NparCapable': True, 'NparEnabled': False}, 'VirtualizationOffload': {'SRIOV': {'SRIOVVEPACapable': True}, 'VirtualFunction': {'DeviceMaxCount': 128, 'MinAssignmentGroupSize': 8, 'NetworkPortMaxCount': 128}}}, 'PCIeInterface': {'LanesInUse': 8, 'MaxLanes': 8, 'MaxPCIeType': 'Gen3', 'PCIeType': 'Gen3'}}], 'LLDPEnabled': True, 'Actions': {'#NetworkAdapter.ResetSettingsToDefault': {'target': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000/Actions/NetworkAdapter.ResetSettingsToDefault', '@Redfish.OperationApplyTimeSupport': {'@odata.type': '#Settings.v1_3_3.OperationApplyTimeSupport', 'SupportedValues': ['OnReset']}}}} Debug - HBA卡信息: {'@odata.context': '/redfish/v1/$metadata#NetworkAdapter.NetworkAdapter', '@odata.etag': 'W/"61BF49E3"', '@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000', '@odata.type': '#NetworkAdapter.v1_5_0.NetworkAdapter', 'Id': 'DC081000', '@Redfish.Settings': {'SettingsObject': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/Settings'}}, 'Actions': {'#NetworkAdapter.ResetSettingsToDefault': {'target': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/Actions/NetworkAdapter.ResetSettingsToDefault', 'title': 'Reset network adapter configuration to factory default values.'}}, 'Controllers': [{'ControllerCapabilities': {'DataCenterBridging': {'Capable': False}, 'NPIV': {'MaxDeviceLogins': 256, 'MaxPortLogins': 128}, 'NetworkDeviceFunctionCount': 2, 'NetworkPortCount': 2}, 'FirmwarePackageVersion': '2.02.05', 'Links': {'NetworkDeviceFunctions': [{'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/NetworkDeviceFunctions/1'}, {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/NetworkDeviceFunctions/2'}], 'NetworkPorts': [{'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/NetworkPorts/1'}, {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/NetworkPorts/2'}], 'Ports': [{'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/Ports/1'}, {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/Ports/2'}]}, 'Location': {'PartLocation': {'LocationOrdinalValue': 2, 'LocationType': 'Slot', 'ServiceLabel': 'PCI-E Slot 2'}}}], 'Description': 'Device capabilities and characteristics with active configuration status', 'Manufacturer': 'Hewlett Packard Enterprise', 'Model': 'HPE SN1100Q 16Gb 2p FC HBA', 'Name': 'HPE SN1100Q 16Gb 2P FC HBA', 'NetworkDeviceFunctions': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/NetworkDeviceFunctions'}, 'NetworkPorts': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/NetworkPorts'}, 'Oem': {'Hpe': {'@odata.context': '/redfish/v1/$metadata#HpeNetworkAdapter.HpeNetworkAdapter', '@odata.type': '#HpeNetworkAdapter.v1_3_0.HpeNetworkAdapter', 'Actions': {'#HpeNetworkAdapter.FlushConfigurationToNVM': {'target': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/Actions/Oem/Hpe/HpeNetworkAdapter.FlushConfigurationToNVM', 'title': 'Force a save of current network adapter configuration to non-volatile storage.'}, '#NetworkAdapter.FlushConfigurationToNVM': {'target': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/Actions/Oem/Hpe/NetworkAdapter.FlushConfigurationToNVM', 'title': 'NOTE: Deprecated, will be removed in a future release. Replaced by HpeNetworkAdapter.FlushConfigurationToNVM. Force a save of current network adapter configuration to non-volatile storage.'}}, 'CLPVersion': '', 'Controllers': [{'ConfigurationStatus': {'Detail': [{'Group': 6, 'SubGroup': 0, 'Summary': 0}, {'Group': 8, 'SubGroup': 1, 'Summary': 0}, {'Group': 8, 'SubGroup': 2, 'Summary': 0}, {'Group': 15, 'SubGroup': 0, 'Summary': 0}, {'Group': 15, 'SubGroup': 1, 'Summary': 0}, {'Group': 34, 'SubGroup': 1, 'Summary': 0}, {'Group': 34, 'SubGroup': 2, 'Summary': 0}], 'Summary': 869593167}, 'DeviceLimitationsBitmap': 0, 'FunctionTypeLimits': [], 'FunctionTypes': ['FibreChannel'], 'MostRecentConfigurationChangeSource': 'None', 'RDMASupport': ['None'], 'UnderlyingDataSource': 'DCi'}], 'FactoryDefaultsActuationBehavior': 'AtNextReboot', 'PCAVersion': 'P9D94-63001', 'RedfishConfiguration': 'Disabled'}}, 'PartNumber': 'P9D94A', 'Ports': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/Ports'}, 'SKU': 'SN1100Q', 'SerialNumber': 'MY5332214N', 'Settings': {'href': '/redfish/v1/Chassis/1/NetworkAdapters/DC081000/Settings'}} Debug - HBA卡信息: {'@odata.context': '/redfish/v1/$metadata#NetworkAdapter.NetworkAdapter', '@odata.etag': 'W/"E24DDEBE"', '@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000', '@odata.type': '#NetworkAdapter.v1_5_0.NetworkAdapter', 'Id': 'DC082000', '@Redfish.Settings': {'SettingsObject': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/Settings'}}, 'Actions': {'#NetworkAdapter.ResetSettingsToDefault': {'target': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/Actions/NetworkAdapter.ResetSettingsToDefault', 'title': 'Reset network adapter configuration to factory default values.'}}, 'Controllers': [{'ControllerCapabilities': {'DataCenterBridging': {'Capable': False}, 'NPIV': {'MaxDeviceLogins': 256, 'MaxPortLogins': 128}, 'NetworkDeviceFunctionCount': 2, 'NetworkPortCount': 2}, 'FirmwarePackageVersion': '2.02.05', 'Links': {'NetworkDeviceFunctions': [{'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/NetworkDeviceFunctions/1'}, {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/NetworkDeviceFunctions/2'}], 'NetworkPorts': [{'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/NetworkPorts/1'}, {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/NetworkPorts/2'}], 'Ports': [{'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/Ports/1'}, {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/Ports/2'}]}, 'Location': {'PartLocation': {'LocationOrdinalValue': 3, 'LocationType': 'Slot', 'ServiceLabel': 'PCI-E Slot 3'}}}], 'Description': 'Device capabilities and characteristics with active configuration status', 'Manufacturer': 'Hewlett Packard Enterprise', 'Model': 'HPE SN1100Q 16Gb 2p FC HBA', 'Name': 'HPE SN1100Q 16Gb 2P FC HBA', 'NetworkDeviceFunctions': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/NetworkDeviceFunctions'}, 'NetworkPorts': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/NetworkPorts'}, 'Oem': {'Hpe': {'@odata.context': '/redfish/v1/$metadata#HpeNetworkAdapter.HpeNetworkAdapter', '@odata.type': '#HpeNetworkAdapter.v1_3_0.HpeNetworkAdapter', 'Actions': {'#HpeNetworkAdapter.FlushConfigurationToNVM': {'target': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/Actions/Oem/Hpe/HpeNetworkAdapter.FlushConfigurationToNVM', 'title': 'Force a save of current network adapter configuration to non-volatile storage.'}, '#NetworkAdapter.FlushConfigurationToNVM': {'target': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/Actions/Oem/Hpe/NetworkAdapter.FlushConfigurationToNVM', 'title': 'NOTE: Deprecated, will be removed in a future release. Replaced by HpeNetworkAdapter.FlushConfigurationToNVM. Force a save of current network adapter configuration to non-volatile storage.'}}, 'CLPVersion': '', 'Controllers': [{'ConfigurationStatus': {'Detail': [{'Group': 6, 'SubGroup': 0, 'Summary': 0}, {'Group': 8, 'SubGroup': 1, 'Summary': 0}, {'Group': 8, 'SubGroup': 2, 'Summary': 0}, {'Group': 15, 'SubGroup': 0, 'Summary': 0}, {'Group': 15, 'SubGroup': 1, 'Summary': 0}, {'Group': 34, 'SubGroup': 1, 'Summary': 0}, {'Group': 34, 'SubGroup': 2, 'Summary': 0}], 'Summary': 869593167}, 'DeviceLimitationsBitmap': 0, 'FunctionTypeLimits': [], 'FunctionTypes': ['FibreChannel'], 'MostRecentConfigurationChangeSource': 'None', 'RDMASupport': ['None'], 'UnderlyingDataSource': 'DCi'}], 'FactoryDefaultsActuationBehavior': 'AtNextReboot', 'PCAVersion': 'P9D94-63001', 'RedfishConfiguration': 'Disabled'}}, 'PartNumber': 'P9D94A', 'Ports': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/Ports'}, 'SKU': 'SN1100Q', 'SerialNumber': 'MY5332214L', 'Settings': {'href': '/redfish/v1/Chassis/1/NetworkAdapters/DC082000/Settings'}} Debug - HBA卡信息: {'@odata.context': '/redfish/v1/$metadata#NetworkAdapter.NetworkAdapter', '@odata.type': '#NetworkAdapter.v1_9_0.NetworkAdapter', '@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000', '@odata.etag': 'W/"2AE16ECF"', '@Redfish.Settings': {'@odata.type': '#Settings.v1_3_3.Settings', 'SettingsObject': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000/Settings'}, 'SupportedApplyTimes': ['OnReset']}, 'Id': 'DE07B000', 'Name': 'Network Adapter', 'Manufacturer': 'Broadcom', 'Model': 'BCM57412', 'SKU': '10Gb 2-port SFP+ BCM57412 OCP3 Adapter', 'SerialNumber': 'VNM3400SXF', 'PartNumber': 'P26258-001', 'Status': {'Health': 'OK', 'State': 'Enabled'}, 'Ports': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000/Ports'}, 'NetworkDeviceFunctions': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000/NetworkDeviceFunctions'}, 'Metrics': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000/Metrics'}, 'Controllers': [{'FirmwarePackageVersion': '229.1.123.0', 'Links': {'PCIeDevices': [{'@odata.id': '/redfish/v1/Chassis/1/PCIeDevices/DE07B000'}]}, 'ControllerCapabilities': {'NetworkPortCount': 2, 'NetworkDeviceFunctionCount': 2, 'DataCenterBridging': {'Capable': True}, 'NPAR': {'NparCapable': True, 'NparEnabled': False}, 'VirtualizationOffload': {'SRIOV': {'SRIOVVEPACapable': True}, 'VirtualFunction': {'DeviceMaxCount': 128, 'MinAssignmentGroupSize': 8, 'NetworkPortMaxCount': 128}}}, 'PCIeInterface': {'LanesInUse': 8, 'MaxLanes': 8, 'MaxPCIeType': 'Gen3', 'PCIeType': 'Gen3'}}], 'LLDPEnabled': True, 'Actions': {'#NetworkAdapter.ResetSettingsToDefault': {'target': '/redfish/v1/Chassis/1/NetworkAdapters/DE07B000/Actions/NetworkAdapter.ResetSettingsToDefault', '@Redfish.OperationApplyTimeSupport': {'@odata.type': '#Settings.v1_3_3.OperationApplyTimeSupport', 'SupportedValues': ['OnReset']}}}} Debug - HBA卡信息: {'@odata.context': '/redfish/v1/$metadata#NetworkAdapter.NetworkAdapter', '@odata.type': '#NetworkAdapter.v1_9_0.NetworkAdapter', '@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000', '@odata.etag': 'W/"20FD634C"', '@Redfish.Settings': {'@odata.type': '#Settings.v1_3_3.Settings', 'SettingsObject': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000/Settings'}, 'SupportedApplyTimes': ['OnReset']}, 'Id': 'DE080000', 'Name': 'Network Adapter', 'Manufacturer': 'Broadcom', 'Model': 'BCM57412', 'SKU': '10Gb 2-port SFP+ BCM57412 Adapter', 'SerialNumber': 'VNM40109SX', 'PartNumber': 'P26261-001', 'Status': {'Health': 'OK', 'State': 'Enabled'}, 'Ports': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000/Ports'}, 'NetworkDeviceFunctions': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000/NetworkDeviceFunctions'}, 'Metrics': {'@odata.id': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000/Metrics'}, 'Controllers': [{'FirmwarePackageVersion': '229.1.123.0', 'Links': {'PCIeDevices': [{'@odata.id': '/redfish/v1/Chassis/1/PCIeDevices/DE080000'}]}, 'ControllerCapabilities': {'NetworkPortCount': 2, 'NetworkDeviceFunctionCount': 2, 'DataCenterBridging': {'Capable': True}, 'NPAR': {'NparCapable': True, 'NparEnabled': False}, 'VirtualizationOffload': {'SRIOV': {'SRIOVVEPACapable': True}, 'VirtualFunction': {'DeviceMaxCount': 128, 'MinAssignmentGroupSize': 8, 'NetworkPortMaxCount': 128}}}, 'PCIeInterface': {'LanesInUse': 8, 'MaxLanes': 8, 'MaxPCIeType': 'Gen3', 'PCIeType': 'Gen3'}}], 'LLDPEnabled': True, 'Actions': {'#NetworkAdapter.ResetSettingsToDefault': {'target': '/redfish/v1/Chassis/1/NetworkAdapters/DE080000/Actions/NetworkAdapter.ResetSettingsToDefault', '@Redfish.OperationApplyTimeSupport': {'@odata.type': '#Settings.v1_3_3.OperationApplyTimeSupport', 'SupportedValues': ['OnReset']}}}}
09-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值