Search in sources :

Example 81 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class GCTopologyOperationRequestMapperTest method deactivateOrUnassignVnrReqMapperTest.

@Test
public void deactivateOrUnassignVnrReqMapperTest() throws URISyntaxException {
    RequestContext requestContext = new RequestContext();
    requestContext.setMsoRequestId("MsoRequestId");
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setServiceInstanceId("ServiceInstanceId");
    Configuration Configuration = new Configuration();
    Configuration.setConfigurationId("ConfigurationId");
    Configuration.setConfigurationType("VLAN-NETWORK-RECEPTOR");
    GenericResourceApiGcTopologyOperationInformation genericInfo = genObjMapper.deactivateOrUnassignVnrReqMapper(SDNCSvcAction.UNASSIGN, serviceInstance, requestContext, Configuration, "uuid", new URI("http://localhost"));
    Assert.assertNotNull(genericInfo);
    Assert.assertNotNull(genericInfo.getRequestInformation());
    Assert.assertNotNull(genericInfo.getSdncRequestHeader());
    Assert.assertNotNull(genericInfo.getClass());
    Assert.assertNotNull(genericInfo.getServiceInformation());
    Assert.assertEquals("ConfigurationId", genericInfo.getConfigurationInformation().getConfigurationId());
    Assert.assertEquals("VLAN-NETWORK-RECEPTOR", genericInfo.getConfigurationInformation().getConfigurationType());
    Assert.assertEquals("uuid", genericInfo.getSdncRequestHeader().getSvcRequestId());
    Assert.assertEquals("http://localhost", genericInfo.getSdncRequestHeader().getSvcNotificationUrl());
    Assert.assertEquals("MsoRequestId", genericInfo.getRequestInformation().getRequestId());
}
Also used : Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) GenericResourceApiGcTopologyOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) URI(java.net.URI) Test(org.junit.Test)

Example 82 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class NetworkTopologyOperationRequestMapperTest method before.

@Before
public void before() {
    // prepare and set service instance
    serviceInstance = new ServiceInstance();
    serviceInstanceNoCollection = new ServiceInstance();
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid");
    modelInfoServiceInstance.setModelName("modelName");
    modelInfoServiceInstance.setModelUuid("modelUuid");
    modelInfoServiceInstance.setModelVersion("modelVersion");
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    serviceInstanceNoCollection.setModelInfoServiceInstance(modelInfoServiceInstance);
    // prepare Customer object
    customer = new Customer();
    customer.setGlobalCustomerId("globalCustomerId");
    // serviceInstance.setCustomer(customer);
    // set Customer on service instance
    ServiceSubscription serviceSubscription = new ServiceSubscription();
    serviceSubscription.setServiceType("productFamilyId");
    customer.setServiceSubscription(serviceSubscription);
    // set Customer on service instance
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    customer.getServiceSubscription().getServiceInstances().add(serviceInstanceNoCollection);
    // 
    InstanceGroup networkInstanceGroup = new InstanceGroup();
    networkInstanceGroup.setId("networkInstanceGroupId");
    networkInstanceGroup.setInstanceGroupFunction("instanceGroupFunction");
    Collection networkCollection = new Collection();
    networkCollection.setInstanceGroup(networkInstanceGroup);
    serviceInstance.setCollection(networkCollection);
    // 
    requestContext = new RequestContext();
    Map<String, Object> userParams = new HashMap<>();
    userParams.put("key1", "value1");
    requestContext.setUserParams(userParams);
    requestContext.setProductFamilyId("productFamilyId");
    requestContext.setMsoRequestId("MsoRequestId");
    network = new L3Network();
    network.setNetworkId("TEST_NETWORK_ID");
    network.setNetworkName("TEST_NETWORK_NAME");
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    modelInfoNetwork.setModelInvariantUUID("modelInvariantUuid");
    modelInfoNetwork.setModelName("modelName");
    modelInfoNetwork.setModelVersion("modelVersion");
    modelInfoNetwork.setModelUUID("modelUuid");
    modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID");
    network.setModelInfoNetwork(modelInfoNetwork);
    cloudRegion = new CloudRegion();
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Before(org.junit.Before)

Example 83 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class GenericPnfCDSControllerRunnableBBTest method prepareData.

private void prepareData() throws BBObjectNotFoundException, PayloadGenerationException {
    Pnf pnf = new Pnf();
    ServiceInstance serviceInstance = new ServiceInstance();
    pnf.setPnfName(pnfName);
    pnf.setPnfId(pnfID);
    ModelInfoPnf modelInfoPnf = new ModelInfoPnf();
    modelInfoPnf.setModelCustomizationUuid(pnfCustomizationUUID);
    pnf.setModelInfoPnf(modelInfoPnf);
    serviceInstance.setServiceInstanceId(serviceInstanceID);
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelUuid(serviceModelUUID);
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock(createService(createPnfsList())));
    when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.PNF))).thenReturn(pnf);
    when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.SERVICE_INSTANCE_ID))).thenReturn(serviceInstance);
    doNothing().when(configureInstanceParamsForPnf).populateInstanceParams(any(), any(), any());
}
Also used : ModelInfoPnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf) Pnf(org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf) ModelInfoPnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf) ConfigureInstanceParamsForPnf(org.onap.so.client.cds.ConfigureInstanceParamsForPnf) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)

