summaryrefslogtreecommitdiffstats
path: root/so-simulator/src/main/java
diff options
context:
space:
mode:
authorMnushkin, Dmitry <dmitry.mnushkin@att.com>2020-06-24 10:32:40 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-06-24 10:32:41 -0400
commita0f2f88faabaed5e24a5fd9ae3ceb1f7fa428d7c (patch)
tree7f1f25e71a345b4217ee6afafa1da016abfcb758 /so-simulator/src/main/java
parentcf5b7493eb7dffdeb211af056ce8459ede89292a (diff)
Update sim case for sdnc
updated what we write to aai to match sdnc Issue-ID: SO-3004 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ic223034fc8805c956637e8443e162c71456da476
Diffstat (limited to 'so-simulator/src/main/java')
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java26
1 files changed, 26 insertions, 0 deletions
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 f790d804ca..954ebdd013 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,12 +1,18 @@
package org.onap.so.simulator.actions.aai;
+import java.io.InputStream;
+import java.util.List;
import org.onap.aai.domain.yang.Vnfc;
+import org.onap.aai.domain.yang.Vserver;
+import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.Relationships;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.io.ClassPathResource;
import com.consol.citrus.actions.AbstractTestAction;
import com.consol.citrus.context.TestContext;
@@ -56,6 +62,26 @@ public class ProcessVnfc extends AbstractTestAction {
aaiResourceClient.connect(vnfcURI, vserverURI);
aaiResourceClient.connect(vserverURI, pserverURI);
aaiResourceClient.connect(vfModuleURI, vnfcURI);
+ } else if (context.getVariable("requestAction").equals("CreateVfModuleInstance")
+ && context.getVariable("serviceAction").equals("activate")) {
+ // For recreate after soft delete
+ AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, "zauk51bfrwl09oam001");
+ AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
+ context.getVariable("cloudOwner"), context.getVariable("cloudRegion"),
+ context.getVariable("tenant"), "d29f3151-592d-4011-9356-ad047794e236");
+
+ Relationships relationships = aaiResourceClient.get(vnfcURI).getRelationships().get();
+ List<AAIResourceUri> uris = relationships.getRelatedUris(AAIObjectType.VSERVER);
+ if (uris.isEmpty() || uris.size() == 0) {
+ if (!aaiResourceClient.exists(vserverURI)) {
+ AAICommonObjectMapperProvider aaiMapper = new AAICommonObjectMapperProvider();
+ InputStream vserverFile =
+ new ClassPathResource("openstack/gr_api/CreateVserver.json").getInputStream();
+ Vserver vserver = aaiMapper.getMapper().readValue(vserverFile, Vserver.class);
+ aaiResourceClient.create(vserverURI, vserver);
+ }
+ aaiResourceClient.connect(vnfcURI, vserverURI);
+ }
}
} catch (Exception e) {
logger.debug("Exception in ProcessVnfc.doExecute", e);