获取分布式交换机端口组

def get_dvs_portgroup(content):


    for datacenter in content.rootFolder.childEntity:

        networkFolder = datacenter.networkFolder
        for childEntity in networkFolder.childEntity:

            if hasattr(childEntity.summary, 'uuid'):
                portgroupName = childEntity.summary.portgroupName
                for portgroup in portgroupName:
                    print(portgroup)

你可能感兴趣的:(Linux)