vcenter(10):Python3 SDK 查询返回数据JSON化并存入Mongodb,redis等数据库--host

目录

 

detail_host

detail_network_port

detail_host_config

detail_vswitch

detail_host_pnic

detail_host_vnic

detail_host_hardware

 


detail_host

#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author:hanxiaoshun
# datetime:2020/6/26 10:10
# software: PyCharm
from xxxxx.vmware_api.detail_network_port import detail_network_port
from xxxxxxx.vmware_api.detail_host_config import detail_host_config
from xxxxxx.vmware_api.detail_host_hardware import detail_host_hardware

def detail_host(host=None):
    host_tmp = {}
    host_tmp['_moId'] = host._moId
    host_tmp['name'] = host.name
    host_tmp['alarmActionsEnabled'] = host.alarmActionsEnabled
    host_tmp['answerFileValidationResult'] = host.answerFileValidationResult
    host_tmp['answerFileValidationState'] = host.answerFileValidationState
    host_tmp['capability'] = {}
    host_tmp['capability']['accel3dSupported'] = host.capability.accel3dSupported
    host_tmp['capability'][
        'backgroundSnapshotsSupported'] = host.capability.backgroundSnapshotsSupported
    host_tmp['capability'][
        'cloneFromSnapshotSupported'] = host.capability.cloneFromSnapshotSupported
    host_tmp['capability']['cpuHwMmuSupported'] = host.capability.cpuHwMmuSupported
    host_tmp['capability'][
        'cpuMemoryResourceConfigurationSupported'] = host.capability.cpuMemoryResourceConfigurationSupported
    host_tmp['capability']['cryptoSupported'] = host.capability.cryptoSupported
    host_tmp['capability'][
        'datastorePrincipalSupported'] = host.capability.datastorePrincipalSupported
    host_tmp['capability'][
        'deltaDiskBackingsSupported'] = host.capability.deltaDiskBackingsSupported
    host_tmp['capability'][
        'eightPlusHostVmfsSharedAccessSupported'] = host.capability.eightPlusHostVmfsSharedAccessSupported
    host_tmp['capability'][
        'encryptedVMotionSupported'] = host.capability.encryptedVMotionSupported
    host_tmp['capability'][
        'encryptionCBRCSupported'] = host.capability.encryptionCBRCSupported
    host_tmp['capability'][
        'encryptionChangeOnAddRemoveSupported'] = host.capability.encryptionChangeOnAddRemoveSupported
    host_tmp['capability'][
        'encryptionFaultToleranceSupported'] = host.capability.encryptionFaultToleranceSupported
    host_tmp['capability'][
        'encryptionHBRSupported'] = host.capability.encryptionHBRSupported
    host_tmp['capability'][
        'encryptionHotOperationSupported'] = host.capability.encryptionHotOperationSupported
    host_tmp['capability'][
        'encryptionMemorySaveSupported'] = host.capability.encryptionMemorySaveSupported
    host_tmp['capability'][
        'encryptionRDMSupported'] = host.capability.encryptionRDMSupported
    host_tmp['capability'][
        'encryptionVFlashSupported'] = host.capability.encryptionVFlashSupported
    host_tmp['capability'][
        'encryptionWithSnapshotsSupported'] = host.capability.encryptionWithSnapshotsSupported
    host_tmp['capability'][
        'featureCapabilitiesSupported'] = host.capability.featureCapabilitiesSupported
    host_tmp['capability'][
        'firewallIpRulesSupported'] = host.capability.firewallIpRulesSupported
    ftCompatibilityIssues_list = []
    for ftCompatibilityIssues in host.capability.ftCompatibilityIssues:
        ftCompatibilityIssues_list.append(ftCompatibilityIssues)
    host_tmp['capability']['ftCompatibilityIssues'] = ftCompatibilityIssues_list
    host_tmp['capability']['ftEfiSupported'] = host.capability.ftEfiSupported
    host_tmp['capability']['ftVmcpSupported'] = host.capability.ftVmcpSupported
    host_tmp['capability']['gatewayOnNicSupported'] = host.capability.gatewayOnNicSupported
    host_tmp['capability'][
        'hbrNicSelectionSupported'] = host.capability.hbrNicSelectionSupported
    host_tmp['capability']['highGuestMemSupported'] = host.capability.highGuestMemSupported
    host_tmp['capability']['hostAccessManagerSupported'] = host.capability.hostAccessManagerSupported
    host_tmp['capability'][
        'interVMCommunicationThroughVMCISupported'] = host.capability.interVMCommunicationThroughVMCISupported
    host_tmp['capability']['ipmiSupported'] = host.capability.ipmiSupported
    host_tmp['capability']['latencySensitivitySupported'] = host.capability.latencySensitivitySupported
    host_tmp['capability']['localSwapDatastoreSupported'] = host.capability.localSwapDatastoreSupported
    host_tmp['capability']['loginBySSLThumbprintSupported'] = host.capability.loginBySSLThumbprintSupported
    host_tmp['capability']['maintenanceModeSupported'] = host.capability.maintenanceModeSupported
    host_tmp['capability']['markAsLocalSupported'] = host.capability.markAsLocalSupported
    host_tmp['capability']['markAsSsdSupported'] = host.capability.markAsSsdSupported
    host_tmp['capability']['maxHostSupportedVcpus'] = host.capability.maxHostSupportedVcpus
    host_tmp['capability']['maxHostRunningVms'] = host.capability.maxHostRunningVms
    host_tmp['capability']['maxMemMBPerFtVm'] = host.capability.maxMemMBPerFtVm
    host_tmp['capability']['maxNumDisksSVMotion'] = host.capability.maxNumDisksSVMotion
    host_tmp['capability']['maxRegisteredVMs'] = host.capability.maxRegisteredVMs
    host_tmp['capability']['maxRunningVMs'] = host.capability.maxRunningVMs
    host_tmp['capability']['maxSupportedVMs'] = host.capability.maxSupportedVMs
    host_tmp['capability']['maxVcpusPerFtVm'] = host.capability.maxVcpusPerFtVm
    host_tmp['capability']['maxSupportedVcpus'] = host.capability.maxSupportedVcpus
    host_tmp['capability']['messageBusProxySupported'] = host.capability.messageBusProxySupported
    host_tmp['capability'][
        'multipleNetworkStackInstanceSupported'] = host.capability.multipleNetworkStackInstanceSupported
    host_tmp['capability']['nestedHVSupported'] = host.capability.nestedHVSupported
    host_tmp['capability'][
        'multipleNetworkStackInstanceSupported'] = host.capability.multipleNetworkStackInstanceSupported
    host_tmp['capability']['nfs41Krb5iSupported'] = host.capability.nfs41Krb5iSupported
    host_tmp['capability']['nfs41Supported'] = host.capability.nfs41Supported
    host_tmp['capability']['nfsSupported'] = host.capability.nfsSupported
    host_tmp['capability']['nicTeamingSupported'] = host.capability.nicTeamingSupported
    host_tmp['capability']['pMemSnapshotSupported'] = host.capability.pMemSnapshotSupported
    host_tmp['capability']['oneKVolumeAPIsSupported'] = host.capability.oneKVolumeAPIsSupported
    host_tmp['capability']['pMemSnapshotSupported'] = host.capability.pMemSnapshotSupported
    host_tmp['capability']['oneKVolumeAPIsSupported'] = host.capability.oneKVolumeAPIsSupported
    host_tmp['capability']['pMemSupported'] = host.capability.pMemSupported
    host_tmp['capability'][
        'perVMNetworkTrafficShapingSupported'] = host.capability.perVMNetworkTrafficShapingSupported
    host_tmp['capability']['perVmSwapFiles'] = host.capability.perVmSwapFiles
    host_tmp['capability'][
        'preAssignedPCIUnitNumbersSupported'] = host.capability.preAssignedPCIUnitNumbersSupported
    host_tmp['capability'][
        'provisioningNicSelectionSupported'] = host.capability.provisioningNicSelectionSupported
    host_tmp['capability']['rebootSupported'] = host.capability.rebootSupported
    host_tmp['capability']['recordReplaySupported'] = host.capability.recordReplaySupported
    host_tmp['capability'][
        'recursiveResourcePoolsSupported'] = host.capability.recursiveResourcePoolsSupported
    host_tmp['capability']['reliableMemoryAware'] = host.capability.reliableMemoryAware
    replayCompatibilityIssues_list = []
    for replayCompatibilityIssues in host.capability.replayCompatibilityIssues:
        replayCompatibilityIssues_list.append(replayCompatibilityIssues)
    host_tmp['capability']['replayCompatibilityIssues'] = replayCompatibilityIssues_list
    host_tmp['capability']['replayUnsupportedReason'] = host.capability.replayUnsupportedReason
    host_tmp['capability'][
        'restrictedSnapshotRelocateSupported'] = host.capability.restrictedSnapshotRelocateSupported
    host_tmp['capability']['sanSupported'] = host.capability.sanSupported
    host_tmp['capability'][
        'scaledScreenshotSupported'] = host.capability.scaledScreenshotSupported
    host_tmp['capability'][
        'scheduledHardwareUpgradeSupported'] = host.capability.scheduledHardwareUpgradeSupported
    host_tmp['capability']['screenshotSupported'] = host.capability.screenshotSupported
    host_tmp['capability'][
        'servicePackageInfoSupported'] = host.capability.servicePackageInfoSupported
    host_tmp['capability']['shutdownSupported'] = host.capability.shutdownSupported
    host_tmp['capability'][
        'smartCardAuthenticationSupported'] = host.capability.smartCardAuthenticationSupported
    smpFtCompatibilityIssues_list = []
    for smpFtCompatibilityIssues in host.capability.smpFtCompatibilityIssues:
        smpFtCompatibilityIssues_list.append(smpFtCompatibilityIssues)
    host_tmp['capability'][
        'smpFtCompatibilityIssues'] = smpFtCompatibilityIssues_list
    host_tmp['capability']['smpFtSupported'] = host.capability.smpFtSupported
    host_tmp['capability'][
        'snapshotRelayoutSupported'] = host.capability.snapshotRelayoutSupported
    host_tmp['capability']['standbySupported'] = host.capability.standbySupported
    host_tmp['capability']['storageIORMSupported'] = host.capability.storageIORMSupported
    host_tmp['capability'][
        'storagePolicySupported'] = host.capability.storagePolicySupported
    host_tmp['capability'][
        'storageVMotionSupported'] = host.capability.storageVMotionSupported
    host_tmp['capability']['supportedCpuFeature'] = host.capability.supportedCpuFeature
    supportedVmfsMajorVersion_list = []
    for supportedVmfsMajorVersion in host.capability.supportedVmfsMajorVersion:
        supportedVmfsMajorVersion_list.append(supportedVmfsMajorVersion)
    host_tmp['capability'][
        'supportedVmfsMajorVersion'] = supportedVmfsMajorVersion_list
    host_tmp['capability'][
        'suspendedRelocateSupported'] = host.capability.suspendedRelocateSupported
    host_tmp['capability']['tpmSupported'] = host.capability.tpmSupported
    host_tmp['capability']['tpmVersion'] = host.capability.tpmVersion
    host_tmp['capability'][
        'storagePolicySupported'] = host.capability.storagePolicySupported
    host_tmp['capability']['supportedCpuFeature'] = host.capability.supportedCpuFeature
    host_tmp['capability'][
        'suspendedRelocateSupported'] = host.capability.suspendedRelocateSupported
    host_tmp['capability']['tpmSupported'] = host.capability.tpmSupported
    host_tmp['capability']['upitSupported'] = host.capability.upitSupported
    host_tmp['capability']['vFlashSupported'] = host.capability.vFlashSupported
    host_tmp['capability']['vPMCSupported'] = host.capability.vPMCSupported
    host_tmp['capability']['vStorageCapable'] = host.capability.vStorageCapable
    host_tmp['capability'][
        'virtualExecUsageIgnored'] = host.capability.virtualExecUsageIgnored
    host_tmp['capability'][
        'virtualExecUsageSupported'] = host.capability.virtualExecUsageSupported
    host_tmp['capability'][
        'virtualMmuUsageIgnored'] = host.capability.virtualMmuUsageIgnored
    host_tmp['capability'][
        'virtualVolumeDatastoreSupported'] = host.capability.virtualVolumeDatastoreSupported
    host_tmp['capability']['vlanTaggingSupported'] = host.capability.vlanTaggingSupported
    host_tmp['capability']['vmCreateDateSupported'] = host.capability.vmCreateDateSupported
    vmDirectPathGen2UnsupportedReason_list = []
    for vmDirectPathGen2UnsupportedReason in host.capability.vmDirectPathGen2UnsupportedReason:
        vmDirectPathGen2UnsupportedReason_list.append(vmDirectPathGen2UnsupportedReason)
    host_tmp['capability'][
        'vmDirectPathGen2UnsupportedReason'] = vmDirectPathGen2UnsupportedReason_list
    host_tmp['capability'][
        'vmDirectPathGen2UnsupportedReasonExtended'] = host.capability.vmDirectPathGen2UnsupportedReasonExtended
    host_tmp['capability']['vmfs3EOLSupported'] = host.capability.vmfs3EOLSupported
    host_tmp['capability'][
        'vmotionAcrossNetworkSupported'] = host.capability.vmotionAcrossNetworkSupported
    host_tmp['capability']['vmotionSupported'] = host.capability.vmotionSupported
    host_tmp['capability'][
        'vmotionWithStorageVMotionSupported'] = host.capability.vmotionWithStorageVMotionSupported
    host_tmp['capability'][
        'vrNfcNicSelectionSupported'] = host.capability.vrNfcNicSelectionSupported
    host_tmp['capability']['vsanSupported'] = host.capability.vsanSupported
    # host.config的处理开始
    host_tmp.update(detail_host_config(host.config))
    # host.config的处理结束
    configIssue_list = []
    for configIssue in host.configIssue:
        configIssue_tmp = {}
        configIssue_tmp['chainId'] = configIssue.chainId
        configIssue_tmp['changeTag'] = configIssue.changeTag
        configIssue_tmp['computeResource'] = {}
        configIssue_tmp['computeResource']['name'] = configIssue.computeResource.name
        configIssue_tmp['createdTime'] = configIssue.createdTime
        if configIssue.createdTime is not None:
            configIssue_tmp['createdTime'] = configIssue.createdTime.strftime('%Y-%m-%d %H:%M:%S')
        configIssue_tmp['datacenter'] = {}
        configIssue_tmp['datacenter']['name'] = configIssue.datacenter.name
        configIssue_tmp['ds'] = configIssue.ds
        configIssue_tmp['dvs'] = configIssue.dvs
        configIssue_tmp['fullFormattedMessage'] = configIssue.fullFormattedMessage
        configIssue_tmp['host'] = {}
        configIssue_tmp['host']['name'] = configIssue.host.name
        configIssue_tmp['key'] = configIssue.key
        configIssue_tmp['net'] = configIssue.net
        configIssue_tmp['vm'] = configIssue.vm
        configIssue_list.append(configIssue_tmp)
    host_tmp['configIssue'] = configIssue_list
    host_tmp['configManager'] = {}
    host_tmp['configStatus'] = host.configStatus
    host_tmp['datastore'] = {}
    host_tmp['datastoreBrowser'] = {}
    host_tmp['declaredAlarmState'] = {}
    host_tmp['disabledMethod'] = {}
    host_tmp['effectiveRole'] = {}
    # host.hardware start
    host_tmp.update(detail_host_hardware(host.hardware))
    # host.hardware wnd
    host_tmp['licensableResource'] = {}
    resource_list = []
    for resource in host.licensableResource.resource:
        resource_tmp = {}
        resource_tmp['key'] = resource.key
        resource_tmp['value'] = resource.value
        resource_list.append(resource_tmp)
    host_tmp['licensableResource']['resource'] = resource_list
    host_tmp['name'] = host.name
    network_list = []
    for host_network in host.network:
        network_tmp = detail_network_port(host_network)
        if len(network_tmp) > 0:
            network_list.append(network_tmp)
    host_tmp['network'] = network_list
    
    return host_tmp



