Search in sources :

Example 6 with PnfResourceCustomization

use of org.onap.so.db.catalog.beans.PnfResourceCustomization in project so by onap.

the class PnfCustomizationRepositoryTest method findById_ValidUuid_ExpectedOutput.

@Test
public void findById_ValidUuid_ExpectedOutput() throws Exception {
    PnfResourceCustomization pnfResourceCustomization = pnfCustomizationRepository.findById("68dc9a92-214c-11e7-93ae-92361f002680").orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
    checkPnfResourceCustomization(pnfResourceCustomization);
}
Also used : PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization) NoEntityFoundException(org.onap.so.db.catalog.exceptions.NoEntityFoundException) BaseTest(org.onap.so.db.catalog.BaseTest) Test(org.junit.Test)

Example 7 with PnfResourceCustomization

use of org.onap.so.db.catalog.beans.PnfResourceCustomization in project so by onap.

the class NfSoftwareUpgradeDispatcher method execute.

@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
    logger.debug("Running execute block for activity id: {}, name: {}", delegateExecution.getCurrentActivityId(), delegateExecution.getCurrentActivityName());
    RequestDetails bpmnRequestDetails = requestVerification(delegateExecution);
    final String serviceInstanceName = bpmnRequestDetails.getRequestInfo().getInstanceName();
    final String pnfName = bpmnRequestDetails.getRequestParameters().getUserParamValue(PNF_NAME);
    final String serviceModelUuid = bpmnRequestDetails.getModelInfo().getModelUuid();
    final List<Map<String, Object>> userParams = bpmnRequestDetails.getRequestParameters().getUserParams();
    final Pnf pnf = getPnfByPnfName(delegateExecution, pnfName);
    final List<PnfResourceCustomization> pnfCustomizations = getPnfResourceCustomizations(delegateExecution, serviceModelUuid);
    final PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0);
    final String payload = bpmnRequestDetails.getRequestParameters().getPayload();
    populateExecution(delegateExecution, bpmnRequestDetails, pnfResourceCustomization, pnf, serviceInstanceName, pnfName, serviceModelUuid, userParams, payload);
    logger.trace("Completed preProcessRequest PnfSoftwareUpgradeServiceRequest Request ");
}
Also used : PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization) Pnf(org.onap.aai.domain.yang.Pnf) Map(java.util.Map) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails)

Example 8 with PnfResourceCustomization

use of org.onap.so.db.catalog.beans.PnfResourceCustomization in project so by onap.

the class NfSoftwareUpgradeDispatcherTest method buildPnfResourceCustomization.

private PnfResourceCustomization buildPnfResourceCustomization() {
    PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization();
    pnfResourceCustomization.setSkipPostInstConf(true);
    pnfResourceCustomization.setBlueprintName(TEST_PNF_RESOURCE_BLUEPRINT_NAME);
    pnfResourceCustomization.setBlueprintVersion(TEST_PNF_RESOURCE_BLUEPRINT_VERSION);
    pnfResourceCustomization.setModelInstanceName(TEST_PNF_RESOURCE_INSTANCE_NAME);
    pnfResourceCustomization.setModelCustomizationUUID(TEST_PNF_RESOURCE_CUSTOMIZATION_UUID);
    pnfResourceCustomization.setControllerActor(TEST_PRC_CONTROLLER_ACTOR);
    return pnfResourceCustomization;
}
Also used : PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization)

Example 9 with PnfResourceCustomization

use of org.onap.so.db.catalog.beans.PnfResourceCustomization in project so by onap.

the class SkipCDSBuildingBlockListenerTest method before.

@Before
public void before() {
    executeBuildingBlock = new ExecuteBuildingBlock();
    buildingBlock = new BuildingBlock();
    ArrayList<Resource> resources = new ArrayList<>();
    Resource service = new Resource(WorkflowType.SERVICE, SERVICE_MODEL_VERSION_ID, false, null);
    service.setModelVersionId(SERVICE_MODEL_VERSION_ID);
    resources.add(service);
    Resource vnf = new Resource(WorkflowType.VNF, VNF_MODEL_CUSTOMIZATION_ID, false, null);
    vnf.setModelCustomizationId(VNF_MODEL_CUSTOMIZATION_ID);
    resources.add(vnf);
    Resource vfModule = new Resource(WorkflowType.VFMODULE, VF_MODULE_CUSTOMIZATION_ID, false, null);
    vfModule.setModelCustomizationId(VF_MODULE_CUSTOMIZATION_ID);
    resources.add(vfModule);
    Resource pnf = new Resource(WorkflowType.PNF, PNF_CUSTOMIZATION_ID, false, null);
    pnf.setModelCustomizationId(PNF_CUSTOMIZATION_ID);
    resources.add(pnf);
    buildingBlockExecution.setVariable("resources", resources);
    vnfCust = new VnfResourceCustomization();
    vfCust = new VfModuleCustomization();
    pnfResourceCustomization = new PnfResourceCustomization();
}
Also used : PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) BuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) ArrayList(java.util.ArrayList) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) VnfResourceCustomization(org.onap.so.db.catalog.beans.VnfResourceCustomization) Before(org.junit.Before)

