From 4180d54d46aebca6bba531241d01759615887e2c Mon Sep 17 00:00:00 2001 From: Mateusz Gołuchowski Date: Thu, 30 Jul 2020 15:33:03 +0200 Subject: Create DeactivatePnfBB and include it into Service-Macro-Delete flow. - created DeactivatePnfBB which changes orchestration status to inventoried when invoked - included BB into flow in R_MacroData script which initializes database - added support for mapping of service relations to PNFs - changed version of logging-analytics to 1.6.7 Issue-ID: SO-3111 Change-Id: I375db2014887f1f634adac31d4d1af3675f5911c Signed-off-by: Mateusz Goluchowski --- .../tasks/BBInputSetupMapperLayerTest.java | 13 +++++++++++- .../tasks/BBInputSetupTest.java | 24 ++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) (limited to 'bpmn/MSOCommonBPMN/src/test/java/org/onap') diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index 13d2b7d3d3..4755e58582 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -39,6 +39,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; @@ -75,7 +76,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; -import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfcCustomization; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -421,6 +421,17 @@ public class BBInputSetupMapperLayerTest { assertThat(actual, sameBeanAs(expected)); } + @Test + public void testMapAAIPnfIntoPnf() throws IOException { + Pnf expected = mapper.readValue(new File(RESOURCE_PATH + "PnfExpected.json"), Pnf.class); + org.onap.aai.domain.yang.Pnf aaiPnf = + mapper.readValue(new File(RESOURCE_PATH + "aaiPnfInput.json"), org.onap.aai.domain.yang.Pnf.class); + + Pnf actual = bbInputSetupMapperLayer.mapAAIPnfIntoPnf(aaiPnf); + + assertThat(actual, sameBeanAs(expected)); + } + @Test public void testMapAAICollectionIntoCollection() throws JsonParseException, JsonMappingException, IOException { org.onap.aai.domain.yang.Collection aaiCollection = mapper diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 9e9c6f365f..dd79d2772f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -69,6 +69,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; @@ -1814,6 +1815,29 @@ public class BBInputSetupTest { verify(SPY_bbInputSetup, times(1)).mapVolumeGroups(any()); } + @Test + public void testMapPnfs() throws JsonProcessingException { + org.onap.aai.domain.yang.Pnf expectedAAI = new org.onap.aai.domain.yang.Pnf(); + org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList(); + org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship(); + relationshipList.getRelationship().add(relationship); + expectedAAI.setRelationshipList(relationshipList); + + Pnf expected = new Pnf(); + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, "pnfId"); + AAIResultWrapper pnfWrapper = + new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(pnfWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri); + doReturn(expected).when(bbInputSetupMapperLayer).mapAAIPnfIntoPnf(isA(org.onap.aai.domain.yang.Pnf.class)); + + List pnfs = new ArrayList<>(); + + SPY_bbInputSetup.mapPnfs(Arrays.asList(aaiResourceUri), pnfs); + + assertEquals(expected, pnfs.get(0)); + } + @Test public void testMapVolumeGroups() throws JsonProcessingException { org.onap.aai.domain.yang.VolumeGroup expectedAAI = new org.onap.aai.domain.yang.VolumeGroup(); -- cgit 1.2.3-korg