Search in sources :

Example 11 with ConfigResolveClass

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

the class UCSMServiceImpl method getLsServer.

public LsServer getLsServer(ComputeSession computeSession, String uuid) throws ClientGeneralException {
    try {
        ConfigResolveClass configResolveClass = new ConfigResolveClass();
        configResolveClass.setClassId(NamingClassId.LS_SERVER);
        configResolveClass.setInHierarchical("true");
        // configResolveClass.getContent()
        FilterFilter inFilter = new FilterFilter();
        EqFilter eqFilter = new EqFilter();
        eqFilter.setClazz(NamingClassId.LS_SERVER);
        eqFilter.setProperty("uuid");
        eqFilter.setValue(uuid);
        inFilter.setAbstractFilter(factory.createEq(eqFilter));
        configResolveClass.getContent().add(new JAXBElement<>(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 LsServer) {
                                return (LsServer) managedObject.getValue();
                            }
                        }
                    }
                }
            }
        }
    } catch (ClientGeneralException e) {
        log.error("Unable to get all associated lsServers", e);
        throw e;
    }
    return null;
}
Also used : QName(javax.xml.namespace.QName) LsServer(com.emc.cloud.platform.ucs.out.model.LsServer) ConfigResolveClass(com.emc.cloud.platform.ucs.in.model.ConfigResolveClass) JAXBElement(javax.xml.bind.JAXBElement) 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) ClientGeneralException(com.emc.cloud.platform.clientlib.ClientGeneralException)

Example 12 with ConfigResolveClass

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

the class UCSMServiceImpl method getUcsSwitchVSans.

@Override
public List<SwVsan> getUcsSwitchVSans(String ucsmURL, String username, String password) throws ClientGeneralException {
    List<SwVsan> vSanList = new ArrayList<SwVsan>();
    ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
    ConfigResolveClass configResolveClass = new ConfigResolveClass();
    configResolveClass.setClassId(NamingClassId.SW_VSAN);
    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 SwVsan) {
            vSanList.add((SwVsan) managedObject.getValue());
        }
    }
    return vSanList;
}
Also used : ArrayList(java.util.ArrayList) SwVsan(com.emc.cloud.platform.ucs.out.model.SwVsan) ConfigResolveClass(com.emc.cloud.platform.ucs.in.model.ConfigResolveClass)

Example 13 with ConfigResolveClass

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

the class UCSMServiceImpl method getBootPolicies.

@Override
public List<com.emc.cloud.platform.ucs.out.model.LsbootPolicy> getBootPolicies(String ucsmURL, String username, String password) throws ClientGeneralException {
    List<com.emc.cloud.platform.ucs.out.model.LsbootPolicy> bootPolicies = Collections.synchronizedList(new ArrayList<com.emc.cloud.platform.ucs.out.model.LsbootPolicy>());
    ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
    ConfigResolveClass configResolveClass = new ConfigResolveClass();
    configResolveClass.setClassId(NamingClassId.LSBOOT_POLICY);
    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 com.emc.cloud.platform.ucs.out.model.LsbootPolicy) {
            bootPolicies.add((com.emc.cloud.platform.ucs.out.model.LsbootPolicy) managedObject.getValue());
        }
    }
    return bootPolicies;
}
Also used : ConfigResolveClass(com.emc.cloud.platform.ucs.in.model.ConfigResolveClass)

Example 14 with ConfigResolveClass

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

the class UCSMServiceImpl method getSwitchFCInterfaces.

@Override
public Map<String, SwFcSanEp> getSwitchFCInterfaces(String ucsmURL, String username, String password) throws ClientGeneralException {
    Map<String, SwFcSanEp> switchFcInterfaceMap = new HashMap<String, SwFcSanEp>();
    ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
    ConfigResolveClass configResolveClass = new ConfigResolveClass();
    configResolveClass.setClassId(NamingClassId.SW_FC_SAN_EP);
    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 SwFcSanEp) {
            switchFcInterfaceMap.put(((SwFcSanEp) managedObject.getValue()).getEpDn(), (SwFcSanEp) managedObject.getValue());
        }
    }
    return switchFcInterfaceMap;
}
Also used : SwFcSanEp(com.emc.cloud.platform.ucs.out.model.SwFcSanEp) HashMap(java.util.HashMap) ConfigResolveClass(com.emc.cloud.platform.ucs.in.model.ConfigResolveClass)

Example 15 with ConfigResolveClass

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

the class UCSMServiceImpl method getAllAssociatedLsServers.

@Override
public Map<String, LsServer> getAllAssociatedLsServers(String ucsmURL, String username, String password) throws ClientGeneralException {
    Map<String, LsServer> associatedLsServers = Collections.synchronizedMap(new HashMap<String, LsServer>());
    ;
    try {
        ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
        ConfigResolveClass configResolveClass = new ConfigResolveClass();
        configResolveClass.setClassId(NamingClassId.LS_SERVER);
        configResolveClass.setInHierarchical("true");
        // configResolveClass.getContent()
        FilterFilter inFilter = new FilterFilter();
        EqFilter eqFilter = new EqFilter();
        eqFilter.setProperty("assocState");
        eqFilter.setClazz(NamingClassId.LS_SERVER);
        eqFilter.setValue("associated");
        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 LsServer) {
                                LsServer lsServer = (LsServer) managedObject.getValue();
                                associatedLsServers.put(lsServer.getPnDn(), lsServer);
                            }
                        }
                    }
                }
            }
        }
    } catch (ClientGeneralException e) {
        log.error("Unable to get all associated lsServers", e);
        throw e;
    }
    return associatedLsServers;
}
Also used : QName(javax.xml.namespace.QName) LsServer(com.emc.cloud.platform.ucs.out.model.LsServer) ConfigResolveClass(com.emc.cloud.platform.ucs.in.model.ConfigResolveClass) JAXBElement(javax.xml.bind.JAXBElement) 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) ClientGeneralException(com.emc.cloud.platform.clientlib.ClientGeneralException)

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