From a06fb5e6ecc13c0b9742819c710f762fed2b79ac Mon Sep 17 00:00:00 2001 From: Lukasz Rajewski Date: Tue, 26 May 2020 16:57:47 +0200 Subject: Add missing relationship in heatbridge Added missing relationship creation between v-server and generic-vnf Issue-ID: SO-2956 Signed-off-by: Lukasz Rajewski Change-Id: I8c74f078d7073041492b8c03ce6adb26823dec51 --- .../src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java | 7 ++++++- .../src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java index f18279d5d3..90f55dcbb5 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java @@ -62,7 +62,7 @@ import org.openstack4j.model.network.Port; public class AaiHelper { /** - * Build vserver relationship object to entities: pserver, vf-module, image, flavor + * Build vserver relationship object to entities: pserver, vf-module, generic-vnf, image, flavor * * @param cloudOwner AAI cloudOwner value * @param cloudRegionId AAI cloud-region identifier @@ -88,6 +88,11 @@ public class AaiHelper { .put(HeatBridgeConstants.AAI_VF_MODULE_ID, vfModuleId).build()); relationships.add(vfModuleRelationship); + // vserver to generic-vnf relationship + Relationship genericVnfRelationship = buildRelationship(HeatBridgeConstants.AAI_GENERIC_VNF, ImmutableMap + .builder().put(HeatBridgeConstants.AAI_GENERIC_VNF_ID, genericVnfId).build()); + relationships.add(genericVnfRelationship); + // vserver to image relationship if (server.getImage() != null) { Relationship imageRel = buildRelationship(HeatBridgeConstants.AAI_IMAGE, diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java index 988e78b9a3..302af268d3 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java @@ -320,15 +320,15 @@ public class HeatBridgeImplTest { org.onap.aai.domain.yang.RelationshipList relList = aaiHelper.getVserverRelationshipList(CLOUD_OWNER, REGION_ID, "test-genericVnf-id", "test-vfModule-id", server1); - assertEquals(2, relList.getRelationship().size()); + assertEquals(3, relList.getRelationship().size()); org.onap.aai.domain.yang.RelationshipList relList2 = aaiHelper.getVserverRelationshipList(CLOUD_OWNER, REGION_ID, "test-genericVnf-id", "test-vfModule-id", server2); - assertEquals(1, relList2.getRelationship().size()); + assertEquals(2, relList2.getRelationship().size()); org.onap.aai.domain.yang.RelationshipList relList3 = aaiHelper.getVserverRelationshipList(CLOUD_OWNER, REGION_ID, "test-genericVnf-id", "test-vfModule-id", server3); - assertEquals(1, relList3.getRelationship().size()); + assertEquals(2, relList3.getRelationship().size()); } @Test -- cgit 1.2.3-korg