use of com.emc.cloud.platform.ucs.out.model.ConfigSet 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;
}
use of com.emc.cloud.platform.ucs.out.model.ConfigSet in project coprhd-controller by CoprHD.
the class UCSMServiceImpl method getServiceProfileTemplates.
@Override
public List<LsServer> getServiceProfileTemplates(String ucsmURL, String username, String password) throws ClientGeneralException {
List<LsServer> serviceProfileTemplates = Collections.synchronizedList(new ArrayList<LsServer>());
ComputeSession computeSession = sessionManager.getSession(ucsmURL, username, password);
ConfigResolveClass configResolveClass = new ConfigResolveClass();
configResolveClass.setClassId(NamingClassId.LS_SERVER);
configResolveClass.setInHierarchical("true");
FilterFilter inFilter = new FilterFilter();
OrFilter orFilter = new OrFilter();
EqFilter eqFilterInitTemplate = new EqFilter();
eqFilterInitTemplate.setProperty("type");
eqFilterInitTemplate.setClazz(NamingClassId.LS_SERVER);
eqFilterInitTemplate.setValue("initial-template");
EqFilter eqFilterUpdatingTemplate = new EqFilter();
eqFilterUpdatingTemplate.setProperty("type");
eqFilterUpdatingTemplate.setClazz(NamingClassId.LS_SERVER);
eqFilterUpdatingTemplate.setValue("updating-template");
orFilter.getAbstractFilter().add(factory.createEq(eqFilterUpdatingTemplate));
orFilter.getAbstractFilter().add(factory.createEq(eqFilterInitTemplate));
inFilter.setAbstractFilter(factory.createOr(orFilter));
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) {
serviceProfileTemplates.add((LsServer) managedObject.getValue());
LsServer spt = (LsServer) managedObject.getValue();
log.info("SPT Name:" + spt.getName());
}
}
}
}
}
}
return serviceProfileTemplates;
}
use of com.emc.cloud.platform.ucs.out.model.ConfigSet in project coprhd-controller by CoprHD.
the class UcsLoginLogoutTest method getBlades.
@Test(groups = "runByDefault", dependsOnMethods = "testGetBladeDNs")
public void getBlades() throws ClientGeneralException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
ConfigResolveDns configResolveDns = new ConfigResolveDns();
configResolveDns.setInHierarchical("false");
com.emc.cloud.platform.ucs.in.model.DnSet inDnSet = new com.emc.cloud.platform.ucs.in.model.DnSet();
for (Dn dn : this.dnSet.getDn()) {
com.emc.cloud.platform.ucs.in.model.DnSet.Dn inDn = new com.emc.cloud.platform.ucs.in.model.DnSet.Dn();
inDn.setValue(dn.getValue());
inDnSet.getDn().add(inDn);
}
configResolveDns.getContent().add(new JAXBElement<com.emc.cloud.platform.ucs.in.model.DnSet>(new QName("inDns"), com.emc.cloud.platform.ucs.in.model.DnSet.class, inDnSet));
com.emc.cloud.platform.ucs.out.model.ConfigResolveDns configResolveDnsOut = clientHttpMethods.postEntity(factory.createConfigResolveDns(configResolveDns), com.emc.cloud.platform.ucs.out.model.ConfigResolveDns.class);
System.out.println(BeanUtils.describe(configResolveDnsOut));
if (configResolveDnsOut.getContent() != null && !configResolveDnsOut.getContent().isEmpty()) {
for (Object object : configResolveDnsOut.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()) {
System.out.println("\t\t" + BeanUtils.describe(managedObject.getValue()));
}
}
}
}
}
}
Aggregations