summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2020-10-22 13:41:33 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-10-22 13:41:34 -0400
commit88aa0c2fc7965cb6c4b167938157b8269548ab3f (patch)
tree7ac11788bbed9321cf64f604492c65b98645d00b
parent1ab809dc66569ae9db7fb94b861c0852d095428d (diff)
Update to not create VNFC relationship
Update to not create VNFC relationship remove VNFC edge, AAI will automatically create this Move edge creation to sim, as AAI other ms does it update to search to make edge to vserver Issue-ID: SO-3329 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I70e37f98c8c7b9e9859149f326cfde76fa408f7c
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java7
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java6
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java24
4 files changed, 27 insertions, 15 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index c8cb8d9731..5f17f3ca38 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -328,11 +328,6 @@ public class HeatBridgeImpl implements HeatBridgeApi {
.cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(vserver.getVserverId()));
if (resourcesClient.exists(vserverUri)) {
AAIResultWrapper existingVserver = resourcesClient.get(vserverUri);
- if (!existingVserver.hasRelationshipsTo(Types.VNFC)) {
- AAIResourceUri vnfcUri =
- AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(server.getName()));
- transaction.connect(vserverUri, vnfcUri);
- }
if (!existingVserver.hasRelationshipsTo(Types.VF_MODULE)) {
AAIResourceUri vfModuleUri = AAIUriFactory.createResourceUri(
AAIFluentTypeBuilder.network().genericVnf(genericVnfId).vfModule(vfModuleId));
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 c1a97cefc4..8e6f8cc69b 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
@@ -92,13 +92,6 @@ public class AaiHelper {
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId)));
relationships.add(genericVnfRelationship);
- // vserver to vnfc relationship
- if (!StringUtils.isEmpty(server.getName())) {
- Relationship vnfcRelationship = buildRelationship(
- AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(server.getName())));
- relationships.add(vnfcRelationship);
- }
-
// vserver to vf-module relationship
Relationship vfModuleRelationship = buildRelationship(AAIUriFactory
.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId).vfModule(vfModuleId)));
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 309a143e32..7912bceede 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
@@ -297,15 +297,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(4, 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(3, 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(3, relList3.getRelationship().size());
+ assertEquals(2, relList3.getRelationship().size());
}
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
index d8d62d99bc..80e50befaa 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
@@ -1,7 +1,11 @@
package org.onap.so.simulator.actions.aai;
+import java.util.Optional;
import org.onap.aai.domain.yang.Vnfc;
+import org.onap.aai.domain.yang.Vserver;
+import org.onap.aai.domain.yang.Vservers;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
@@ -58,6 +62,26 @@ public class ProcessVnfc extends AbstractTestAction {
.genericVnf(context.getVariable("vnfId")).vfModule(context.getVariable("vfModuleId")));
logger.debug("creating VNFC edge to vf module");
aaiResourceClient.connect(vfModuleURI, vnfcURI);
+ } else if (context.getVariable("requestAction").equals("CreateVfModuleInstance")
+ && context.getVariable("serviceAction").equals("activate")) {
+ logger.debug("creating edge between vserver and vnfc");
+ AAIResourceUri vnfcURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc("ssc_server_1"));
+ AAIPluralResourceUri vserverPlural =
+ AAIUriFactory
+ .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(context.getVariable("cloudOwner"),
+ context.getVariable("cloudRegion"))
+ .tenant(context.getVariable("tenant")).vservers())
+ .queryParam("vserver-name", "ssc_server_1");
+ Optional<Vserver> vserver = aaiResourceClient.getFirst(Vservers.class, Vserver.class, vserverPlural);
+ if (vserver.isPresent()) {
+ AAIResourceUri vserverURI =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(context.getVariable("cloudOwner"), context.getVariable("cloudRegion"))
+ .tenant(context.getVariable("tenant")).vserver(vserver.get().getVserverId()));
+ aaiResourceClient.connect(vserverURI, vnfcURI);
+ }
}
} catch (Exception e) {