From e1fdca172977fdc48ab5222575f660a11e99964a Mon Sep 17 00:00:00 2001 From: Mateusz Gołuchowski Date: Fri, 26 Jun 2020 12:59:03 +0200 Subject: AssignPnfBB - store model related PNF parameters in AAI Issue-ID: SO-2640 Change-Id: I375db2004687f1f634adac31d4d1af3875f5981c Signed-off-by: Mateusz Goluchowski --- .../bpmn/servicedecomposition/tasks/BBInputSetupPnf.java | 5 +++++ .../servicedecomposition/tasks/BBInputSetupPnfTest.java | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java index 4379864bfe..68161a8dd5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.serviceinstancebeans.Pnfs; @@ -36,6 +37,10 @@ final class BBInputSetupPnf { Pnf pnf = new Pnf(); pnf.setPnfId(pnfId); pnf.setPnfName(pnfs.getInstanceName()); + pnf.setModelInfoPnf(new ModelInfoPnf()); + pnf.getModelInfoPnf().setModelCustomizationUuid(pnfs.getModelInfo().getModelCustomizationId()); + pnf.getModelInfoPnf().setModelInvariantUuid(pnfs.getModelInfo().getModelInvariantId()); + pnf.getModelInfoPnf().setModelUuid(pnfs.getModelInfo().getModelVersionId()); pnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); serviceInstance.getPnfs().add(pnf); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java index 0eef9cccd8..aa9943b9b1 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java @@ -29,6 +29,7 @@ import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.Pnfs; import static org.mockito.Mockito.doReturn; @@ -38,11 +39,22 @@ public class BBInputSetupPnfTest { @Mock private Pnfs pnfs; + @Mock + private ModelInfo modelInfo; + @Test public void populatePnfShouldSetRequiredFields() { final String pnfId = "PNF_id1"; final String pnfName = "PNF_name1"; + final String modelCustomizationId = "8421fe03-fd1b-4bf7-845a-c3fe91edb031"; + final String modelInvariantId = "3360a2a5-22ff-44c7-8935-08c8e5ecbd06"; + final String modelVersionId = "b80c3a52-abd4-436c-a22e-9c5da768781a"; + + doReturn(modelCustomizationId).when(modelInfo).getModelCustomizationId(); + doReturn(modelInvariantId).when(modelInfo).getModelInvariantId(); + doReturn(modelVersionId).when(modelInfo).getModelVersionId(); doReturn(pnfName).when(pnfs).getInstanceName(); + doReturn(modelInfo).when(pnfs).getModelInfo(); ServiceInstance serviceInstance = new ServiceInstance(); BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance); @@ -53,6 +65,9 @@ public class BBInputSetupPnfTest { assertEquals(pnfId, pnf.getPnfId()); assertEquals(pnfName, pnf.getPnfName()); + assertEquals(modelCustomizationId, pnf.getModelInfoPnf().getModelCustomizationUuid()); + assertEquals(modelInvariantId, pnf.getModelInfoPnf().getModelInvariantUuid()); + assertEquals(modelVersionId, pnf.getModelInfoPnf().getModelUuid()); assertEquals(OrchestrationStatus.PRECREATED, pnf.getOrchestrationStatus()); } } -- cgit 1.2.3-korg