use of org.onap.so.db.catalog.beans.CollectionResourceCustomization in project so by onap.
the class BBInputSetup method mapCatalogNetworkCollectionInstanceGroup.
protected void mapCatalogNetworkCollectionInstanceGroup(Service service, InstanceGroup instanceGroup, String key) {
CollectionResourceCustomization collectionCust = this.findCatalogNetworkCollection(service, key);
org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = null;
if (collectionCust != null) {
catalogInstanceGroup = collectionCust.getCollectionResource().getInstanceGroup();
}
instanceGroup.setModelInfoInstanceGroup(mapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionCust, catalogInstanceGroup));
}
use of org.onap.so.db.catalog.beans.CollectionResourceCustomization in project so by onap.
the class BBInputSetupMapperLayerTest method testMapCatalogInstanceGroupToInstanceGroup.
@Test
public void testMapCatalogInstanceGroupToInstanceGroup() throws IOException {
ModelInfoInstanceGroup expected = mapper.readValue(new File(RESOURCE_PATH + "ModelInfoInstanceGroup.json"), ModelInfoInstanceGroup.class);
InstanceGroup instanceGroup = mapper.readValue(new File(RESOURCE_PATH + "InstanceGroup.json"), InstanceGroup.class);
instanceGroup.setCollectionInstanceGroupCustomizations(new ArrayList<>());
CollectionResourceInstanceGroupCustomization collectionInstanceGroupCust = new CollectionResourceInstanceGroupCustomization();
collectionInstanceGroupCust.setModelCustomizationUUID("modelCustomizationUUID");
collectionInstanceGroupCust.setFunction("function");
collectionInstanceGroupCust.setDescription("description");
instanceGroup.getCollectionInstanceGroupCustomizations().add(collectionInstanceGroupCust);
CollectionResourceCustomization collectionResourceCust = new CollectionResourceCustomization();
collectionResourceCust.setModelCustomizationUUID("modelCustomizationUUID");
ModelInfoInstanceGroup actual = bbInputSetupMapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionResourceCust, instanceGroup);
assertThat(actual, sameBeanAs(expected));
}
use of org.onap.so.db.catalog.beans.CollectionResourceCustomization in project so by onap.
the class ServiceEBBLoader method traverseNetworkCollection.
protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceList, Resource serviceResource, org.onap.so.db.catalog.beans.Service service) {
if (isVnfCustomizationsInTheService(service)) {
buildAndThrowException(execution, "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
}
if (isPnfCustomizationsInTheService(service)) {
buildAndThrowException(execution, "Cannot orchestrate Service-Macro-Create without user params with a pnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
}
List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
if (customizations.isEmpty()) {
logger.debug("No Collections found. CollectionResourceCustomization list is empty.");
} else {
CollectionResourceCustomization collectionResourceCustomization = findCatalogNetworkCollection(execution, service);
traverseNetworkCollectionResourceCustomization(resourceList, serviceResource, collectionResourceCustomization);
}
traverseNetworkCollectionCustomization(resourceList, serviceResource, service);
}
use of org.onap.so.db.catalog.beans.CollectionResourceCustomization in project so by onap.
the class ServiceEBBLoader method findCatalogNetworkCollection.
public CollectionResourceCustomization findCatalogNetworkCollection(DelegateExecution execution, org.onap.so.db.catalog.beans.Service service) {
CollectionResourceCustomization networkCollection = null;
int count = 0;
for (CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()) {
if (catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCust.getModelCustomizationUUID()) != null) {
networkCollection = collectionCust;
count++;
}
}
if (count == 0) {
return null;
} else if (count > 1) {
buildAndThrowException(execution, "Found multiple Network Collections in the Service model, only one per Service is supported.");
}
return networkCollection;
}
use of org.onap.so.db.catalog.beans.CollectionResourceCustomization in project so by onap.
the class WorkflowActionTest method selectExecutionListNetworkCollectionMacroCreate.
@Ignore
@Test
public void selectExecutionListNetworkCollectionMacroCreate() throws Exception {
String gAction = "createInstance";
String resource = "NetworkCollection";
String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_NETWORK_COLLECTION_JSON);
initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("CreateNetworkCollectionBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "ActivateNetworkCollectionBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
Service service = new Service();
CollectionResourceCustomization collectionResourceCustomization = new CollectionResourceCustomization();
CollectionResource collectionResource = new CollectionResource();
collectionResource.setToscaNodeType("Data NetworkCollection Data");
collectionResourceCustomization.setCollectionResource(collectionResource);
service.getCollectionResourceCustomizations().add(collectionResourceCustomization);
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "CreateNetworkCollectionBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "ActivateNetworkCollectionBB");
}
Aggregations