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));
}
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");
}
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;
}
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;
}
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;
}
Aggregations