Example 84 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance 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 85 with ServiceInstance

use of org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance in project so by onap.

the class OofHomingV2IT method testProcessSolution_success_3Allotteds_1Solution.

@Test
public void testProcessSolution_success_3Allotteds_1Solution() {
    beforeAllottedResource();
    JSONObject asyncResponse = new JSONObject();
    asyncResponse.put("transactionId", "transactionId").put("requestId", "testRequestId").put("requestState", "completed");
    JSONArray solution1 = new JSONArray();
    solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId1").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", "True")).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", "testCloudRegionId1"))));
    solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId2").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", "True")).put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "vnfHostName").put("value", "testVnfHostName2")).put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).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", "testCloudRegionId2"))));
    solution1.put(new JSONObject().put("serviceResourceId", "testAllottedResourceId3").put("solution", new JSONObject().put("identifierType", "cloudRegionId").put("identifiers", new JSONArray().put("testCloudRegionId3"))).put("assignmentInfo", new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "True")).put(new JSONObject().put("key", "cloudOwner").put("value", "aic")).put(new JSONObject().put("key", "aicClli").put("value", "testAicClli2")).put(new JSONObject().put("key", "aicVersion").put("value", "3"))));
    asyncResponse.put("solutions", new JSONObject().put("placementSolutions", new JSONArray().put(solution1)).put("licenseSolutions", new JSONArray()));
    oofHoming.processSolution(execution, asyncResponse.toString());
    ServiceInstance si = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
    assertFalse(si.getAllottedResources().isEmpty());
    AllottedResource ar = si.getAllottedResources().get(0);
    assertNotNull(ar);
    assertEquals("testServiceInstanceId1", ar.getParentServiceInstance().getServiceInstanceId());
    assertNotNull(ar.getParentServiceInstance().getSolutionInfo());
    assertEquals("testVnfHostName1", ar.getParentServiceInstance().getVnfs().get(0).getVnfName());
    AllottedResource ar2 = si.getAllottedResources().get(1);
    assertNotNull(ar2);
    assertEquals("testServiceInstanceId2", ar2.getParentServiceInstance().getServiceInstanceId());
    assertNotNull(ar2.getParentServiceInstance().getSolutionInfo());
    assertEquals("testVnfHostName2", ar2.getParentServiceInstance().getVnfs().get(0).getVnfName());
    AllottedResource ar3 = si.getAllottedResources().get(2);
    assertNotNull(ar3);
    assertNotNull(ar3.getParentServiceInstance().getSolutionInfo());
    assertEquals("testCloudRegionId3", ar3.getParentServiceInstance().getSolutionInfo().getTargetedCloudRegion().getLcpCloudRegionId());
}
Also used : JSONObject(org.json.JSONObject) JSONArray(org.json.JSONArray) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) AllottedResource(org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource) BaseIntegrationTest(org.onap.so.BaseIntegrationTest) Test(org.junit.Test)

Aggregations

ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)228 Test (org.junit.Test)118 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)110 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)84 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)70 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)61 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)54 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)53 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)51 HashMap (java.util.HashMap)50 Service (org.onap.so.db.catalog.beans.Service)46 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)40 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)38 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)37 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)35 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)33 ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)33 File (java.io.File)31 OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)25 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)24