def doDiscovery(shell, hostOsh, managedSystemOsh, framework, osType):
    vector = ObjectStateHolderVector()
    scsiAdaptersList = []
    physAdaptList = []
    virtAdaptList = []
    seaAdaptList = []
    linkAggrAdaptList = []
    volumeGroupsDict = {}
    physicalVolumeDict = {}
    logicalVolumeDict = {}
    scsiManList = []
    pvAssignList = []
    fiberChannelAdaptersList = []
    ethAliasesList = []
    isVio = ibm_hmc_lib.isVio(shell)

    if isVio:
        try:
            cpus = discoverCpus(shell)
            for cpu in cpus:
                cpuOsh = modeling.createCpuOsh(cpu.idStr, managedSystemOsh, cpu.speed, cpu.coresCount, 'ibm_corp', data_name = cpu.model)
                vector.add(cpuOsh)
        except:
            logger.errorException('')
            framework.reportWarning('Failed to discover CPUs')

    if osType and osType.upper() == 'AIX':
        try:
            fiberChannelAdaptersList = discoverFiberChannels(shell)
        except:
            framework.reportWarning("Failed to discover Fibre Channel adapters")
        ethAdaptersDict = {}
        if isVio:
            ethAdaptersDict = discoverEthernetAdapters(shell)
            ethAliasesList = discoverEhernetAdapterAliasses(shell)
        else:
            ethAdaptersDict = discoverAixLparEthernetAdapters(shell)
        physAdaptList = getPhysicalEthAdapters(ethAdaptersDict.values())
        virtAdaptList = getVirtualEthAdapters(ethAdaptersDict.values())
        seaAdaptList = getSeaAdapters(ethAdaptersDict.values())
        linkAggrAdaptList = getLinkAggregationInterfaces(ethAdaptersDict.values())
        calculateAdaptersSpeed(linkAggrAdaptList, ethAdaptersDict)
        calculateAdaptersSpeed(seaAdaptList, ethAdaptersDict)
        calculateAdaptersSpeed(virtAdaptList, ethAdaptersDict)

        volumeGroupsDict = discoverVolumeGroups(shell)
        physicalVolumeDict = discoverPhysicalVolumes(shell)
        logicalVolumeDict = discoverLogicalVolumes(shell, volumeGroupsDict)
        if isVio:
            scsiAdaptersList = discoverScsi(shell, physicalVolumeDict, logicalVolumeDict)
            (scsiManList, pvAssignList) = discoverPhysScsiAndRaid(shell, physicalVolumeDict)
        else:
            (scsiManList, pvAssignList) = discoverLparPhysScsiAndRaid(shell, physicalVolumeDict)
    elif osType and osType.upper() == 'LINUX':
        scsiAdaptersList = discoverLinuxVScsiAdapters(shell)
        (volumeGroupsDict, logicalVolumeDict, physicalVolumeDict) = discoverLinuxStorageInfo(shell)
    ethAdaptersDict = {}
    if physAdaptList:
        for physAdapt in physAdaptList:
            physAdaptOsh = createInterfaceOsh(physAdapt, hostOsh)
            linkOsh = modeling.createLinkOSH('contained', managedSystemOsh, physAdaptOsh)
            vector.add(linkOsh)
            if physAdapt.physicalPath:
                ioSlot = ibm_hmc_lib.IoSlot()
                ioSlot.name = physAdapt.physicalPath
                ioSlot.drcName = physAdapt.physicalPath
                ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(ioSlot.drcName)
                ioSlotOsh = None
                if isPhysicalSlot(ioSlot):
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, managedSystemOsh)
                else:
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh)
                linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, physAdaptOsh)
                vector.add(ioSlotOsh)
                vector.add(linkOsh)

            if ethAliasesList:
                for aliasName in ['en'+str(physAdapt.interfaceIndex), 'et'+str(physAdapt.interfaceIndex)]:
                    if aliasName in ethAliasesList:
                        aliasOsh = createAliasOsh(aliasName, hostOsh, physAdapt)
                        if aliasOsh:
                            vector.add(aliasOsh)
                            vector.add(vector.add(modeling.createLinkOSH('realization', physAdaptOsh, aliasOsh)))
            if logger.Version().getVersion(framework) < 9:
                interfaceIndexOsh = createInterfaceIndexOsh(physAdapt, hostOsh)
                if interfaceIndexOsh:
                    linkOsh = modeling.createLinkOSH('parent', interfaceIndexOsh, physAdaptOsh)
                    vector.add(interfaceIndexOsh)
                    vector.add(linkOsh)
