use of org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink in project so by onap.
the class TestDataSetup method setVpnBondingLink.
public VpnBondingLink setVpnBondingLink() {
VpnBondingLink vpnBondingLink = buildVpnBondingLink();
ServiceInstance serviceInstance = null;
try {
serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
} catch (BBObjectNotFoundException e) {
serviceInstance = setServiceInstance();
}
serviceInstance.getVpnBondingLinks().add(vpnBondingLink);
lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId());
return vpnBondingLink;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink in project so by onap.
the class TestDataSetup method buildVpnBondingLink.
public VpnBondingLink buildVpnBondingLink() {
vpnBondingLinkCounter++;
VpnBondingLink vpnBondingLink = new VpnBondingLink();
vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter);
Configuration vnrConfiguration = buildConfiguration();
vnrConfiguration.setNetwork(buildL3Network());
vpnBondingLink.setVnrConfiguration(vnrConfiguration);
vpnBondingLink.setVrfConfiguration(buildConfiguration());
vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy());
vpnBondingLink.setTransportServiceProxy(buildServiceProxy());
return vpnBondingLink;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink in project so by onap.
the class OofHomingV2IT method testProcessSolution_success_1VpnLink_2Solutions.
@Test
public void testProcessSolution_success_1VpnLink_2Solutions() {
beforeVpnBondingLink("1");
JSONObject asyncResponse = new JSONObject();
asyncResponse.put("transactionId", "transactionId").put("requestId", "testRequestId").put("requestState", "completed");
JSONArray solution1 = new JSONArray();
solution1.put(new JSONObject().put("serviceResourceId", "testProxyId1").put("solution", new JSONObject().put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId1"))).put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")).put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName1")).put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1")).put(new JSONObject().put("key", "aicVersion").put("value", "3")).put(new JSONObject().put("key", "vnfId").put("value", "testVnfId1")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId1"))));
solution1.put(new JSONObject().put("serviceResourceId", "testProxyId2").put("solution", new JSONObject().put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId2"))).put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")).put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "primaryPnfName").put("value", "testPrimaryPnfName2")).put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).put(new JSONObject().put("key", "aicVersion").put("value", "3")).put(new JSONObject().put("key", "secondaryPnfName").put("value", "testSecondaryPnfName2")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId2"))));
JSONArray solution2 = new JSONArray();
solution2.put(new JSONObject().put("serviceResourceId", "testProxyId1").put("solution", new JSONObject().put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId3"))).put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")).put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName3")).put(new JSONObject().put("key", "aicClli").put("value", "testAicClli3")).put(new JSONObject().put("key", "aicVersion").put("value", "3")).put(new JSONObject().put("key", "vnfId").put("value", "testVnfId3")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId3"))));
solution2.put(new JSONObject().put("serviceResourceId", "testProxyId2").put("solution", new JSONObject().put("identifierType", "serviceInstanceId").put("identifiers", new JSONArray().put("testServiceInstanceId4"))).put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False")).put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "primaryPnfName").put("value", "testPrimaryPnfName4")).put(new JSONObject().put("key", "aicClli").put("value", "testAicClli4")).put(new JSONObject().put("key", "aicVersion").put("value", "3")).put(new JSONObject().put("key", "secondaryPnfName").put("value", "testSecondaryPnfName4")).put(new JSONObject().put("key", "cloudRegionId").put("value", "testSloudRegionId4"))));
asyncResponse.put("solutions", new JSONObject().put("placementSolutions", new JSONArray().put(solution1).put(solution2)).put("licenseSolutions", new JSONArray()));
oofHoming.processSolution(execution, asyncResponse.toString());
ServiceInstance si = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
assertFalse(si.getVpnBondingLinks().isEmpty());
VpnBondingLink link = si.getVpnBondingLinks().get(0);
VpnBondingLink link2 = si.getVpnBondingLinks().get(1);
assertNotNull(link);
assertFalse(link.getServiceProxies().isEmpty());
assertEquals("testServiceInstanceId1", link.getServiceProxy("testProxyId1").getServiceInstance().getServiceInstanceId());
assertNotNull(link.getServiceProxy("testProxyId1").getServiceInstance().getSolutionInfo());
assertEquals("testVnfHostName1", link.getServiceProxy("testProxyId1").getServiceInstance().getVnfs().get(0).getVnfName());
assertEquals("testServiceInstanceId2", link.getServiceProxy("testProxyId2").getServiceInstance().getServiceInstanceId());
assertNotNull(link.getServiceProxy("testProxyId2").getServiceInstance().getSolutionInfo());
assertFalse(link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().isEmpty());
assertEquals("testPrimaryPnfName2", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(0).getPnfName());
assertEquals("primary", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(0).getRole());
assertEquals("testSecondaryPnfName2", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(1).getPnfName());
assertEquals("secondary", link.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(1).getRole());
assertNotNull(link2);
assertFalse(link2.getServiceProxies().isEmpty());
assertEquals("testServiceInstanceId3", link2.getServiceProxy("testProxyId1").getServiceInstance().getServiceInstanceId());
assertNotNull(link2.getServiceProxy("testProxyId1").getServiceInstance().getSolutionInfo());
assertEquals("testVnfHostName3", link2.getServiceProxy("testProxyId1").getServiceInstance().getVnfs().get(0).getVnfName());
assertEquals("testServiceInstanceId4", link2.getServiceProxy("testProxyId2").getServiceInstance().getServiceInstanceId());
assertNotNull(link2.getServiceProxy("testProxyId2").getServiceInstance().getSolutionInfo());
assertFalse(link2.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().isEmpty());
assertEquals("testPrimaryPnfName4", link2.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(0).getPnfName());
assertEquals("primary", link2.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(0).getRole());
assertEquals("testSecondaryPnfName4", link2.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(1).getPnfName());
assertEquals("secondary", link2.getServiceProxy("testProxyId2").getServiceInstance().getPnfs().get(1).getRole());
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink in project so by onap.
the class SniroHomingV2IT method beforeVpnBondingLink.
public void beforeVpnBondingLink(String id) {
VpnBondingLink bondingLink = new VpnBondingLink();
bondingLink.setVpnBondingLinkId("testVpnBondingId" + id);
bondingLink.getServiceProxies().add(setServiceProxy("1", "transport"));
ServiceProxy sp2 = setServiceProxy("2", "infrastructure");
Candidate requiredCandidate = new Candidate();
requiredCandidate.setIdentifierType(CandidateType.VNF_ID);
List<String> c = new ArrayList<String>();
c.add("testVnfId");
requiredCandidate.setIdentifiers(c);
sp2.addRequiredCandidates(requiredCandidate);
bondingLink.getServiceProxies().add(sp2);
serviceInstance.getVpnBondingLinks().add(bondingLink);
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink in project so by onap.
the class OofHomingV2 method buildPlacementDemands.
/**
* Builds the placement demand list for the homing/licensing request
*/
private PlacementInfo buildPlacementDemands(ServiceInstance serviceInstance, PlacementInfo placementInfo) {
logger.trace("Building placement information demands");
List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
if (!allottedResourceList.isEmpty()) {
logger.debug("Adding allotted resources to placement demands list");
for (AllottedResource ar : allottedResourceList) {
if (isBlank(ar.getId())) {
ar.setId(UUID.randomUUID().toString());
}
PlacementDemand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
// addCandidates(ar, demand);
placementInfo.getPlacementDemands().add(demand);
}
}
List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks();
if (!vpnBondingLinkList.isEmpty()) {
logger.debug("Adding vpn bonding links to placement demands list");
for (VpnBondingLink vbl : vpnBondingLinkList) {
List<ServiceProxy> serviceProxyList = vbl.getServiceProxies();
for (ServiceProxy sp : serviceProxyList) {
if (isBlank(sp.getId())) {
sp.setId(UUID.randomUUID().toString());
}
PlacementDemand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
// addCandidates(sp, demand);
placementInfo.getPlacementDemands().add(demand);
}
}
}
return placementInfo;
}
Aggregations