Search in sources :

Example 6 with ConfigResolveClass

use of com.emc.cloud.platform.ucs.in.model.ConfigResolveClass in project coprhd-controller by CoprHD.

the class UCSMServiceImpl method getFICUplinkPorts.

@Override
public Map<String, FcPIo> getFICUplinkPorts(String ucsmURL, String username, String password) throws ClientGeneralException {
    Map<String, FcPIo> uplinkMap = new HashMap<String, FcPIo>();
    ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
    ConfigResolveClass configResolveClass = new ConfigResolveClass();
    configResolveClass.setClassId(NamingClassId.FC_P_IO);
    configResolveClass.setInHierarchical("false");
    com.emc.cloud.platform.ucs.out.model.ConfigResolveClass configResolveClassOut = computeSession.execute(factory.createConfigResolveClass(configResolveClass), com.emc.cloud.platform.ucs.out.model.ConfigResolveClass.class);
    for (JAXBElement<?> managedObject : getConfigSetManagedObjects(configResolveClassOut)) {
        if (managedObject.getValue() instanceof FcPIo) {
            uplinkMap.put(((FcPIo) managedObject.getValue()).getDn(), (FcPIo) managedObject.getValue());
        }
    }
    return uplinkMap;
}
Also used : FcPIo(com.emc.cloud.platform.ucs.out.model.FcPIo) HashMap(java.util.HashMap) ConfigResolveClass(com.emc.cloud.platform.ucs.in.model.ConfigResolveClass)

Example 7 with ConfigResolveClass

use of com.emc.cloud.platform.ucs.in.model.ConfigResolveClass in project coprhd-controller by CoprHD.

the class UCSMServiceImpl method getComputeBlades.

@Override
public List<ComputeBlade> getComputeBlades(String ucsmURL, String username, String password) throws ClientGeneralException {
    List<ComputeBlade> blades = new ArrayList<ComputeBlade>();
    try {
        ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
        ConfigResolveClass configResolveClass = new ConfigResolveClass();
        configResolveClass.setClassId(NamingClassId.COMPUTE_ITEM);
        configResolveClass.setInHierarchical("true");
        com.emc.cloud.platform.ucs.out.model.ConfigResolveClass configResolveClassOut = computeSession.execute(factory.createConfigResolveClass(configResolveClass), com.emc.cloud.platform.ucs.out.model.ConfigResolveClass.class);
        ConfigSet configSet = null;
        if (configResolveClassOut.getContent() != null && !configResolveClassOut.getContent().isEmpty()) {
            for (Object object : configResolveClassOut.getContent()) {
                if (object instanceof JAXBElement<?>) {
                    if (!(((JAXBElement) object).getValue() instanceof ConfigSet)) {
                        continue;
                    }
                    configSet = ((JAXBElement<ConfigSet>) object).getValue();
                    if (configSet != null && configSet.getManagedObject() != null && !configSet.getManagedObject().isEmpty()) {
                        for (JAXBElement<?> managedObject : configSet.getManagedObject()) {
                            if (managedObject.getValue() instanceof ComputeBlade) {
                                blades.add((ComputeBlade) managedObject.getValue());
                            }
                        }
                    }
                }
            }
        }
    } catch (ClientGeneralException e) {
        log.warn("Unable to get compute elements", e);
        throw e;
    }
    return blades;
}
Also used : ComputeBlade(com.emc.cloud.platform.ucs.out.model.ComputeBlade) ArrayList(java.util.ArrayList) ConfigResolveClass(com.emc.cloud.platform.ucs.in.model.ConfigResolveClass) JAXBElement(javax.xml.bind.JAXBElement) ConfigSet(com.emc.cloud.platform.ucs.out.model.ConfigSet) ClientGeneralException(com.emc.cloud.platform.clientlib.ClientGeneralException)

Example 8 with ConfigResolveClass

use of com.emc.cloud.platform.ucs.in.model.ConfigResolveClass in project coprhd-controller by CoprHD.

the class UCSMServiceImpl method getVlanById.

@Override
public FabricVlan getVlanById(String ucsmURL, String username, String password, String vlanId) throws ClientGeneralException {
    ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
    ConfigResolveClass configResolveClass = new ConfigResolveClass();
    configResolveClass.setClassId(NamingClassId.FABRIC_VLAN);
    configResolveClass.setInHierarchical("true");
    FilterFilter inFilter = new FilterFilter();
    EqFilter eqFilter = new EqFilter();
    eqFilter.setProperty("id");
    eqFilter.setClazz(NamingClassId.FABRIC_VLAN);
    eqFilter.setValue(vlanId);
    inFilter.setAbstractFilter(factory.createEq(eqFilter));
    configResolveClass.getContent().add(new JAXBElement<FilterFilter>(new QName("inFilter"), FilterFilter.class, inFilter));
    com.emc.cloud.platform.ucs.out.model.ConfigResolveClass configResolveClassOut = computeSession.execute(factory.createConfigResolveClass(configResolveClass), com.emc.cloud.platform.ucs.out.model.ConfigResolveClass.class);
    ConfigSet configSet = null;
    if (configResolveClassOut.getContent() != null && !configResolveClassOut.getContent().isEmpty()) {
        for (Object object : configResolveClassOut.getContent()) {
            if (object instanceof JAXBElement<?>) {
                if (!(((JAXBElement) object).getValue() instanceof ConfigSet)) {
                    continue;
                }
                configSet = ((JAXBElement<ConfigSet>) object).getValue();
                if (configSet != null && configSet.getManagedObject() != null && !configSet.getManagedObject().isEmpty()) {
                    for (JAXBElement<?> managedObject : configSet.getManagedObject()) {
                        if (managedObject.getValue() instanceof FabricVlan) {
                            return (FabricVlan) managedObject.getValue();
                        }
                    }
                }
            }
        }
    }
    return null;
}
Also used : QName(javax.xml.namespace.QName) ConfigResolveClass(com.emc.cloud.platform.ucs.in.model.ConfigResolveClass) JAXBElement(javax.xml.bind.JAXBElement) FabricVlan(com.emc.cloud.platform.ucs.out.model.FabricVlan) FilterFilter(com.emc.cloud.platform.ucs.in.model.FilterFilter) EqFilter(com.emc.cloud.platform.ucs.in.model.EqFilter) ConfigSet(com.emc.cloud.platform.ucs.out.model.ConfigSet)