#            vector.add(physAdaptOsh)
            ethAdaptersDict[physAdapt.name] = physAdaptOsh
    if linkAggrAdaptList:
        for linkAggr in linkAggrAdaptList:
            linkAggrOsh = createLinkAggrOsh(linkAggr, hostOsh)
            if linkAggr.usedAdapters:
                vector.add(linkAggrOsh)
                ethAdaptersDict[linkAggr.name] = linkAggrOsh
                for usedAdapterName in linkAggr.usedAdapters:
                    physAdaptOsh = ethAdaptersDict.get(usedAdapterName)
                    if physAdaptOsh:
                        #change the KEY attribute for the Physical Ethernet Adapter
                        mac = physAdaptOsh.getAttributeValue('interface_macaddr')
                        newKey = '%s_%s' % (mac, usedAdapterName)
                        physAdaptOsh.setAttribute('interface_macaddr', newKey)
                        ethAdaptersDict[usedAdapterName] = physAdaptOsh
                        linkOsh = modeling.createLinkOSH('member', linkAggrOsh, physAdaptOsh)
                        vector.add(linkOsh)
            if linkAggr.backupAdapter:
                ethBackOsh = ethAdaptersDict.get(linkAggr.backupAdapter)
                linkOsh = modeling.createLinkOSH('member', linkAggrOsh, ethBackOsh)
                vector.add(linkOsh)
    #Adding Physical ETH adapters to the result vector
    if ethAdaptersDict:
        for physAdaptOsh in ethAdaptersDict.values():
            vector.add(physAdaptOsh)
    if seaAdaptList:
        for seaAdapter in seaAdaptList:
            seaAdapterOsh = createSeaOsh(seaAdapter, hostOsh)
            if seaAdapter.usedAdapters:
                vector.add(seaAdapterOsh)
                ethAdaptersDict[seaAdapter.name] = seaAdapterOsh
                for usedAdapterName in seaAdapter.usedAdapters:
                    backAdapterOsh = ethAdaptersDict.get(usedAdapterName)
                    if backAdapterOsh:
                        linkOsh = modeling.createLinkOSH('use', seaAdapterOsh, backAdapterOsh)
                        vector.add(linkOsh)
    if virtAdaptList:
        for virtualAdapter in virtAdaptList:
            virtAdapterOsh = ibm_hmc_lib.createVEthOsh(virtualAdapter, hostOsh)
            vector.add(virtAdapterOsh)
            if ethAliasesList:
                for aliasName in ['en'+str(virtualAdapter.interfaceIndex), 'et'+str(virtualAdapter.interfaceIndex)]:
                        if aliasName in ethAliasesList:
                            aliasOsh = createAliasOsh(aliasName, hostOsh, virtualAdapter)
                            if aliasOsh:
                                vector.add(aliasOsh)
                                vector.add(vector.add(modeling.createLinkOSH('realization', virtAdapterOsh, aliasOsh)))
            if virtualAdapter.usedAdapters:
                for usedAdapterName in virtualAdapter.usedAdapters:
                    backAdapterOsh = ethAdaptersDict.get(usedAdapterName)
                    if backAdapterOsh:
                        linkOsh = modeling.createLinkOSH('use', virtAdapterOsh, backAdapterOsh)
                        vector.add(linkOsh)
