use of org.onap.so.bpmn.servicedecomposition.bbobjects.Collection in project so by onap.
the class CreateNetworkCollection method connectCollectionToServiceInstance.
/**
* BPMN access method to connect Network Collection
*
* @param execution
* @throws Exception
*/
public void connectCollectionToServiceInstance(BuildingBlockExecution execution) throws Exception {
execution.setVariable("connectCollectionToServiceInstanceRollback", false);
try {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Collection networkCollection = serviceInstance.getCollection();
aaiNetworkResources.connectNetworkCollectionToServiceInstance(networkCollection, serviceInstance);
execution.setVariable("connectCollectionToServiceInstanceRollback", true);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.Collection in project so by onap.
the class BuildingBlockTestDataSetup method buildCollection.
public Collection buildCollection() {
collectionCounter++;
Collection collection = new Collection();
collection.setId("testId" + collectionCounter);
collection.setInstanceGroup(buildInstanceGroup());
return collection;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.Collection 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());
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.Collection in project so by onap.
the class TestDataSetup method buildCollection.
public Collection buildCollection() {
collectionCounter++;
Collection collection = new Collection();
collection.setId("testId" + collectionCounter);
collection.setInstanceGroup(buildInstanceGroup());
return collection;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.Collection in project so by onap.
the class BBInputSetup method populateNetworkCollectionAndInstanceGroupAssign.
protected void populateNetworkCollectionAndInstanceGroupAssign(BBInputSetupParameter parameter) throws Exception {
if (parameter.getServiceInstance().getCollection() == null && parameter.getBbName().equalsIgnoreCase(AssignFlows.NETWORK_COLLECTION.toString())) {
Collection collection = this.createCollection(parameter.getResourceId());
parameter.getServiceInstance().setCollection(collection);
this.mapCatalogCollection(parameter.getService(), parameter.getServiceInstance().getCollection(), parameter.getKey());
if (isVlanTagging(parameter.getService(), parameter.getKey())) {
InstanceGroup instanceGroup = this.createInstanceGroup();
parameter.getServiceInstance().getCollection().setInstanceGroup(instanceGroup);
this.mapCatalogNetworkCollectionInstanceGroup(parameter.getService(), parameter.getServiceInstance().getCollection().getInstanceGroup(), parameter.getKey());
}
}
}
Aggregations