Example 10 with PnfResourceCustomization

use of org.onap.so.db.catalog.beans.PnfResourceCustomization in project so by onap.

the class ConfigCheckerDelegate method execute.

@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
    logger.debug("Running execute block for activity id:{}, name:{}", delegateExecution.getCurrentActivityId(), delegateExecution.getCurrentActivityName());
    if (delegateExecution.hasVariable(SERVICE_MODEL_INFO)) {
        String serviceModelInfo = (String) delegateExecution.getVariable(SERVICE_MODEL_INFO);
        String serviceModelUuid = JsonUtils.getJsonValue(serviceModelInfo, MODEL_UUID);
        delegateExecution.setVariable(MODEL_UUID, serviceModelUuid);
        List<PnfResourceCustomization> pnfCustomizations = catalogDbClient.getPnfResourceCustomizationByModelUuid(serviceModelUuid);
        if (pnfCustomizations != null && !pnfCustomizations.isEmpty()) {
            PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0);
            boolean skipPostInstantiationConfiguration = pnfResourceCustomization.getSkipPostInstConf();
            delegateExecution.setVariable(SKIP_POST_INSTANTIATION_CONFIGURATION, skipPostInstantiationConfiguration);
            delegateExecution.setVariable(PRC_BLUEPRINT_NAME, pnfResourceCustomization.getBlueprintName());
            delegateExecution.setVariable(PRC_BLUEPRINT_VERSION, pnfResourceCustomization.getBlueprintVersion());
            delegateExecution.setVariable(PRC_CUSTOMIZATION_UUID, pnfResourceCustomization.getModelCustomizationUUID());
            delegateExecution.setVariable(PRC_INSTANCE_NAME, pnfResourceCustomization.getModelInstanceName());
            delegateExecution.setVariable(PRC_CONTROLLER_ACTOR, pnfResourceCustomization.getControllerActor());
        } else {
            logger.warn("Unable to find the PNF resource customizations of model service UUID: {}", serviceModelUuid);
            exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, "Unable to find the PNF resource customizations of model service UUID:  " + serviceModelUuid);
        }
    } else {
        logger.warn("Unable to find the parameter: {} in the execution context", SERVICE_MODEL_INFO);
        exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, "Unable to find parameter " + SERVICE_MODEL_INFO);
    }
}
Also used : PnfResourceCustomization(org.onap.so.db.catalog.beans.PnfResourceCustomization)

Aggregations

PnfResourceCustomization (org.onap.so.db.catalog.beans.PnfResourceCustomization)19 Test (org.junit.Test)7 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)5 ArrayList (java.util.ArrayList)4 PnfResource (org.onap.so.db.catalog.beans.PnfResource)4 Service (org.onap.so.db.catalog.beans.Service)4 EntityNotFoundException (javax.persistence.EntityNotFoundException)3 CatalogDbAdapterBaseTest (org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)3 BaseTest (org.onap.so.asdc.BaseTest)3 ASDCControllerException (org.onap.so.asdc.client.exceptions.ASDCControllerException)3 ArtifactInfoImpl (org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl)3 NotificationDataImpl (org.onap.so.asdc.client.test.emulators.NotificationDataImpl)3 ResourceInfoImpl (org.onap.so.asdc.client.test.emulators.ResourceInfoImpl)3 ToscaCsar (org.onap.so.db.catalog.beans.ToscaCsar)3 WatchdogComponentDistributionStatus (org.onap.so.db.request.beans.WatchdogComponentDistributionStatus)3 Map (java.util.Map)2 Pnf (org.onap.aai.domain.yang.Pnf)2 Metadata (org.onap.sdc.toscaparser.api.elements.Metadata)2 Resource (org.onap.so.bpmn.infrastructure.workflow.tasks.Resource)2 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)2