#FIXME: move to function to avoid code dups
            if virtualAdapter.physicalPath:
                ioSlot = ibm_hmc_lib.IoSlot()
                ioSlot.name = virtualAdapter.physicalPath
                ioSlot.drcName = virtualAdapter.physicalPath
                ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(ioSlot.drcName)
                if isPhysicalSlot(ioSlot):
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, managedSystemOsh)
                else:
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh)
                linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, virtAdapterOsh)
                vector.add(ioSlotOsh)
                vector.add(linkOsh)

    if fiberChannelAdaptersList:
        for fiberChannelAdapter in fiberChannelAdaptersList:
            fiberChannelOsh = createFiberChannelOsh(fiberChannelAdapter, managedSystemOsh)
            vector.add(fiberChannelOsh)
            linkOsh = modeling.createLinkOSH('contained', hostOsh, fiberChannelOsh)
            vector.add(linkOsh)
            if fiberChannelAdapter.physPath:
                ioSlot = ibm_hmc_lib.IoSlot()
                ioSlot.name = fiberChannelAdapter.physPath
                ioSlot.drcName = fiberChannelAdapter.physPath
                ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(ioSlot.drcName)
                ioSlotOsh = None
                if isPhysicalSlot(ioSlot):
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, managedSystemOsh)
                else:
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh)
                linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, fiberChannelOsh)
                vector.add(ioSlotOsh)
                vector.add(linkOsh)
    #create Storage Topology
    vector.addAll(storage_topology.createStorageTopology(volumeGroupsDict.values(), logicalVolumeDict.values(), physicalVolumeDict.values(), scsiAdaptersList, hostOsh))
    if scsiManList and pvAssignList:
        pScsiDict = {}
        for scsi in scsiManList:
            scsiOsh = None
            ioSlot = ibm_hmc_lib.IoSlot()
            ioSlot.name = scsi.physicalPath
            ioSlot.drcName = scsi.physicalPath
            ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(ioSlot.drcName)
            ioSlotOsh = None
            if isPhysicalSlot(ioSlot):
                ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, managedSystemOsh)
                scsiOsh = storage_topology.createScsiAdapterOsh(scsi, managedSystemOsh)
                linkOsh = modeling.createLinkOSH('contained', hostOsh, scsiOsh)
                vector.add(linkOsh)
            else:
                ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh)
                scsiOsh = storage_topology.createScsiAdapterOsh(scsi, hostOsh)
            vector.add(scsiOsh)
            pScsiDict[scsi.slotNumber] = scsiOsh
            linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, scsiOsh)
            vector.add(ioSlotOsh)
            vector.add(linkOsh)
        for pv in pvAssignList:
            pvOsh = storage_topology.createPhysicalVolumeOsh(pv, hostOsh)
            scsiOsh = pScsiDict.get(pv.scsiAdapterSlotNumber)
            if pvOsh and scsiOsh:
                vector.add(pvOsh)
                linkOsh = modeling.createLinkOSH("depend", pvOsh, scsiOsh)
                vector.add(linkOsh)

    return vector
def createAliasOsh(aliasName, hostOsh, physAdapt):
    if aliasName and hostOsh and physAdapt:
        aliasOsh = createInterfaceOsh(physAdapt, hostOsh)
        aliasOsh.setStringAttribute('interface_name', aliasName)
        aliasOsh.setBoolAttribute('isvirtual', 1)
        return aliasOsh
def createLinkAggrOsh(linkAggregation, hostOsh):
    if linkAggregation and hostOsh:
        linkAggregation.className = 'interface_aggregation'
        return createInterfaceOsh(linkAggregation, hostOsh)
