Search in sources :

Example 6 with InstanceGroup

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

the class BuildingBlockTestDataSetup method buildInstanceGroup.

public InstanceGroup buildInstanceGroup() {
    instanceGroupCounter++;
    InstanceGroup instanceGroup = new InstanceGroup();
    instanceGroup.setId("testId" + instanceGroupCounter);
    instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
    return instanceGroup;
}
Also used : InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)

Example 7 with InstanceGroup

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

the class BBInputSetupTest method testMapCollection.

@Test
public void testMapCollection() throws JsonProcessingException {
    List<AAIResultWrapper> collections = new ArrayList<>();
    ServiceInstance serviceInstance = new ServiceInstance();
    org.onap.aai.domain.yang.Collection aaiCollection = new org.onap.aai.domain.yang.Collection();
    org.onap.aai.domain.yang.RelationshipList collectionRelationshipList = new org.onap.aai.domain.yang.RelationshipList();
    org.onap.aai.domain.yang.Relationship collectionInstanceGroupRelationship = new org.onap.aai.domain.yang.Relationship();
    collectionRelationshipList.getRelationship().add(collectionInstanceGroupRelationship);
    aaiCollection.setRelationshipList(collectionRelationshipList);
    collections.add(new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiCollection)));
    Collection collection = new Collection();
    ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
    List<InstanceGroup> instanceGroupsList = new ArrayList<>();
    InstanceGroup instanceGroup = new InstanceGroup();
    instanceGroupsList.add(instanceGroup);
    NetworkCollectionResourceCustomization networkCollectionCust = Mockito.mock(NetworkCollectionResourceCustomization.class);
    CollectionResource collectionResource = new CollectionResource();
    doReturn(collection).when(bbInputSetupMapperLayer).mapAAICollectionIntoCollection(isA(org.onap.aai.domain.yang.Collection.class));
    doReturn(instanceGroupsList).when(SPY_bbInputSetup).mapInstanceGroups(any());
    doReturn(networkCollectionCust).when(SPY_bbInputSetupUtils).getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId());
    doReturn(collectionResource).when(networkCollectionCust).getCollectionResource();
    doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(networkCollectionCust, collectionResource);
    SPY_bbInputSetup.mapCollection(collections, serviceInstance);
    assertEquals(collection, serviceInstance.getCollection());
    assertEquals(instanceGroup, collection.getInstanceGroup());
    instanceGroupsList.clear();
    collection = new Collection();
    SPY_bbInputSetup.mapCollection(collections, serviceInstance);
    assertEquals(collection, serviceInstance.getCollection());
    assertNull(collection.getInstanceGroup());
}
Also used : CollectionResource(org.onap.so.db.catalog.beans.CollectionResource) ArrayList(java.util.ArrayList) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ModelInfoCollection(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection) AAICommonObjectMapperProvider(org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) ModelInfoCollection(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper) Test(org.junit.Test)

Example 8 with InstanceGroup

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

the class BBInputSetupTest method testMapVnfcCollectionInstanceGroup.

@Test
public void testMapVnfcCollectionInstanceGroup() {
    VnfResourceCustomization vnfResourceCust = Mockito.mock(VnfResourceCustomization.class);
    GenericVnf genericVnf = new GenericVnf();
    ModelInfo modelInfo = Mockito.mock(ModelInfo.class);
    Service service = Mockito.mock(Service.class);
    org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup();
    instanceGroup.setModelUUID("modelUUID");
    List<VnfcInstanceGroupCustomization> vnfcInstanceGroups = new ArrayList<>();
    VnfcInstanceGroupCustomization vnfcInstanceGroupCust = new VnfcInstanceGroupCustomization();
    vnfcInstanceGroupCust.setInstanceGroup(instanceGroup);
    vnfcInstanceGroupCust.setFunction("function");
    vnfcInstanceGroupCust.setDescription("description");
    vnfcInstanceGroups.add(vnfcInstanceGroupCust);
    ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup();
    modelInfoInstanceGroup.setModelUUID("modelUUID");
    doReturn(vnfResourceCust).when(SPY_bbInputSetup).getVnfResourceCustomizationFromService(modelInfo, service);
    doReturn(vnfcInstanceGroups).when(vnfResourceCust).getVnfcInstanceGroupCustomizations();
    doReturn(instanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup("modelUUID");
    doReturn(modelInfoInstanceGroup).when(bbInputSetupMapperLayer).mapCatalogInstanceGroupToInstanceGroup(null, instanceGroup);
    SPY_bbInputSetup.mapVnfcCollectionInstanceGroup(genericVnf, modelInfo, service);
    assertEquals("Instance Group was created", true, genericVnf.getInstanceGroups().size() == 1);
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ArrayList(java.util.ArrayList) Service(org.onap.so.db.catalog.beans.Service) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) VnfcInstanceGroupCustomization(org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) Test(org.junit.Test)

Example 9 with InstanceGroup

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

the class AssignVnfTest method before.

@Before
public void before() throws BBObjectNotFoundException {
    ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup();
    modelVnfc.setType("VNFC");
    modelVnfc.setFunction("function");
    ModelInfoInstanceGroup modelNetworkInstanceGroup = new ModelInfoInstanceGroup();
    modelNetworkInstanceGroup.setType("L3-NETWORK");
    modelNetworkInstanceGroup.setFunction("function");
    instanceGroup1 = new InstanceGroup();
    instanceGroup1.setId("test-001");
    instanceGroup1.setModelInfoInstanceGroup(modelVnfc);
    instanceGroup2 = new InstanceGroup();
    instanceGroup2.setId("test-002");
    instanceGroup2.setModelInfoInstanceGroup(modelVnfc);
    instanceGroup3 = new InstanceGroup();
    instanceGroup3.setId("test-003");
    instanceGroup3.setModelInfoInstanceGroup(modelNetworkInstanceGroup);
    instanceGroup4 = new InstanceGroup();
    instanceGroup4.setId("test-004");
    instanceGroup4.setModelInfoInstanceGroup(modelNetworkInstanceGroup);
    genericVnf = setGenericVnf();
    genericVnf.setVnfName("vnfName");
    doNothing().when(aaiInstanceGroupResources).createInstanceGroup(isA(InstanceGroup.class));
    doNothing().when(aaiInstanceGroupResources).connectInstanceGroupToVnf(isA(InstanceGroup.class), isA(GenericVnf.class));
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
    doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
    doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
}
Also used : ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) BuildingBlockExecution(org.onap.so.bpmn.common.BuildingBlockExecution) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) BpmnError(org.camunda.bpm.engine.delegate.BpmnError) Before(org.junit.Before)

Example 10 with InstanceGroup

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

the class TestDataSetup method buildInstanceGroup.

public InstanceGroup buildInstanceGroup() {
    instanceGroupCounter++;
    InstanceGroup instanceGroup = new InstanceGroup();
    instanceGroup.setId("testId" + instanceGroupCounter);
    instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter);
    return instanceGroup;
}
Also used : InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)

Aggregations

InstanceGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)32 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)14 ModelInfoInstanceGroup (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup)13 Test (org.junit.Test)9 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)9 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)9 Collection (org.onap.so.bpmn.servicedecomposition.bbobjects.Collection)8 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)7 ArrayList (java.util.ArrayList)6 Service (org.onap.so.db.catalog.beans.Service)4 AAIFluentTypeBuilder (org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder)3 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)3 ServiceSubscription (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription)3 ModelInfoCollection (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection)3 CollectionResource (org.onap.so.db.catalog.beans.CollectionResource)3 NetworkCollectionResourceCustomization (org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization)3 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 GenericResourceApiVnfOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation)2 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)2