From 88aa0c2fc7965cb6c4b167938157b8269548ab3f Mon Sep 17 00:00:00 2001 From: "Smokowski, Steven" Date: Thu, 22 Oct 2020 13:41:33 -0400 Subject: 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) Change-Id: I70e37f98c8c7b9e9859149f326cfde76fa408f7c --- .../onap/so/simulator/actions/aai/ProcessVnfc.java | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'so-simulator') 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 = 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) { -- cgit 1.2.3-korg