def doDiscovery(shell, hostOsh, managedSystemOsh, framework, osType):
    vector = ObjectStateHolderVector()
    scsiAdaptersList = []
    physAdaptList = []
    virtAdaptList = []
    seaAdaptList = []
    linkAggrAdaptList = []
    volumeGroupsDict = {}
    physicalVolumeDict = {}
    logicalVolumeDict = {}
    scsiManList = []
    pvAssignList = []
    fiberChannelAdaptersList = []
    ethAliasesList = []
    isVio = ibm_hmc_lib.isVio(shell)

    try:
        cpus = discover_cpus(shell, framework, isVio)
        for cpu in cpus:
            cpuOsh = modeling.createCpuOsh(cpu.idStr,
                                           managedSystemOsh,
                                           cpu.speed,
                                           cpu.coresCount,
                                           'ibm_corp',
                                           data_name=cpu.model)
            vector.add(cpuOsh)
    except:
        logger.errorException('')
        framework.reportWarning('Failed to discover CPUs')

    if osType and osType.upper() == 'AIX':
        try:
            fiberChannelAdaptersList = discoverFiberChannels(shell)
        except:
            framework.reportWarning(
                "Failed to discover Fibre Channel adapters")
        ethAdaptersDict = {}
        if isVio:
            ethAdaptersDict = discoverEthernetAdapters(shell)
            ethAliasesList = discoverEhernetAdapterAliasses(shell)
        else:
            ethAdaptersDict = discoverAixLparEthernetAdapters(shell)
        physAdaptList = getPhysicalEthAdapters(ethAdaptersDict.values())
        virtAdaptList = getVirtualEthAdapters(ethAdaptersDict.values())
        seaAdaptList = getSeaAdapters(ethAdaptersDict.values())
        linkAggrAdaptList = getLinkAggregationInterfaces(
            ethAdaptersDict.values())
        calculateAdaptersSpeed(linkAggrAdaptList, ethAdaptersDict)
        calculateAdaptersSpeed(seaAdaptList, ethAdaptersDict)
        calculateAdaptersSpeed(virtAdaptList, ethAdaptersDict)

        volumeGroupsDict = discoverVolumeGroups(shell)
        physicalVolumeDict = discoverPhysicalVolumes(shell)
        logicalVolumeDict = discoverLogicalVolumes(shell, volumeGroupsDict)
        if isVio:
            scsiAdaptersList = discoverScsi(shell, physicalVolumeDict,
                                            logicalVolumeDict)
            (scsiManList,
             pvAssignList) = discoverPhysScsiAndRaid(shell, physicalVolumeDict)
        else:
            (scsiManList, pvAssignList) = discoverLparPhysScsiAndRaid(
                shell, physicalVolumeDict)
    elif osType and osType.upper() == 'LINUX':
        scsiAdaptersList = discoverLinuxVScsiAdapters(shell)
        (volumeGroupsDict, logicalVolumeDict,
         physicalVolumeDict) = discoverLinuxStorageInfo(shell)
    ethAdaptersDict = {}
    if physAdaptList:
        for physAdapt in physAdaptList:
            physAdaptOsh = createInterfaceOsh(physAdapt, hostOsh)
            linkOsh = modeling.createLinkOSH('contained', managedSystemOsh,
                                             physAdaptOsh)
            vector.add(linkOsh)
            if physAdapt.physicalPath:
                ioSlot = ibm_hmc_lib.IoSlot()
                ioSlot.name = physAdapt.physicalPath
                ioSlot.drcName = physAdapt.physicalPath
                ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(
                    ioSlot.drcName)
                ioSlotOsh = None
                if isPhysicalSlot(ioSlot):
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(
                        ioSlot, managedSystemOsh)
                else:
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh)
                linkOsh = modeling.createLinkOSH('contained', ioSlotOsh,
                                                 physAdaptOsh)
                vector.add(ioSlotOsh)
                vector.add(linkOsh)

            if ethAliasesList:
                for aliasName in [
                        'en' + str(physAdapt.interfaceIndex),
                        'et' + str(physAdapt.interfaceIndex)
                ]:
                    if aliasName in ethAliasesList:
                        aliasOsh = createAliasOsh(aliasName, hostOsh,
                                                  physAdapt)
                        if aliasOsh:
                            vector.add(aliasOsh)
                            vector.add(
                                vector.add(
                                    modeling.createLinkOSH(
                                        'realization', physAdaptOsh,
                                        aliasOsh)))
            if logger.Version().getVersion(framework) < 9:
                interfaceIndexOsh = createInterfaceIndexOsh(physAdapt, hostOsh)
                if interfaceIndexOsh:
                    linkOsh = modeling.createLinkOSH('parent',
                                                     interfaceIndexOsh,
                                                     physAdaptOsh)
                    vector.add(interfaceIndexOsh)
                    vector.add(linkOsh)
