diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2020-02-11 10:11:24 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-02-11 10:11:24 +0000 |
commit | 00ba764f619848bcd4a384e26b0806bd5fb80749 (patch) | |
tree | fd55661648e5a2515cda5cedf17bc1aa1c0ab02e /bpmn/so-bpmn-tasks | |
parent | 505b82d23d4340e67f619675bad4580fc3ae050a (diff) | |
parent | 6829555c125ee4243482acc792455272c214c6fe (diff) |
Merge "AssignPnfBB - store model related PNF parameters in AAI"
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r-- | bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java | 11 | ||||
-rw-r--r-- | bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java | 32 |
2 files changed, 43 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java index 11a7b83259..cf56964af3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java @@ -90,6 +90,17 @@ public class AAIObjectMapper { } public org.onap.aai.domain.yang.Pnf mapPnf(Pnf pnf) { + if (modelMapper.getTypeMap(Pnf.class, org.onap.aai.domain.yang.Pnf.class) == null) { + modelMapper.addMappings(new PropertyMap<Pnf, org.onap.aai.domain.yang.Pnf>() { + @Override + protected void configure() { + map().setModelCustomizationId(source.getModelInfoPnf().getModelCustomizationUuid()); + map().setModelInvariantId(source.getModelInfoPnf().getModelInvariantUuid()); + map().setModelVersionId(source.getModelInfoPnf().getModelUuid()); + } + }); + } + return modelMapper.map(pnf, org.onap.aai.domain.yang.Pnf.class); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java index 821e70a8c8..dc64e4ee48 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -41,6 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget; import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment; @@ -55,6 +58,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.db.catalog.beans.OrchestrationStatus; @@ -233,6 +237,34 @@ public class AAIObjectMapperTest { } @Test + public void pnfMap() { + final String pnfId = "PNF_id1"; + final String pnfName = "PNF_name1"; + final String modelCustomizationId = "8421fe03-fd1b-4bf7-845a-c3fe91edb03e"; + final String modelInvariantId = "341a6f84-2cf9-4942-8f9e-2472ffe4e1d8"; + final String modelVersionId = "b13a0706-46b9-4a98-a9f9-5b28431235e7"; + final OrchestrationStatus orchestrationStatus = OrchestrationStatus.PRECREATED; + + Pnf pnf = new Pnf(); + pnf.setPnfId(pnfId); + pnf.setPnfName(pnfName); + pnf.setModelInfoPnf(new ModelInfoPnf()); + pnf.getModelInfoPnf().setModelCustomizationUuid(modelCustomizationId); + pnf.getModelInfoPnf().setModelInvariantUuid(modelInvariantId); + pnf.getModelInfoPnf().setModelUuid(modelVersionId); + pnf.setOrchestrationStatus(orchestrationStatus); + + org.onap.aai.domain.yang.Pnf aaiPnf = aaiObjectMapper.mapPnf(pnf); + + assertEquals(aaiPnf.getPnfId(), pnfId); + assertEquals(aaiPnf.getPnfName(), pnfName); + assertEquals(aaiPnf.getModelCustomizationId(), modelCustomizationId); + assertEquals(aaiPnf.getModelInvariantId(), modelInvariantId); + assertEquals(aaiPnf.getModelVersionId(), modelVersionId); + assertEquals(aaiPnf.getOrchestrationStatus(), orchestrationStatus.toString()); + } + + @Test public void vfModuleMap() throws Exception { VfModule vfModule = new VfModule(); vfModule.setVfModuleId("a"); |