use of com.emc.cloud.platform.ucs.out.model.SwFcSanEp 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;
}
use of com.emc.cloud.platform.ucs.out.model.SwFcSanEp in project coprhd-controller by CoprHD.
the class UcsDiscoveryWorker method getUnpinnedVSans.
/**
* Created COPP-38 to track the sonar issue.
*
* @param vsanList
* @param fcInterfaceMap
* @return
*/
@SuppressWarnings({ "squid:S2175" })
private Map<String, Set<String>> getUnpinnedVSans(List<SwVsan> vsanList, Map<String, SwFcSanEp> fcInterfaceMap) {
Map<String, Set<String>> switchWiseVsan = new HashMap<>();
for (SwVsan vsan : vsanList) {
if (switchWiseVsan.containsKey(vsan.getSwitchId())) {
switchWiseVsan.get(vsan.getSwitchId()).add(vsan.getId());
} else {
Set<String> set = new HashSet<>();
set.add(vsan.getId());
switchWiseVsan.put(vsan.getSwitchId(), set);
}
}
for (SwFcSanEp swInterfaces : fcInterfaceMap.values()) {
Set<String> vsanSet = switchWiseVsan.get(swInterfaces.getSwitchId());
if (vsanSet == null) {
continue;
}
if (vsanSet.contains(swInterfaces.getPortVsanId())) {
vsanSet.remove(swInterfaces.getPortVsanId());
}
}
return switchWiseVsan;
}
use of com.emc.cloud.platform.ucs.out.model.SwFcSanEp in project coprhd-controller by CoprHD.
the class UcsDiscoveryWorker method discoverComputeSystem.
public void discoverComputeSystem(URI computeSystemURI) {
String ucsmVersion;
ComputeSystem cs = _dbClient.queryObject(ComputeSystem.class, computeSystemURI);
_log.info("Inside discoverComputeSystems of class : " + getClass().toString());
URL ucsmURL = getUcsmURL(cs);
List<ComputeBlade> computeBlades;
List<LsServer> allServiceProfiles;
Map<String, LsServer> associatedLsServers;
List<LsServer> serviceProfileTemplates;
List<VnicLanConnTempl> vnicTemplates;
List<VnicSanConnTempl> vhbaTemplates;
Map<String, FcPIo> uplinkMap;
Map<String, SwFcSanEp> fcInterfaceMap;
List<SwVsan> vsanList;
Map<String, SwFcSanPc> portChannelMap;
List<FabricVlan> vlanList;
List<FabricVsan> vsanFabricList;
List<com.emc.cloud.platform.ucs.out.model.LsbootPolicy> bootPolicies;
try {
ucsmVersion = ucsmService.getDeviceVersion(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
verifyVersion(cs, ucsmVersion);
computeBlades = ucsmService.getComputeBlades(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
allServiceProfiles = ucsmService.getAllServiceProfiles(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
associatedLsServers = ucsmService.getAllAssociatedLsServers(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
serviceProfileTemplates = ucsmService.getServiceProfileTemplates(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
bootPolicies = ucsmService.getBootPolicies(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
vnicTemplates = ucsmService.getVnicTemplates(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
vhbaTemplates = ucsmService.getVhbaTemplates(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
uplinkMap = ucsmService.getFICUplinkPorts(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
fcInterfaceMap = ucsmService.getSwitchFCInterfaces(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
vsanList = ucsmService.getUcsSwitchVSans(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
portChannelMap = ucsmService.getUplinkPortChannels(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
vlanList = ucsmService.getUcsVlans(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
vsanFabricList = ucsmService.getUcsFabricVsans(ucsmURL.toString(), cs.getUsername(), cs.getPassword());
} catch (Exception e) {
_log.error("Failed to pull device data: " + cs.getId(), e);
if (e.getCause() != null && e.getCause().getMessage() != null) {
cs.setLastDiscoveryStatusMessage(e.getCause().getMessage());
} else {
cs.setLastDiscoveryStatusMessage(e.getMessage());
}
_dbClient.updateObject(cs);
throw ComputeSystemControllerException.exceptions.discoverFailed(computeSystemURI.toString(), e);
}
try {
reconcileServiceProfileTemplates(cs, serviceProfileTemplates);
reconcileServiceProfiles(cs, allServiceProfiles);
reconcileComputeBlades(cs, computeBlades, associatedLsServers);
reconcileVhbas(cs, associatedLsServers, new VhbaHelper(vsanFabricList));
reconcileServiceProfileTemplatesHBAs(cs, serviceProfileTemplates, new VhbaHelper(vsanFabricList));
reconcileServiceProfileTemplatesVnics(cs, serviceProfileTemplates);
reconcileServiceProfileTemplatesBootDefinitions(cs, serviceProfileTemplates);
reconcileBootPolicies(cs, bootPolicies);
reconcileVnicTemplates(cs, vnicTemplates);
reconcileVhbaTemplates(cs, vhbaTemplates);
Map<String, Set<String>> unpinnedVsans = getUnpinnedVSans(vsanList, fcInterfaceMap);
reconcileUplinkPorts(cs, uplinkMap, fcInterfaceMap, unpinnedVsans);
reconcileUplinkPortChannels(cs, portChannelMap, unpinnedVsans);
reconcileVlans(cs, vlanList);
associateComputeImageServer(cs);
matchComputeBladesToHosts(cs);
cs.setLastDiscoveryRunTime(Calendar.getInstance().getTimeInMillis());
cs.setSuccessDiscoveryTime(Calendar.getInstance().getTimeInMillis());
cs.setDiscoveryStatus(DiscoveredDataObject.DataCollectionJobStatus.COMPLETE.name());
} catch (ComputeSystemControllerException e) {
cs.setLastDiscoveryStatusMessage(e.getMessage());
throw ComputeSystemControllerException.exceptions.discoverFailed(cs.getId().toString(), e);
} finally {
_dbClient.persistObject(cs);
}
}
use of com.emc.cloud.platform.ucs.out.model.SwFcSanEp in project coprhd-controller by CoprHD.
the class UcsDiscoveryWorker method updateUplinkPorts.
private void updateUplinkPorts(ComputeFabricUplinkPort cfup, FcPIo fcPIo, Map<String, SwFcSanEp> fcInterfaceMap, Map<String, Set<String>> unpinnedVsans) {
SwFcSanEp fcInterface = fcInterfaceMap.get(fcPIo.getDn());
if (fcInterface != null) {
// Set vSanId
String vsanId = fcInterface.getPortVsanId();
cfup.setVsanId(vsanId);
/*
* If
* the VSAN ID 1 is the default, then a defaulted port will trunk all non-pinned VSANs
* else
* the VSAN will only be available via the pinned port(s)
*/
if (vsanId.equals("1") && unpinnedVsans.get(fcPIo.getSwitchId()) != null) {
StringSet vsanStringSet = new StringSet();
vsanStringSet.add(vsanId);
cfup.setVsans(vsanStringSet);
cfup.addVsans(unpinnedVsans.get(fcPIo.getSwitchId()));
} else {
Set<String> vsanSet = new HashSet<>();
vsanSet.add(vsanId);
cfup.addVsans(vsanSet);
}
cfup.setPeerDn(fcInterface.getPeerDn());
}
cfup.setSwitchId(fcPIo.getSwitchId());
cfup.setWwpn(fcPIo.getWwn());
}
Aggregations