Search in sources :

Example 1 with ConfigResolveClass

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

the class UCSMServiceImpl method getVnicTemplates.

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

Example 2 with ConfigResolveClass

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

the class UCSMServiceImpl method getAllLsServers.

private List<LsServer> getAllLsServers(String ucsmURL, String username, String password, boolean serviceProfilesOnly) throws ClientGeneralException {
    List<LsServer> lsServers = Collections.synchronizedList(new ArrayList<LsServer>());
    try {
        ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
        ConfigResolveClass configResolveClass = new ConfigResolveClass();
        configResolveClass.setClassId(NamingClassId.LS_SERVER);
        configResolveClass.setInHierarchical("true");
        // configResolveClass.getContent();
        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();
                                if (serviceProfilesOnly && !(lsServer.getType().equals("instance"))) {
                                    continue;
                                }
                                lsServers.add(lsServer);
                            }
                        }
                    }
                }
            }
        }
    } catch (ClientGeneralException e) {
        log.error("Unable to get all lsServers", e);
        throw e;
    }
    return lsServers;
}
Also used : LsServer(com.emc.cloud.platform.ucs.out.model.LsServer) 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 3 with ConfigResolveClass

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

the class UCSMServiceImpl method getUplinkFCInterfaces.

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

Example 4 with ConfigResolveClass

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

the class UCSMServiceImpl method getUcsFabricVsans.

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

Example 5 with ConfigResolveClass

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

the class UCSMServiceImpl method getVhbaTemplates.

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

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