Search in sources :

Example 71 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class AaiResourceIdValidatorTest method setupRequestDetails.

private RequestDetails setupRequestDetails() {
    RequestDetails reqDetails = new RequestDetails();
    SubscriberInfo subInfo = new SubscriberInfo();
    subInfo.setGlobalSubscriberId("id123");
    reqDetails.setSubscriberInfo(subInfo);
    RequestParameters reqParams = new RequestParameters();
    reqParams.setSubscriptionServiceType("subServiceType123");
    reqDetails.setRequestParameters(reqParams);
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationId("1234567");
    reqDetails.setModelInfo(modelInfo);
    return reqDetails;
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) SubscriberInfo(org.onap.so.serviceinstancebeans.SubscriberInfo) RequestParameters(org.onap.so.serviceinstancebeans.RequestParameters)

Example 72 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class BBInputSetupTest method testPopulateInstanceGroup.

@Test
public void testPopulateInstanceGroup() throws Exception {
    ModelInfo modelInfo = Mockito.mock(ModelInfo.class);
    Service service = Mockito.mock(Service.class);
    List<InstanceGroup> instanceGroups = Mockito.spy(new ArrayList<>());
    ServiceInstance serviceInstance = Mockito.spy(new ServiceInstance());
    serviceInstance.setServiceInstanceId("si-001");
    serviceInstance.setServiceInstanceName("test service instance");
    serviceInstance.setInstanceGroups(instanceGroups);
    BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setModelInfo(modelInfo).setService(service).setServiceInstance(serviceInstance).setResourceId("instance-group-001").setInstanceName("test instance group").build();
    SPY_bbInputSetup.populateInstanceGroup(parameter);
    verify(SPY_bbInputSetup, times(1)).mapCatalogInstanceGroup(isA(InstanceGroup.class), isA(ModelInfo.class), isA(Service.class));
    verify(instanceGroups, times(1)).add(isA(InstanceGroup.class));
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) AAIFluentTypeBuilder(org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder) Service(org.onap.so.db.catalog.beans.Service) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) Test(org.junit.Test)

Example 73 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class BBInputSetupTest method testPopulateGenericVnf.

@Test
public void testPopulateGenericVnf() throws JsonParseException, JsonMappingException, IOException {
    org.onap.so.serviceinstancebeans.Platform platform = new org.onap.so.serviceinstancebeans.Platform();
    org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = new org.onap.so.serviceinstancebeans.LineOfBusiness();
    String instanceName = "vnfName";
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelType(ModelType.vnf);
    ServiceInstance serviceInstance = new ServiceInstance();
    GenericVnf vnf = new GenericVnf();
    vnf.setVnfId("genericVnfId");
    vnf.setVnfName("vnfName");
    serviceInstance.getVnfs().add(vnf);
    String vnfType = "vnfType";
    String applicationId = "applicationId";
    RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetails_CreateVnf.json"), RequestDetails.class);
    Service service = mapper.readValue(new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
    Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
    lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId");
    String bbName = AssignFlows.VNF.toString();
    ServiceModel serviceModel = new ServiceModel();
    serviceModel.setCurrentService(service);
    Platform expectedPlatform = new Platform();
    LineOfBusiness expectedLineOfBusiness = new LineOfBusiness();
    String resourceId = "123";
    doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform);
    doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness);
    org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf();
    vnfAAI.setModelCustomizationId("modelCustId");
    doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
    doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf, modelInfo, service);
    org.onap.aai.domain.yang.InstanceGroup instanceGroupAAI = new org.onap.aai.domain.yang.InstanceGroup();
    doReturn(instanceGroupAAI).when(SPY_bbInputSetupUtils).getAAIInstanceGroup(any());
    org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup();
    doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any());
    BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID).setModelInfo(modelInfo).setInstanceName(instanceName).setPlatform(platform).setLineOfBusiness(lineOfBusiness).setService(service).setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).setRelatedInstanceList(requestDetails.getRelatedInstanceList()).setResourceId(resourceId).setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId()).setServiceModel(serviceModel).build();
    SPY_bbInputSetup.populateGenericVnf(parameter);
    lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
    SPY_bbInputSetup.populateGenericVnf(parameter);
    verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
    instanceName = "vnfName2";
    GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
    doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
    doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
    lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId2");
    SPY_bbInputSetup.populateGenericVnf(parameter);
    verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service);
    verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
    verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
    assertEquals("modelCustId", modelInfo.getModelCustomizationUuid());
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ServiceModel(org.onap.so.bpmn.servicedecomposition.entities.ServiceModel) Service(org.onap.so.db.catalog.beans.Service) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) LineOfBusiness(org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness) File(java.io.File) Test(org.junit.Test)

Example 74 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class BBInputSetupTest method testMapCatalogNetwork.

@Test
public void testMapCatalogNetwork() {
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    L3Network network = new L3Network();
    RequestDetails requestDetails = new RequestDetails();
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationUuid("modelCustomizationUUID");
    requestDetails.setModelInfo(modelInfo);
    Service service = new Service();
    NetworkResourceCustomization resourceCust = new NetworkResourceCustomization();
    resourceCust.setModelCustomizationUUID("modelCustomizationUUID");
    service.setNetworkCustomizations(Arrays.asList(new NetworkResourceCustomization[] { resourceCust }));
    doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(resourceCust);
    SPY_bbInputSetup.mapCatalogNetwork(network, modelInfo, service);
    assertEquals(modelInfoNetwork, network.getModelInfoNetwork());
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) Service(org.onap.so.db.catalog.beans.Service) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) NetworkResourceCustomization(org.onap.so.db.catalog.beans.NetworkResourceCustomization) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 75 with ModelInfo

use of org.onap.so.serviceinstancebeans.ModelInfo in project so by onap.

the class BBInputSetupTest method testMapCatalogConfiguration.

@Test
public void testMapCatalogConfiguration() {
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    L3Network network = new L3Network();
    RequestDetails requestDetails = new RequestDetails();
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationUuid("modelCustomizationUUID");
    requestDetails.setModelInfo(modelInfo);
    Service service = new Service();
    NetworkResourceCustomization resourceCust = new NetworkResourceCustomization();
    resourceCust.setModelCustomizationUUID("modelCustomizationUUID");
    service.setNetworkCustomizations(Arrays.asList(new NetworkResourceCustomization[] { resourceCust }));
    doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(resourceCust);
    SPY_bbInputSetup.mapCatalogNetwork(network, modelInfo, service);
    assertEquals(modelInfoNetwork, network.getModelInfoNetwork());
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) Service(org.onap.so.db.catalog.beans.Service) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) NetworkResourceCustomization(org.onap.so.db.catalog.beans.NetworkResourceCustomization) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Aggregations

ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)84 Test (org.junit.Test)46 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)35 Service (org.onap.so.db.catalog.beans.Service)30 HashMap (java.util.HashMap)18 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)18 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)17 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)17 RelatedInstanceList (org.onap.so.serviceinstancebeans.RelatedInstanceList)15 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)14 RelatedInstance (org.onap.so.serviceinstancebeans.RelatedInstance)14 ServiceInstancesRequest (org.onap.so.serviceinstancebeans.ServiceInstancesRequest)14 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)12 RequestInfo (org.onap.so.serviceinstancebeans.RequestInfo)12 ServiceModel (org.onap.so.bpmn.servicedecomposition.entities.ServiceModel)11 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)11 File (java.io.File)10 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)10 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)10 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)10