Search in sources :

Example 1 with ConfigAssignRequestVnf

use of org.onap.so.client.cds.beans.ConfigAssignRequestVnf in project so by onap.

the class ConfigAssignVnf method preProcessAbstractCDSProcessing.

/**
 * Getting the vnf data, blueprint name, blueprint version etc and setting them in execution object and calling the
 * subprocess.
 */
public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) {
    logger.info("Start preProcessAbstractCDSProcessing ");
    try {
        GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
        configAssignPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId());
        configAssignPropertiesForVnf.setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
        configAssignPropertiesForVnf.setVnfCustomizationUuid(genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid());
        configAssignPropertiesForVnf.setVnfId(genericVnf.getVnfId());
        configAssignPropertiesForVnf.setVnfName(genericVnf.getVnfName());
        setUserParamsInConfigAssignPropertiesForVnf(configAssignPropertiesForVnf, execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams(), genericVnf);
        ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf();
        configAssignRequestVnf.setResolutionKey(genericVnf.getVnfName());
        configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
        String blueprintName = genericVnf.getModelInfoGenericVnf().getBlueprintName();
        String blueprintVersion = genericVnf.getModelInfoGenericVnf().getBlueprintVersion();
        logger.debug(" BlueprintName : " + blueprintName + " BlueprintVersion : " + blueprintVersion);
        AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
        abstractCDSPropertiesBean.setBlueprintName(blueprintName);
        abstractCDSPropertiesBean.setBlueprintVersion(blueprintVersion);
        abstractCDSPropertiesBean.setRequestObject(configAssignRequestVnf.toString());
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        abstractCDSPropertiesBean.setOriginatorId(ORIGINATOR_ID);
        abstractCDSPropertiesBean.setRequestId(gBBInput.getRequestContext().getMsoRequestId());
        abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString());
        abstractCDSPropertiesBean.setActionName(ACTION_NAME);
        abstractCDSPropertiesBean.setMode(MODE);
        execution.setVariable("executionObject", abstractCDSPropertiesBean);
    } catch (Exception ex) {
        logger.error("An exception occurred when creating ConfigAssignPropertiesForVnf for CDS request", ex);
        exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : ConfigAssignPropertiesForVnf(org.onap.so.client.cds.beans.ConfigAssignPropertiesForVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) AbstractCDSPropertiesBean(org.onap.so.client.cds.beans.AbstractCDSPropertiesBean) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ConfigAssignRequestVnf(org.onap.so.client.cds.beans.ConfigAssignRequestVnf) IOException(java.io.IOException) VnfNotFoundException(org.onap.so.bpmn.infrastructure.flowspecific.exceptions.VnfNotFoundException)

Aggregations

IOException (java.io.IOException)1 VnfNotFoundException (org.onap.so.bpmn.infrastructure.flowspecific.exceptions.VnfNotFoundException)1 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)1 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)1 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)1 AbstractCDSPropertiesBean (org.onap.so.client.cds.beans.AbstractCDSPropertiesBean)1 ConfigAssignPropertiesForVnf (org.onap.so.client.cds.beans.ConfigAssignPropertiesForVnf)1 ConfigAssignRequestVnf (org.onap.so.client.cds.beans.ConfigAssignRequestVnf)1