Search in sources :

Example 1 with VpnBondingLink

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;
}
Also used : BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) VpnBondingLink(org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)

Example 2 with 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;
}
Also used : VpnBondingLink(org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration)

Example 3 with 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());
}
Also used : VpnBondingLink(org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink) JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) BaseIntegrationTest(org.onap.so.BaseIntegrationTest) Test(org.junit.Test)

Example 4 with VpnBondingLink

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);
}
Also used : Candidate(org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate) VpnBondingLink(org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink) ServiceProxy(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy) ArrayList(java.util.ArrayList)

Example 5 with VpnBondingLink

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;
}
Also used : VpnBondingLink(org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink) ServiceProxy(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy) PlacementDemand(org.onap.so.client.oof.beans.PlacementDemand) AllottedResource(org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource)

Aggregations

VpnBondingLink (org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink)14 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)8 JSONObject (org.json.JSONObject)6 ServiceProxy (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy)6 JSONArray (org.json.JSONArray)4 Test (org.junit.Test)4 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)4 AllottedResource (org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource)4 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)4 ArrayList (java.util.ArrayList)3 Configuration (org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration)2 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)2 Candidate (org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate)2 SolutionInfo (org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo)2 ModelInfoConfiguration (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration)2 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)2 PlacementDemand (org.onap.so.client.oof.beans.PlacementDemand)1 Demand (org.onap.so.client.sniro.beans.Demand)1