Example 9 with ConfigResolveClass

use of com.emc.cloud.platform.ucs.in.model.ConfigResolveClass in project coprhd-controller by CoprHD.

the class UCSMServiceImpl method getUcsVlans.

@Override
public List<FabricVlan> getUcsVlans(String ucsmURL, String username, String password) throws ClientGeneralException {
    List<FabricVlan> vlanList = new ArrayList<FabricVlan>();
    ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
    ConfigResolveClass configResolveClass = new ConfigResolveClass();
    configResolveClass.setClassId(NamingClassId.FABRIC_VLAN);
    configResolveClass.setInHierarchical("false");
    com.emc.cloud.platform.ucs.out.model.ConfigResolveClass configResolveClassOut = computeSession.execute(factory.createConfigResolveClass(configResolveClass), com.emc.cloud.platform.ucs.out.model.ConfigResolveClass.class);
    for (JAXBElement<?> managedObject : getConfigSetManagedObjects(configResolveClassOut)) {
        if (managedObject.getValue() instanceof FabricVlan) {
            vlanList.add((FabricVlan) managedObject.getValue());
        }
    }
    return vlanList;
}
Also used : ArrayList(java.util.ArrayList) ConfigResolveClass(com.emc.cloud.platform.ucs.in.model.ConfigResolveClass) FabricVlan(com.emc.cloud.platform.ucs.out.model.FabricVlan)

Example 10 with ConfigResolveClass

use of com.emc.cloud.platform.ucs.in.model.ConfigResolveClass in project coprhd-controller by CoprHD.

the class UCSMServiceImpl method getUplinkPortChannels.

@Override
public Map<String, SwFcSanPc> getUplinkPortChannels(String ucsmURL, String username, String password) throws ClientGeneralException {
    Map<String, SwFcSanPc> switchFcInterfaceMap = new HashMap<String, SwFcSanPc>();
    ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
    ConfigResolveClass configResolveClass = new ConfigResolveClass();
    configResolveClass.setClassId(NamingClassId.SW_FC_SAN_PC);
    configResolveClass.setInHierarchical("true");
    com.emc.cloud.platform.ucs.out.model.ConfigResolveClass configResolveClassOut = computeSession.execute(factory.createConfigResolveClass(configResolveClass), com.emc.cloud.platform.ucs.out.model.ConfigResolveClass.class);
    for (JAXBElement<?> managedObject : getConfigSetManagedObjects(configResolveClassOut)) {
        if (managedObject.getValue() instanceof SwFcSanPc) {
            switchFcInterfaceMap.put(((SwFcSanPc) managedObject.getValue()).getDn(), (SwFcSanPc) managedObject.getValue());
        }
    }
    return switchFcInterfaceMap;
}
Also used : HashMap(java.util.HashMap) ConfigResolveClass(com.emc.cloud.platform.ucs.in.model.ConfigResolveClass) SwFcSanPc(com.emc.cloud.platform.ucs.out.model.SwFcSanPc)

Aggregations

ConfigResolveClass (com.emc.cloud.platform.ucs.in.model.ConfigResolveClass)16 ConfigSet (com.emc.cloud.platform.ucs.out.model.ConfigSet)6 JAXBElement (javax.xml.bind.JAXBElement)6 ClientGeneralException (com.emc.cloud.platform.clientlib.ClientGeneralException)4 EqFilter (com.emc.cloud.platform.ucs.in.model.EqFilter)4 FilterFilter (com.emc.cloud.platform.ucs.in.model.FilterFilter)4 LsServer (com.emc.cloud.platform.ucs.out.model.LsServer)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 QName (javax.xml.namespace.QName)4 FabricVlan (com.emc.cloud.platform.ucs.out.model.FabricVlan)2 OrFilter (com.emc.cloud.platform.ucs.in.model.OrFilter)1 ComputeBlade (com.emc.cloud.platform.ucs.out.model.ComputeBlade)1 FabricFcSanEp (com.emc.cloud.platform.ucs.out.model.FabricFcSanEp)1 FabricVsan (com.emc.cloud.platform.ucs.out.model.FabricVsan)1 FcPIo (com.emc.cloud.platform.ucs.out.model.FcPIo)1 SwFcSanEp (com.emc.cloud.platform.ucs.out.model.SwFcSanEp)1 SwFcSanPc (com.emc.cloud.platform.ucs.out.model.SwFcSanPc)1 SwVsan (com.emc.cloud.platform.ucs.out.model.SwVsan)1 VnicLanConnTempl (com.emc.cloud.platform.ucs.out.model.VnicLanConnTempl)1