# -*- coding: utf-8 -*-
from pyvim import connect
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
import atexit


vcenter_address = 'vc22.xxxxxxxxx.com'
service_instance = connect.SmartConnect(host=vcenter_address,
                                        user='administrator@xxx.xxxxxx',
                                        pwd='P@xxxxx',
                                        port=443)

content = service_instance.RetrieveContent()
vcontent = service_instance.content

from cloudenforce.vmware_api.vcenter_mongo import insert_patch

if __name__ == '__main__':
    data_list = []
    for datacenter in vcontent.rootFolder.childEntity:
        for cluster in datacenter.hostFolder.childEntity:
            for host in cluster.host:
                data_list.append(detail_host(host=host))
    print(data_list)
    insert_patch(data_list, 'vcenter_host')

detail_network_port

#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:hanxiaoshun
# datetime:2020/6/24 21:13
# software: PyCharm
from xxxxxx.vmware_api.detail_dvs import detail_dvs
import pyVmomi

def detail_network_port(network=None):
    network_port_tmp = {}
    network_port_tmp['alarmActionsEnabled'] = network.alarmActionsEnabled
    network_port_tmp['availableField'] = []
    if hasattr(network, 'config'):
        # 判断是个dvs的分布式端口组
        network_port_tmp['config'] = {}
        network_port_tmp['config']['autoExpand'] = network.config.autoExpand
        network_port_tmp['config']['configVersion'] = network.config.configVersion
        network_port_tmp['config']['defaultPortConfig'] = {}
        network_port_tmp['config']['defaultPortConfig']['blocked'] = {}
        network_port_tmp['config']['defaultPortConfig']['blocked'][
            'inherited'] = network.config.defaultPortConfig.blocked.inherited
        network_port_tmp['config']['defaultPortConfig']['blocked']['value'] = network.config.defaultPortConfig.blocked.value
        network_port_tmp['config']['defaultPortConfig']['filterPolicy'] = {}

        filterConfig_list = []
        for filterConfig in network.config.defaultPortConfig.filterPolicy.filterConfig:
            filterConfig_tmp = {}
            filterConfig_tmp['inherited'] = filterConfig.inherited
            filterConfig_tmp['key'] = filterConfig.key
            filterConfig_tmp['agentName'] = filterConfig.agentName
            filterConfig_tmp['slotNumber'] = filterConfig.slotNumber
            filterConfig_tmp['parameters'] = filterConfig.parameters
            filterConfig_tmp['onFailure'] = filterConfig.onFailure
            filterConfig_tmp['trafficRuleset'] = {}
            filterConfig_tmp['trafficRuleset']['key'] = filterConfig.trafficRuleset.key
            filterConfig_tmp['trafficRuleset']['enabled'] = filterConfig.trafficRuleset.enabled
            filterConfig_tmp['trafficRuleset']['precedence'] = filterConfig.trafficRuleset.precedence
            filterConfig_tmp['trafficRuleset']['rules'] = []
            filterConfig_list.append(filterConfig_tmp)
        network_port_tmp['config']['defaultPortConfig']['filterPolicy'][
            'filterConfig'] = filterConfig_list
        network_port_tmp['config']['defaultPortConfig']['filterPolicy'][
            'inherited'] = network.config.defaultPortConfig.filterPolicy.inherited
        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy'] = {}
        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['averageBandwidth'] = {}
        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['averageBandwidth'][
            'inherited'] = network.config.defaultPortConfig.inShapingPolicy.averageBandwidth.inherited
        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['averageBandwidth'][
            'value'] = network.config.defaultPortConfig.inShapingPolicy.averageBandwidth.value
        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['burstSize'] = {}
        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['burstSize'][
            'inherited'] = network.config.defaultPortConfig.inShapingPolicy.burstSize.inherited
        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['burstSize'][
            'value'] = network.config.defaultPortConfig.inShapingPolicy.burstSize.value

        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['enabled'] = {}
        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['enabled'][
            'inherited'] = network.config.defaultPortConfig.inShapingPolicy.enabled.inherited
        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['enabled'][
            'value'] = network.config.defaultPortConfig.inShapingPolicy.enabled.value

        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy'][
            'inherited'] = network.config.defaultPortConfig.inShapingPolicy.inherited

        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['peakBandwidth'] = {}
        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['peakBandwidth'][
            'inherited'] = network.config.defaultPortConfig.inShapingPolicy.peakBandwidth.inherited
        network_port_tmp['config']['defaultPortConfig']['inShapingPolicy']['peakBandwidth'][
            'value'] = network.config.defaultPortConfig.inShapingPolicy.peakBandwidth.value
        network_port_tmp['config']['defaultPortConfig']['ipfixEnabled'] = {}
        network_port_tmp['config']['defaultPortConfig']['ipfixEnabled'][
            'inherited'] = network.config.defaultPortConfig.ipfixEnabled.inherited
        network_port_tmp['config']['defaultPortConfig']['ipfixEnabled'][
            'value'] = network.config.defaultPortConfig.ipfixEnabled.value
        network_port_tmp['config']['defaultPortConfig']['lacpPolicy'] = {}
        network_port_tmp['config']['defaultPortConfig']['lacpPolicy']['enable'] = {}
        network_port_tmp['config']['defaultPortConfig']['lacpPolicy']['enable'][
            'inherited'] = network.config.defaultPortConfig.lacpPolicy.enable.inherited
        network_port_tmp['config']['defaultPortConfig']['lacpPolicy']['enable'][
            'value'] = network.config.defaultPortConfig.lacpPolicy.enable.value
        network_port_tmp['config']['defaultPortConfig']['lacpPolicy'][
            'inherited'] = network.config.defaultPortConfig.lacpPolicy.inherited
        network_port_tmp['config']['defaultPortConfig']['lacpPolicy']['mode'] = {}
        network_port_tmp['config']['defaultPortConfig']['lacpPolicy']['mode'][
            'inherited'] = network.config.defaultPortConfig.lacpPolicy.mode.inherited
        network_port_tmp['config']['defaultPortConfig']['lacpPolicy']['mode'][
            'value'] = network.config.defaultPortConfig.lacpPolicy.mode.value
        network_port_tmp['config']['defaultPortConfig']['macManagementPolicy'] = {}
        network_port_tmp['config']['defaultPortConfig']['macManagementPolicy'][
            'allowPromiscuous'] = network.config.defaultPortConfig.macManagementPolicy.allowPromiscuous
        network_port_tmp['config']['defaultPortConfig']['macManagementPolicy'][
            'forgedTransmits'] = network.config.defaultPortConfig.macManagementPolicy.forgedTransmits
        network_port_tmp['config']['defaultPortConfig']['macManagementPolicy'][
            'inherited'] = network.config.defaultPortConfig.macManagementPolicy.inherited
        network_port_tmp['config']['defaultPortConfig']['macManagementPolicy'][
            'macChanges'] = network.config.defaultPortConfig.macManagementPolicy.macChanges
        network_port_tmp['config']['defaultPortConfig']['macManagementPolicy']['macLearningPolicy'] = {}
        network_port_tmp['config']['defaultPortConfig']['macManagementPolicy']['macLearningPolicy'][
            'allowUnicastFlooding'] = network.config.defaultPortConfig.macManagementPolicy.macLearningPolicy.allowUnicastFlooding
        network_port_tmp['config']['defaultPortConfig']['macManagementPolicy']['macLearningPolicy'][
            'enabled'] = network.config.defaultPortConfig.macManagementPolicy.macLearningPolicy.enabled
        network_port_tmp['config']['defaultPortConfig']['macManagementPolicy']['macLearningPolicy'][
            'inherited'] = network.config.defaultPortConfig.macManagementPolicy.macLearningPolicy.inherited
        network_port_tmp['config']['defaultPortConfig']['macManagementPolicy']['macLearningPolicy'][
            'limit'] = network.config.defaultPortConfig.macManagementPolicy.macLearningPolicy.limit
        network_port_tmp['config']['defaultPortConfig']['macManagementPolicy']['macLearningPolicy'][
            'limitPolicy'] = network.config.defaultPortConfig.macManagementPolicy.macLearningPolicy.limitPolicy
        network_port_tmp['config']['defaultPortConfig']['networkResourcePoolKey'] = {}
        network_port_tmp['config']['defaultPortConfig']['networkResourcePoolKey'][
            'inherited'] = network.config.defaultPortConfig.networkResourcePoolKey.inherited
        network_port_tmp['config']['defaultPortConfig']['networkResourcePoolKey'][
            'value'] = network.config.defaultPortConfig.networkResourcePoolKey.value
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy'] = {}
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['averageBandwidth'] = {}
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['averageBandwidth'][
            'inherited'] = network.config.defaultPortConfig.outShapingPolicy.averageBandwidth.inherited
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['averageBandwidth'][
            'value'] = network.config.defaultPortConfig.outShapingPolicy.averageBandwidth.value
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['burstSize'] = {}
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['burstSize'][
            'inherited'] = network.config.defaultPortConfig.outShapingPolicy.burstSize.inherited
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['burstSize'][
            'value'] = network.config.defaultPortConfig.outShapingPolicy.burstSize.value
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['enabled'] = {}
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['enabled'][
            'inherited'] = network.config.defaultPortConfig.outShapingPolicy.enabled.inherited
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['enabled'][
            'value'] = network.config.defaultPortConfig.outShapingPolicy.enabled.value

        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy'][
            'inherited'] = network.config.defaultPortConfig.outShapingPolicy.inherited
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['peakBandwidth'] = {}
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['peakBandwidth'][
            'inherited'] = network.config.defaultPortConfig.outShapingPolicy.enabled.inherited
        network_port_tmp['config']['defaultPortConfig']['outShapingPolicy']['peakBandwidth'][
            'value'] = network.config.defaultPortConfig.outShapingPolicy.enabled.value

        network_port_tmp['config']['defaultPortConfig']['qosTag'] = {}
        network_port_tmp['config']['defaultPortConfig']['qosTag'][
            'inherited'] = network.config.defaultPortConfig.qosTag.inherited
        network_port_tmp['config']['defaultPortConfig']['qosTag']['value'] = network.config.defaultPortConfig.qosTag.value
        network_port_tmp['config']['defaultPortConfig']['securityPolicy'] = {}
        network_port_tmp['config']['defaultPortConfig']['securityPolicy']['allowPromiscuous'] = {}
        network_port_tmp['config']['defaultPortConfig']['securityPolicy']['allowPromiscuous'][
            'inherited'] = network.config.defaultPortConfig.securityPolicy.allowPromiscuous.inherited
        network_port_tmp['config']['defaultPortConfig']['securityPolicy']['allowPromiscuous'][
            'value'] = network.config.defaultPortConfig.securityPolicy.allowPromiscuous.value

        network_port_tmp['config']['defaultPortConfig']['securityPolicy']['forgedTransmits'] = {}
        network_port_tmp['config']['defaultPortConfig']['securityPolicy']['forgedTransmits'][
            'inherited'] = network.config.defaultPortConfig.securityPolicy.forgedTransmits.inherited
        network_port_tmp['config']['defaultPortConfig']['securityPolicy']['forgedTransmits'][
            'value'] = network.config.defaultPortConfig.securityPolicy.forgedTransmits.value
        network_port_tmp['config']['defaultPortConfig']['securityPolicy'][
            'inherited'] = network.config.defaultPortConfig.securityPolicy.inherited

        network_port_tmp['config']['defaultPortConfig']['securityPolicy']['macChanges'] = {}
        network_port_tmp['config']['defaultPortConfig']['securityPolicy']['macChanges'][
            'inherited'] = network.config.defaultPortConfig.securityPolicy.macChanges.inherited
        network_port_tmp['config']['defaultPortConfig']['securityPolicy']['macChanges'][
            'value'] = network.config.defaultPortConfig.securityPolicy.macChanges.value

        network_port_tmp['config']['defaultPortConfig']['txUplink'] = {}
        network_port_tmp['config']['defaultPortConfig']['txUplink'][
            'inherited'] = network.config.defaultPortConfig.txUplink.inherited
        network_port_tmp['config']['defaultPortConfig']['txUplink'][
            'value'] = network.config.defaultPortConfig.txUplink.value

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['checkBeacon'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['checkBeacon'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.checkBeacon.inherited

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['checkBeacon'][
            'value'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.checkBeacon.value

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria'][
            'checkDuplex'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['checkDuplex'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.checkDuplex.inherited
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['checkDuplex'][
            'value'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.checkDuplex.value

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria'][
            'checkErrorPercent'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['checkErrorPercent'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.checkErrorPercent.inherited
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['checkErrorPercent'][
            'value'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.checkErrorPercent.value

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria'][
            'checkSpeed'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['checkSpeed'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.checkSpeed.inherited
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['checkSpeed'][
            'value'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.checkSpeed.value
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria'][
            'fullDuplex'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['fullDuplex'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.fullDuplex.inherited
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['fullDuplex'][
            'value'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.fullDuplex.value

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.inherited

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria'][
            'percentage'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['percentage'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.percentage.inherited
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['percentage'][
            'value'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.percentage.value

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria'][
            'speed'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['speed'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.speed.inherited
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['failureCriteria']['speed'][
            'value'] = network.config.defaultPortConfig.uplinkTeamingPolicy.failureCriteria.speed.value

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['notifySwitches'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['notifySwitches'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.notifySwitches.inherited
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['notifySwitches'][
            'value'] = network.config.defaultPortConfig.uplinkTeamingPolicy.notifySwitches.value

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['policy'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['policy'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.policy.inherited
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['policy'][
            'value'] = network.config.defaultPortConfig.uplinkTeamingPolicy.policy.value

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['reversePolicy'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['reversePolicy'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.reversePolicy.inherited
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['reversePolicy'][
            'value'] = network.config.defaultPortConfig.uplinkTeamingPolicy.reversePolicy.value

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['rollingOrder'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['rollingOrder'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.rollingOrder.inherited
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['rollingOrder'][
            'value'] = network.config.defaultPortConfig.uplinkTeamingPolicy.rollingOrder.value

        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['uplinkPortOrder'] = {}
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['uplinkPortOrder'][
            'inherited'] = network.config.defaultPortConfig.uplinkTeamingPolicy.uplinkPortOrder.inherited
        activeUplinkPort_list = []
        for activeUplinkPort in network.config.defaultPortConfig.uplinkTeamingPolicy.uplinkPortOrder.activeUplinkPort:
            activeUplinkPort_list.append(activeUplinkPort)
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['uplinkPortOrder'][
            'activeUplinkPort'] = activeUplinkPort_list
        standbyUplinkPort_list = []
        for standbyUplinkPort in network.config.defaultPortConfig.uplinkTeamingPolicy.uplinkPortOrder.standbyUplinkPort:
            standbyUplinkPort_list.append(standbyUplinkPort)
        network_port_tmp['config']['defaultPortConfig']['uplinkTeamingPolicy']['uplinkPortOrder'][
            'standbyUplinkPort'] = standbyUplinkPort_list
        network_port_tmp['config']['defaultPortConfig']['vendorSpecificConfig'] = {}
        network_port_tmp['config']['defaultPortConfig']['vendorSpecificConfig'][
            'inherited'] = network.config.defaultPortConfig.vendorSpecificConfig.inherited
        network_port_tmp['config']['defaultPortConfig']['vendorSpecificConfig'][
            'keyValue'] = []

        network_port_tmp['config']['defaultPortConfig']['vlan'] = {}
        network_port_tmp['config']['defaultPortConfig']['vlan'][
            'inherited'] = network.config.defaultPortConfig.vlan.inherited
        network_port_tmp['config']['defaultPortConfig']['vlan'][
            'vlanId'] = ''
        
        if isinstance(network.config.defaultPortConfig.vlan, pyVmomi.vim.dvs.VmwareDistributedVirtualSwitch.PvlanSpec):
            # PvlanSpec_list = []
            # for PvlanSpec in network.config.defaultPortConfig.vlan:
            #     PvlanSpec_tmp = {}
            #     PvlanSpec_tmp['PvlanSpec'] = {}
            #     PvlanSpec_tmp['inherited'] = PvlanSpec.inherited
            #     PvlanSpec_tmp['pvlanId'] = PvlanSpec.pvlanId
            #     PvlanSpec_list.append(PvlanSpec_tmp)
            network_port_tmp['config']['defaultPortConfig']['vlan'][
                'inherited'] = network.config.defaultPortConfig.vlan.inherited
            network_port_tmp['config']['defaultPortConfig']['vlan'][
                'pvlanId'] = network.config.defaultPortConfig.vlan.pvlanId
        else:
            if isinstance(network.config.defaultPortConfig.vlan.vlanId, int):
                network_port_tmp['config']['defaultPortConfig']['vlan'][
                    'vlanId'] = network.config.defaultPortConfig.vlan.vlanId
            elif isinstance(network.config.defaultPortConfig.vlan.vlanId, pyVmomi.vim.NumericRange):
                vlanId_list = []
                for vlanId in network.config.defaultPortConfig.vlan.vlanId:
                    vlanId_tmp = {}
                    vlanId_tmp['start'] = vlanId.start
                    vlanId_tmp['end'] = vlanId.end
                    vlanId_list.append(vlanId_tmp)
                network_port_tmp['config']['defaultPortConfig']['vlan'][
                    'vlanId'] = vlanId_list
        network_port_tmp['config']['defaultPortConfig']['vmDirectPathGen2Allowed'] = {}
        network_port_tmp['config']['defaultPortConfig']['vmDirectPathGen2Allowed'][
            'inherited'] = network.config.defaultPortConfig.vmDirectPathGen2Allowed.inherited
        network_port_tmp['config']['defaultPortConfig']['vmDirectPathGen2Allowed'][
            'value'] = network.config.defaultPortConfig.vmDirectPathGen2Allowed.value
        
        network_port_tmp['config']['description'] = network.config.description
        # dvs start
        network_port_tmp['config']['distributedVirtualSwitch'] = {}
        network_port_tmp['config']['distributedVirtualSwitch']['_moId'] = network.config.distributedVirtualSwitch._moId
        network_port_tmp['config']['distributedVirtualSwitch']['name'] = network.config.distributedVirtualSwitch.name
        #dvs end
        network_port_tmp['config']['key'] = network.config.key
        network_port_tmp['config']['name'] = network.config.name
        network_port_tmp['config']['numPorts'] = network.config.numPorts
        network_port_tmp['config']['policy'] = {}
        network_port_tmp['config']['policy']['blockOverrideAllowed'] = network.config.policy.blockOverrideAllowed
        network_port_tmp['config']['policy']['ipfixOverrideAllowed'] = network.config.policy.ipfixOverrideAllowed
        network_port_tmp['config']['policy']['livePortMovingAllowed'] = network.config.policy.livePortMovingAllowed
        network_port_tmp['config']['policy']['networkResourcePoolOverrideAllowed'] = network.config.policy.networkResourcePoolOverrideAllowed
        network_port_tmp['config']['policy']['portConfigResetAtDisconnect'] = network.config.policy.portConfigResetAtDisconnect
        network_port_tmp['config']['policy']['securityPolicyOverrideAllowed'] = network.config.policy.securityPolicyOverrideAllowed
        network_port_tmp['config']['policy']['shapingOverrideAllowed'] = network.config.policy.shapingOverrideAllowed
        network_port_tmp['config']['policy']['trafficFilterOverrideAllowed'] = network.config.policy.trafficFilterOverrideAllowed
        network_port_tmp['config']['policy']['uplinkTeamingOverrideAllowed'] = network.config.policy.uplinkTeamingOverrideAllowed
        network_port_tmp['config']['policy']['vendorConfigOverrideAllowed'] = network.config.policy.vendorConfigOverrideAllowed
        network_port_tmp['config']['policy']['vlanOverrideAllowed'] = network.config.policy.vlanOverrideAllowed
        network_port_tmp['config']['portNameFormat'] = network.config.portNameFormat
        network_port_tmp['config']['scope'] = network.config.scope
        network_port_tmp['config']['type'] = network.config.type
        network_port_tmp['config']['uplink'] = network.config.uplink
        network_port_tmp['config']['vendorSpecificConfig'] = network.config.vendorSpecificConfig
        network_port_tmp['config']['vmVnicNetworkResourcePoolKey'] = network.config.vmVnicNetworkResourcePoolKey
    network_port_tmp['configIssue'] = []
    network_port_tmp['configStatus'] = network.configStatus
    network_port_tmp['customValue'] = []
    network_port_tmp['declaredAlarmState'] = []
    network_port_tmp['disabledMethod'] = []
    host_list = []
    for host in network.host:
        host_tmp = {}
        host_tmp['name'] = host.name
        host_tmp['summary'] = {}
        host_tmp['summary']['managementServerIp'] = host.summary.managementServerIp
        host_list.append(host_tmp)
    network_port_tmp['host'] = host_list
    network_port_tmp['key'] = ''
    if hasattr(network, 'key'):
        network_port_tmp['key'] = network.key
    network_port_tmp['name'] = network.name
    network_port_tmp['overallStatus'] = network.overallStatus
    network_port_tmp['parent'] = {}
    network_port_tmp['parent']['_moId'] = network.parent._moId
    network_port_tmp['parent']['name'] = network.parent.name
    network_port_tmp['permission'] = []
    if hasattr(network, 'portKeys'):
        portKeys_list = []
        for portKeys in network.portKeys:
            portKeys_list.append(portKeys)
        network_port_tmp['portKeys'] = portKeys_list
    network_port_tmp['recentTask'] = []
    network_port_tmp['summary'] = {}
    network_port_tmp['summary']['accessible'] = network.summary.accessible
    network_port_tmp['summary']['ipPoolId'] = network.summary.ipPoolId
    network_port_tmp['summary']['ipPoolName'] = network.summary.ipPoolName
    network_port_tmp['summary']['name'] = network.summary.name
    network_port_tmp['summary']['network'] = {}
    network_port_tmp['summary']['network']['name'] = network.summary.network.name
    network_port_tmp['tag'] = []
    network_port_tmp['triggeredAlarmState'] = []
    network_port_tmp['value'] = []
    vm_list = []
    for vm in network.vm:
        vm_tmp = {}
        vm_tmp['_moId'] = vm._moId
        vm_tmp['name'] = vm.name
        vm_list.append(vm_tmp)
    network_port_tmp['vm'] = vm_list

    return network_port_tmp


# -*- coding: utf-8 -*-
from pyvim import connect
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
import atexit


vcenter_address = 'vc22.x.com'
service_instance = connect.SmartConnect(host=vcenter_address,
                                        user='xxxxxx@xxxxxx.x',
                                        pwd='xxxxxx',
                                        port=443)

content = service_instance.RetrieveContent()
vcontent = service_instance.content


if __name__ == '__main__':
    for datacenter in vcontent.rootFolder.childEntity:
        for network in datacenter.network:
            print(detail_network_port(network))

detail_host_config

#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author:hanxiaoshun
# datetime:2020/6/26 10:53
# software: PyCharm
from cloudenforce.vmware_api.detail_vswitch import detail_vswitch
from cloudenforce.vmware_api.detail_host_pnic import detail_host_pnic
from cloudenforce.vmware_api.detail_host_vnic import detail_host_vnic

def detail_host_config(config=None):
    host_tmp = {}
    host_tmp['config'] = {}
    host_tmp['config']['activeDiagnosticPartition'] = {}
    host_tmp['config']['activeDiagnosticPartition'][
        'diagnosticType'] = config.activeDiagnosticPartition.diagnosticType
    host_tmp['config']['activeDiagnosticPartition']['id'] = {}
    host_tmp['config']['activeDiagnosticPartition'][
        'id']['diskName'] = config.activeDiagnosticPartition.id.diskName
    host_tmp['config']['activeDiagnosticPartition'][
        'id']['partition'] = config.activeDiagnosticPartition.id.partition
    host_tmp['config']['activeDiagnosticPartition'][
        'slots'] = config.activeDiagnosticPartition.slots
    host_tmp['config']['activeDiagnosticPartition'][
        'storageType'] = config.activeDiagnosticPartition.storageType
    host_tmp['config']['adminDisabled'] = config.adminDisabled
    host_tmp['config']['capabilities'] = {}
    host_tmp['config']['capabilities'][
        'canSetPhysicalNicLinkSpeed'] = config.capabilities.canSetPhysicalNicLinkSpeed
    host_tmp['config']['capabilities'][
        'dhcpOnVnicSupported'] = config.capabilities.dhcpOnVnicSupported
    host_tmp['config']['capabilities'][
        'dnsConfigSupported'] = config.capabilities.dnsConfigSupported
    host_tmp['config']['capabilities'][
        'ipRouteConfigSupported'] = config.capabilities.ipRouteConfigSupported
    host_tmp['config']['capabilities'][
        'ipV6Supported'] = config.capabilities.ipV6Supported
    host_tmp['config']['capabilities'][
        'maxPortGroupsPerVswitch'] = config.capabilities.maxPortGroupsPerVswitch
    nicTeamingPolicy_list = []
    for nicTeamingPolicy in config.capabilities.nicTeamingPolicy:
        nicTeamingPolicy_list.append(nicTeamingPolicy)
    host_tmp['config']['capabilities'][
        'nicTeamingPolicy'] = nicTeamingPolicy_list
    host_tmp['config']['capabilities'][
        'supportsNetworkHints'] = config.capabilities.supportsNetworkHints
    host_tmp['config']['capabilities'][
        'supportsNicTeaming'] = config.capabilities.supportsNicTeaming
    host_tmp['config']['capabilities'][
        'supportsVlan'] = config.capabilities.supportsVlan
    host_tmp['config']['capabilities'][
        'usesServiceConsoleNic'] = config.capabilities.usesServiceConsoleNic
    host_tmp['config']['capabilities'][
        'vnicConfigSupported'] = config.capabilities.vnicConfigSupported
    host_tmp['config']['capabilities'][
        'vswitchConfigSupported'] = config.capabilities.vswitchConfigSupported
    host_tmp['config']['consoleReservation'] = config.consoleReservation
    host_tmp['config']['datastoreCapabilities'] = {}
    host_tmp['config']['datastoreCapabilities'][
        'localDatastoreSupported'] = config.datastoreCapabilities.localDatastoreSupported
    host_tmp['config']['datastoreCapabilities'][
        'nfsMountCreationRequired'] = config.datastoreCapabilities.nfsMountCreationRequired
    host_tmp['config']['datastoreCapabilities'][
        'nfsMountCreationSupported'] = config.datastoreCapabilities.nfsMountCreationSupported
    host_tmp['config']['datastoreCapabilities'][
        'vmfsExtentExpansionSupported'] = config.datastoreCapabilities.vmfsExtentExpansionSupported
    host_tmp['config']['datastorePrincipal'] = config.datastorePrincipal
    host_tmp['config']['dateTimeInfo'] = {}
    host_tmp['config']['dateTimeInfo']['ntpConfig'] = {}
    configFile_list = []
    for configFile in config.dateTimeInfo.ntpConfig.configFile:
        configFile_list.append(configFile)
    host_tmp['config']['dateTimeInfo']['ntpConfig'][
        'configFile'] = configFile_list
    server_list = []
    for server in config.dateTimeInfo.ntpConfig.server:
        server_list.append(server)
    host_tmp['config']['dateTimeInfo']['ntpConfig'][
        'server'] = server_list
    host_tmp['config']['dateTimeInfo']['timeZone'] = {}
    host_tmp['config']['dateTimeInfo']['timeZone'][
        'description'] = config.dateTimeInfo.timeZone.description
    host_tmp['config']['dateTimeInfo']['timeZone'][
        'gmtOffset'] = config.dateTimeInfo.timeZone.gmtOffset
    host_tmp['config']['dateTimeInfo']['timeZone'][
        'key'] = config.dateTimeInfo.timeZone.key
    host_tmp['config']['dateTimeInfo']['timeZone'][
        'name'] = config.dateTimeInfo.timeZone.name
    host_tmp['config']['deploymentInfo'] = {}
    host_tmp['config']['deploymentInfo'][
        'bootedFromStatelessCache'] = config.deploymentInfo.bootedFromStatelessCache
    host_tmp['config']['featureVersion'] = []
    # host_tmp['config']['fileSystemVolume']['mountInfo'] = config.fileSystemVolume.mountInfo
    host_tmp['config']['fileSystemVolume'] = {}
    volumeTypeList_list = []
    for volumeTypeList in config.fileSystemVolume.volumeTypeList:
        volumeTypeList_list.append(volumeTypeList)
    host_tmp['config']['fileSystemVolume'][
        'volumeTypeList'] = volumeTypeList_list

    host_tmp['config']['firewall'] = {}
    host_tmp['config']['flags'] = {}
    host_tmp['config']['flags'][
        'backgroundSnapshotsEnabled'] = config.flags.backgroundSnapshotsEnabled
    host_tmp['config']['hostConfigCheckSum'] = config.hostConfigCheckSum
    host_tmp['config']['hyperThread'] = {}
    host_tmp['config']['hyperThread']['active'] = config.hyperThread.active
    host_tmp['config']['hyperThread']['available'] = config.hyperThread.available
    host_tmp['config']['hyperThread']['config'] = config.hyperThread.config
    ioFilterInfo_list = []
    for ioFilterInfo in config.ioFilterInfo:
        ioFilterInfo_tmp = {}
        ioFilterInfo_tmp['id'] = ioFilterInfo.id
        ioFilterInfo_tmp['vendor'] = ioFilterInfo.vendor
        ioFilterInfo_tmp['version'] = ioFilterInfo.version
        ioFilterInfo_tmp['type'] = ioFilterInfo.type
        ioFilterInfo_tmp['summary'] = ioFilterInfo.summary
        ioFilterInfo_tmp['releaseDate'] = ioFilterInfo.releaseDate
        ioFilterInfo_tmp['available'] = ioFilterInfo.available
        ioFilterInfo_list.append(ioFilterInfo_tmp)
    host_tmp['config']['ioFilterInfo'] = ioFilterInfo_list
    host_tmp['config']['lockdownMode'] = config.lockdownMode
    host_tmp['config']['network'] = {}
    host_tmp['config']['network'][
        'atBootIpV6Enabled'] = config.network.atBootIpV6Enabled
    host_tmp['config']['network'][
        'consoleIpRouteConfig'] = config.network.consoleIpRouteConfig
    host_tmp['config']['network']['consoleVnic'] = []
    host_tmp['config']['network']['dhcp'] = []
    host_tmp['config']['network']['dnsConfig'] = {}
    address_list = []
    for address in config.network.dnsConfig.address:
        address_list.append(address)
    host_tmp['config']['network']['dnsConfig'][
        'address'] = address_list
    host_tmp['config']['network']['dnsConfig']['dhcp'] = config.network.dnsConfig.dhcp
    host_tmp['config']['network']['dnsConfig'][
        'domainName'] = config.network.dnsConfig.domainName
    host_tmp['config']['network']['dnsConfig'][
        'hostName'] = config.network.dnsConfig.hostName
    host_tmp['config']['network']['dnsConfig'][
        'ipv6VirtualNicDevice'] = config.network.dnsConfig.ipv6VirtualNicDevice
    searchDomain_list = []
    for searchDomain in config.network.dnsConfig.searchDomain:
        searchDomain_list.append(searchDomain)
    host_tmp['config']['network']['dnsConfig'][
        'searchDomain'] = searchDomain_list
    host_tmp['config']['network']['dnsConfig'][
        'virtualNicDevice'] = config.network.dnsConfig.virtualNicDevice
    host_tmp['config']['network']['ipRouteConfig'] = {}
    host_tmp['config']['network']['ipRouteConfig'][
        'defaultGateway'] = config.network.ipRouteConfig.defaultGateway
    host_tmp['config']['network']['ipRouteConfig'][
        'gatewayDevice'] = config.network.ipRouteConfig.gatewayDevice
    host_tmp['config']['network']['ipRouteConfig'][
        'ipV6GatewayDevice'] = config.network.ipRouteConfig.ipV6GatewayDevice
    host_tmp['config']['network']['ipRouteConfig'][
        'ipV6DefaultGateway'] = config.network.ipRouteConfig.ipV6DefaultGateway
    host_tmp['config']['network']['ipV6Enabled'] = config.network.ipV6Enabled
    host_tmp['config']['network']['nat'] = []
    pnic_list = []
    for pnic in config.network.pnic:
        pnic_tmp = detail_host_pnic(pnic=pnic)
        pnic_list.append(pnic_tmp)
    host_tmp['config']['network']['pnic'] = pnic_list
    host_tmp['config']['network']['routeTableInfo'] = {}
    ipRoute_list = []
    for ipRoute in config.network.routeTableInfo.ipRoute:
        ipRoute_tmp = {}
        ipRoute_tmp['network'] = ipRoute.network
        ipRoute_tmp['prefixLength'] = ipRoute.prefixLength
        ipRoute_tmp['gateway'] = ipRoute.gateway
        ipRoute_tmp['deviceName'] = ipRoute.deviceName
        ipRoute_list.append(ipRoute_tmp)
    host_tmp['config']['network']['routeTableInfo'][
        'ipRoute'] = ipRoute_list
    ipv6Route_list = []
    for ipv6Route in config.network.routeTableInfo.ipv6Route:
        ipv6Route_tmp = {}
        ipv6Route_tmp['network'] = ipv6Route.network
        ipv6Route_tmp['prefixLength'] = ipv6Route.prefixLength
        ipv6Route_tmp['gateway'] = ipv6Route.gateway
        ipv6Route_tmp['deviceName'] = ipv6Route.deviceName
        ipv6Route_list.append(ipv6Route_tmp)
    host_tmp['config']['network']['routeTableInfo'][
        'ipv6Route'] = ipv6Route_list
    vnic_list = []
    for vnic in config.network.vnic:
        vnic_tmp = detail_host_vnic(vnic=vnic)
        vnic_list.append(vnic_tmp)
    host_tmp['config']['network']['vnic'] = vnic_list
    vswitch_list = []
    for vswitch in config.network.vswitch:
        vswitch_tmp = detail_vswitch(vswitch=vswitch)
        vswitch_list.append(vswitch_tmp)
    host_tmp['config']['network']['vswitch'] = vswitch_list
    host_tmp['config']['offloadCapabilities'] = {}
    host_tmp['config']['offloadCapabilities']['csumOffload'] = config.offloadCapabilities.csumOffload
    host_tmp['config']['offloadCapabilities'][
        'tcpSegmentation'] = config.offloadCapabilities.tcpSegmentation
    host_tmp['config']['offloadCapabilities']['zeroCopyXmit'] = config.offloadCapabilities.zeroCopyXmit
    pciPassthruInfo_list = []
    for pciPassthruInfo in config.pciPassthruInfo:
        pciPassthruInfo_tmp = {}
        pciPassthruInfo_tmp['id'] = pciPassthruInfo.id
        pciPassthruInfo_tmp['dependentDevice'] = pciPassthruInfo.dependentDevice
        pciPassthruInfo_tmp['passthruEnabled'] = pciPassthruInfo.passthruEnabled
        pciPassthruInfo_tmp['passthruCapable'] = pciPassthruInfo.passthruCapable
        pciPassthruInfo_tmp['passthruActive'] = pciPassthruInfo.passthruActive
        pciPassthruInfo_list.append(pciPassthruInfo_tmp)
    host_tmp['config']['offloadCapabilities']['pciPassthruInfo'] = pciPassthruInfo_list
    host_tmp['config']['powerSystemCapability'] = {}
    availablePolicy_list = []
    for availablePolicy in config.powerSystemCapability.availablePolicy:
        availablePolicy_tmp = {}
        availablePolicy_tmp['description'] = availablePolicy.description
        availablePolicy_tmp['key'] = availablePolicy.key
        availablePolicy_tmp['name'] = availablePolicy.name
        availablePolicy_tmp['shortName'] = availablePolicy.shortName
        availablePolicy_list.append(availablePolicy_tmp)
    host_tmp['config']['powerSystemCapability']['availablePolicy'] = availablePolicy_list
    host_tmp['config']['powerSystemInfo'] = {}
    host_tmp['config']['powerSystemInfo']['currentPolicy'] = {}
    host_tmp['config']['powerSystemInfo']['currentPolicy'][
        'description'] = config.powerSystemInfo.currentPolicy.description
    host_tmp['config']['powerSystemInfo']['currentPolicy'][
        'key'] = config.powerSystemInfo.currentPolicy.key
    host_tmp['config']['powerSystemInfo']['currentPolicy'][
        'name'] = config.powerSystemInfo.currentPolicy.name
    host_tmp['config']['powerSystemInfo']['currentPolicy'][
        'shortName'] = config.powerSystemInfo.currentPolicy.shortName
    host_tmp['config']['product'] = {}
    host_tmp['config']['product']['apiType'] = config.product.apiType
    host_tmp['config']['product']['apiVersion'] = config.product.apiVersion
    host_tmp['config']['product']['build'] = config.product.build
    host_tmp['config']['product']['fullName'] = config.product.fullName
    host_tmp['config']['product']['instanceUuid'] = config.product.instanceUuid
    host_tmp['config']['product']['licenseProductName'] = config.product.licenseProductName
    host_tmp['config']['product']['licenseProductVersion'] = config.product.licenseProductVersion
    host_tmp['config']['product']['localeBuild'] = config.product.localeBuild
    host_tmp['config']['product']['localeVersion'] = config.product.localeVersion
    host_tmp['config']['product']['name'] = config.product.name
    host_tmp['config']['product']['osType'] = config.product.osType
    host_tmp['config']['product']['productLineId'] = config.product.productLineId
    host_tmp['config']['product']['vendor'] = config.product.vendor
    host_tmp['config']['product']['version'] = config.product.version
    host_tmp['config']['scriptCheckSum'] = config.scriptCheckSum
    host_tmp['config']['service'] = {}
    service_list = []
    for service in config.service.service:
        service_tmp = {}
        service_tmp['key'] = service.key
        service_tmp['label'] = service.label
        service_tmp['policy'] = service.policy
        service_tmp['required'] = service.required
        ruleset_list = []
        for ruleset in service.ruleset:
            ruleset_list.append(ruleset)
        service_tmp['ruleset'] = ruleset_list
        service_tmp['running'] = service.running
        service_tmp['sourcePackage'] = {}
        if service.sourcePackage is not None:
            service_tmp['sourcePackage']['description'] = service.sourcePackage.description
            service_tmp['sourcePackage']['sourcePackageName'] = service.sourcePackage.sourcePackageName
        service_tmp['uninstallable'] = service.uninstallable
        service_list.append(service_tmp)

    host_tmp['config']['service']['service'] = service_list
    host_tmp['config']['sharedGpuCapabilities'] = []
    sharedPassthruGpuTypes_list = []
    for sharedPassthruGpuTypes in config.sharedPassthruGpuTypes:
        sharedPassthruGpuTypes_list.append(sharedPassthruGpuTypes)
    host_tmp['config']['sharedPassthruGpuTypes'] = sharedPassthruGpuTypes_list
    host_tmp['config']['sriovDevicePool'] = []
    host_tmp['config']['sslThumbprintData'] = []
    host_tmp['config']['storageDevice'] = {}
    hostBusAdapter_list = []
    for hostBusAdapter in config.storageDevice.hostBusAdapter:
        hostBusAdapter_tmp = {}
        hostBusAdapter_tmp['bus'] = hostBusAdapter.bus
        hostBusAdapter_tmp['device'] = hostBusAdapter.device
        hostBusAdapter_tmp['driver'] = hostBusAdapter.driver
        hostBusAdapter_tmp['key'] = hostBusAdapter.key
        hostBusAdapter_tmp['model'] = hostBusAdapter.model
        hostBusAdapter_tmp['pci'] = hostBusAdapter.pci
        hostBusAdapter_tmp['status'] = hostBusAdapter.status
        hostBusAdapter_list.append(hostBusAdapter_tmp)
    host_tmp['config']['storageDevice']['hostBusAdapter'] = hostBusAdapter_list
    host_tmp['config']['storageDevice']['multipathInfo'] = {}
    host_tmp['config']['storageDevice']['plugStoreTopology'] = {}
    host_tmp['config']['storageDevice']['scsiLun'] = {}
    host_tmp['config']['storageDevice']['scsiTopology'] = {}
    host_tmp['config']['storageDevice'][
        'softwareInternetScsiEnabled'] = config.storageDevice.softwareInternetScsiEnabled
    systemFile_list = []
    for systemFile in config.systemFile:
        systemFile_list.append(systemFile)
    host_tmp['config']['systemFile'] = systemFile_list
    host_tmp['config']['systemResources'] = {}
    child_list = []
    for child in config.systemResources.child:
        child_dict = {}
        child_list.append(child_dict)

    host_tmp['config']['systemResources']['child'] = child_list
    host_tmp['config']['systemResources']['config'] = {}
    host_tmp['config']['systemResources']['config'][
        'changeVersion'] = config.systemResources.config.changeVersion
    host_tmp['config']['systemResources']['config']['cpuAllocation'] = {}
    host_tmp['config']['systemResources']['config']['cpuAllocation'][
        'expandableReservation'] = config.systemResources.config.cpuAllocation.expandableReservation
    host_tmp['config']['systemResources']['config']['cpuAllocation'][
        'limit'] = config.systemResources.config.cpuAllocation.limit
    host_tmp['config']['systemResources']['config']['cpuAllocation'][
        'overheadLimit'] = config.systemResources.config.cpuAllocation.overheadLimit
    host_tmp['config']['systemResources']['config']['cpuAllocation'][
        'reservation'] = config.systemResources.config.cpuAllocation.reservation
    host_tmp['config']['systemResources']['config']['cpuAllocation']['shares'] = {}
    host_tmp['config']['systemResources']['config']['cpuAllocation']['shares'][
        'level'] = config.systemResources.config.cpuAllocation.shares.level
    host_tmp['config']['systemResources']['config']['cpuAllocation']['shares'][
        'shares'] = config.systemResources.config.cpuAllocation.shares.shares
    host_tmp['config']['systemResources']['config']['entity'] = config.systemResources.config.entity
    host_tmp['config']['systemResources']['config'][
        'lastModified'] = config.systemResources.config.lastModified
    host_tmp['config']['systemResources']['config']['memoryAllocation'] = {}
    host_tmp['config']['systemResources']['config']['memoryAllocation'][
        'expandableReservation'] = config.systemResources.config.memoryAllocation.expandableReservation
    host_tmp['config']['systemResources']['config']['memoryAllocation'][
        'limit'] = config.systemResources.config.memoryAllocation.limit
    host_tmp['config']['systemResources']['config']['memoryAllocation'][
        'overheadLimit'] = config.systemResources.config.memoryAllocation.overheadLimit
    host_tmp['config']['systemResources']['config']['memoryAllocation'][
        'reservation'] = config.systemResources.config.memoryAllocation.reservation
    host_tmp['config']['systemResources']['config']['memoryAllocation']['shares'] = {}
    host_tmp['config']['systemResources']['config']['memoryAllocation']['shares'][
        'level'] = config.systemResources.config.memoryAllocation.shares.level
    host_tmp['config']['systemResources']['config']['memoryAllocation']['shares'][
        'shares'] = config.systemResources.config.memoryAllocation.shares.shares
    host_tmp['config']['systemResources']['key'] = config.systemResources.key
    host_tmp['config']['systemSwapConfiguration'] = {}
    option_list = []
    for option in config.systemSwapConfiguration.option:
        option_dict = {}
        option_dict['key'] = option.key
        option_list.append(option_dict)
    host_tmp['config']['systemSwapConfiguration']['option'] = option_list
    host_tmp['config']['vFlashConfigInfo'] = {}
    host_tmp['config']['virtualMachineReservation'] = config.virtualMachineReservation
    host_tmp['config']['virtualNicManagerInfo'] = {}
    netConfig_list = []
    for netConfig in config.virtualNicManagerInfo.netConfig:
        netConfig_tmp = {}
        netConfig_tmp['nicType'] = netConfig.nicType
        netConfig_tmp['multiSelectAllowed'] = netConfig.multiSelectAllowed
        candidateVnic_list = []
        for candidateVnic in netConfig.candidateVnic:
            candidateVnic_tmp = {}
            candidateVnic_tmp['device'] = candidateVnic.device
            candidateVnic_tmp['key'] = candidateVnic.key
            candidateVnic_tmp['portgroup'] = candidateVnic.portgroup
            candidateVnic_tmp['spec'] = {}
            candidateVnic_tmp['spec']['ip'] = {}
            candidateVnic_tmp['spec']['ip']['dhcp'] = candidateVnic.spec.ip.dhcp
            candidateVnic_tmp['spec']['ip']['ipAddress'] = candidateVnic.spec.ip.ipAddress
            candidateVnic_tmp['spec']['ip']['subnetMask'] = candidateVnic.spec.ip.subnetMask
            candidateVnic_tmp['spec']['ip']['ipV6Config'] = {}
            ipV6Address_list = []
            for ipV6Address in candidateVnic.spec.ip.ipV6Config.ipV6Address:
                ipV6Address_tmp = {}
                ipV6Address_tmp['ipAddress'] = ipV6Address.ipAddress
                ipV6Address_tmp['prefixLength'] = ipV6Address.prefixLength
                ipV6Address_tmp['origin'] = ipV6Address.origin
                ipV6Address_tmp['dadState'] = ipV6Address.dadState
                ipV6Address_tmp['lifetime'] = ipV6Address.lifetime
                if ipV6Address.lifetime is not None:
                    ipV6Address_tmp['lifetime'] = ipV6Address.lifetime.strftime('%Y-%m-%d %H:%M:%S')
                ipV6Address_tmp['operation'] = ipV6Address.operation
                ipV6Address_list.append(ipV6Address_tmp)
            candidateVnic_tmp['spec']['ip']['ipV6Config']['ipV6Address'] = ipV6Address_list
            candidateVnic_tmp['spec']['ip']['dhcp'] = candidateVnic.spec.ip.dhcp
            candidateVnic_tmp['device'] = candidateVnic.device
            candidateVnic_list.append(candidateVnic_tmp)
        netConfig_tmp['candidateVnic'] = candidateVnic_list
        netConfig_list.append(netConfig_tmp)
    host_tmp['config']['virtualNicManagerInfo']['netConfig'] = netConfig_list
    host_tmp['config']['vmotion'] = {}
    host_tmp['config']['vmotion']['ipConfig'] = config.vmotion.ipConfig
    host_tmp['config']['vmotion']['netConfig'] = {}
    candidateVnic_list = []
    for candidateVnic in config.vmotion.netConfig.candidateVnic:
        candidateVnic_tmp = {}
        candidateVnic_tmp['device'] = candidateVnic.device
        candidateVnic_tmp['key'] = candidateVnic.key
        candidateVnic_tmp['port'] = candidateVnic.port
        candidateVnic_tmp['portgroup'] = candidateVnic.portgroup
        candidateVnic_tmp['spec'] = {}
        candidateVnic_tmp['spec']['distributedVirtualPort'] = candidateVnic.spec.distributedVirtualPort
        if candidateVnic.spec.distributedVirtualPort is not None:
            candidateVnic_tmp['spec']['distributedVirtualPort'] = {}
            candidateVnic_tmp['spec']['distributedVirtualPort']['switchUuid'] = candidateVnic.spec.distributedVirtualPort.switchUuid
            candidateVnic_tmp['spec']['distributedVirtualPort']['portgroupKey'] = candidateVnic.spec.distributedVirtualPort.portgroupKey
            candidateVnic_tmp['spec']['distributedVirtualPort']['portKey'] = candidateVnic.spec.distributedVirtualPort.portKey
            candidateVnic_tmp['spec']['distributedVirtualPort']['connectionCookie'] = candidateVnic.spec.distributedVirtualPort.connectionCookie
        candidateVnic_tmp['spec']['externalId'] = candidateVnic.spec.externalId
        candidateVnic_tmp['spec']['ip'] = {}
        candidateVnic_tmp['spec']['ip']['dhcp'] = candidateVnic.spec.ip.dhcp
        candidateVnic_tmp['spec']['ip']['ipAddress'] = candidateVnic.spec.ip.ipAddress
        candidateVnic_tmp['spec']['ip']['ipV6Config'] = {}
        candidateVnic_tmp['spec']['ip']['ipV6Config'][
            'autoConfigurationEnabled'] = candidateVnic.spec.ip.ipV6Config.autoConfigurationEnabled
        candidateVnic_tmp['spec']['ip']['ipV6Config'][
            'dhcpV6Enabled'] = candidateVnic.spec.ip.ipV6Config.dhcpV6Enabled
        ipV6Address_list = []
        for ipV6Address in candidateVnic.spec.ip.ipV6Config.ipV6Address:
            ipV6Address_tmp = {}
            ipV6Address_tmp['ipAddress'] = ipV6Address.ipAddress
            ipV6Address_tmp['prefixLength'] = ipV6Address.prefixLength
            ipV6Address_tmp['origin'] = ipV6Address.origin
            ipV6Address_tmp['dadState'] = ipV6Address.dadState
            ipV6Address_tmp['lifetime'] = ipV6Address.lifetime
            if ipV6Address.lifetime is not None:
                ipV6Address_tmp['lifetime'] = ipV6Address.lifetime.strftime('%Y-%m-%d %H:%M:%S')
            ipV6Address_tmp['operation'] = ipV6Address.operation
            ipV6Address_list.append(ipV6Address_tmp)
        candidateVnic_tmp['spec']['ip']['ipV6Config'][
            'ipV6Address'] = ipV6Address_list
        candidateVnic_tmp['spec']['ip']['subnetMask'] = candidateVnic.spec.ip.subnetMask
        candidateVnic_tmp['spec']['ipRouteSpec'] = {}
        candidateVnic_tmp['spec']['ipRouteSpec']['ipRouteConfig'] = {}
        if candidateVnic.spec.ipRouteSpec is not None:
            candidateVnic_tmp['spec']['ipRouteSpec']['ipRouteConfig'][
                'defaultGateway'] = candidateVnic.spec.ipRouteSpec.ipRouteConfig.defaultGateway
            candidateVnic_tmp['spec']['ipRouteSpec']['ipRouteConfig'][
                'gatewayDevice'] = candidateVnic.spec.ipRouteSpec.ipRouteConfig.gatewayDevice
            candidateVnic_tmp['spec']['ipRouteSpec']['ipRouteConfig'][
                'ipV6DefaultGateway'] = candidateVnic.spec.ipRouteSpec.ipRouteConfig.ipV6DefaultGateway
            candidateVnic_tmp['spec']['ipRouteSpec']['ipRouteConfig'][
                'ipV6GatewayDevice'] = candidateVnic.spec.ipRouteSpec.ipRouteConfig.ipV6GatewayDevice
        candidateVnic_tmp['spec']['mac'] = candidateVnic.spec.mac
        candidateVnic_tmp['spec']['mtu'] = candidateVnic.spec.mtu
        candidateVnic_tmp['spec']['netStackInstanceKey'] = candidateVnic.spec.netStackInstanceKey
        candidateVnic_tmp['spec']['opaqueNetwork'] = candidateVnic.spec.opaqueNetwork
        candidateVnic_tmp['spec']['pinnedPnic'] = candidateVnic.spec.pinnedPnic
        candidateVnic_tmp['spec']['portgroup'] = candidateVnic.spec.portgroup
        candidateVnic_tmp['spec']['tsoEnabled'] = candidateVnic.spec.tsoEnabled
        candidateVnic_list.append(candidateVnic_tmp)
    host_tmp['config']['vmotion']['netConfig']['candidateVnic'] = candidateVnic_list
    host_tmp['config']['vmotion']['netConfig']['selectedVnic'] = config.vmotion.netConfig.selectedVnic
    host_tmp['config']['vsanHostConfig'] = {}
    host_tmp['config']['vsanHostConfig']['clusterInfo'] = {}
    host_tmp['config']['vsanHostConfig']['clusterInfo'][
        'nodeUuid'] = config.vsanHostConfig.clusterInfo.nodeUuid
    host_tmp['config']['vsanHostConfig']['clusterInfo'][
        'uuid'] = config.vsanHostConfig.clusterInfo.uuid
    host_tmp['config']['vsanHostConfig']['enabled'] = config.vsanHostConfig.enabled
    host_tmp['config']['vsanHostConfig']['faultDomainInfo'] = {}
    host_tmp['config']['vsanHostConfig']['faultDomainInfo'][
        'name'] = config.vsanHostConfig.faultDomainInfo.name
    host_tmp['config']['vsanHostConfig']['hostSystem'] = {}
    host_tmp['config']['vsanHostConfig']['networkInfo'] = {}
    host_tmp['config']['vsanHostConfig']['networkInfo'][
        'port'] = []
    host_tmp['config']['vsanHostConfig']['storageInfo'] = {}
    host_tmp['config']['vsanHostConfig']['storageInfo'][
        'autoClaimStorage'] = config.vsanHostConfig.storageInfo.autoClaimStorage
    host_tmp['config']['vsanHostConfig']['storageInfo'][
        'checksumEnabled'] = config.vsanHostConfig.storageInfo.checksumEnabled
    host_tmp['config']['vsanHostConfig']['storageInfo'][
        'diskMapInfo'] = []
    host_tmp['config']['wakeOnLanCapable'] = config.wakeOnLanCapable
    return host_tmp

detail_vswitch

#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:hanxiaoshun
# datetime:2020/6/26 10:21
# software: PyCharm

def detail_vswitch(vswitch=None):
    vswitch_tmp = {}
    vswitch_tmp['key'] = vswitch.key
    vswitch_tmp['mtu'] = vswitch.mtu
    vswitch_tmp['name'] = vswitch.name
    vswitch_tmp['numPorts'] = vswitch.numPorts
    vswitch_tmp['numPortsAvailable'] = vswitch.numPortsAvailable
    pnic_list = []
    for pnic in vswitch.pnic:
        pnic_list.append(pnic)
    vswitch_tmp['pnic'] = pnic_list
    portgroup_list = []
    for portgroup in vswitch.portgroup:
        portgroup_list.append(portgroup)
    vswitch_tmp['portgroup'] = portgroup_list
    vswitch_tmp['spec'] = {}
    vswitch_tmp['spec']['bridge'] = {}
    if vswitch.spec.bridge is not None:
        vswitch_tmp['spec']['bridge']['beacon'] = {}
        vswitch_tmp['spec']['bridge']['beacon']['interval'] = vswitch.spec.bridge.beacon.interval
        vswitch_tmp['spec']['bridge']['linkDiscoveryProtocolConfig'] = {}
        vswitch_tmp['spec']['bridge']['linkDiscoveryProtocolConfig'][
            'operation'] = vswitch.spec.bridge.linkDiscoveryProtocolConfig.operation
        vswitch_tmp['spec']['bridge']['linkDiscoveryProtocolConfig'][
            'protocol'] = vswitch.spec.bridge.linkDiscoveryProtocolConfig.protocol
    vswitch_tmp['spec']['mtu'] = vswitch.spec.mtu
    vswitch_tmp['spec']['numPorts'] = vswitch.spec.numPorts
    vswitch_tmp['spec']['policy'] = {}
    vswitch_tmp['spec']['policy']['nicTeaming'] = {}
    vswitch_tmp['spec']['policy']['nicTeaming']['failureCriteria'] = {}
    vswitch_tmp['spec']['policy']['nicTeaming']['failureCriteria'][
        'checkBeacon'] = vswitch.spec.policy.nicTeaming.failureCriteria.checkBeacon
    vswitch_tmp['spec']['policy']['nicTeaming']['failureCriteria'][
        'checkDuplex'] = vswitch.spec.policy.nicTeaming.failureCriteria.checkDuplex
    vswitch_tmp['spec']['policy']['nicTeaming']['failureCriteria'][
        'checkErrorPercent'] = vswitch.spec.policy.nicTeaming.failureCriteria.checkErrorPercent
    vswitch_tmp['spec']['policy']['nicTeaming']['failureCriteria'][
        'checkSpeed'] = vswitch.spec.policy.nicTeaming.failureCriteria.checkSpeed
    vswitch_tmp['spec']['policy']['nicTeaming']['failureCriteria'][
        'fullDuplex'] = vswitch.spec.policy.nicTeaming.failureCriteria.fullDuplex
    vswitch_tmp['spec']['policy']['nicTeaming']['failureCriteria'][
        'percentage'] = vswitch.spec.policy.nicTeaming.failureCriteria.percentage
    vswitch_tmp['spec']['policy']['nicTeaming']['failureCriteria'][
        'speed'] = vswitch.spec.policy.nicTeaming.failureCriteria.speed
    vswitch_tmp['spec']['policy']['nicTeaming']['nicOrder'] = {}
    activeNic_list = []
    for activeNic in vswitch.spec.policy.nicTeaming.nicOrder.activeNic:
        activeNic_list.append(activeNic)
    vswitch_tmp['spec']['policy']['nicTeaming']['nicOrder'][
        'activeNic'] = activeNic_list
    standbyNic_list = []
    for standbyNic in vswitch.spec.policy.nicTeaming.nicOrder.standbyNic:
        standbyNic_list.append(standbyNic)
    vswitch_tmp['spec']['policy']['nicTeaming']['nicOrder'][
        'standbyNic'] = standbyNic_list
    vswitch_tmp['spec']['policy']['nicTeaming'][
        'notifySwitches'] = vswitch.spec.policy.nicTeaming.notifySwitches
    vswitch_tmp['spec']['policy']['nicTeaming']['policy'] = vswitch.spec.policy.nicTeaming.policy
    vswitch_tmp['spec']['policy']['nicTeaming'][
        'reversePolicy'] = vswitch.spec.policy.nicTeaming.reversePolicy
    vswitch_tmp['spec']['policy']['nicTeaming'][
        'rollingOrder'] = vswitch.spec.policy.nicTeaming.rollingOrder
    vswitch_tmp['spec']['policy']['offloadPolicy'] = {}
    vswitch_tmp['spec']['policy']['offloadPolicy'][
        'csumOffload'] = vswitch.spec.policy.offloadPolicy.csumOffload
    vswitch_tmp['spec']['policy']['offloadPolicy'][
        'tcpSegmentation'] = vswitch.spec.policy.offloadPolicy.tcpSegmentation
    vswitch_tmp['spec']['policy']['offloadPolicy'][
        'zeroCopyXmit'] = vswitch.spec.policy.offloadPolicy.zeroCopyXmit
    vswitch_tmp['spec']['policy']['security'] = {}
    vswitch_tmp['spec']['policy']['security'][
        'allowPromiscuous'] = vswitch.spec.policy.security.allowPromiscuous
    vswitch_tmp['spec']['policy']['security'][
        'forgedTransmits'] = vswitch.spec.policy.security.forgedTransmits
    vswitch_tmp['spec']['policy']['security']['macChanges'] = vswitch.spec.policy.security.macChanges
    vswitch_tmp['spec']['policy']['shapingPolicy'] = {}
    vswitch_tmp['spec']['policy']['shapingPolicy'][
        'averageBandwidth'] = vswitch.spec.policy.shapingPolicy.averageBandwidth
    vswitch_tmp['spec']['policy']['shapingPolicy'][
        'burstSize'] = vswitch.spec.policy.shapingPolicy.burstSize
    vswitch_tmp['spec']['policy']['shapingPolicy'][
        'enabled'] = vswitch.spec.policy.shapingPolicy.enabled
    vswitch_tmp['spec']['policy']['shapingPolicy'][
        'peakBandwidth'] = vswitch.spec.policy.shapingPolicy.peakBandwidth
    return vswitch_tmp

detail_host_pnic

#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author:hanxiaoshun
# datetime:2020/6/26 10:28
# software: PyCharm

def detail_host_pnic(pnic=None):
    pnic_dict = {}
    pnic_dict['autoNegotiateSupported'] = pnic.autoNegotiateSupported
    pnic_dict['device'] = pnic.device
    pnic_dict['driver'] = pnic.driver
    pnic_dict['enhancedNetworkingStackSupported'] = pnic.enhancedNetworkingStackSupported
    pnic_dict['fcoeConfiguration'] = pnic.fcoeConfiguration
    pnic_dict['linkSpeed'] = {}
    if pnic.linkSpeed is not None:
        pnic_dict['linkSpeed']['duplex'] = pnic.linkSpeed.duplex
        pnic_dict['linkSpeed']['speedMb'] = pnic.linkSpeed.speedMb
    pnic_dict['key'] = pnic.key
    pnic_dict['mac'] = pnic.mac
    pnic_dict['pci'] = pnic.pci
    pnic_dict['resourcePoolSchedulerAllowed'] = pnic.resourcePoolSchedulerAllowed
    pnic_dict[
        'resourcePoolSchedulerDisallowedReason'] = []
    pnic_dict['spec'] = {}
    pnic_dict['spec'][
        'enableEnhancedNetworkingStack	'] = pnic.spec.enableEnhancedNetworkingStack
    pnic_dict['spec']['ip'] = {}
    pnic_dict['spec']['ip']['dhcp'] = pnic.spec.ip.dhcp
    pnic_dict['spec']['ip']['ipAddress'] = pnic.spec.ip.ipAddress
    ipV6Config_list = []
    pnic_dict['spec']['ip']['ipV6Config'] = {}
    if pnic.spec.ip.ipV6Config is not None:
        for ipV6Config in pnic.spec.ip.ipV6Config:
            ipV6Config_tmp = {}
            ipV6Address_list = []
            for ipV6Address in ipV6Config.ipV6Address:
                ipV6Address_tmp = {}
                ipV6Address_tmp['ipAddress'] = ipV6Address.ipAddress
                ipV6Address_tmp['prefixLength'] = ipV6Address.prefixLength
                ipV6Address_tmp['origin'] = ipV6Address.origin
                ipV6Address_tmp['dadState'] = ipV6Address.dadState
                ipV6Address_tmp['lifetime'] = ipV6Address.lifetime.strftime('%Y-%m-%d %H:%M:%S')
                ipV6Address_tmp['operation'] = ipV6Address.operation
                ipV6Address_list.append(ipV6Address_tmp)
            ipV6Config_tmp['ipV6Address'] = ipV6Address_list
            ipV6Config_list.append(ipV6Config_tmp)
        pnic_dict['spec']['ip']['ipV6Config'] = ipV6Config_list
    pnic_dict['spec']['ip']['subnetMask'] = pnic.spec.ip.subnetMask
    pnic_dict['spec']['linkSpeed'] = {}
    if pnic.spec.linkSpeed is not None:
        pnic_dict['spec']['linkSpeed']['speedMb'] = pnic.spec.linkSpeed.speedMb
        pnic_dict['spec']['linkSpeed']['duplex'] = pnic.spec.linkSpeed.duplex

    pnic_dict['vmDirectPathGen2Supported'] = pnic.vmDirectPathGen2Supported
    pnic_dict['vmDirectPathGen2SupportedMode'] = pnic.vmDirectPathGen2SupportedMode
    pnic_dict['wakeOnLanSupported'] = pnic.wakeOnLanSupported
    return pnic_dict

detail_host_vnic

#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:hanxiaoshun
# datetime:2020/6/26 10:38
# software: PyCharm

def detail_host_vnic(vnic=None):
    vnic_tmp = {}
    vnic_tmp['device'] = vnic.device
    vnic_tmp['key'] = vnic.key
    vnic_tmp['port'] = vnic.port
    vnic_tmp['portgroup'] = vnic.portgroup
    vnic_tmp['spec'] = {}
    vnic_tmp['spec']['distributedVirtualPort'] = {}
    if vnic.spec.distributedVirtualPort is not None:
        vnic_tmp['spec']['distributedVirtualPort']['switchUuid'] = vnic.spec.distributedVirtualPort.switchUuid
        vnic_tmp['spec']['distributedVirtualPort']['portgroupKey'] = vnic.spec.distributedVirtualPort.portgroupKey
        vnic_tmp['spec']['distributedVirtualPort']['portKey'] = vnic.spec.distributedVirtualPort.portKey
        vnic_tmp['spec']['distributedVirtualPort']['connectionCookie'] = vnic.spec.distributedVirtualPort.connectionCookie
    vnic_tmp['spec']['dynamicProperty'] = vnic.spec.dynamicProperty
    vnic_tmp['spec']['externalId'] = vnic.spec.externalId
    vnic_tmp['spec']['ip'] = {}
    vnic_tmp['spec']['ip']['dhcp'] = vnic.spec.ip.dhcp
    vnic_tmp['spec']['ip']['ipAddress'] = vnic.spec.ip.ipAddress
    vnic_tmp['spec']['ip']['ipV6Config'] = {}
    vnic_tmp['spec']['ip']['ipV6Config'][
        'autoConfigurationEnabled'] = vnic.spec.ip.ipV6Config.autoConfigurationEnabled
    vnic_tmp['spec']['ip']['ipV6Config']['dhcpV6Enabled'] = vnic.spec.ip.ipV6Config.dhcpV6Enabled
    vnic_tmp['spec']['ip']['ipV6Config']['ipV6Address'] = vnic.spec.ip.ipV6Config.ipV6Address
    vnic_tmp['spec']['ip']['ipV6Config'] = {}
    if vnic.spec.ip.ipV6Config is not None:
        ipV6Address_list = []
        for ipV6Address in vnic.spec.ip.ipV6Config.ipV6Address:
            ipV6Address_tmp = {}
            ipV6Address_tmp['ipAddress'] = ipV6Address.ipAddress
            ipV6Address_tmp['prefixLength'] = ipV6Address.prefixLength
            ipV6Address_tmp['origin'] = ipV6Address.origin
            ipV6Address_tmp['dadState'] = ipV6Address.dadState
            if ipV6Address.lifetime is not None:
                ipV6Address_tmp['lifetime'] = ipV6Address.lifetime.strftime('%Y-%m-%d %H:%M:%S')
            ipV6Address_tmp['operation'] = ipV6Address.operation
            ipV6Address_list.append(ipV6Address_tmp)
        vnic_tmp['spec']['ip']['ipV6Config']['ipAddress'] = ipV6Address_list
        vnic_tmp['spec']['ip']['ipV6Config']['autoConfigurationEnabled'] = vnic.spec.ip.ipV6Config.autoConfigurationEnabled
        vnic_tmp['spec']['ip']['ipV6Config']['dhcpV6Enabled'] = vnic.spec.ip.ipV6Config.dhcpV6Enabled
    vnic_tmp['spec']['ip']['subnetMask'] = vnic.spec.ip.subnetMask
    vnic_tmp['spec']['ipRouteSpec'] = {}
    vnic_tmp['spec']['ipRouteSpec']['ipRouteConfig'] = {}
    if vnic.spec.ipRouteSpec is not None:
        vnic_tmp['spec']['ipRouteSpec']['ipRouteConfig'][
            'defaultGateway'] = vnic.spec.ipRouteSpec.ipRouteConfig.defaultGateway
        vnic_tmp['spec']['ipRouteSpec']['ipRouteConfig'][
            'gatewayDevice'] = vnic.spec.ipRouteSpec.ipRouteConfig.gatewayDevice
        vnic_tmp['spec']['ipRouteSpec']['ipRouteConfig'][
            'ipV6DefaultGateway'] = vnic.spec.ipRouteSpec.ipRouteConfig.ipV6DefaultGateway
        vnic_tmp['spec']['ipRouteSpec']['ipRouteConfig'][
            'ipV6GatewayDevice'] = vnic.spec.ipRouteSpec.ipRouteConfig.ipV6GatewayDevice
    vnic_tmp['spec']['mac'] = vnic.spec.mac
    vnic_tmp['spec']['mtu'] = vnic.spec.mtu
    vnic_tmp['spec']['netStackInstanceKey'] = vnic.spec.netStackInstanceKey
    vnic_tmp['spec']['opaqueNetwork'] = vnic.spec.opaqueNetwork
    vnic_tmp['spec']['pinnedPnic'] = vnic.spec.pinnedPnic
    vnic_tmp['spec']['portgroup'] = vnic.spec.portgroup
    vnic_tmp['spec']['tsoEnabled'] = vnic.spec.tsoEnabled
    return vnic_tmp

detail_host_hardware

#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author:hanxiaoshun
# datetime:2020/6/26 11:02
# software: PyCharm

def detail_host_hardware(hardware=None):
    host_tmp = {}
    host_tmp['hardware'] = {}
    host_tmp['hardware']['biosInfo'] = {}
    host_tmp['hardware']['biosInfo']['biosVersion'] = hardware.biosInfo.biosVersion
    host_tmp['hardware']['biosInfo']['firmwareMajorRelease'] = hardware.biosInfo.firmwareMajorRelease
    host_tmp['hardware']['biosInfo']['firmwareMinorRelease'] = hardware.biosInfo.firmwareMinorRelease
    host_tmp['hardware']['biosInfo']['majorRelease'] = hardware.biosInfo.majorRelease
    host_tmp['hardware']['biosInfo']['minorRelease'] = hardware.biosInfo.minorRelease
    host_tmp['hardware']['biosInfo']['releaseDate'] = hardware.biosInfo.releaseDate
    host_tmp['hardware']['biosInfo']['vendor'] = hardware.biosInfo.vendor
    cpuFeature_list = []
    for cpuFeature in hardware.cpuFeature:
        cpuFeature_tmp = {}
        cpuFeature_tmp['level'] = cpuFeature.level
        cpuFeature_tmp['vendor'] = cpuFeature.vendor
        cpuFeature_tmp['eax'] = cpuFeature.eax
        cpuFeature_tmp['ebx'] = cpuFeature.ebx
        cpuFeature_tmp['ecx'] = cpuFeature.ecx
        cpuFeature_tmp['edx'] = cpuFeature.edx
        cpuFeature_list.append(cpuFeature_tmp)
    host_tmp['hardware']['cpuFeature'] = cpuFeature_list
    host_tmp['hardware']['cpuInfo'] = {}
    host_tmp['hardware']['cpuInfo']['hz'] = hardware.cpuInfo.hz
    host_tmp['hardware']['cpuInfo']['numCpuCores'] = hardware.cpuInfo.numCpuCores
    host_tmp['hardware']['cpuInfo']['numCpuPackages'] = hardware.cpuInfo.numCpuPackages
    host_tmp['hardware']['cpuInfo']['numCpuThreads'] = hardware.cpuInfo.numCpuThreads
    cpuPkg_list = []
    for cpuPkg in hardware.cpuPkg:
        cpuPkg_tmp = {}
        cpuPkg_tmp['index'] = cpuPkg.index
        cpuPkg_tmp['vendor'] = cpuPkg.vendor
        cpuPkg_tmp['hz'] = cpuPkg.hz
        cpuPkg_tmp['busHz'] = cpuPkg.busHz
        cpuPkg_tmp['description'] = cpuPkg.description
        threadId_list = []
        for threadId in cpuPkg.threadId:
            threadId_list.append(threadId)
        cpuPkg_tmp['threadId'] = threadId_list
        cpuFeature_list = []
        for cpuFeature in cpuPkg.cpuFeature:
            cpuFeature_tmp = {}
            cpuFeature_tmp['level'] = cpuFeature.level
            cpuFeature_tmp['vendor'] = cpuFeature.level
            cpuFeature_tmp['eax'] = cpuFeature.eax
            cpuFeature_tmp['ebx'] = cpuFeature.ebx
            cpuFeature_tmp['ecx'] = cpuFeature.ecx
            cpuFeature_tmp['edx'] = cpuFeature.edx
            cpuFeature_list.append(cpuFeature_tmp)
        cpuPkg_tmp['cpuFeature'] = cpuFeature_list
        cpuPkg_tmp['index'] = cpuPkg.index
        cpuPkg_tmp['index'] = cpuPkg.index

        cpuPkg_list.append(cpuPkg_tmp)
    host_tmp['hardware']['cpuPkg'] = cpuPkg_list
    host_tmp['hardware']['cpuPowerManagementInfo'] = {}
    host_tmp['hardware']['cpuPowerManagementInfo'][
        'currentPolicy'] = hardware.cpuPowerManagementInfo.currentPolicy
    host_tmp['hardware']['cpuPowerManagementInfo'][
        'currentPolicy'] = hardware.cpuPowerManagementInfo.currentPolicy
    host_tmp['hardware']['memorySize'] = hardware.memorySize
    host_tmp['hardware']['numaInfo'] = {}
    host_tmp['hardware']['numaInfo']['numNodes'] = hardware.numaInfo.numNodes
    numaNode_list = []
    for numaNode in hardware.numaInfo.numaNode:
        numaNode_tmp = {}
        numaNode_tmp['typeId'] = numaNode.typeId
        cpuID_list = []
        for cpuID in numaNode.cpuID:
            cpuID_list.append(cpuID)
        numaNode_tmp['cpuID'] = cpuID_list
        numaNode_tmp['memoryRangeBegin'] = numaNode.memoryRangeBegin
        numaNode_tmp['memoryRangeLength'] = numaNode.memoryRangeLength
        pciId_list = []
        for pciId in numaNode.pciId:
            pciId_list.append(pciId)
        numaNode_tmp['pciId'] = pciId_list
        numaNode_list.append(numaNode_tmp)
    host_tmp['hardware']['numaInfo']['numaNode'] = numaNode_list
    host_tmp['hardware']['numaInfo']['type'] = hardware.numaInfo.type
    pciDevice_list = []
    for pciDevice in hardware.pciDevice:
        pciDevice_tmp = {}
        pciDevice_tmp['id'] = pciDevice.id
        pciDevice_tmp['classId'] = pciDevice.classId
        pciDevice_tmp['bus'] = pciDevice.bus
        pciDevice_tmp['slot'] = pciDevice.slot
        pciDevice_tmp['function'] = pciDevice.function
        pciDevice_tmp['vendorId'] = pciDevice.vendorId
        pciDevice_tmp['subVendorId'] = pciDevice.subVendorId
        pciDevice_tmp['vendorName'] = pciDevice.vendorName
        pciDevice_tmp['deviceId'] = pciDevice.deviceId
        pciDevice_tmp['subDeviceId'] = pciDevice.subDeviceId
        pciDevice_tmp['parentBridge'] = pciDevice.parentBridge
        pciDevice_tmp['deviceName'] = pciDevice.deviceName
        pciDevice_list.append(pciDevice_tmp)
    host_tmp['hardware']['pciDevice'] = pciDevice_list
    host_tmp['hardware']['persistentMemoryInfo'] = hardware.persistentMemoryInfo
    host_tmp['hardware']['reliableMemoryInfo'] = hardware.reliableMemoryInfo
    host_tmp['hardware']['smcPresent'] = hardware.smcPresent
    host_tmp['hardware']['systemInfo'] = {}
    host_tmp['hardware']['systemInfo']['model'] = hardware.systemInfo.model
    host_tmp['hardware']['systemInfo'][
        'otherIdentifyingInfo'] = hardware.systemInfo.otherIdentifyingInfo
    host_tmp['hardware']['systemInfo']['serialNumber'] = hardware.systemInfo.serialNumber
    host_tmp['hardware']['systemInfo']['uuid'] = hardware.systemInfo.uuid
    host_tmp['hardware']['systemInfo']['vendor'] = hardware.systemInfo.vendor
    return host_tmp

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

千码君2016

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值