use of org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo in project so by onap.
the class OofHomingV2 method processPlacementSolution.
/**
* Processes a placement solution list then correlates and sets each placement solution to its corresponding
* resource
*/
private void processPlacementSolution(ServiceInstance serviceInstance, JSONArray placements, int i) {
List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
List<AllottedResource> allottes = serviceInstance.getAllottedResources();
List<GenericVnf> vnfs = serviceInstance.getVnfs();
logger.debug("Processing placement solution " + i + 1);
for (int p = 0; p < placements.length(); p++) {
JSONObject placement = placements.getJSONObject(p);
SolutionInfo solutionInfo = new SolutionInfo();
solutionInfo.setSolutionId(i + 1);
search: {
for (VpnBondingLink vbl : links) {
List<ServiceProxy> proxies = vbl.getServiceProxies();
for (ServiceProxy sp : proxies) {
if (placement.getString(SERVICE_RESOURCE_ID).equals(sp.getId())) {
if (i > 0) {
if (p % 2 == 0) {
VpnBondingLink vblNew = (VpnBondingLink) SerializationUtils.clone(vbl);
vblNew.setVpnBondingLinkId(UUID.randomUUID().toString());
links.add(vblNew);
}
links.get(links.size() - 1).getServiceProxy(sp.getId()).setServiceInstance(setSolution(solutionInfo, placement));
} else {
sp.setServiceInstance(setSolution(solutionInfo, placement));
}
break search;
}
}
}
for (AllottedResource ar : allottes) {
if (placement.getString(SERVICE_RESOURCE_ID).equals(ar.getId())) {
ar.setParentServiceInstance(setSolution(solutionInfo, placement));
break search;
}
}
for (GenericVnf vnf : vnfs) {
if (placement.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())) {
ServiceInstance si = setSolution(solutionInfo, placement);
serviceInstance.setSolutionInfo(si.getSolutionInfo());
serviceInstance.getVnfs().add(si.getVnfs().get(0));
break search;
}
}
}
}
}
use of org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo in project so by onap.
the class SniroHomingV2 method processPlacementSolution.
/**
* Processes a placement solution list then correlates and sets each placement solution to its corresponding
* resource
*/
private void processPlacementSolution(ServiceInstance serviceInstance, JSONArray placements, int i) {
List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
List<AllottedResource> allottes = serviceInstance.getAllottedResources();
List<GenericVnf> vnfs = serviceInstance.getVnfs();
List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies();
logger.debug("Processing placement solution " + i + 1);
for (int p = 0; p < placements.length(); p++) {
JSONObject placement = placements.getJSONObject(p);
SolutionInfo solutionInfo = new SolutionInfo();
solutionInfo.setSolutionId(i + 1);
search: {
for (VpnBondingLink vbl : links) {
List<ServiceProxy> proxies = vbl.getServiceProxies();
for (ServiceProxy sp : proxies) {
if (placement.getString(SERVICE_RESOURCE_ID).equals(sp.getId())) {
if (i > 0) {
if (p % 2 == 0) {
VpnBondingLink vblNew = (VpnBondingLink) SerializationUtils.clone(vbl);
vblNew.setVpnBondingLinkId(UUID.randomUUID().toString());
links.add(vblNew);
}
links.get(links.size() - 1).getServiceProxy(sp.getId()).setServiceInstance(setSolution(solutionInfo, placement));
} else {
sp.setServiceInstance(setSolution(solutionInfo, placement));
}
break search;
}
}
}
for (AllottedResource ar : allottes) {
if (placement.getString(SERVICE_RESOURCE_ID).equals(ar.getId())) {
ar.setParentServiceInstance(setSolution(solutionInfo, placement));
break search;
}
}
for (GenericVnf vnf : vnfs) {
if (placement.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())) {
ServiceInstance si = setSolution(solutionInfo, placement);
serviceInstance.setSolutionInfo(si.getSolutionInfo());
serviceInstance.getVnfs().add(si.getVnfs().get(0));
break search;
}
}
for (ServiceProxy proxy : serviceProxies) {
if (placement.getString(SERVICE_RESOURCE_ID).equals(proxy.getId())) {
proxy.setServiceInstance(setSolution(solutionInfo, placement));
break search;
}
}
}
}
}
Aggregations