#            vector.add(physAdaptOsh)
            ethAdaptersDict[physAdapt.name] = physAdaptOsh
    if linkAggrAdaptList:
        for linkAggr in linkAggrAdaptList:
            linkAggrOsh = createLinkAggrOsh(linkAggr, hostOsh)
            if linkAggr.usedAdapters:
                vector.add(linkAggrOsh)
                ethAdaptersDict[linkAggr.name] = linkAggrOsh
                for usedAdapterName in linkAggr.usedAdapters:
                    physAdaptOsh = ethAdaptersDict.get(usedAdapterName)
                    if physAdaptOsh:
                        #change the KEY attribute for the Physical Ethernet Adapter
                        mac = physAdaptOsh.getAttributeValue(
                            'interface_macaddr')
                        newKey = '%s_%s' % (mac, usedAdapterName)
                        physAdaptOsh.setAttribute('interface_macaddr', newKey)
                        ethAdaptersDict[usedAdapterName] = physAdaptOsh
                        linkOsh = modeling.createLinkOSH(
                            'member', linkAggrOsh, physAdaptOsh)
                        vector.add(linkOsh)
            if linkAggr.backupAdapter:
                ethBackOsh = ethAdaptersDict.get(linkAggr.backupAdapter)
                linkOsh = modeling.createLinkOSH('member', linkAggrOsh,
                                                 ethBackOsh)
                vector.add(linkOsh)
    #Adding Physical ETH adapters to the result vector
    if ethAdaptersDict:
        for physAdaptOsh in ethAdaptersDict.values():
            vector.add(physAdaptOsh)
    if seaAdaptList:
        for seaAdapter in seaAdaptList:
            seaAdapterOsh = createSeaOsh(seaAdapter, hostOsh)
            if seaAdapter.usedAdapters:
                vector.add(seaAdapterOsh)
                ethAdaptersDict[seaAdapter.name] = seaAdapterOsh
                for usedAdapterName in seaAdapter.usedAdapters:
                    backAdapterOsh = ethAdaptersDict.get(usedAdapterName)
                    if backAdapterOsh:
                        linkOsh = modeling.createLinkOSH(
                            'use', seaAdapterOsh, backAdapterOsh)
                        vector.add(linkOsh)
    if virtAdaptList:
        for virtualAdapter in virtAdaptList:
            virtAdapterOsh = ibm_hmc_lib.createVEthOsh(virtualAdapter, hostOsh)
            vector.add(virtAdapterOsh)
            if ethAliasesList:
                for aliasName in [
                        'en' + str(virtualAdapter.interfaceIndex),
                        'et' + str(virtualAdapter.interfaceIndex)
                ]:
                    if aliasName in ethAliasesList:
                        aliasOsh = createAliasOsh(aliasName, hostOsh,
                                                  virtualAdapter)
                        if aliasOsh:
                            vector.add(aliasOsh)
                            vector.add(
                                vector.add(
                                    modeling.createLinkOSH(
                                        'realization', virtAdapterOsh,
                                        aliasOsh)))
            if virtualAdapter.usedAdapters:
                for usedAdapterName in virtualAdapter.usedAdapters:
                    backAdapterOsh = ethAdaptersDict.get(usedAdapterName)
                    if backAdapterOsh:
                        linkOsh = modeling.createLinkOSH(
                            'use', virtAdapterOsh, backAdapterOsh)
                        vector.add(linkOsh)
            if virtualAdapter.physicalPath:
                ioSlot = ibm_hmc_lib.IoSlot()
                ioSlot.name = virtualAdapter.physicalPath
                ioSlot.drcName = virtualAdapter.physicalPath
                ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(
                    ioSlot.drcName)
                if isPhysicalSlot(ioSlot):
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(
                        ioSlot, managedSystemOsh)
                else:
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh)
                linkOsh = modeling.createLinkOSH('contained', ioSlotOsh,
                                                 virtAdapterOsh)
                vector.add(ioSlotOsh)
                vector.add(linkOsh)

    if fiberChannelAdaptersList:
        for fiberChannelAdapter in fiberChannelAdaptersList:
            fiberChannelOsh = createFiberChannelOsh(fiberChannelAdapter,
                                                    managedSystemOsh)
            vector.add(fiberChannelOsh)
            linkOsh = modeling.createLinkOSH('contained', hostOsh,
                                             fiberChannelOsh)
            vector.add(linkOsh)
            if fiberChannelAdapter.physPath:
                ioSlot = ibm_hmc_lib.IoSlot()
                ioSlot.name = fiberChannelAdapter.physPath
                ioSlot.drcName = fiberChannelAdapter.physPath
                ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(
                    ioSlot.drcName)
                ioSlotOsh = None
                if isPhysicalSlot(ioSlot):
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(
                        ioSlot, managedSystemOsh)
                else:
                    ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh)
                linkOsh = modeling.createLinkOSH('contained', ioSlotOsh,
                                                 fiberChannelOsh)
                vector.add(ioSlotOsh)
                vector.add(linkOsh)
    #create Storage Topology
    vector.addAll(
        storage_topology.createStorageTopology(volumeGroupsDict.values(),
                                               logicalVolumeDict.values(),
                                               physicalVolumeDict.values(),
                                               scsiAdaptersList, hostOsh))
    if scsiManList and pvAssignList:
        pScsiDict = {}
        for scsi in scsiManList:
            scsiOsh = None
            ioSlot = ibm_hmc_lib.IoSlot()
            ioSlot.name = scsi.physicalPath
            ioSlot.drcName = scsi.physicalPath
            ioSlot.normalizedDrcName = ibm_hmc_lib.normaliseIoSlotDrcName(
                ioSlot.drcName)
            ioSlotOsh = None
            if isPhysicalSlot(ioSlot):
                ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(
                    ioSlot, managedSystemOsh)
                scsiOsh = storage_topology.createScsiAdapterOsh(
                    scsi, managedSystemOsh)
                linkOsh = modeling.createLinkOSH('contained', hostOsh, scsiOsh)
                vector.add(linkOsh)
            else:
                ioSlotOsh = ibm_hmc_lib.createIoSlotOsh(ioSlot, hostOsh)
                scsiOsh = storage_topology.createScsiAdapterOsh(scsi, hostOsh)
            vector.add(scsiOsh)
            pScsiDict[scsi.slotNumber] = scsiOsh
            linkOsh = modeling.createLinkOSH('contained', ioSlotOsh, scsiOsh)
            vector.add(ioSlotOsh)
            vector.add(linkOsh)
        for pv in pvAssignList:
            pvOsh = storage_topology.createPhysicalVolumeOsh(pv, hostOsh)
            scsiOsh = pScsiDict.get(pv.scsiAdapterSlotNumber)
            if pvOsh and scsiOsh:
                vector.add(pvOsh)
                linkOsh = modeling.createLinkOSH("depend", pvOsh, scsiOsh)
                vector.add(linkOsh)

    return vector
def createAliasOsh(aliasName, hostOsh, physAdapt):
    if aliasName and hostOsh and physAdapt:
        aliasOsh = createInterfaceOsh(physAdapt, hostOsh)
        aliasOsh.setStringAttribute('interface_name', aliasName)
        aliasOsh.setBoolAttribute('isvirtual', 1)
        return aliasOsh
def createLinkAggrOsh(linkAggregation, hostOsh):
    if linkAggregation and hostOsh:
        linkAggregation.className = 'interface_aggregation'
        return createInterfaceOsh(linkAggregation, hostOsh)