Search in sources :

Example 51 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class VfModuleCDSRequestProvider method buildRequestPayload.

@Override
public Optional<String> buildRequestPayload(String action) throws PayloadGenerationException {
    JsonObject cdsPropertyObject = new JsonObject();
    JsonObject vfModuleObject = new JsonObject();
    String vfModuleName;
    try {
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        final String modelCustomizationUuidForVnf = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid();
        blueprintName = genericVnf.getModelInfoGenericVnf().getBlueprintName();
        blueprintVersion = genericVnf.getModelInfoGenericVnf().getBlueprintVersion();
        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        vfModuleName = vfModule.getVfModuleName();
        final String modelCustomizationUuidForVfModule = vfModule.getModelInfoVfModule().getModelCustomizationUUID();
        vfModuleObject.addProperty("service-instance-id", serviceInstance.getServiceInstanceId());
        vfModuleObject.addProperty("service-model-uuid", serviceInstance.getModelInfoServiceInstance().getModelUuid());
        vfModuleObject.addProperty("vnf-id", genericVnf.getVnfId());
        vfModuleObject.addProperty("vnf-name", genericVnf.getVnfName());
        vfModuleObject.addProperty("vf-module-id", vfModule.getVfModuleId());
        vfModuleObject.addProperty("vf-module-name", vfModule.getVfModuleName());
        vfModuleObject.addProperty("vf-module-customization-uuid", vfModule.getModelInfoVfModule().getModelCustomizationUUID());
        final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
        List<Map<String, Object>> userParamsFromRequest = buildingBlock.getRequestContext().getRequestParameters().getUserParams();
        String vfModuleInstanceName = execution.getLookupMap().getOrDefault(ResourceKey.VF_MODULE_INSTANCE_NAME, "");
        if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
            configureInstanceParamsForVfModule.populateInstanceParams(vfModuleObject, userParamsFromRequest, modelCustomizationUuidForVnf, modelCustomizationUuidForVfModule, vfModuleInstanceName);
        }
    } catch (Exception e) {
        throw new PayloadGenerationException("Failed to buildPropertyObject for VF-Module", e);
    }
    // Not sure for resolutionKey should be same as vfModule name.
    cdsPropertyObject.addProperty("resolution-key", vfModuleName);
    cdsPropertyObject.addProperty("template-prefix", vfModuleName + action);
    cdsPropertyObject.add(action + SEPARATOR + PROPERTIES, vfModuleObject);
    return Optional.of(buildRequestJsonObject(cdsPropertyObject, action));
}
Also used : GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) JsonObject(com.google.gson.JsonObject) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) Map(java.util.Map) PayloadGenerationException(org.onap.so.client.exception.PayloadGenerationException) PayloadGenerationException(org.onap.so.client.exception.PayloadGenerationException)

Example 52 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class ExternalTicketTasksTest method before.

@Before
public void before() throws Exception {
    delegateExecution = new DelegateExecutionFake();
    buildingBlockExecution = new DelegateExecutionImpl(delegateExecution);
    generalBuildingBlock = new GeneralBuildingBlock();
    requestContext = new RequestContext();
    requestContext.setRequestorId("someRequestorId");
    generalBuildingBlock.setRequestContext(requestContext);
    buildingBlockExecution.setVariable("mso-request-id", ("testMsoRequestId"));
    buildingBlockExecution.setVariable("vnfType", "testVnfType");
    buildingBlockExecution.setVariable("gBBInput", generalBuildingBlock);
    buildingBlockExecution.setVariable("rainyDayVnfName", "someVnfName");
    buildingBlockExecution.setVariable("workStep", "someWorkstep");
    buildingBlockExecution.setVariable("taskTimeout", "PT5M");
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) DelegateExecutionImpl(org.onap.so.bpmn.common.DelegateExecutionImpl) DelegateExecutionFake(org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) Before(org.junit.Before)

Example 53 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class GenericCDSProcessingBBTest method createGeneralBuildingBlock.

private GeneralBuildingBlock createGeneralBuildingBlock() {
    GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
    RequestContext requestContext = new RequestContext();
    RequestParameters requestParameters = new RequestParameters();
    requestParameters.setUserParams(createRequestParameters());
    requestContext.setRequestParameters(requestParameters);
    requestContext.setMsoRequestId(TEST_MSO_REQUEST_ID);
    generalBuildingBlock.setRequestContext(requestContext);
    return generalBuildingBlock;
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) RequestParameters(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters)

Example 54 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class DeleteVfModuleTest method prepareGeneralBuildingBlock.

private GeneralBuildingBlock prepareGeneralBuildingBlock() {
    GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
    CloudRegion cloudRegion = new CloudRegion();
    cloudRegion.setCloudOwner(CLOUD_OWNER);
    cloudRegion.setLcpCloudRegionId(LCP_CLOUD_REGION_ID);
    generalBuildingBlock.setCloudRegion(cloudRegion);
    Tenant tenant = new Tenant();
    tenant.setTenantId(TENANT_ID);
    tenant.setTenantName(TENANT_NAME);
    tenant.setTenantContext(TENANT_CONTEXT);
    generalBuildingBlock.setTenant(tenant);
    return generalBuildingBlock;
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) Tenant(org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)

Example 55 with GeneralBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock in project so by onap.

the class ConfigAssignVnfTest method createGeneralBuildingBlock.

private GeneralBuildingBlock createGeneralBuildingBlock(Object serviceJson) {
    GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
    RequestContext requestContext = new RequestContext();
    RequestParameters requestParameters = new RequestParameters();
    requestParameters.setUserParams(createRequestUserParams(serviceJson));
    requestContext.setRequestParameters(requestParameters);
    generalBuildingBlock.setRequestContext(requestContext);
    return generalBuildingBlock;
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) RequestParameters(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters)

Aggregations

GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)117 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)61 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)51 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)40 Test (org.junit.Test)37 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)37 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)35 File (java.io.File)34 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)34 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)29 Service (org.onap.so.db.catalog.beans.Service)27 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)25 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)23 HashMap (java.util.HashMap)22 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)22 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)20 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)19 SDNCRequest (org.onap.so.client.sdnc.beans.SDNCRequest)19 ConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys)16 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)16