aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorLaMont, William (wl2432) <wl2432@att.com>2019-01-22 15:02:47 -0500
committerLaMont, William (wl2432) <wl2432@att.com>2019-01-22 15:03:05 -0500
commit34ca2877182d1a505015578b0728f32452ac5cbb (patch)
tree324e52ca003d2acac7d2a40b8786d89b89886cb5 /src/test
parent4e579fc1bca9fdc42d294b21541cfe80cb0c60a2 (diff)
update cacher repo with v15
Issue-ID: AAI-2112 Change-Id: I8aab3d9c498d217638d50b8fde5f500b556d7fd0 Signed-off-by: LaMont, William (wl2432) <wl2432@att.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/aai/cacher/common/LimitTest.java429
-rw-r--r--src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonNoFakeTest.java27
-rw-r--r--src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorScenariosTest.java419
-rw-r--r--src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorTest.java26
-rw-r--r--src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIEventConsumerTest.java67
-rw-r--r--src/test/java/org/onap/aai/cacher/injestion/parser/AAIResourcesUriTemplatesTest.java117
-rw-r--r--src/test/java/org/onap/aai/cacher/injestion/parser/InjestionTestComponent.java2
-rw-r--r--src/test/java/org/onap/aai/cacher/injestion/parser/PayloadParserServiceTest.java86
-rw-r--r--src/test/java/org/onap/aai/cacher/injestion/parser/strategy/AAIResourceDmaapParserStrategyTest.java429
-rw-r--r--src/test/java/org/onap/aai/cacher/injestion/parser/strategy/AAIResourceDmaapParserStrategyTestConstants.java12
-rw-r--r--src/test/java/org/onap/aai/cacher/injestion/parser/strategy/aai/dmaap/AAIResourceDmaapParserStrategyTest.java360
-rw-r--r--src/test/java/org/onap/aai/cacher/model/CacheKeyTest.java20
-rw-r--r--src/test/java/org/onap/aai/cacher/service/helper/CacheHelperServiceScenariosTest.java50
-rw-r--r--src/test/java/org/onap/aai/cacher/service/rest/util/CacheKeyRequestValidationTest.java12
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/address-list.json4
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/allotted-resource.json53
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/create-generic-vnf-with-children-update-generic-vnf-property.json710
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/createPserverCreateCRWithNestingAndRelsToUpdateRemovingARelTest.json151
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/createPserverRelationshipsToNonExistingTest.json90
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/createPserverWithNestedDeleteNested.json56
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/createPserverWithoutNestedAddNested.json49
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/cvlan-tag-entry-create.json32
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/cvlan-tag-entry.json61
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/cvlan-tag.json61
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/deleteRelationship/1-create-logical-link.json4
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/deleteRelationship/2-create-generic-vnf.json4
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/deleteRelationship/3-create-rel-generic-vnf-vlan-to-logical-link.json6
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/deleteRelationship/4-delete-rel-to-generic-vnf-vlan-from-logical-link.json4
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/large-pserver.json4
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/linterfaceWithLinterfaceTest.json57
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/nos.json10
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/vce.json4
-rw-r--r--src/test/resources/test/payloads/json/generic-vnfs-one-with-nesting-with-address-list.json86
-rw-r--r--src/test/resources/test/payloads/json/generic-vnfs-one-with-nesting.json78
-rw-r--r--src/test/resources/test/payloads/json/one-cr-with-nested-dupe-get-all.json183
-rw-r--r--src/test/resources/test/payloads/json/pservers-one-with-nesting.json143
-rw-r--r--src/test/resources/test/payloads/json/test-empty.json6
37 files changed, 3217 insertions, 695 deletions
diff --git a/src/test/java/org/onap/aai/cacher/common/LimitTest.java b/src/test/java/org/onap/aai/cacher/common/LimitTest.java
new file mode 100644
index 0000000..366181d
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/common/LimitTest.java
@@ -0,0 +1,429 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.aai.cacher.common;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import com.mongodb.DB;
+import com.mongodb.MongoClient;
+import com.mongodb.client.MongoDatabase;
+import de.flapdoodle.embed.mongo.Command;
+import de.flapdoodle.embed.mongo.MongodExecutable;
+import de.flapdoodle.embed.mongo.MongodProcess;
+import de.flapdoodle.embed.mongo.MongodStarter;
+import de.flapdoodle.embed.mongo.config.*;
+import de.flapdoodle.embed.mongo.distribution.Version;
+import de.flapdoodle.embed.process.config.io.ProcessOutput;
+import de.flapdoodle.embed.process.io.Processors;
+import de.flapdoodle.embed.process.io.Slf4jLevel;
+import de.flapdoodle.embed.process.runtime.Network;
+import org.apache.commons.io.IOUtils;
+import org.json.JSONException;
+import org.junit.*;
+import org.junit.rules.TestName;
+import org.junit.runner.RunWith;
+import org.onap.aai.cacher.egestion.printer.PayloadPrinterService;
+import org.onap.aai.cacher.injestion.parser.PayloadParserService;
+import org.onap.aai.cacher.injestion.parser.strategy.PayloadParserType;
+import org.onap.aai.cacher.model.CacheKey;
+import org.onap.aai.cacher.service.helper.CacheHelperService;
+import org.onap.aai.cacher.util.AAIConstants;
+import org.skyscreamer.jsonassert.JSONAssert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import static org.hamcrest.core.IsNot.not;
+import static org.hamcrest.core.StringContains.containsString;
+import static org.junit.Assert.*;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration
+public class LimitTest {
+
+ private static final String DB_NAME = LimitTest.class.getSimpleName();
+ private static MongoDatabase mongoDatabase;
+ private static DB db;
+ private static MongodProcess mongod;
+ private static MongoClient mongoC;
+
+ @Autowired private PayloadParserService payloadParserService;
+ @Autowired private PayloadPrinterService payloadPrinterService;
+ @Autowired private MongoHelperSingleton mongoHelperSingleton;
+ private CacheHelperService cacheHelperService;
+ private JsonParser parser = new JsonParser();
+
+
+ @Configuration
+ @ComponentScan({"org.onap.aai.cacher.egestion","org.onap.aai.cacher.injestion"})
+ public static class SpringConfig {
+ @Bean
+ public MongoHelperSingleton getMongoHelperSingleton() {
+ return new MongoHelperSingleton(db, mongoDatabase);
+ }
+ }
+
+ @Rule
+ public TestName name = new TestName();
+
+ @BeforeClass
+ public static void setup() throws IOException, InterruptedException {
+
+ String bindIp = "localhost";
+ int port = 27017;
+ startEmbedded(port);
+ mongoC = new MongoClient(bindIp, port);
+ mongoDatabase = mongoC.getDatabase(DB_NAME);
+ db = mongoC.getDB(DB_NAME);
+ }
+
+ protected static void startEmbedded(int port) throws IOException {
+ Logger logger = LoggerFactory.getLogger("mongo");
+
+ IMongodConfig mongoConfigConfig = new MongodConfigBuilder()
+ .version(Version.Main.PRODUCTION)
+ .net(new Net(port, Network.localhostIsIPv6()))
+ .cmdOptions(new MongoCmdOptionsBuilder().enableTextSearch(true).useNoPrealloc(false).build())
+ .configServer(false)
+ .build();
+
+ ProcessOutput processOutput = new ProcessOutput(Processors.logTo(logger, Slf4jLevel.WARN), Processors.logTo(logger,
+ Slf4jLevel.WARN), Processors.logTo(logger, Slf4jLevel.WARN));
+
+ MongodExecutable mongodExecutable = MongodStarter
+ .getInstance((new RuntimeConfigBuilder())
+ .defaults(Command.MongoD)
+ .processOutput(processOutput)
+ .build())
+ .prepare(mongoConfigConfig);
+
+ mongod = mongodExecutable.start();
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ if (mongod != null && mongod.isProcessRunning()) {
+ mongod.stop();
+ }
+ }
+
+ @Before
+ public void init() {
+ cacheHelperService = new CacheHelperService();
+ cacheHelperService.setMongoHelper(mongoHelperSingleton);
+ cacheHelperService.setPayloadParserService(payloadParserService);
+ cacheHelperService.setPayloadPrinterService(payloadPrinterService);
+
+ }
+
+ @After
+ public void cleanup() {
+ final List<String> collectionNames = new ArrayList<>();
+ mongoDatabase.listCollections().iterator().forEachRemaining(document -> collectionNames.add(document.getString("name")));
+ collectionNames.forEach(collectionName -> mongoDatabase.getCollection(collectionName).drop());
+ }
+
+ @Test
+ public void testBsonLimitWhereCacheIsArrayOfSmallObjs() throws JSONException {
+
+ mongoDatabase.createCollection(AAIConstants.COLLECTION_CACHEKEY);
+ String genericVnfCacheKey = "{" +
+ "'cacheKey': 'generic-vnf'," +
+ "'baseUrl': 'https://localhost:8443'," +
+ "'module': '/aai/v14/'," +
+ "'URI': 'network/generic-vnf?depth=0'" +
+ "}";
+ JsonObject ckJson = (JsonObject) parser.parse(genericVnfCacheKey);
+ CacheKey ck = CacheKey.fromJson(ckJson);
+ ck.setParserStrategy(PayloadParserType.AAI_RESOURCE_GET_ALL.getValue());
+ cacheHelperService.addCacheKey(ck);
+ ck = cacheHelperService.retrieveCacheKeyObject(ck);
+ System.out.println("\n\nCache key after insert");
+ System.out.println(ck.toString());
+
+ String collectionName = name.getMethodName();
+ mongoDatabase.createCollection(collectionName);
+
+ JsonObject genericVnfsObj = new JsonObject();
+ JsonArray genericVnfsArray = new JsonArray();
+ String genericVnfTemplate = "{" +
+ "'vnf-id':'%s'," +
+ "'vnf-name':'vn2f0-SDN'," +
+ "'vnf-type':'test-gvnf-type'," +
+ "'service-id':'a92a77d5a0-123e-4'," +
+ "'orchestration-status':'active'," +
+ "'in-maint':true," +
+ "'is-closed-loop-disabled':false," +
+ "'resource-version':'1506978203538'" +
+ "}";
+
+ String vnfId;
+ JsonObject genericVnf;
+ for (int i = 0; i < 70000; i++) {
+ vnfId = UUID.randomUUID().toString();
+ genericVnf = parser.parse(String.format(genericVnfTemplate, vnfId)).getAsJsonObject();
+ genericVnfsArray.add(genericVnf);
+ }
+
+ genericVnfsObj.add("generic-vnf", genericVnfsArray);
+
+ cacheHelperService.populateCache(ck, genericVnfsObj.toString());
+
+ ck = cacheHelperService.retrieveCacheKeyObject(ck);
+ System.out.println("Updated cache key");
+ System.out.println(ck.toString());
+
+ Response response = cacheHelperService.getData(ck);
+ assertEquals("Get is Successful", 200, response.getStatus());
+ JSONAssert.assertEquals(genericVnfsObj.toString(), response.getEntity().toString(), false);
+
+ }
+
+ @Test
+ public void testBsonLimitWhereCacheContainsOneLargeObj() throws JSONException {
+
+ mongoDatabase.createCollection(AAIConstants.COLLECTION_CACHEKEY);
+ String genericVnfCacheKey = "{" +
+ "'cacheKey': 'generic-vnf'," +
+ "'baseUrl': 'https://localhost:8443'," +
+ "'module': '/aai/v14/'," +
+ "'URI': 'network/generic-vnf?depth=0'" +
+ "}";
+ JsonObject ckJson = (JsonObject) parser.parse(genericVnfCacheKey);
+ CacheKey ck = CacheKey.fromJson(ckJson);
+ ck.setParserStrategy(PayloadParserType.AAI_RESOURCE_GET_ALL.getValue());
+ cacheHelperService.addCacheKey(ck);
+ ck = cacheHelperService.retrieveCacheKeyObject(ck);
+ System.out.println("\n\nCache key after insert");
+ System.out.println(ck.toString());
+
+ String collectionName = name.getMethodName();
+ mongoDatabase.createCollection(collectionName);
+
+ JsonObject genericVnfsObj = new JsonObject();
+ JsonArray genericVnfsArray = new JsonArray();
+ String genericVnfTemplate = "{" +
+ "'vnf-id':'%s'," +
+ "'vnf-name':'vn2f0-SDN'," +
+ "'vnf-type':'test-gvnf-type'," +
+ "'service-id':'a92a77d5a0-123e-4'," +
+ "'orchestration-status':'active'," +
+ "'in-maint':true," +
+ "'is-closed-loop-disabled':false," +
+ "'resource-version':'1506978203538'" +
+ "}";
+ String vnfId;
+ JsonObject genericVnf;
+ for (int i = 0; i < 20; i++) {
+ vnfId = UUID.randomUUID().toString();
+ genericVnf = parser.parse(String.format(genericVnfTemplate, vnfId)).getAsJsonObject();
+ genericVnfsArray.add(genericVnf);
+ }
+
+ JsonObject vfModulesObj = new JsonObject();
+ JsonArray vfModulesArray = new JsonArray();
+ String vfModuleTemplate = "{" +
+ "'vf-module-id':'%s'," +
+ "'vf-module-name':'example-vf-module-name'," +
+ "'heat-stack-id':'example-heat-stack-id'," +
+ "'orchestration-status':'example-orchestration-status'," +
+ "'is-base-vf-module':true," +
+ "'automated-assignment':true" +
+ "}";
+ String vfModuleId;
+ JsonObject vfModule;
+ for (int i = 0; i < 70000; i++) {
+ vfModuleId = UUID.randomUUID().toString();
+ vfModule = parser.parse(String.format(vfModuleTemplate, vfModuleId)).getAsJsonObject();
+ vfModulesArray.add(vfModule);
+ }
+
+ vfModulesObj.add("vf-module", vfModulesArray);
+ genericVnfsArray.get(0).getAsJsonObject().add("vf-modules", vfModulesObj);
+ genericVnfsObj.add("generic-vnf", genericVnfsArray);
+
+ cacheHelperService.populateCache(ck, genericVnfsObj.toString());
+
+ ck = cacheHelperService.retrieveCacheKeyObject(ck);
+ System.out.println("Updated cache key");
+ System.out.println(ck.toString());
+
+ Response response = cacheHelperService.getData(ck);
+ assertEquals("Get is Successful", 200, response.getStatus());
+ JSONAssert.assertEquals(genericVnfsObj.toString(), response.getEntity().toString(), false);
+
+ }
+
+ @Test
+ public void testBsonLimitWhereCacheContainsOneSmallObj() throws JSONException {
+
+ mongoDatabase.createCollection(AAIConstants.COLLECTION_CACHEKEY);
+ String genericVnfCacheKey = "{" +
+ "'cacheKey': 'generic-vnf'," +
+ "'baseUrl': 'https://localhost:8443'," +
+ "'module': '/aai/v14/'," +
+ "'URI': 'network/generic-vnf?depth=0'" +
+ "}";
+ JsonObject ckJson = (JsonObject) parser.parse(genericVnfCacheKey);
+ CacheKey ck = CacheKey.fromJson(ckJson);
+ ck.setParserStrategy(PayloadParserType.AAI_RESOURCE_GET_ALL.getValue());
+ cacheHelperService.addCacheKey(ck);
+ ck = cacheHelperService.retrieveCacheKeyObject(ck);
+ System.out.println("\n\nCache key after insert");
+ System.out.println(ck.toString());
+
+ String collectionName = name.getMethodName();
+ mongoDatabase.createCollection(collectionName);
+
+ JsonObject genericVnfsObj = new JsonObject();
+ JsonArray genericVnfsArray = new JsonArray();
+ String genericVnfTemplate = "{" +
+ "'vnf-id':'%s'," +
+ "'vnf-name':'vn2f0-SDN'," +
+ "'vnf-type':'test-gvnf-type'," +
+ "'service-id':'a92a77d5a0-123e-4'," +
+ "'orchestration-status':'active'," +
+ "'in-maint':true," +
+ "'is-closed-loop-disabled':false," +
+ "'resource-version':'1506978203538'" +
+ "}";
+ String vnfId;
+ JsonObject genericVnf;
+ for (int i = 0; i < 2; i++) {
+ vnfId = UUID.randomUUID().toString();
+ genericVnf = parser.parse(String.format(genericVnfTemplate, vnfId)).getAsJsonObject();
+ genericVnfsArray.add(genericVnf);
+ }
+
+ JsonObject vfModulesObj = new JsonObject();
+ JsonArray vfModulesArray = new JsonArray();
+ String vfModuleTemplate = "{" +
+ "'vf-module-id':'%s'," +
+ "'vf-module-name':'example-vf-module-name'," +
+ "'heat-stack-id':'example-heat-stack-id'," +
+ "'orchestration-status':'example-orchestration-status'," +
+ "'is-base-vf-module':true," +
+ "'automated-assignment':true" +
+ "}";
+ String vfModuleId;
+ JsonObject vfModule;
+ for (int i = 0; i < 2; i++) {
+ vfModuleId = UUID.randomUUID().toString();
+ vfModule = parser.parse(String.format(vfModuleTemplate, vfModuleId)).getAsJsonObject();
+ vfModulesArray.add(vfModule);
+ }
+
+ JsonArray addrArray = new JsonArray();
+ String addrTemplate = "{" +
+ "'vip-ipv4-address': '%s'" +
+ "}";
+ for (int i = 0; i < 2; i++) {
+ String addr = UUID.randomUUID().toString();
+ JsonObject addrObj = parser.parse(String.format(addrTemplate, addr)).getAsJsonObject();
+ addrArray.add(addrObj);
+ }
+ vfModulesArray.get(0).getAsJsonObject().add("vip-ipv4-address-list", addrArray);
+ vfModulesObj.add("vf-module", vfModulesArray);
+ genericVnfsArray.get(0).getAsJsonObject().add("vf-modules", vfModulesObj);
+ genericVnfsObj.add("generic-vnf", genericVnfsArray);
+
+ System.out.println(genericVnfsObj.toString());
+ cacheHelperService.populateCache(ck, genericVnfsObj.toString());
+
+ ck = cacheHelperService.retrieveCacheKeyObject(ck);
+ System.out.println("Updated cache key");
+ System.out.println(ck.toString());
+
+ Response response = cacheHelperService.getData(ck);
+ assertEquals("Get is Successful", 200, response.getStatus());
+ JSONAssert.assertEquals(genericVnfsObj.toString(), response.getEntity().toString(), false);
+
+ }
+
+ @Test
+ public void testOneCrWithNestedDupeGetAll() throws JSONException, IOException {
+
+ mongoDatabase.createCollection(AAIConstants.COLLECTION_CACHEKEY);
+ String crKey = "{" +
+ "'cacheKey': 'cloud-region'," +
+ "'baseUrl': 'https://localhost:8443'," +
+ "'module': '/aai/v14/'," +
+ "'URI': '/cloud-infrastructure/cloud-regions'" +
+ "}";
+ JsonObject ckJson = (JsonObject) parser.parse(crKey);
+ CacheKey ck = CacheKey.fromJson(ckJson);
+ ck.setParserStrategy(PayloadParserType.AAI_RESOURCE_GET_ALL.getValue());
+ cacheHelperService.addCacheKey(ck);
+ ck = cacheHelperService.retrieveCacheKeyObject(ck);
+ System.out.println("\n\nCache key after insert");
+ System.out.println(ck.toString());
+
+ String collectionName = name.getMethodName();
+ mongoDatabase.createCollection(collectionName);
+
+ String crs = getJsonPayload("one-cr-with-nested-dupe-get-all");
+
+ cacheHelperService.populateCache(ck, crs);
+
+ assertEquals(5, mongoHelperSingleton.findAllWithIdsStartingWith("cloud-region", "/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner").size());
+
+ ck = cacheHelperService.retrieveCacheKeyObject(ck);
+ System.out.println("Updated cache key");
+ System.out.println(ck.toString());
+
+ Response response = cacheHelperService.getData(ck);
+ assertEquals("Get is Successful", 200, response.getStatus());
+ System.out.println("*********\n" + response.getEntity().toString() + "\n********");
+
+ assertThat("Stored does not contain empty array", response.getEntity().toString(), not(containsString("[]")));
+
+ }
+
+ private String getJsonPayload(String payload) throws IOException {
+ return getPayload("test/payloads/json/" + payload + ".json");
+ }
+
+ private String getPayload(String filename) throws IOException {
+
+ InputStream inputStream = getClass()
+ .getClassLoader()
+ .getResourceAsStream(filename);
+
+ String message = String.format("Unable to find the %s in src/test/resources", filename);
+ assertNotNull(message, inputStream);
+
+ return IOUtils.toString(inputStream);
+ }
+
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonNoFakeTest.java b/src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonNoFakeTest.java
index 1a086bc..3f236a2 100644
--- a/src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonNoFakeTest.java
+++ b/src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonNoFakeTest.java
@@ -25,14 +25,15 @@ import com.mongodb.MongoClient;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import com.mongodb.client.model.UpdateOptions;
+import de.flapdoodle.embed.mongo.Command;
import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodProcess;
import de.flapdoodle.embed.mongo.MongodStarter;
-import de.flapdoodle.embed.mongo.config.IMongodConfig;
-import de.flapdoodle.embed.mongo.config.MongoCmdOptionsBuilder;
-import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
-import de.flapdoodle.embed.mongo.config.Net;
+import de.flapdoodle.embed.mongo.config.*;
import de.flapdoodle.embed.mongo.distribution.Version;
+import de.flapdoodle.embed.process.config.io.ProcessOutput;
+import de.flapdoodle.embed.process.io.Processors;
+import de.flapdoodle.embed.process.io.Slf4jLevel;
import de.flapdoodle.embed.process.runtime.Network;
import org.bson.Document;
import org.json.JSONException;
@@ -42,6 +43,8 @@ import org.onap.aai.cacher.dmaap.consumer.AAIDmaapEventProcessorScenariosTest;
import org.onap.aai.cacher.model.CacheEntry;
import org.onap.aai.cacher.model.DBAction;
import org.skyscreamer.jsonassert.JSONAssert;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
@@ -78,14 +81,24 @@ public class MongoHelperSingletonNoFakeTest {
}
protected static void startEmbedded(int port) throws IOException {
+ Logger logger = LoggerFactory.getLogger("mongo");
+
IMongodConfig mongoConfigConfig = new MongodConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(port, Network.localhostIsIPv6()))
- .cmdOptions(new MongoCmdOptionsBuilder().verbose(true).build())
+ .cmdOptions(new MongoCmdOptionsBuilder().enableTextSearch(true).useNoPrealloc(false).build())
.configServer(false)
.build();
- MongodExecutable mongodExecutable = MongodStarter.getDefaultInstance().prepare(mongoConfigConfig);
+ ProcessOutput processOutput = new ProcessOutput(Processors.logTo(logger, Slf4jLevel.WARN), Processors.logTo(logger,
+ Slf4jLevel.WARN), Processors.logTo(logger, Slf4jLevel.WARN));
+
+ MongodExecutable mongodExecutable = MongodStarter
+ .getInstance((new RuntimeConfigBuilder())
+ .defaults(Command.MongoD)
+ .processOutput(processOutput)
+ .build())
+ .prepare(mongoConfigConfig);
mongod = mongodExecutable.start();
}
@@ -106,7 +119,7 @@ public class MongoHelperSingletonNoFakeTest {
public void cleanup() {
final List<String> collectionNames = new ArrayList<>();
mongoDatabase.listCollections().iterator().forEachRemaining(document -> collectionNames.add(document.getString("name")));
- collectionNames.stream().forEach(collectionName -> mongoDatabase.getCollection(collectionName).drop());
+ collectionNames.forEach(collectionName -> mongoDatabase.getCollection(collectionName).drop());
}
diff --git a/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorScenariosTest.java b/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorScenariosTest.java
index 2c01f5a..c5d39a0 100644
--- a/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorScenariosTest.java
+++ b/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorScenariosTest.java
@@ -19,30 +19,28 @@
*/
package org.onap.aai.cacher.dmaap.consumer;
+import com.github.fakemongo.Fongo;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mongodb.DB;
import com.mongodb.MongoClient;
import com.mongodb.client.MongoDatabase;
-import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodProcess;
-import de.flapdoodle.embed.mongo.MongodStarter;
-import de.flapdoodle.embed.mongo.config.IMongodConfig;
-import de.flapdoodle.embed.mongo.config.MongoCmdOptionsBuilder;
-import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
-import de.flapdoodle.embed.mongo.config.Net;
-import de.flapdoodle.embed.mongo.distribution.Version;
-import de.flapdoodle.embed.process.runtime.Network;
import org.apache.commons.io.IOUtils;
import org.bson.Document;
+import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.aai.cacher.common.MongoHelperSingleton;
+import org.onap.aai.cacher.egestion.printer.PayloadPrinterService;
+import org.onap.aai.cacher.egestion.printer.strategy.PayloadPrinterType;
import org.onap.aai.cacher.injestion.parser.InjestionTestComponent;
import org.onap.aai.cacher.injestion.parser.PayloadParserService;
+import org.onap.aai.cacher.injestion.parser.strategy.PayloadParserType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -51,10 +49,14 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URI;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
import static junit.framework.TestCase.assertFalse;
+import static org.hamcrest.core.IsNot.not;
+import static org.hamcrest.core.StringContains.containsString;
import static org.junit.Assert.*;
@RunWith(SpringJUnit4ClassRunner.class)
@@ -72,6 +74,9 @@ public class AAIDmaapEventProcessorScenariosTest {
@Autowired
private AAIDmaapEventProcessor aaiDmaapEventProcessor;
+ @Autowired PayloadPrinterService payloadPrinterService;
+ @Autowired PayloadParserService payloadParserService;
+ @Autowired MongoHelperSingleton mongoHelperSingleton;
@Bean
public DB db() {
@@ -89,34 +94,15 @@ public class AAIDmaapEventProcessorScenariosTest {
}
@Bean
- public AAIDmaapEventProcessor aaiDmaapEventProcessor(MongoHelperSingleton mongoHelperSingleton, PayloadParserService payloadParserService) {
- return new AAIDmaapEventProcessor(mongoHelperSingleton, payloadParserService);
+ public AAIDmaapEventProcessor aaiDmaapEventProcessor(MongoHelperSingleton mongoHelperSingleton, PayloadParserService payloadParserService, PayloadPrinterService payloadPrinterService) {
+ return new AAIDmaapEventProcessor(mongoHelperSingleton, payloadParserService, payloadPrinterService);
}
@BeforeClass
public static void setup() throws IOException, InterruptedException {
-
- String bindIp = "localhost";
- int port = 27017;
- startEmbedded(port);
-
- mongoC = new MongoClient(bindIp, port);
- mongoDb = mongoC.getDatabase(DB_NAME);
- db = mongoC.getDB(DB_NAME);
-
- }
-
- protected static void startEmbedded(int port) throws IOException {
- IMongodConfig mongoConfigConfig = new MongodConfigBuilder()
- .version(Version.Main.PRODUCTION)
- .net(new Net(port, Network.localhostIsIPv6()))
- .cmdOptions(new MongoCmdOptionsBuilder().verbose(true).build())
- .configServer(false)
- .build();
-
- MongodExecutable mongodExecutable = MongodStarter.getDefaultInstance().prepare(mongoConfigConfig);
-
- mongod = mongodExecutable.start();
+ Fongo fongo = new Fongo(DB_NAME);
+ mongoDb = fongo.getDatabase(DB_NAME);
+ db = fongo.getDB(DB_NAME);
}
@AfterClass
@@ -136,7 +122,7 @@ public class AAIDmaapEventProcessorScenariosTest {
@Test
public void createPserverCreateCRWithNestingAndRelationshipsToTest() throws Exception {
- String pserverCreate = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v13','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false}}";
+ String pserverCreate = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v14','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false}}";
aaiDmaapEventProcessor.process(pserverCreate);
assertNotEquals("pserver collection exists", mongoDatabase().getCollection("pserver"), null);
@@ -152,7 +138,7 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
"}"))
.iterator().hasNext()
);
@@ -160,13 +146,13 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
"}"))
.iterator().hasNext()
);
- String crWithNestingAndWithRels = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'cloud-region','top-entity-type':'cloud-region','entity-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'3d567832-df00-49b5-b862-4d3a341dbec1','source-name':'JUNIT','version':'v13','timestamp':'20180515-10:57:55:750'},'entity':{'tenants':{'tenant':[{'vservers':{'vserver':[{'relationship-list':{'relationship':[{'related-to':'pserver','relationship-data':[{'relationship-value':'pserver-1','relationship-key':'pserver.hostname'}],'related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','relationship-label':'tosca.relationships.HostedOn'}]},'l-interfaces':{'l-interface':[{'interface-name':'l-int-1','interface-id':'l-int-1','l3-interface-ipv4-address-list':[{'neutron-network-id':'93fb399c-9bfc-4234-b2bb-a76eda38f117','neutron-subnet-id':'79e5bb69-24bb-4ea3-8d1d-c04fca5f5e1e','l3-interface-ipv4-address':'192.168.70.3'}],'relationship-list':{'relationship':[{'related-to':'pserver','relationship-data':[{'relationship-value':'pserver-1','relationship-key':'pserver.hostname'}],'related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','relationship-label':'tosca.relationships.HostedOn'}]}}]},'vserver-id':'vserver-1'}]},'tenant-id':'tenenat-1'}]},'cloud-owner':'onap-cloud-owner','cloud-region-id':'mtn6'}}";
+ String crWithNestingAndWithRels = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'cloud-region','top-entity-type':'cloud-region','entity-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'3d567832-df00-49b5-b862-4d3a341dbec1','source-name':'JUNIT','version':'v14','timestamp':'20180515-10:57:55:750'},'entity':{'tenants':{'tenant':[{'vservers':{'vserver':[{'relationship-list':{'relationship':[{'related-to':'pserver','relationship-data':[{'relationship-value':'pserver-1','relationship-key':'pserver.hostname'}],'related-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1','relationship-label':'tosca.relationships.HostedOn'}]},'l-interfaces':{'l-interface':[{'interface-name':'l-int-1','interface-id':'l-int-1','l3-interface-ipv4-address-list':[{'neutron-network-id':'93fb399c-9bfc-4234-b2bb-a76eda38f117','neutron-subnet-id':'79e5bb69-24bb-4ea3-8d1d-c04fca5f5e1e','l3-interface-ipv4-address':'192.168.70.3'}],'relationship-list':{'relationship':[{'related-to':'pserver','relationship-data':[{'relationship-value':'pserver-1','relationship-key':'pserver.hostname'}],'related-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1','relationship-label':'tosca.relationships.HostedOn'}]}}]},'vserver-id':'vserver-1'}]},'tenant-id':'tenenat-1'}]},'cloud-owner':'onap-cloud-owner','cloud-region-id':'mtn6'}}";
aaiDmaapEventProcessor.process(crWithNestingAndWithRels);
@@ -175,7 +161,7 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
"}"))
.iterator().hasNext()
);
@@ -183,7 +169,7 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
"}"))
.iterator().hasNext()
);
@@ -192,44 +178,39 @@ public class AAIDmaapEventProcessorScenariosTest {
@Test
public void createCRWithNestingCreatePserverRelationshipsToNestedTest() throws Exception {
- String crWithNesting = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'cloud-region','top-entity-type':'cloud-region','entity-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'3d567832-df00-49b5-b862-4d3a341dbec1','source-name':'JUNIT','version':'v13','timestamp':'20180515-10:57:55:750'},'entity':{'tenants':{'tenant':[{'vservers':{'vserver':[{'l-interfaces':{'l-interface':[{'interface-name':'l-int-1','interface-id':'l-int-1','l3-interface-ipv4-address-list':[{'neutron-network-id':'93fb399c-9bfc-4234-b2bb-a76eda38f117','neutron-subnet-id':'79e5bb69-24bb-4ea3-8d1d-c04fca5f5e1e','l3-interface-ipv4-address':'192.168.70.3'}]}]},'vserver-id':'vserver-1'}]},'tenant-id':'tenenat-1'}]},'cloud-owner':'onap-cloud-owner','cloud-region-id':'mtn6'}}";
+ String crWithNesting = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'cloud-region','top-entity-type':'cloud-region','entity-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'3d567832-df00-49b5-b862-4d3a341dbec1','source-name':'JUNIT','version':'v14','timestamp':'20180515-10:57:55:750'},'entity':{'tenants':{'tenant':[{'vservers':{'vserver':[{'l-interfaces':{'l-interface':[{'interface-name':'l-int-1','interface-id':'l-int-1','l3-interface-ipv4-address-list':[{'neutron-network-id':'93fb399c-9bfc-4234-b2bb-a76eda38f117','neutron-subnet-id':'79e5bb69-24bb-4ea3-8d1d-c04fca5f5e1e','l3-interface-ipv4-address':'192.168.70.3'}]}]},'vserver-id':'vserver-1'}]},'tenant-id':'tenenat-1'}]},'cloud-owner':'onap-cloud-owner','cloud-region-id':'mtn6'}}";
aaiDmaapEventProcessor.process(crWithNesting);
assertNotEquals("cloud-region collection exists", mongoDatabase().getCollection("cloud-region"), null);
- String pserverWithRelsToNested = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v13','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false,'relationship-list':{'relationship':[{'related-to':'vserver','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'},{'relationship-key':'tenant.tenant-id','relationship-value':'tenenat-1'},{'relationship-key':'vserver.vserver-id','relationship-value':'vserver-1'}]},{'related-to':'l-interface','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'},{'relationship-key':'tenant.tenant-id','relationship-value':'tenenat-1'},{'relationship-key':'vserver.vserver-id','relationship-value':'vserver-1'},{'relationship-key':'l-interface.interface-name','relationship-value':'l-int-1'}]}]}}}";
+ String pserverWithRelsToNested = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v14','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false,'relationship-list':{'relationship':[{'related-to':'vserver','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'},{'relationship-key':'tenant.tenant-id','relationship-value':'tenenat-1'},{'relationship-key':'vserver.vserver-id','relationship-value':'vserver-1'}]},{'related-to':'l-interface','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'},{'relationship-key':'tenant.tenant-id','relationship-value':'tenenat-1'},{'relationship-key':'vserver.vserver-id','relationship-value':'vserver-1'},{'relationship-key':'l-interface.interface-name','relationship-value':'l-int-1'}]}]}}}";
aaiDmaapEventProcessor.process(pserverWithRelsToNested);
assertTrue("Now cloud-region->tenant->vserver now has relationship to pserver",
mongoDatabase().getCollection("cloud-region")
.find(Document.parse("{" +
- "'cloud-owner':'onap-cloud-owner'," +
- "'cloud-region-id':'mtn6'," +
- "'tenants.tenant.tenant-id':'tenenat-1'," +
- "'tenants.tenant.vservers.vserver.vserver-id':'vserver-1'," +
- "'tenants.tenant.vservers.vserver.relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1'" +
- "}"))
+ "'_id':'/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'," +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1'" +
+ "}"))
.iterator().hasNext()
);
assertTrue("Now cloud-region->tenant->vserver->l-interface now has relationship to pserver",
mongoDatabase().getCollection("cloud-region")
.find(Document.parse("{" +
- "'cloud-owner':'onap-cloud-owner'," +
- "'cloud-region-id':'mtn6'," +
- "'tenants.tenant.tenant-id':'tenenat-1'," +
- "'tenants.tenant.vservers.vserver.vserver-id':'vserver-1'," +
- "'tenants.tenant.vservers.vserver.l-interfaces.l-interface.interface-name':'l-int-1'," +
- "'tenants.tenant.vservers.vserver.relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1'" +
+ "'_id':'/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'," +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1'" +
"}"))
.iterator().hasNext()
);
}
- @Ignore
+
@Test
public void createPserverCreateCRWithNestingAndRelsToUpdateRemovingARelTest() throws Exception {
- String pserverCreate = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v13','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false}}";
+
+ JsonObject payloads = parser.parse(getEventPayload("createPserverCreateCRWithNestingAndRelsToUpdateRemovingARelTest")).getAsJsonObject();
+ String pserverCreate = payloads.get("pserverCreate").toString();
aaiDmaapEventProcessor.process(pserverCreate);
assertNotEquals("pserver collection exists", mongoDatabase().getCollection("pserver"), null);
@@ -245,7 +226,7 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
"}"))
.iterator().hasNext()
);
@@ -253,13 +234,13 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
"}"))
.iterator().hasNext()
);
- String crWithNestingAndWithRels = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'cloud-region','top-entity-type':'cloud-region','entity-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'3d567832-df00-49b5-b862-4d3a341dbec1','source-name':'JUNIT','version':'v13','timestamp':'20180515-10:57:55:750'},'entity':{'tenants':{'tenant':[{'vservers':{'vserver':[{'relationship-list':{'relationship':[{'related-to':'pserver','relationship-data':[{'relationship-value':'pserver-1','relationship-key':'pserver.hostname'}],'related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','relationship-label':'tosca.relationships.HostedOn'}]},'l-interfaces':{'l-interface':[{'interface-name':'l-int-1','interface-id':'l-int-1','l3-interface-ipv4-address-list':[{'neutron-network-id':'93fb399c-9bfc-4234-b2bb-a76eda38f117','neutron-subnet-id':'79e5bb69-24bb-4ea3-8d1d-c04fca5f5e1e','l3-interface-ipv4-address':'192.168.70.3'}],'relationship-list':{'relationship':[{'related-to':'pserver','relationship-data':[{'relationship-value':'pserver-1','relationship-key':'pserver.hostname'}],'related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','relationship-label':'tosca.relationships.HostedOn'}]}}]},'vserver-id':'vserver-1'}]},'tenant-id':'tenenat-1'}]},'cloud-owner':'onap-cloud-owner','cloud-region-id':'mtn6'}}";
+ String crWithNestingAndWithRels = payloads.get("crWithNestingAndWithRels").toString();
aaiDmaapEventProcessor.process(crWithNestingAndWithRels);
@@ -268,7 +249,7 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
"}"))
.iterator().hasNext()
);
@@ -276,36 +257,29 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
"}"))
.iterator().hasNext()
);
- String updatePserverWithoutInterfaceRel = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'UPDATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v13','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false,'relationship-list':{'relationship':[{'related-to':'vserver','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'},{'relationship-key':'tenant.tenant-id','relationship-value':'tenenat-1'},{'relationship-key':'vserver.vserver-id','relationship-value':'vserver-1'}]}]}}}";
+ String updatePserverWithoutInterfaceRel = payloads.get("updatePserverWithoutInterfaceRel").toString();
aaiDmaapEventProcessor.process(updatePserverWithoutInterfaceRel);
assertTrue("Now cloud-region->tenant->vserver should still have relationship to pserver",
mongoDatabase().getCollection("cloud-region")
.find(Document.parse("{" +
- "'cloud-owner':'onap-cloud-owner'," +
- "'cloud-region-id':'mtn6'," +
- "'tenants.tenant.tenant-id':'tenenat-1'," +
- "'tenants.tenant.vservers.vserver.vserver-id':'vserver-1'," +
- "'tenants.tenant.vservers.vserver.relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1'" +
+ "'_id':'/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'," +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1'" +
"}"))
.iterator().hasNext()
);
assertFalse("Now cloud-region->tenant->vserver->l-interface should not have relationship to pserver",
mongoDatabase().getCollection("cloud-region")
.find(Document.parse("{" +
- "'cloud-owner':'onap-cloud-owner'," +
- "'cloud-region-id':'mtn6'," +
- "'tenants.tenant.tenant-id':'tenenat-1'," +
- "'tenants.tenant.vservers.vserver.vserver-id':'vserver-1'," +
- "'tenants.tenant.vservers.vserver.l-interfaces.l-interface.interface-name':'l-int-1'," +
- "'tenants.tenant.vservers.vserver.l-interfaces.l-interface.relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1'" +
+ "'_id':'/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'," +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1'" +
"}"))
.iterator().hasNext()
);
@@ -313,7 +287,7 @@ public class AAIDmaapEventProcessorScenariosTest {
@Test
public void createPserverCreateCRWithNestingAndRelationshipsToThenDeletePserverTest() throws Exception {
- String pserverCreate = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v13','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false}}";
+ String pserverCreate = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v14','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false}}";
aaiDmaapEventProcessor.process(pserverCreate);
assertNotEquals("pserver collection exists", mongoDatabase().getCollection("pserver"), null);
@@ -329,7 +303,7 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
"}"))
.iterator().hasNext()
);
@@ -337,13 +311,13 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
"}"))
.iterator().hasNext()
);
- String crWithNestingAndWithRels = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'cloud-region','top-entity-type':'cloud-region','entity-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'3d567832-df00-49b5-b862-4d3a341dbec1','source-name':'JUNIT','version':'v13','timestamp':'20180515-10:57:55:750'},'entity':{'tenants':{'tenant':[{'vservers':{'vserver':[{'relationship-list':{'relationship':[{'related-to':'pserver','relationship-data':[{'relationship-value':'pserver-1','relationship-key':'pserver.hostname'}],'related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','relationship-label':'tosca.relationships.HostedOn'}]},'l-interfaces':{'l-interface':[{'interface-name':'l-int-1','interface-id':'l-int-1','l3-interface-ipv4-address-list':[{'neutron-network-id':'93fb399c-9bfc-4234-b2bb-a76eda38f117','neutron-subnet-id':'79e5bb69-24bb-4ea3-8d1d-c04fca5f5e1e','l3-interface-ipv4-address':'192.168.70.3'}],'relationship-list':{'relationship':[{'related-to':'pserver','relationship-data':[{'relationship-value':'pserver-1','relationship-key':'pserver.hostname'}],'related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','relationship-label':'tosca.relationships.HostedOn'}]}}]},'vserver-id':'vserver-1'}]},'tenant-id':'tenenat-1'}]},'cloud-owner':'onap-cloud-owner','cloud-region-id':'mtn6'}}";
+ String crWithNestingAndWithRels = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'cloud-region','top-entity-type':'cloud-region','entity-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'3d567832-df00-49b5-b862-4d3a341dbec1','source-name':'JUNIT','version':'v14','timestamp':'20180515-10:57:55:750'},'entity':{'tenants':{'tenant':[{'vservers':{'vserver':[{'relationship-list':{'relationship':[{'related-to':'pserver','relationship-data':[{'relationship-value':'pserver-1','relationship-key':'pserver.hostname'}],'related-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1','relationship-label':'tosca.relationships.HostedOn'}]},'l-interfaces':{'l-interface':[{'interface-name':'l-int-1','interface-id':'l-int-1','l3-interface-ipv4-address-list':[{'neutron-network-id':'93fb399c-9bfc-4234-b2bb-a76eda38f117','neutron-subnet-id':'79e5bb69-24bb-4ea3-8d1d-c04fca5f5e1e','l3-interface-ipv4-address':'192.168.70.3'}],'relationship-list':{'relationship':[{'related-to':'pserver','relationship-data':[{'relationship-value':'pserver-1','relationship-key':'pserver.hostname'}],'related-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1','relationship-label':'tosca.relationships.HostedOn'}]}}]},'vserver-id':'vserver-1'}]},'tenant-id':'tenenat-1'}]},'cloud-owner':'onap-cloud-owner','cloud-region-id':'mtn6'}}";
aaiDmaapEventProcessor.process(crWithNestingAndWithRels);
@@ -352,7 +326,7 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'" +
"}"))
.iterator().hasNext()
);
@@ -360,12 +334,12 @@ public class AAIDmaapEventProcessorScenariosTest {
mongoDatabase().getCollection("pserver")
.find(Document.parse("{" +
"'hostname':'pserver-1'," +
- "'relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'" +
"}"))
.iterator().hasNext()
);
- String pserverDelete = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'DELETE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v13','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false,'relationship-list':{'relationship':[{'related-to':'vserver','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'},{'relationship-key':'tenant.tenant-id','relationship-value':'tenenat-1'},{'relationship-key':'vserver.vserver-id','relationship-value':'vserver-1'}]},{'related-to':'l-interface','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'},{'relationship-key':'tenant.tenant-id','relationship-value':'tenenat-1'},{'relationship-key':'vserver.vserver-id','relationship-value':'vserver-1'},{'relationship-key':'l-interface.interface-name','relationship-value':'l-int-1'}]}]}}}";
+ String pserverDelete = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'DELETE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v14','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false,'relationship-list':{'relationship':[{'related-to':'vserver','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'},{'relationship-key':'tenant.tenant-id','relationship-value':'tenenat-1'},{'relationship-key':'vserver.vserver-id','relationship-value':'vserver-1'}]},{'related-to':'l-interface','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'},{'relationship-key':'tenant.tenant-id','relationship-value':'tenenat-1'},{'relationship-key':'vserver.vserver-id','relationship-value':'vserver-1'},{'relationship-key':'l-interface.interface-name','relationship-value':'l-int-1'}]}]}}}";
aaiDmaapEventProcessor.process(pserverDelete);
assertNotEquals("pserver collection exists", mongoDatabase().getCollection("pserver"), null);
@@ -374,23 +348,16 @@ public class AAIDmaapEventProcessorScenariosTest {
assertFalse("Now cloud-region->tenant->vserver should not have relationship to pserver",
mongoDatabase().getCollection("cloud-region")
.find(Document.parse("{" +
- "'cloud-owner':'onap-cloud-owner'," +
- "'cloud-region-id':'mtn6'," +
- "'tenants.tenant.tenant-id':'tenenat-1'," +
- "'tenants.tenant.vservers.vserver.vserver-id':'vserver-1'," +
- "'tenants.tenant.vservers.vserver.relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1'" +
+ "'_id':'/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1'," +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1'" +
"}"))
.iterator().hasNext()
);
assertFalse("Now cloud-region->tenant->vserver->l-interface should not have relationship to pserver",
mongoDatabase().getCollection("cloud-region")
.find(Document.parse("{" +
- "'cloud-owner':'onap-cloud-owner'," +
- "'cloud-region-id':'mtn6'," +
- "'tenants.tenant.tenant-id':'tenenat-1'," +
- "'tenants.tenant.vservers.vserver.vserver-id':'vserver-1'," +
- "'tenants.tenant.vservers.vserver.l-interfaces.l-interface.interface-name':'l-int-1'," +
- "'tenants.tenant.vservers.vserver.l-interfaces.l-interface.relationship-list.relationship.related-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1'" +
+ "'_id':'/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1'," +
+ "'relationship-list.relationship.related-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1'" +
"}"))
.iterator().hasNext()
);
@@ -401,7 +368,7 @@ public class AAIDmaapEventProcessorScenariosTest {
@Test
public void createPserverRelationshipsToNonExistingTest() throws Exception {
- String pserverWithRelsToNested = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v13','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false,'relationship-list':{'relationship':[{'related-to':'cloud-region','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'}]},{'related-to':'vserver','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'},{'relationship-key':'tenant.tenant-id','relationship-value':'tenenat-1'},{'relationship-key':'vserver.vserver-id','relationship-value':'vserver-1'}]},{'related-to':'l-interface','relationship-label':'tosca.relationships.HostedOn','related-link':'/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1','relationship-data':[{'relationship-key':'cloud-region.cloud-owner','relationship-value':'onap-cloud-owner'},{'relationship-key':'cloud-region.cloud-region-id','relationship-value':'mtn6'},{'relationship-key':'tenant.tenant-id','relationship-value':'tenenat-1'},{'relationship-key':'vserver.vserver-id','relationship-value':'vserver-1'},{'relationship-key':'l-interface.interface-name','relationship-value':'l-int-1'}]}]}}}";
+ String pserverWithRelsToNested = getEventPayload("createPserverRelationshipsToNonExistingTest");
aaiDmaapEventProcessor.process(pserverWithRelsToNested);
@@ -410,13 +377,49 @@ public class AAIDmaapEventProcessorScenariosTest {
@Test
public void linterfaceWithLinterfaceTest() throws Exception {
- String linterfaceWithLinterface = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'l-interface','top-entity-type':'pserver','entity-link':'/aai/v13/cloud-infrastructure/pservers/pserver/c9e8ffb6-a360-4f9c-96c3-f5f0244dfe55-jenkins/lag-interfaces/lag-interface/8806d30d-e5f5-409e-9e9e-9b1c1943058d-jenkins/l-interfaces/l-interface/f4f9b9c7-eb83-4622-9d6f-14027a556ff5-jenkins/l-interfaces/l-interface/89796dd1-89a5-4ddc-bd13-324ba9bce3b6-jenkins','event-type':'AAI-EVENT','domain':'uINT1','action':'DELETE','sequence-number':'0','id':'9060077e-00a3-4239-80ed-855331b4d551','source-name':'FitNesse-Test-jenkins','version':'v13','timestamp':'20180625-01:24:04:857'},'entity':{'pserver-name2':'iqFmGNmNLM6','hostname':'c9e8ffb6-a360-4f9c-96c3-f5f0244dfe55-jenkins','lag-interfaces':{'lag-interface':[{'l-interfaces':{'l-interface':[{'l-interfaces':{'l-interface':[{'v6-wan-link-ip':'PuNFKRUUpd3','interface-name':'89796dd1-89a5-4ddc-bd13-324ba9bce3b6-jenkins','allowed-address-pairs':'RGo6MaADK','prov-status':'uot','macaddr':'xUj8TGre','interface-role':'SyT0hd9Uu4b','selflink':'HxDI','in-maint':false,'admin-status':'GDgD','is-port-mirrored':true,'resource-version':'1529889840462','is-ip-unnumbered':false,'network-name':'RXCo3p3p5BhBS','management-option':'jNiTd','interface-id':'4n8niH','interface-description':'drnTF3'}]},'interface-name':'f4f9b9c7-eb83-4622-9d6f-14027a556ff5-jenkins'}]},'interface-name':'8806d30d-e5f5-409e-9e9e-9b1c1943058d-jenkins'}]}}}";
-
+ String linterfaceWithLinterface = getEventPayload("linterfaceWithLinterfaceTest");
aaiDmaapEventProcessor.process(linterfaceWithLinterface);
}
@Test
+ public void createGenericVnfWithChildrenUpdateGenericVnfProperty() throws Exception {
+
+ JsonObject testPayloads = parser.parse(getEventPayload("create-generic-vnf-with-children-update-generic-vnf-property")).getAsJsonObject();
+
+ String createGvnfMsg = testPayloads.get("create-generic-vnf").getAsJsonObject().toString();
+ aaiDmaapEventProcessor.process(createGvnfMsg);
+ assertTrue("generic-vnf in collection with vnf-name",
+ mongoDatabase().getCollection("generic-vnf")
+ .find(Document.parse("{" +
+ "'_id':'/network/generic-vnfs/generic-vnf/generic-vnf-987654321-9-cleanup-later-PS2418'," +
+ "'vnf-name':'example-vnf-name-val-45282'" +
+ "}"))
+ .iterator().hasNext()
+ );
+
+ String updateGvnfMsg = testPayloads.get("update-generic-vnf").getAsJsonObject().toString();
+ aaiDmaapEventProcessor.process(updateGvnfMsg);
+ assertTrue("generic-vnf updated vnf-name",
+ mongoDatabase().getCollection("generic-vnf")
+ .find(Document.parse("{" +
+ "'_id':'/network/generic-vnfs/generic-vnf/generic-vnf-987654321-9-cleanup-later-PS2418'," +
+ "'vnf-name':'example-vnf-name-val-45282-generic-vnf-987654321-9-cleanup-later-PS2418-patched'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ assertFalse("generic-vnf with vnf-name not in collection",
+ mongoDatabase().getCollection("generic-vnf")
+ .find(Document.parse("{" +
+ "'_id':'/network/generic-vnfs/generic-vnf/generic-vnf-987654321-9-cleanup-later-PS2418'," +
+ "'vnf-name':'example-vnf-name-val-45282'" +
+ "}"))
+ .iterator().hasNext()
+ );
+
+ }
+
+ @Test
public void nosTest() throws Exception {
String nos = getEventPayload("nos");
@@ -425,12 +428,24 @@ public class AAIDmaapEventProcessorScenariosTest {
}
- @Test
+ @Test()
public void addressListTest() throws Exception {
String event = getEventPayload("address-list");
aaiDmaapEventProcessor.process(event);
+ // verifies that the uri is valid
+ List<String> ids = payloadParserService.doParse("dmaap", event, PayloadParserType.AAI_RESOURCE_DMAAP)
+ .stream().map(entry -> entry.getFindQuery().get("_id").getAsString()).collect(Collectors.toList());
+
+ for (String id : ids) {
+ new URI(id);
+ }
+
+ assertEquals("No id should contain '//'", 0L, ids.stream().filter(id -> id.contains("//")).count());
+
+
+
}
@Test
@@ -448,18 +463,89 @@ public class AAIDmaapEventProcessorScenariosTest {
aaiDmaapEventProcessor.process(event);
}
+
+ @Test
+ public void cvlanTagTest() throws Exception {
+
+ String event = getEventPayload("cvlan-tag");
+ aaiDmaapEventProcessor.process(event);
+ assertNotEquals("customer collection exists", mongoDatabase().getCollection("customer"), null);
+ assertEquals("customer collection contains 1", mongoDatabase().getCollection("customer").count(), 1);
+ }
+
+ @Test
+ public void cvlanTagEntryTest() throws Exception {
+
+ String event = getEventPayload("cvlan-tag-entry");
+
+ aaiDmaapEventProcessor.process(event);
+ }
+
+ @Test
+ public void cvlanTagEntryCreateTest() throws Exception {
+
+ String event = getEventPayload("cvlan-tag-entry-create");
+
+ aaiDmaapEventProcessor.process(event);
+ }
+
+ @Test
+ public void allottedResourceUpdateTest() throws Exception {
+
+ String event = getEventPayload("allotted-resource");
+
+ aaiDmaapEventProcessor.process(event);
+ }
@Test
- public void delRel() throws Exception {
+ public void delRelTest() throws Exception {
String event = getEventPayload("deleteRelationship/1-create-logical-link");
aaiDmaapEventProcessor.process(event);
+ assertTrue("Now logical-link should exist",
+ mongoDatabase().getCollection("logical-link")
+ .find(Document.parse("{" +
+ "'_id': '/network/logical-links/logical-link/logical-link'" +
+ "}"))
+ .iterator().hasNext());
event = getEventPayload("deleteRelationship/2-create-generic-vnf");
aaiDmaapEventProcessor.process(event);
+ assertTrue("Now generic-vnf with nested l-interface with nested vlan should exist",
+ mongoDatabase().getCollection("generic-vnf")
+ .find(Document.parse("{" +
+ "'_id': '/network/generic-vnfs/generic-vnf/generic-vnf-id'" +
+ "}"))
+ .iterator().hasNext());
+ assertTrue("Now nested l-interface should exist",
+ mongoDatabase().getCollection("generic-vnf")
+ .find(Document.parse("{" +
+ "'_id': '/network/generic-vnfs/generic-vnf/generic-vnf-id/l-interfaces/l-interface/l-interface-name-1'" +
+ "}"))
+ .iterator().hasNext());
+ assertTrue("Now nested vlan should exist",
+ mongoDatabase().getCollection("generic-vnf")
+ .find(Document.parse("{" +
+ "'_id': '/network/generic-vnfs/generic-vnf/generic-vnf-id/l-interfaces/l-interface/l-interface-name-1/vlans/vlan/vlan-1'" +
+ "}"))
+ .iterator().hasNext());
event = getEventPayload("deleteRelationship/3-create-rel-generic-vnf-vlan-to-logical-link");
aaiDmaapEventProcessor.process(event);
+ assertTrue("Now generic-vnf->l-interface->vlan should have relationship to logical-link",
+ mongoDatabase().getCollection("generic-vnf")
+ .find(Document.parse("{" +
+ "'_id': '/network/generic-vnfs/generic-vnf/generic-vnf-id/l-interfaces/l-interface/l-interface-name-1/vlans/vlan/vlan-1'," +
+ "'relationship-list.relationship.related-link':'/aai/v14/network/logical-links/logical-link/logical-link'" +
+ "}"))
+ .iterator().hasNext());
+ assertTrue("Now logical-link should have relationship to generic-vnf->l-interface->vlan",
+ mongoDatabase().getCollection("logical-link")
+ .find(Document.parse("{" +
+ "'_id': '/network/logical-links/logical-link/logical-link'," +
+ "'relationship-list.relationship.related-link':'/aai/v14/network/generic-vnfs/generic-vnf/generic-vnf-id/l-interfaces/l-interface/l-interface-name-1/vlans/vlan/vlan-1'" +
+ "}"))
+ .iterator().hasNext());
event = getEventPayload("deleteRelationship/4-delete-rel-to-generic-vnf-vlan-from-logical-link");
aaiDmaapEventProcessor.process(event);
@@ -467,16 +553,128 @@ public class AAIDmaapEventProcessorScenariosTest {
assertFalse("Now generic-vnf->l-interface->vlan should not have relationship to logical-link",
mongoDatabase().getCollection("generic-vnf")
.find(Document.parse("{" +
- "'_id': '/network/generic-vnfs/generic-vnf/generic-vnf-id'," +
- "'vnf-id': 'generic-vnf-id'," +
- "'l-interfaces.l-interface.interface-name': 'l-interface-name-1'," +
- "'l-interfaces.l-interface.vlans.vlan.vlan-interface': 'vlan-1'," +
- "'l-interfaces.l-interface.vlans.vlan.relationship-list.relationship.related-link':'/aai/v13/network/logical-links/logical-link/logical-link'" +
+ "'_id': '/network/generic-vnfs/generic-vnf/generic-vnf-id/l-interfaces/l-interface/l-interface-name-1/vlans/vlan/vlan-1'," +
+ "'relationship-list.relationship.related-link':'/aai/v14/network/logical-links/logical-link/logical-link'" +
+ "}"))
+ .iterator().hasNext());
+ assertFalse("Now logical-link should not have relationship to generic-vnf->l-interface->vlan",
+ mongoDatabase().getCollection("logical-link")
+ .find(Document.parse("{" +
+ "'_id': '/network/logical-links/logical-link/logical-link'," +
+ "'relationship-list.relationship.related-link':'/aai/v14/network/generic-vnfs/generic-vnf/generic-vnf-id/l-interfaces/l-interface/l-interface-name-1/vlans/vlan/vlan-1'" +
+ "}"))
+ .iterator().hasNext());
+
+ }
+
+
+ @Test
+ public void createPserverWithNestedDeleteNestedTest() throws Exception {
+
+ String type = "pserver";
+ String topUri = "/cloud-infrastructure/pservers/pserver/pserver-1";
+
+ JsonObject testPayloads = parser.parse(getEventPayload("createPserverWithNestedDeleteNested")).getAsJsonObject();
+ String createPserver = testPayloads.get("createPserverWithNested").toString();
+
+ aaiDmaapEventProcessor.process(createPserver);
+ assertTrue("Now pserver should be in the collections",
+ mongoDatabase().getCollection(type)
+ .find(Document.parse("{" +
+ "'_id': '" + topUri + "'" +
+ "}"))
+ .iterator().hasNext());
+ assertTrue("Now nested p-interface should exist",
+ mongoDatabase().getCollection(type)
+ .find(Document.parse("{" +
+ "'_id': '" + topUri + "/p-interfaces/p-interface/interface-1'" +
+ "}"))
+ .iterator().hasNext());
+
+ JsonObject existing = readObj(type, topUri);
+ assertThat("Stored contains the nested", existing.toString(), containsString("\"interface-name\":\"interface-1\""));
+
+ String deleteNested = testPayloads.get("deletedNested").toString();
+
+ aaiDmaapEventProcessor.process(deleteNested);
+ assertTrue("Now pserver should still be in the collections",
+ mongoDatabase().getCollection(type)
+ .find(Document.parse("{" +
+ "'_id': '" + topUri + "'" +
+ "}"))
+ .iterator().hasNext());
+ assertFalse("Now nested p-interface should not exist",
+ mongoDatabase().getCollection(type)
+ .find(Document.parse("{" +
+ "'_id': '" + topUri + "/p-interfaces/p-interface/interface-1'" +
+ "}"))
+ .iterator().hasNext());
+
+ existing = readObj(type, topUri);
+ assertThat("Stored does not contain the nested", existing.toString(), not(containsString("\"interface-name\":\"interface-1\"")));
+ assertThat("Stored does not contain the wrapping", existing.toString(), not(containsString("[]")));
+
+ }
+
+ @Test
+ public void createPserverWithoutNestedAddNestedTest() throws Exception {
+
+ String type = "pserver";
+ String topUri = "/cloud-infrastructure/pservers/pserver/pserver-1";
+
+ JsonObject testPayloads = parser.parse(getEventPayload("createPserverWithoutNestedAddNested")).getAsJsonObject();
+ String createPserver = testPayloads.get("createPserverWithoutNested").toString();
+
+ aaiDmaapEventProcessor.process(createPserver);
+ assertTrue("Now pserver should be in the collections",
+ mongoDatabase().getCollection(type)
+ .find(Document.parse("{" +
+ "'_id': '" + topUri + "'" +
"}"))
.iterator().hasNext());
+ assertFalse("Now nested p-interface should not exist",
+ mongoDatabase().getCollection(type)
+ .find(Document.parse("{" +
+ "'_id': '" + topUri + "/p-interfaces/p-interface/interface-1'" +
+ "}"))
+ .iterator().hasNext());
+
+ JsonObject existing = readObj(type, topUri);
+ assertThat("Stored does not contain the nested", existing.toString(), not(containsString("\"interface-name\":\"interface-1\"")));
+
+ String addNested = testPayloads.get("addNested").toString();
+
+ aaiDmaapEventProcessor.process(addNested);
+ assertTrue("Now pserver should still be in the collections",
+ mongoDatabase().getCollection(type)
+ .find(Document.parse("{" +
+ "'_id': '" + topUri + "'" +
+ "}"))
+ .iterator().hasNext());
+ assertTrue("Now nested p-interface should exist",
+ mongoDatabase().getCollection(type)
+ .find(Document.parse("{" +
+ "'_id': '" + topUri + "/p-interfaces/p-interface/interface-1'" +
+ "}"))
+ .iterator().hasNext());
+ existing = readObj(type, topUri);
+ assertThat("Stored does contain the nested", existing.toString(), containsString("\"interface-name\":\"interface-1\""));
+
+ }
+
+ private JsonObject readObj(String type, String topUri) {
+ List<JsonObject> found = mongoHelperSingleton.findAllWithIdsStartingWith(type, topUri);
+ JsonObject existing = new JsonObject();
+ if (!found.isEmpty()) {
+ JsonArray ja = new JsonArray();
+ found.forEach(ja::add);
+ existing = payloadPrinterService.createJson(type, ja, PayloadPrinterType.AAI_RESOURCE_GET_ALL_PRINTER);
+ }
+ return existing;
}
+
protected String getEventPayload(String eventpayloadName) throws IOException {
return getPayload("test/payloads/dmaapEvents/" + eventpayloadName + ".json");
}
@@ -493,4 +691,25 @@ public class AAIDmaapEventProcessorScenariosTest {
return IOUtils.toString(inputStream);
}
+
+ @Test
+ public void getAllPrinterObjectWithoutPropertiesButWithEmptyNestedObjectTest() throws IOException {
+ String payload = getPayload("test/payloads/json/test-empty.json");
+ System.out.println(payload);
+
+ JsonObject jsonObject = parser.parse(payload).getAsJsonObject();
+ System.out.println(jsonObject.toString());
+
+ JsonArray jsonArray = new JsonArray();
+ jsonArray.add(jsonObject);
+ JsonObject customer = new JsonObject();
+ customer.addProperty("_id","/business/customers/customer/test");
+ customer.addProperty("global-customer-id","test");
+ jsonArray.add(customer);
+ JsonObject recreated = payloadPrinterService.createJson("customer", jsonArray, PayloadPrinterType.AAI_RESOURCE_GET_ALL_PRINTER);
+ System.out.println(recreated.toString());
+
+ assertThat("Reconstructed get all should not have empty object. ", recreated.toString(), not(Matchers.containsString("{}")));
+
+ }
} \ No newline at end of file
diff --git a/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorTest.java b/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorTest.java
index 8fcd7e2..0a7bc4a 100644
--- a/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorTest.java
+++ b/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorTest.java
@@ -19,14 +19,10 @@
*/
package org.onap.aai.cacher.dmaap.consumer;
-import org.json.JSONException;
-import org.json.JSONObject;
+import com.google.gson.JsonSyntaxException;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-
public class AAIDmaapEventProcessorTest {
private AAIDmaapEventProcessor eventProcessor;
@@ -43,37 +39,27 @@ public class AAIDmaapEventProcessorTest {
eventProcessor = new AAIDmaapEventProcessor();
}
- @Ignore
- @Test
- public void testValidEventMessage() throws Exception {
- eventProcessor.process(validEventMessage);
- JSONObject header = eventProcessor.getEventHeader();
- JSONObject body = eventProcessor.getEventBody();
- assertEquals("header id", "ABC",header.getString("id") );
- assertEquals("hostname", "hostName",body.getString("hostname") );
- }
-
- @Test(expected = JSONException.class)
+ @Test(expected = IllegalStateException.class)
public void testJSONException() throws Exception {
eventProcessor.process("invalidJson");
}
- @Test(expected = JSONException.class)
+ @Test(expected = JsonSyntaxException.class)
public void testInvalidHeader() throws Exception {
eventProcessor.process(invalidEventMessageHeader);
}
- @Test(expected = JSONException.class)
+ @Test(expected = JsonSyntaxException.class)
public void testInvalidHeaderMissingId() throws Exception {
eventProcessor.process(invalidEventMessageHeaderMissingId);
}
- @Test(expected = JSONException.class)
+ @Test(expected = JsonSyntaxException.class)
public void testInvalidHeaderMissingSourceName() throws Exception {
eventProcessor.process(invalidEventMessageHeaderMissingSourceName);
}
- @Test(expected = JSONException.class)
+ @Test(expected = JsonSyntaxException.class)
public void testInvalidEventMessageBody() throws Exception {
eventProcessor.process(invalidEventMessageBody);
}
diff --git a/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIEventConsumerTest.java b/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIEventConsumerTest.java
index 3ca3390..12d1416 100644
--- a/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIEventConsumerTest.java
+++ b/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIEventConsumerTest.java
@@ -20,30 +20,17 @@
package org.onap.aai.cacher.dmaap.consumer;
import com.att.nsa.mr.client.MRConsumer;
+import com.github.fakemongo.Fongo;
import com.mongodb.DB;
import com.mongodb.MongoClient;
import com.mongodb.client.MongoDatabase;
-
-import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodProcess;
-import de.flapdoodle.embed.mongo.MongodStarter;
-import de.flapdoodle.embed.mongo.config.IMongodConfig;
-import de.flapdoodle.embed.mongo.config.MongoCmdOptionsBuilder;
-import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
-import de.flapdoodle.embed.mongo.config.Net;
-import de.flapdoodle.embed.mongo.distribution.Version;
-import de.flapdoodle.embed.process.runtime.Network;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.hamcrest.Matchers;
+import org.junit.*;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.onap.aai.cacher.common.MongoHelperSingleton;
-import org.onap.aai.cacher.egestion.printer.EgestionTestComponent;
+import org.onap.aai.cacher.egestion.printer.PayloadPrinterService;
import org.onap.aai.cacher.injestion.parser.InjestionTestComponent;
import org.onap.aai.cacher.injestion.parser.PayloadParserService;
import org.onap.aai.cacher.service.helper.RestClientHelperService;
@@ -58,6 +45,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertThat;
+
//@Ignore
@RunWith(SpringJUnit4ClassRunner.class)
@Configuration
@@ -96,54 +86,35 @@ public class AAIEventConsumerTest {
}
@Bean
- public AAIDmaapEventProcessor aaiDmaapEventProcessor(MongoHelperSingleton mongoHelperSingleton, PayloadParserService payloadParserService) {
- return new AAIDmaapEventProcessor(mongoHelperSingleton, payloadParserService);
+ public AAIDmaapEventProcessor aaiDmaapEventProcessor(MongoHelperSingleton mongoHelperSingleton, PayloadParserService payloadParserService, PayloadPrinterService payloadPrinterService) {
+ return new AAIDmaapEventProcessor(mongoHelperSingleton, payloadParserService, payloadPrinterService);
}
MRConsumer client;
- private String validEventMessage = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v13','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false}}";
- private String validHeldEventMessage = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v13/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v13','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false}}";
+ private String validEventMessage = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v14','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false}}";
+ private String validHeldEventMessage = "{'cambria.partition':'AAI','event-header':{'severity':'NORMAL','entity-type':'pserver','top-entity-type':'pserver','entity-link':'/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1','event-type':'AAI-EVENT','domain':'JUNIT','action':'CREATE','sequence-number':'0','id':'0c3b336d-6554-4ddf-a4d7-90f97876a966','source-name':'JUNIT','version':'v14','timestamp':'20180209-21:02:20:344'},'entity':{'hostname':'pserver-1','in-maint':false}}";
DmaapConsumerSingleton singleton = DmaapConsumerSingleton.getInstance();
List<String> eventMessageList = new ArrayList<>();
-
+
@BeforeClass
- public static void setUp() throws Exception {
- String bindIp = "localhost";
- int port = 27017;
- startEmbedded(port);
-
- mongoC = new MongoClient(bindIp, port);
- mongoDb = mongoC.getDatabase(DB_NAME);
- db = mongoC.getDB(DB_NAME);
-
- }
+ public static void setup() throws IOException, InterruptedException {
+ Fongo fongo = new Fongo(DB_NAME);
+ mongoDb = fongo.getDatabase(DB_NAME);
+ db = fongo.getDB(DB_NAME);
+ }
@Before
public void init() throws Exception {
eventMessageList.add(validEventMessage);
- //super.setupBundleconfig();
aaiEventConsumer = new AAIEventConsumer("aaiDmaaPEventConsumer.properties", true);
Properties prop = aaiEventConsumer.getDmaapEventConsumerProperties();
+ assertThat("dmaap group is generated", prop.getProperty("group"), Matchers.startsWith("cacher-"));
+ assertNotEquals("dmaap id generated", "NA", prop.getProperty("id"));
client = Mockito.mock(MRConsumer.class);
aaiEventConsumer.setConsumer(client);
-
-
}
-
- protected static void startEmbedded(int port) throws IOException {
- IMongodConfig mongoConfigConfig = new MongodConfigBuilder()
- .version(Version.Main.PRODUCTION)
- .net(new Net(port, Network.localhostIsIPv6()))
- .cmdOptions(new MongoCmdOptionsBuilder().verbose(true).build())
- .configServer(false)
- .build();
-
- MongodExecutable mongodExecutable = MongodStarter.getDefaultInstance().prepare(mongoConfigConfig);
-
- mongod = mongodExecutable.start();
- }
@AfterClass
public static void tearDown() {
diff --git a/src/test/java/org/onap/aai/cacher/injestion/parser/AAIResourcesUriTemplatesTest.java b/src/test/java/org/onap/aai/cacher/injestion/parser/AAIResourcesUriTemplatesTest.java
index a48712f..d093b6c 100644
--- a/src/test/java/org/onap/aai/cacher/injestion/parser/AAIResourcesUriTemplatesTest.java
+++ b/src/test/java/org/onap/aai/cacher/injestion/parser/AAIResourcesUriTemplatesTest.java
@@ -19,27 +19,80 @@
*/
package org.onap.aai.cacher.injestion.parser;
+import com.github.fakemongo.Fongo;
+import com.mongodb.DB;
+import com.mongodb.MongoClient;
+import com.mongodb.client.MongoDatabase;
+import de.flapdoodle.embed.mongo.MongodProcess;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.aai.cacher.common.MongoHelperSingleton;
+import org.onap.aai.cacher.injestion.parser.strategy.aai.AAIResourcesUriTemplates;
+import org.onap.aai.cacher.injestion.parser.strategy.aai.AAIUriSegment;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.io.IOException;
+import java.util.*;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = InjestionTestComponent.class)
+@ContextConfiguration(classes = {InjestionTestComponent.class, AAIResourcesUriTemplatesTest.class})
public class AAIResourcesUriTemplatesTest {
+ private static final String DB_NAME = AAIResourcesUriTemplatesTest.class.getSimpleName();
+ private static MongoDatabase mongoDb;
+ private static DB db;
+ private static MongodProcess mongod;
+ private static MongoClient mongoC;
+
@Autowired
AAIResourcesUriTemplates aaiResourcesUriTemplates;
+
+ @Bean
+ public DB db() {
+ return db;
+ }
+
+ @Bean
+ public MongoDatabase mongoDatabase() {
+ return mongoDb;
+ }
+
+ @Bean
+ public MongoHelperSingleton mongoHelperSingleton(DB db, MongoDatabase mongoDb) {
+ return new MongoHelperSingleton(db, mongoDb);
+ }
+
+ @BeforeClass
+ public static void setup() throws IOException, InterruptedException {
+ Fongo fongo = new Fongo(DB_NAME);
+ mongoDb = fongo.getDatabase(DB_NAME);
+ db = fongo.getDB(DB_NAME);
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ if (mongod != null && mongod.isProcessRunning()) {
+ mongod.stop();
+ }
+ }
+
+ @After
+ public void cleanup() {
+ final List<String> collectionNames = new ArrayList<>();
+ mongoDb.listCollections().iterator().forEachRemaining(document -> collectionNames.add(document.getString("name")));
+ collectionNames.forEach(collectionName -> mongoDb.getCollection(collectionName).drop());
+ }
+
@Test
public void getUriTemplateByType() throws Exception {
@@ -134,4 +187,58 @@ public class AAIResourcesUriTemplatesTest {
assertThat(aaiResourcesUriTemplates.getUriTemplateMappings(uri, template), is(expected));
}
+ @Test
+ public void getAaiUriSegmentsTest() {
+
+ String uri = "/service-design-and-creation/services/service/id/l-interfaces/l-interface/name/p-interfaces/p-interface/name2";
+
+ List<AAIUriSegment> segments = aaiResourcesUriTemplates.getAaiUriSegments(uri);
+
+ assertEquals("3 segments are generated", 3, segments.size());
+
+ assertEquals("Segment 1 plural is services", "services", segments.get(0).getSegmentPlural().get());
+ assertEquals("Segment 2 plural is l-interfaces", "l-interfaces", segments.get(1).getSegmentPlural().get());
+ assertEquals("Segment 3 plural is p-interfaces", "p-interfaces", segments.get(2).getSegmentPlural().get());
+
+ assertEquals("Segment 1 singular is service", "service", segments.get(0).getSegmentSingular());
+ assertEquals("Segment 2 singular is l-interface", "l-interface", segments.get(1).getSegmentSingular());
+ assertEquals("Segment 3 singular is p-interface", "p-interface", segments.get(2).getSegmentSingular());
+
+ assertEquals("Segment 1 template",
+ "/service-design-and-creation/services/service/{service-id}",
+ segments.get(0).getSegmentTemplate());
+ assertEquals("Segment 2 template",
+ "/l-interfaces/l-interface/{interface-name}",
+ segments.get(1).getSegmentTemplate());
+ assertEquals("Segment 3 template",
+ "/p-interfaces/p-interface/{interface-name}",
+ segments.get(2).getSegmentTemplate());
+
+ assertEquals("Segment 1 uri",
+ "/service-design-and-creation/services/service/id",
+ segments.get(0).getSegment());
+ assertEquals("Segment 2 uri",
+ "/l-interfaces/l-interface/name",
+ segments.get(1).getSegment());
+ assertEquals("Segment 3 uri",
+ "/p-interfaces/p-interface/name2",
+ segments.get(2).getSegment());
+
+ Map<String, String> expected = new HashMap<>();
+ expected.put("service-id", "id");
+ assertEquals("Segment 1 mapping", expected, segments.get(0).getSegmentKeyValues());
+ expected = new HashMap<>();
+ expected.put("interface-name", "name");
+ assertEquals("Segment 2 mapping", expected, segments.get(1).getSegmentKeyValues());
+ expected = new HashMap<>();
+ expected.put("interface-name", "name2");
+ assertEquals("Segment 3 mapping", expected, segments.get(2).getSegmentKeyValues());
+ }
+
+ @Test
+ public void getFullUriPrefixTest() throws Exception {
+ assertEquals("/aai/v12", aaiResourcesUriTemplates.getAAIUriFromEntityUriPrefix(("/aai/v12/network/pnfs/pnf/pnf-name-value/p-interfaces/p-interface/xe-10%2F3%2F2/l-interfaces/l-interface/l-interface-name")));
+ assertEquals("/aai/v4", aaiResourcesUriTemplates.getAAIUriFromEntityUriPrefix("/aai/v4/names"));
+ }
+
} \ No newline at end of file
diff --git a/src/test/java/org/onap/aai/cacher/injestion/parser/InjestionTestComponent.java b/src/test/java/org/onap/aai/cacher/injestion/parser/InjestionTestComponent.java
index 34cc8a3..0d80aca 100644
--- a/src/test/java/org/onap/aai/cacher/injestion/parser/InjestionTestComponent.java
+++ b/src/test/java/org/onap/aai/cacher/injestion/parser/InjestionTestComponent.java
@@ -25,7 +25,7 @@ import org.springframework.context.annotation.Configuration;
import java.nio.file.FileSystems;
@Configuration
-@ComponentScan(basePackages = {"org.onap.aai.cacher.injestion"})
+@ComponentScan(basePackages = {"org.onap.aai.cacher.injestion","org.onap.aai.cacher.egestion"})
public class InjestionTestComponent {
public InjestionTestComponent() {
System.setProperty("AJSC_HOME", FileSystems.getDefault().getPath(".").toAbsolutePath().toString());
diff --git a/src/test/java/org/onap/aai/cacher/injestion/parser/PayloadParserServiceTest.java b/src/test/java/org/onap/aai/cacher/injestion/parser/PayloadParserServiceTest.java
index 1579323..ddac8e3 100644
--- a/src/test/java/org/onap/aai/cacher/injestion/parser/PayloadParserServiceTest.java
+++ b/src/test/java/org/onap/aai/cacher/injestion/parser/PayloadParserServiceTest.java
@@ -19,21 +19,38 @@
*/
package org.onap.aai.cacher.injestion.parser;
+import com.github.fakemongo.Fongo;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
+import com.mongodb.DB;
+import com.mongodb.MongoClient;
+import com.mongodb.client.MongoDatabase;
+import de.flapdoodle.embed.mongo.MongodExecutable;
+import de.flapdoodle.embed.mongo.MongodProcess;
+import de.flapdoodle.embed.mongo.MongodStarter;
+import de.flapdoodle.embed.mongo.config.IMongodConfig;
+import de.flapdoodle.embed.mongo.config.MongoCmdOptionsBuilder;
+import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
+import de.flapdoodle.embed.mongo.config.Net;
+import de.flapdoodle.embed.mongo.distribution.Version;
+import de.flapdoodle.embed.process.runtime.Network;
import org.json.JSONException;
import org.json.JSONObject;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.aai.cacher.common.MongoHelperSingleton;
import org.onap.aai.cacher.injestion.parser.strategy.PayloadParserType;
import org.onap.aai.cacher.model.CacheEntry;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.io.IOException;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
@@ -41,31 +58,72 @@ import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = InjestionTestComponent.class)
+@ContextConfiguration(classes = {InjestionTestComponent.class,PayloadParserServiceTest.class})
public class PayloadParserServiceTest {
+ private static final String DB_NAME = PayloadParserServiceTest.class.getSimpleName();
+ private static MongoDatabase mongoDb;
+ private static DB db;
+ private static MongodProcess mongod;
+ private static MongoClient mongoC;
+
@Autowired
private PayloadParserService parserService;
+
private JsonParser parser = new JsonParser();
private String aaiGetAllServiceResponse =
"{" +
- " 'service': [" +
- " {" +
- " 'service-id': 'service-id-1:1'," +
- " 'service-description': 'A'," +
- " 'resource-version': '1'" +
- " }," +
- " {" +
- " 'service-id': 'service-id-2'," +
- " 'service-description': 'B'," +
- " 'resource-version': '2'" +
- " }" +
- " ]" +
- "}";
+ " 'service': [" +
+ " {" +
+ " 'service-id': 'service-id-1:1'," +
+ " 'service-description': 'A'," +
+ " 'resource-version': '1'" +
+ " }," +
+ " {" +
+ " 'service-id': 'service-id-2'," +
+ " 'service-description': 'B'," +
+ " 'resource-version': '2'" +
+ " }" +
+ " ]" +
+ "}";
private JsonObject aaiGetAllServiceResponseJson = parser.parse(aaiGetAllServiceResponse).getAsJsonObject();
+ @Bean
+ public DB db() {
+ return db;
+ }
+
+ @Bean
+ public MongoDatabase mongoDatabase() {
+ return mongoDb;
+ }
+
+ @Bean
+ public MongoHelperSingleton mongoHelperSingleton(DB db, MongoDatabase mongoDb) {
+ return new MongoHelperSingleton(db, mongoDb);
+ }
+
+ @BeforeClass
+ public static void setup() throws IOException, InterruptedException {
+ Fongo fongo = new Fongo(DB_NAME);
+ mongoDb = fongo.getDatabase(DB_NAME);
+ db = fongo.getDB(DB_NAME);
+ }
+
+ protected static void startEmbedded(int port) throws IOException {
+ IMongodConfig mongoConfigConfig = new MongodConfigBuilder()
+ .version(Version.Main.PRODUCTION)
+ .net(new Net(port, Network.localhostIsIPv6()))
+ .cmdOptions(new MongoCmdOptionsBuilder().verbose(true).build())
+ .configServer(false)
+ .build();
+
+ MongodExecutable mongodExecutable = MongodStarter.getDefaultInstance().prepare(mongoConfigConfig);
+
+ mongod = mongodExecutable.start();
+ }
private void print(List<CacheEntry> result) {
diff --git a/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/AAIResourceDmaapParserStrategyTest.java b/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/AAIResourceDmaapParserStrategyTest.java
deleted file mode 100644
index 8a4ab0b..0000000
--- a/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/AAIResourceDmaapParserStrategyTest.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.onap.aai.cacher.injestion.parser.strategy;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-import org.json.JSONObject;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.onap.aai.cacher.injestion.parser.InjestionTestComponent;
-import org.onap.aai.cacher.injestion.parser.PayloadParserService;
-import org.onap.aai.cacher.model.CacheEntry;
-import org.skyscreamer.jsonassert.JSONAssert;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.util.MultiValueMap;
-
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = InjestionTestComponent.class)
-public class AAIResourceDmaapParserStrategyTest {
-
- @Autowired
- private PayloadParserService parserService;
-
- @Autowired
- @Qualifier("aai-resource-dmaap")
- private AAIResourceDmaapParserStrategy aaiResourceDmaapParserStrategy;
-
- private JsonParser parser = new JsonParser();
-
- private JsonObject pserverCreateEvent = parser.parse(
- new FileReader("./src/test/resources/test/payloads/dmaap-pserver-create.json")).getAsJsonObject();
-
- public AAIResourceDmaapParserStrategyTest() throws FileNotFoundException {}
-
- private void print(List<CacheEntry> result) {
- Gson gson = new GsonBuilder().setPrettyPrinting().create();
- result.forEach(e -> System.out.println("\n\nCollection: " + e.getCollection() +
- "\nKey: " + e.getId() +
- "\nFind: " + gson.toJson(e.getFindQuery()) +
- "\nNestedFind: " + gson.toJson(e.getNestedFind()) +
- "\nNestedField: " + e.getNestedField() +
- "\nNestedFieldIdentifier: " + gson.toJson(e.getNestedFieldIdentifierObj()) +
- "\nPayload: " + gson.toJson(e.getPayload())));
- }
-
- @Test
- public void test(){
- List<CacheEntry> result = parserService.doParse("dmaapEvent", pserverCreateEvent, PayloadParserType.AAI_RESOURCE_DMAAP);
- print(result);
- }
-
-
- @Test
- public void getUriTest() {
- String fullUri = aaiResourceDmaapParserStrategy.getFullUri(pserverCreateEvent.getAsJsonObject("event-header"));
- assertEquals("/aai/v12/cloud-infrastructure/pservers/pserver/dmaap-pserver-create", fullUri);
- String uri = aaiResourceDmaapParserStrategy.getUri(fullUri);
- assertEquals("/cloud-infrastructure/pservers/pserver/dmaap-pserver-create", uri);
- }
-
- @Test
- public void getAaiUriSegmentsTest() {
-
- String uri = "/service-design-and-creation/services/service/id/l-interfaces/l-interface/name/p-interfaces/p-interface/name2";
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
-
- assertEquals("3 segments are generated", 3, segments.size());
-
- assertEquals("Segment 1 plural is services", "services", segments.get(0).getSegmentPlural().get());
- assertEquals("Segment 2 plural is l-interfaces", "l-interfaces", segments.get(1).getSegmentPlural().get());
- assertEquals("Segment 3 plural is p-interfaces", "p-interfaces", segments.get(2).getSegmentPlural().get());
-
- assertEquals("Segment 1 singular is service", "service", segments.get(0).getSegmentSingular());
- assertEquals("Segment 2 singular is l-interface", "l-interface", segments.get(1).getSegmentSingular());
- assertEquals("Segment 3 singular is p-interface", "p-interface", segments.get(2).getSegmentSingular());
-
- assertEquals("Segment 1 template",
- "/service-design-and-creation/services/service/{service-id}",
- segments.get(0).getSegmentTemplate());
- assertEquals("Segment 2 template",
- "/l-interfaces/l-interface/{interface-name}",
- segments.get(1).getSegmentTemplate());
- assertEquals("Segment 3 template",
- "/p-interfaces/p-interface/{interface-name}",
- segments.get(2).getSegmentTemplate());
-
- assertEquals("Segment 1 uri",
- "/service-design-and-creation/services/service/id",
- segments.get(0).getSegment());
- assertEquals("Segment 2 uri",
- "/l-interfaces/l-interface/name",
- segments.get(1).getSegment());
- assertEquals("Segment 3 uri",
- "/p-interfaces/p-interface/name2",
- segments.get(2).getSegment());
-
- Map<String, String> expected = new HashMap<>();
- expected.put("service-id", "id");
- assertEquals("Segment 1 mapping", expected, segments.get(0).getSegmentKeyValues());
- expected = new HashMap<>();
- expected.put("interface-name", "name");
- assertEquals("Segment 2 mapping", expected, segments.get(1).getSegmentKeyValues());
- expected = new HashMap<>();
- expected.put("interface-name", "name2");
- assertEquals("Segment 3 mapping", expected, segments.get(2).getSegmentKeyValues());
- }
-
- @Test
- public void getEntityBodyChildTest() throws Exception {
- String uri = "/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/ams1b/tenants/tenant/52fd05137ab4453bb53084a13c7bb7a4/vservers/vserver/vs-id";
- String entityString =
- "{" +
- " 'tenants':" +
- " {" +
- " 'tenant': [" +
- " {" +
- " 'vservers':" +
- " {" +
- " 'vserver': [" +
- " {" +
- " 'in-maint': false," +
- " 'resource-version': '1525978690717'," +
- " 'vserver-name': 'slaa-regression-cr-id-api-server-449704329'," +
- " 'vserver-id': 'vs-id'" +
- " }" +
- " ]" +
- " }," +
- " 'tenant-id': 'ten-id'," +
- " 'tenant-name': 'name'" +
- " }" +
- " ]" +
- " }," +
- " 'cloud-owner': 'cr-o'," +
- " 'owner-defined-type': 'lcp'," +
- " 'cloud-region-id': 'cr-id'" +
- "}";
-
- JsonObject entity = parser.parse(entityString).getAsJsonObject();
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
-
- JsonObject result = aaiResourceDmaapParserStrategy.getEntityBody(entity, segments);
-
- JSONAssert.assertEquals(
- new JSONObject(entity
- .getAsJsonObject("tenants").getAsJsonArray("tenant").get(0) .getAsJsonObject()
- .getAsJsonObject("vservers").getAsJsonArray("vserver").get(0).getAsJsonObject()
- .toString()),
- new JSONObject(result.toString()),
- true);
-
- }
-
- @Test
- public void getEntityBodyTopTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn";
- String entityString = "{'hostname':'hn','in-maint':false,'resource-version':'1525801811662','pserver-id':'0A47B945-9C74-4CBE-AD72-0DECB966EB94'}";
-
- JsonObject entity = parser.parse(entityString).getAsJsonObject();
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
-
- JsonObject result = aaiResourceDmaapParserStrategy.getEntityBody(entity, segments);
-
- JSONAssert.assertEquals(
- new JSONObject(entity.toString()),
- new JSONObject(result.toString()),
- true);
-
- }
-
- @Test
- public void getFindQueryTopTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn";
- JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
- "'hostname':'hn'}").getAsJsonObject();
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- JsonObject findQuery = aaiResourceDmaapParserStrategy.getFindQuery(segments);
-
- JSONAssert.assertEquals(
- new JSONObject(expected.toString()),
- new JSONObject(findQuery.toString()),
- true);
- }
-
- @Test
- public void getFindQueryOneLevelTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1";
- JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
- "'hostname':'hn'}").getAsJsonObject();
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- JsonObject findQuery = aaiResourceDmaapParserStrategy.getFindQuery(segments);
-
- JSONAssert.assertEquals(
- new JSONObject(expected.toString()),
- new JSONObject(findQuery.toString()),
- true);
- }
-
- @Test
- public void getFindQueryTwoLevelTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1/l-interfaces/l-interface/interface-2";
- JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
- "'hostname':'hn'," +
- "'p-interfaces.p-interface.interface-name':'interface-1'}").getAsJsonObject();
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- JsonObject findQuery = aaiResourceDmaapParserStrategy.getFindQuery(segments);
-
- JSONAssert.assertEquals(
- new JSONObject(expected.toString()),
- new JSONObject(findQuery.toString()),
- true);
- }
-
- @Test
- public void getNestedFindQueryTopTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn";
- JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
- "'hostname':'hn'}").getAsJsonObject();
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- JsonObject findQuery = aaiResourceDmaapParserStrategy.getNestedFindQuery(segments);
-
- JSONAssert.assertEquals(
- new JSONObject(expected.toString()),
- new JSONObject(findQuery.toString()),
- true);
- }
-
- @Test
- public void getNestedFindQueryOneLevelTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1";
- JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
- "'hostname':'hn'," +
- "'p-interfaces.p-interface.interface-name':'interface-1'}").getAsJsonObject();
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- JsonObject findQuery = aaiResourceDmaapParserStrategy.getNestedFindQuery(segments);
-
- JSONAssert.assertEquals(
- new JSONObject(expected.toString()),
- new JSONObject(findQuery.toString()),
- true);
- }
-
- @Test
- public void getNestedFindQueryTwoLevelTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1/l-interfaces/l-interface/interface-2";
- JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
- "'hostname':'hn'," +
- "'p-interfaces.p-interface.interface-name':'interface-1'," +
- "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'interface-2'}").getAsJsonObject();
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- JsonObject findQuery = aaiResourceDmaapParserStrategy.getNestedFindQuery(segments);
-
- JSONAssert.assertEquals(
- new JSONObject(expected.toString()),
- new JSONObject(findQuery.toString()),
- true);
- }
-
- @Test
- public void getNestedFieldTopTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn";
- String expected = "";
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- String nestedField = aaiResourceDmaapParserStrategy.getNestedField(segments);
-
- assertEquals("Top nested field", expected, nestedField);
- }
-
- @Test
- public void getNestedFieldOneLevelTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1";
- String expected = "p-interfaces.p-interface";
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- String nestedField = aaiResourceDmaapParserStrategy.getNestedField(segments);
-
- assertEquals("Top nested field", expected, nestedField);
- }
-
- @Test
- public void getNestedFieldTwoLevelTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1/l-interfaces/l-interface/interface-2";
- String expected = "p-interfaces.p-interface.$.l-interfaces.l-interface";
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- String nestedField = aaiResourceDmaapParserStrategy.getNestedField(segments);
-
- assertEquals("Top nested field", expected, nestedField);
- }
-
- @Test
- public void getNestedFieldThreeLevelOddCaseTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1/l-interfaces/l-interface/interface-2/l3-interface-ipv4-address-list/addressA";
- String expected = "p-interfaces.p-interface.$.l-interfaces.l-interface.$.l3-interface-ipv4-address-list";
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- String nestedField = aaiResourceDmaapParserStrategy.getNestedField(segments);
-
- assertEquals("Top nested field", expected, nestedField);
- }
-
-
-
-
- @Test
- public void getNestedIdentifierTopTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn";
- JsonObject expected = parser.parse("{}").getAsJsonObject();
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- JsonObject nestedIdentifier = aaiResourceDmaapParserStrategy.getNestedIdentifier(segments);
-
- JSONAssert.assertEquals(
- new JSONObject(expected.toString()),
- new JSONObject(nestedIdentifier.toString()),
- true);
- }
-
- @Test
- public void getNestedIdentifierOneLevelTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1";
- JsonObject expected = parser.parse("{'interface-name':'interface-1'}").getAsJsonObject();
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- JsonObject nestedIdentifier = aaiResourceDmaapParserStrategy.getNestedIdentifier(segments);
-
- JSONAssert.assertEquals(
- new JSONObject(expected.toString()),
- new JSONObject(nestedIdentifier.toString()),
- true);
- }
-
- @Test
- public void getNestedIdentifierTwoLevelTest() throws Exception {
- String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1/l-interfaces/l-interface/interface-2";
- JsonObject expected = parser.parse("{'interface-name':'interface-2'}").getAsJsonObject();
-
- List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
- JsonObject nestedIdentifier = aaiResourceDmaapParserStrategy.getNestedIdentifier(segments);
-
- JSONAssert.assertEquals(
- new JSONObject(expected.toString()),
- new JSONObject(nestedIdentifier.toString()),
- true);
- }
-
-
- @Test
- public void getFullUriPrefixTest() throws Exception {
- assertEquals("/aai/v12", aaiResourceDmaapParserStrategy.getFullUriPrefix("/aai/v12/network/pnfs/pnf/pnf-name-value/p-interfaces/p-interface/xe-10%2F3%2F2/l-interfaces/l-interface/l-interface-name"));
- assertEquals("/aai/v4", aaiResourceDmaapParserStrategy.getFullUriPrefix("/aai/v4/names"));
- }
-
-
- @Test
- public void fullUriToRelationshipObj() throws Exception {
- String fullUri = AAIResourceDmaapParserStrategyTestConstants.VSERVER_URI;
- String expectedRelObj = AAIResourceDmaapParserStrategyTestConstants.VSERVER_RELATIONSHIP_OBJ;
- JsonObject relObj = aaiResourceDmaapParserStrategy.fullUriToRelationshipObj(fullUri, "tosca.relationships.HostedOn");
-
- JSONAssert.assertEquals(new JSONObject(expectedRelObj), new JSONObject(relObj.toString()), true);
- }
-
- @Test
- public void verifyRelationshipEntriesOnUpdateTest() throws Exception {
- List<CacheEntry> result = aaiResourceDmaapParserStrategy
- .process("TEST", parser.parse(AAIResourceDmaapParserStrategyTestConstants.GENERIC_VNF_EVENT_WITH_2_RELAT).getAsJsonObject());
-
- assertEquals(3, result.size());
-
- }
- @Test
- public void verifyRelationshipEntriesSimpleEvent() throws Exception {
- List<CacheEntry> result = aaiResourceDmaapParserStrategy
- .process("TEST", parser.parse(AAIResourceDmaapParserStrategyTestConstants.GENERIC_VNF_EVENT).getAsJsonObject());
-
- assertEquals(1, result.size());
-
- }
-
- @Test
- public void getFromRelationshipFullUriToRelationshipObjTest() throws Exception {
- String entity = AAIResourceDmaapParserStrategyTestConstants.FULL_PSERVER;
- String fullUri = AAIResourceDmaapParserStrategyTestConstants.FULL_PSERVER_URI;
- MultiValueMap<String, AAIResourceDmaapParserStrategy.AAIRelatedToDetails> result = aaiResourceDmaapParserStrategy.getFromRelationshipFullUriToRelationshipObj(parser.parse(entity).getAsJsonObject(), fullUri);
-
- assertEquals(3, result.size());
-
- }
-} \ No newline at end of file
diff --git a/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/AAIResourceDmaapParserStrategyTestConstants.java b/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/AAIResourceDmaapParserStrategyTestConstants.java
index 659c881..53017f0 100644
--- a/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/AAIResourceDmaapParserStrategyTestConstants.java
+++ b/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/AAIResourceDmaapParserStrategyTestConstants.java
@@ -193,7 +193,7 @@ public class AAIResourceDmaapParserStrategyTestConstants {
" 'severity': 'NORMAL'," +
" 'entity-type': 'generic-vnf'," +
" 'top-entity-type': 'generic-vnf'," +
- " 'entity-link': '/aai/v13/network/generic-vnfs/generic-vnf/cc1703a9-a63f-46c5-a6b1-7ff67f3a9848'," +
+ " 'entity-link': '/aai/v14/network/generic-vnfs/generic-vnf/cc1703a9-a63f-46c5-a6b1-7ff67f3a9848'," +
" 'event-type': 'AAI-EVENT'," +
" 'domain': 'e2e1'," +
" 'action': 'UPDATE'," +
@@ -222,7 +222,7 @@ public class AAIResourceDmaapParserStrategyTestConstants {
" {" +
" 'related-to': 'service-instance'," +
" 'relationship-label': 'org.onap.relationships.inventory.ComposedOf'," +
- " 'related-link': '/aai/v13/business/customers/customer/1702_IT3_SubscGblID_20170426162928/service-subscriptions/service-subscription/XXXX-VMS/service-instances/service-instance/SERVERNAME'," +
+ " 'related-link': '/aai/v14/business/customers/customer/1702_IT3_SubscGblID_20170426162928/service-subscriptions/service-subscription/XXXX-VMS/service-instances/service-instance/SERVERNAME'," +
" 'relationship-data': [" +
" {" +
" 'relationship-key': 'customer.global-customer-id'," +
@@ -246,7 +246,7 @@ public class AAIResourceDmaapParserStrategyTestConstants {
" {" +
" 'related-to': 'vserver'," +
" 'relationship-label': 'tosca.relationships.HostedOn'," +
- " 'related-link': '/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/AAIAIC25/tenants/tenant/SERVERNAME%3A%3AXXXX-VMS/vservers/vserver/e77451f2-1c07-4db4-b92b-9907b840fc8f'," +
+ " 'related-link': '/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/AAIAIC25/tenants/tenant/SERVERNAME%3A%3AXXXX-VMS/vservers/vserver/e77451f2-1c07-4db4-b92b-9907b840fc8f'," +
" 'relationship-data': [" +
" {" +
" 'relationship-key': 'cloud-region.cloud-owner'," +
@@ -297,7 +297,7 @@ public class AAIResourceDmaapParserStrategyTestConstants {
" 'relationship-key': 'l3-network.network-id'" +
" }" +
" ]," +
- " 'related-link': '/aai/v13/network/l3-networks/l3-network/91eae07d-6f38-4fd8-b929-e7c04614c8c3'," +
+ " 'related-link': '/aai/v14/network/l3-networks/l3-network/91eae07d-6f38-4fd8-b929-e7c04614c8c3'," +
" 'relationship-label': 'org.onap.relationships.inventory.Uses'," +
" 'related-to-property': [" +
" {" +
@@ -317,7 +317,7 @@ public class AAIResourceDmaapParserStrategyTestConstants {
" {" +
" 'related-to': 'vserver'," +
" 'relationship-label': 'tosca.relationships.HostedOn'," +
- " 'related-link': '/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/AAIAIC25/tenants/tenant/SERVERNAME%3A%3AXXXX-VMS/vservers/vserver/e77451f2-1c07-4db4-b92b-9907b840fc8f'," +
+ " 'related-link': '/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/AAIAIC25/tenants/tenant/SERVERNAME%3A%3AXXXX-VMS/vservers/vserver/e77451f2-1c07-4db4-b92b-9907b840fc8f'," +
" 'relationship-data': [" +
" {" +
" 'relationship-key': 'cloud-region.cloud-owner'," +
@@ -355,7 +355,7 @@ public class AAIResourceDmaapParserStrategyTestConstants {
" 'severity': 'NORMAL'," +
" 'entity-type': 'generic-vnf'," +
" 'top-entity-type': 'generic-vnf'," +
- " 'entity-link': '/aai/v13/network/generic-vnfs/generic-vnf/cc1703a9-a63f-46c5-a6b1-7ff67f3a9848'," +
+ " 'entity-link': '/aai/v14/network/generic-vnfs/generic-vnf/cc1703a9-a63f-46c5-a6b1-7ff67f3a9848'," +
" 'event-type': 'AAI-EVENT'," +
" 'domain': 'e2e1'," +
" 'action': 'UPDATE'," +
diff --git a/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/aai/dmaap/AAIResourceDmaapParserStrategyTest.java b/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/aai/dmaap/AAIResourceDmaapParserStrategyTest.java
new file mode 100644
index 0000000..5a87323
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/aai/dmaap/AAIResourceDmaapParserStrategyTest.java
@@ -0,0 +1,360 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.aai.cacher.injestion.parser.strategy.aai.dmaap;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import org.junit.Ignore;
+import org.junit.runner.RunWith;
+import org.onap.aai.cacher.injestion.parser.InjestionTestComponent;
+import org.onap.aai.cacher.injestion.parser.PayloadParserService;
+import org.onap.aai.cacher.model.CacheEntry;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.util.List;
+
+@Ignore("Due to rework tests from this class need to be moved/removed ")
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = InjestionTestComponent.class)
+public class AAIResourceDmaapParserStrategyTest {
+
+ @Autowired
+ private PayloadParserService parserService;
+
+ @Autowired
+ @Qualifier("aai-resource-dmaap")
+ private AAIResourceDmaapParserStrategy aaiResourceDmaapParserStrategy;
+
+ private JsonParser parser = new JsonParser();
+
+ private JsonObject pserverCreateEvent = parser.parse(
+ new FileReader("./src/test/resources/test/payloads/dmaap-pserver-create.json")).getAsJsonObject();
+
+ public AAIResourceDmaapParserStrategyTest() throws FileNotFoundException {}
+
+ private void print(List<CacheEntry> result) {
+ Gson gson = new GsonBuilder().setPrettyPrinting().create();
+ result.forEach(e -> System.out.println("\n\nCollection: " + e.getCollection() +
+ "\nKey: " + e.getId() +
+ "\nFind: " + gson.toJson(e.getFindQuery()) +
+ "\nNestedFind: " + gson.toJson(e.getNestedFind()) +
+ "\nNestedField: " + e.getNestedField() +
+ "\nNestedFieldIdentifier: " + gson.toJson(e.getNestedFieldIdentifierObj()) +
+ "\nPayload: " + gson.toJson(e.getPayload())));
+ }
+
+// @Test
+// public void getEntityBodyChildTest() throws Exception {
+// String uri = "/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/ams1b/tenants/tenant/52fd05137ab4453bb53084a13c7bb7a4/vservers/vserver/vs-id";
+// String entityString =
+// "{" +
+// " 'tenants':" +
+// " {" +
+// " 'tenant': [" +
+// " {" +
+// " 'vservers':" +
+// " {" +
+// " 'vserver': [" +
+// " {" +
+// " 'in-maint': false," +
+// " 'resource-version': '1525978690717'," +
+// " 'vserver-name': 'slaa-regression-cr-id-api-server-449704329'," +
+// " 'vserver-id': 'vs-id'" +
+// " }" +
+// " ]" +
+// " }," +
+// " 'tenant-id': 'ten-id'," +
+// " 'tenant-name': 'name'" +
+// " }" +
+// " ]" +
+// " }," +
+// " 'cloud-owner': 'cr-o'," +
+// " 'owner-defined-type': 'lcp'," +
+// " 'cloud-region-id': 'cr-id'" +
+// "}";
+//
+// JsonObject entity = parser.parse(entityString).getAsJsonObject();
+//
+// List<AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+//
+// JsonObject result = aaiResourceDmaapParserStrategy.getEntityBody(entity, segments);
+//
+// JSONAssert.assertEquals(
+// new JSONObject(entity
+// .getAsJsonObject("tenants").getAsJsonArray("tenant").get(0) .getAsJsonObject()
+// .getAsJsonObject("vservers").getAsJsonArray("vserver").get(0).getAsJsonObject()
+// .toString()),
+// new JSONObject(result.toString()),
+// true);
+//
+// }
+//
+// @Test
+// public void getEntityBodyTopTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn";
+// String entityString = "{'hostname':'hn','in-maint':false,'resource-version':'1525801811662','pserver-id':'0A47B945-9C74-4CBE-AD72-0DECB966EB94'}";
+//
+// JsonObject entity = parser.parse(entityString).getAsJsonObject();
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+//
+// JsonObject result = aaiResourceDmaapParserStrategy.getEntityBody(entity, segments);
+//
+// JSONAssert.assertEquals(
+// new JSONObject(entity.toString()),
+// new JSONObject(result.toString()),
+// true);
+//
+// }
+//
+// @Test
+// public void getFindQueryTopTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn";
+// JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
+// "'hostname':'hn'}").getAsJsonObject();
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// JsonObject findQuery = aaiResourceDmaapParserStrategy.getFindQuery(segments);
+//
+// JSONAssert.assertEquals(
+// new JSONObject(expected.toString()),
+// new JSONObject(findQuery.toString()),
+// true);
+// }
+//
+// @Test
+// public void getFindQueryOneLevelTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1";
+// JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
+// "'hostname':'hn'}").getAsJsonObject();
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// JsonObject findQuery = aaiResourceDmaapParserStrategy.getFindQuery(segments);
+//
+// JSONAssert.assertEquals(
+// new JSONObject(expected.toString()),
+// new JSONObject(findQuery.toString()),
+// true);
+// }
+//
+// @Test
+// public void getFindQueryTwoLevelTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1/l-interfaces/l-interface/interface-2";
+// JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
+// "'hostname':'hn'," +
+// "'p-interfaces.p-interface.interface-name':'interface-1'}").getAsJsonObject();
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// JsonObject findQuery = aaiResourceDmaapParserStrategy.getFindQuery(segments);
+//
+// JSONAssert.assertEquals(
+// new JSONObject(expected.toString()),
+// new JSONObject(findQuery.toString()),
+// true);
+// }
+//
+// @Test
+// public void getNestedFindQueryTopTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn";
+// JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
+// "'hostname':'hn'}").getAsJsonObject();
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// JsonObject findQuery = aaiResourceDmaapParserStrategy.getNestedFindQuery(segments);
+//
+// JSONAssert.assertEquals(
+// new JSONObject(expected.toString()),
+// new JSONObject(findQuery.toString()),
+// true);
+// }
+//
+// @Test
+// public void getNestedFindQueryOneLevelTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1";
+// JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
+// "'hostname':'hn'," +
+// "'p-interfaces.p-interface.interface-name':'interface-1'}").getAsJsonObject();
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// JsonObject findQuery = aaiResourceDmaapParserStrategy.getNestedFindQuery(segments);
+//
+// JSONAssert.assertEquals(
+// new JSONObject(expected.toString()),
+// new JSONObject(findQuery.toString()),
+// true);
+// }
+//
+// @Test
+// public void getNestedFindQueryTwoLevelTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1/l-interfaces/l-interface/interface-2";
+// JsonObject expected = parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/hn'," +
+// "'hostname':'hn'," +
+// "'p-interfaces.p-interface.interface-name':'interface-1'," +
+// "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'interface-2'}").getAsJsonObject();
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// JsonObject findQuery = aaiResourceDmaapParserStrategy.getNestedFindQuery(segments);
+//
+// JSONAssert.assertEquals(
+// new JSONObject(expected.toString()),
+// new JSONObject(findQuery.toString()),
+// true);
+// }
+//
+// @Test
+// public void getNestedFieldTopTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn";
+// String expected = "";
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// String nestedField = aaiResourceDmaapParserStrategy.getNestedField(segments);
+//
+// assertEquals("Top nested field", expected, nestedField);
+// }
+//
+// @Test
+// public void getNestedFieldOneLevelTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1";
+// String expected = "p-interfaces.p-interface";
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// String nestedField = aaiResourceDmaapParserStrategy.getNestedField(segments);
+//
+// assertEquals("Top nested field", expected, nestedField);
+// }
+//
+// @Test
+// public void getNestedFieldTwoLevelTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1/l-interfaces/l-interface/interface-2";
+// String expected = "p-interfaces.p-interface.$.l-interfaces.l-interface";
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// String nestedField = aaiResourceDmaapParserStrategy.getNestedField(segments);
+//
+// assertEquals("Top nested field", expected, nestedField);
+// }
+//
+// @Test
+// public void getNestedFieldThreeLevelOddCaseTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1/l-interfaces/l-interface/interface-2/l3-interface-ipv4-address-list/addressA";
+// String expected = "p-interfaces.p-interface.$.l-interfaces.l-interface.$.l3-interface-ipv4-address-list";
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// String nestedField = aaiResourceDmaapParserStrategy.getNestedField(segments);
+//
+// assertEquals("Top nested field", expected, nestedField);
+// }
+//
+//
+//
+//
+// @Test
+// public void getNestedIdentifierTopTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn";
+// JsonObject expected = parser.parse("{}").getAsJsonObject();
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// JsonObject nestedIdentifier = aaiResourceDmaapParserStrategy.getNestedIdentifier(segments);
+//
+// JSONAssert.assertEquals(
+// new JSONObject(expected.toString()),
+// new JSONObject(nestedIdentifier.toString()),
+// true);
+// }
+//
+// @Test
+// public void getNestedIdentifierOneLevelTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1";
+// JsonObject expected = parser.parse("{'interface-name':'interface-1'}").getAsJsonObject();
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// JsonObject nestedIdentifier = aaiResourceDmaapParserStrategy.getNestedIdentifier(segments);
+//
+// JSONAssert.assertEquals(
+// new JSONObject(expected.toString()),
+// new JSONObject(nestedIdentifier.toString()),
+// true);
+// }
+//
+// @Test
+// public void getNestedIdentifierTwoLevelTest() throws Exception {
+// String uri = "/cloud-infrastructure/pservers/pserver/hn/p-interfaces/p-interface/interface-1/l-interfaces/l-interface/interface-2";
+// JsonObject expected = parser.parse("{'interface-name':'interface-2'}").getAsJsonObject();
+//
+// List<AAIResourceDmaapParserStrategy.AAIUriSegment> segments = aaiResourceDmaapParserStrategy.getAaiUriSegments(uri);
+// JsonObject nestedIdentifier = aaiResourceDmaapParserStrategy.getNestedIdentifier(segments);
+//
+// JSONAssert.assertEquals(
+// new JSONObject(expected.toString()),
+// new JSONObject(nestedIdentifier.toString()),
+// true);
+// }
+//
+//
+// @Test
+// public void getFullUriPrefixTest() throws Exception {
+// assertEquals("/aai/v12", aaiResourceDmaapParserStrategy.getFullUriPrefix("/aai/v12/network/pnfs/pnf/pnf-name-value/p-interfaces/p-interface/xe-10%2F3%2F2/l-interfaces/l-interface/l-interface-name"));
+// assertEquals("/aai/v4", aaiResourceDmaapParserStrategy.getFullUriPrefix("/aai/v4/names"));
+// }
+//
+//
+// @Test
+// public void fullUriToRelationshipObj() throws Exception {
+// String fullUri = AAIResourceDmaapParserStrategyTestConstants.VSERVER_URI;
+// String expectedRelObj = AAIResourceDmaapParserStrategyTestConstants.VSERVER_RELATIONSHIP_OBJ;
+// JsonObject relObj = aaiResourceDmaapParserStrategy.fullUriToRelationshipObj(fullUri, "tosca.relationships.HostedOn");
+//
+// JSONAssert.assertEquals(new JSONObject(expectedRelObj), new JSONObject(relObj.toString()), true);
+// }
+//
+// @Test
+// public void verifyRelationshipEntriesOnUpdateTest() throws Exception {
+// List<CacheEntry> result = aaiResourceDmaapParserStrategy
+// .process("TEST", parser.parse(AAIResourceDmaapParserStrategyTestConstants.GENERIC_VNF_EVENT_WITH_2_RELAT).getAsJsonObject());
+//
+// assertEquals(3, result.size());
+//
+// }
+// @Test
+// public void verifyRelationshipEntriesSimpleEvent() throws Exception {
+// List<CacheEntry> result = aaiResourceDmaapParserStrategy
+// .process("TEST", parser.parse(AAIResourceDmaapParserStrategyTestConstants.GENERIC_VNF_EVENT).getAsJsonObject());
+//
+// assertEquals(1, result.size());
+//
+// }
+//
+// @Test
+// public void getFromRelationshipFullUriToRelationshipObjTest() throws Exception {
+// String entity = AAIResourceDmaapParserStrategyTestConstants.FULL_PSERVER;
+// String fullUri = AAIResourceDmaapParserStrategyTestConstants.FULL_PSERVER_URI;
+// MultiValueMap<String, AAIRelatedToDetails> result = aaiResourceDmaapParserStrategy.getFromRelationshipFullUriToRelationshipObj(parser.parse(entity).getAsJsonObject(), fullUri);
+//
+// assertEquals(3, result.size());
+//
+// }
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/aai/cacher/model/CacheKeyTest.java b/src/test/java/org/onap/aai/cacher/model/CacheKeyTest.java
index 19a3b3b..fb2baa2 100644
--- a/src/test/java/org/onap/aai/cacher/model/CacheKeyTest.java
+++ b/src/test/java/org/onap/aai/cacher/model/CacheKeyTest.java
@@ -30,7 +30,7 @@ public class CacheKeyTest {
public String inputGETOnInit = "{" +
"'cacheKey': 'cloud-region'," +
"'baseUrl': 'http://localhost:8447'," +
- "'module': '/aai/v13/'," +
+ "'module': '/aai/v14/'," +
"'URI': 'cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3'," +
"'timingIndicator': 'onInit'," +
"'httpMethod': 'GET'}";
@@ -38,20 +38,20 @@ public class CacheKeyTest {
public String inputGETFirstHitDefault = "{" +
"'cacheKey': 'cloud-region'," +
"'baseUrl': 'http://localhost:8447'," +
- "'module': '/aai/v13/'," +
+ "'module': '/aai/v14/'," +
"'URI': 'cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3'}";
public String inputGETScheduledDefault = "{" +
"'cacheKey': 'cloud-region'," +
"'baseUrl': 'http://localhost:8447'," +
- "'module': '/aai/v13/'," +
+ "'module': '/aai/v14/'," +
"'timingIndicator': 'scheduled'," +
"'URI': 'cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3'}";
public String inputGETScheduledWithSyncInterval = "{" +
"'cacheKey': 'cloud-region'," +
"'baseUrl': 'http://localhost:8447'," +
- "'module': '/aai/v13/'," +
+ "'module': '/aai/v14/'," +
"'syncInterval': '2'," +
"'timingIndicator': 'scheduled'," +
"'URI': 'cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3'}";
@@ -59,7 +59,7 @@ public class CacheKeyTest {
public String inputGETScheduledWithSyncIntervalWithId = "{" +
"'_id': 'cloud-region'," +
"'baseUrl': 'http://localhost:8447'," +
- "'module': '/aai/v13/'," +
+ "'module': '/aai/v14/'," +
"'syncInterval': '2'," +
"'timingIndicator': 'scheduled'," +
"'URI': 'cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3'}";
@@ -72,7 +72,7 @@ public class CacheKeyTest {
CacheKey ck = CacheKey.fromJson(ckJson);
assertEquals("cacheKey was incorrect", "cloud-region", ck.getCacheKey());
assertEquals("baseUrl was incorrect", "http://localhost:8447", ck.getBaseUrl());
- assertEquals("Module was incorrect", "/aai/v13/", ck.getModule());
+ assertEquals("Module was incorrect", "/aai/v14/", ck.getModule());
assertEquals("URI was incorrect", "cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3", ck.getURI());
assertEquals("timingIndicator was incorrect", "onInit", ck.getTimingIndicator());
assertEquals("Http Method was incorrect", "GET", ck.getHttpMethod());
@@ -89,7 +89,7 @@ public class CacheKeyTest {
CacheKey ck = CacheKey.fromJson(ckJson);
assertEquals("cacheKey was incorrect", "cloud-region", ck.getCacheKey());
assertEquals("baseUrl was incorrect", "http://localhost:8447", ck.getBaseUrl());
- assertEquals("Module was incorrect", "/aai/v13/", ck.getModule());
+ assertEquals("Module was incorrect", "/aai/v14/", ck.getModule());
assertEquals("URI was incorrect", "cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3", ck.getURI());
assertEquals("timingIndicator was incorrect", "firstHit", ck.getTimingIndicator());
assertEquals("Http Method was incorrect", "GET", ck.getHttpMethod());
@@ -123,7 +123,7 @@ public class CacheKeyTest {
CacheKey ck = CacheKey.fromJson(ckJson);
assertEquals("cacheKey was incorrect", "cloud-region", ck.getCacheKey());
assertEquals("baseUrl was incorrect", "http://localhost:8447", ck.getBaseUrl());
- assertEquals("Module was incorrect", "/aai/v13/", ck.getModule());
+ assertEquals("Module was incorrect", "/aai/v14/", ck.getModule());
assertEquals("URI was incorrect", "cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3", ck.getURI());
assertEquals("timingIndicator was incorrect", "scheduled", ck.getTimingIndicator());
assertEquals("Http Method was incorrect", "GET", ck.getHttpMethod());
@@ -140,7 +140,7 @@ public class CacheKeyTest {
CacheKey ck = CacheKey.fromJson(ckJson);
assertEquals("cacheKey was incorrect", "cloud-region", ck.getCacheKey());
assertEquals("baseUrl was incorrect", "http://localhost:8447", ck.getBaseUrl());
- assertEquals("Module was incorrect", "/aai/v13/", ck.getModule());
+ assertEquals("Module was incorrect", "/aai/v14/", ck.getModule());
assertEquals("URI was incorrect", "cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3", ck.getURI());
assertEquals("timingIndicator was incorrect", "scheduled", ck.getTimingIndicator());
assertEquals("Http Method was incorrect", "GET", ck.getHttpMethod());
@@ -157,7 +157,7 @@ public class CacheKeyTest {
CacheKey ck = CacheKey.fromJson(ckJson);
assertEquals("cacheKey was incorrect", "cloud-region", ck.getCacheKey());
assertEquals("baseUrl was incorrect", "http://localhost:8447", ck.getBaseUrl());
- assertEquals("Module was incorrect", "/aai/v13/", ck.getModule());
+ assertEquals("Module was incorrect", "/aai/v14/", ck.getModule());
assertEquals("URI was incorrect", "cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3", ck.getURI());
assertEquals("timingIndicator was incorrect", "scheduled", ck.getTimingIndicator());
assertEquals("Http Method was incorrect", "GET", ck.getHttpMethod());
diff --git a/src/test/java/org/onap/aai/cacher/service/helper/CacheHelperServiceScenariosTest.java b/src/test/java/org/onap/aai/cacher/service/helper/CacheHelperServiceScenariosTest.java
index f4543ad..00beab6 100644
--- a/src/test/java/org/onap/aai/cacher/service/helper/CacheHelperServiceScenariosTest.java
+++ b/src/test/java/org/onap/aai/cacher/service/helper/CacheHelperServiceScenariosTest.java
@@ -19,18 +19,11 @@
*/
package org.onap.aai.cacher.service.helper;
+import com.github.fakemongo.Fongo;
import com.mongodb.DB;
import com.mongodb.MongoClient;
import com.mongodb.client.MongoDatabase;
-import de.flapdoodle.embed.mongo.MongodExecutable;
import de.flapdoodle.embed.mongo.MongodProcess;
-import de.flapdoodle.embed.mongo.MongodStarter;
-import de.flapdoodle.embed.mongo.config.IMongodConfig;
-import de.flapdoodle.embed.mongo.config.MongoCmdOptionsBuilder;
-import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
-import de.flapdoodle.embed.mongo.config.Net;
-import de.flapdoodle.embed.mongo.distribution.Version;
-import de.flapdoodle.embed.process.runtime.Network;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -49,6 +42,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import javax.ws.rs.core.Response;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -56,9 +50,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import javax.ws.rs.core.Response;
-
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
@RunWith(SpringJUnit4ClassRunner.class)
@Configuration
@@ -120,28 +113,9 @@ public class CacheHelperServiceScenariosTest {
@BeforeClass
public static void setup() throws IOException, InterruptedException {
-
- String bindIp = "localhost";
- int port = 27017;
- startEmbedded(port);
-
- mongoC = new MongoClient(bindIp, port);
- mongoDb = mongoC.getDatabase(DB_NAME);
- db = mongoC.getDB(DB_NAME);
-
- }
-
- protected static void startEmbedded(int port) throws IOException {
- IMongodConfig mongoConfigConfig = new MongodConfigBuilder()
- .version(Version.Main.PRODUCTION)
- .net(new Net(port, Network.localhostIsIPv6()))
- .cmdOptions(new MongoCmdOptionsBuilder().verbose(true).build())
- .configServer(false)
- .build();
-
- MongodExecutable mongodExecutable = MongodStarter.getDefaultInstance().prepare(mongoConfigConfig);
-
- mongod = mongodExecutable.start();
+ Fongo fongo = new Fongo(DB_NAME);
+ mongoDb = fongo.getDatabase(DB_NAME);
+ db = fongo.getDB(DB_NAME);
}
@AfterClass
@@ -203,7 +177,7 @@ public class CacheHelperServiceScenariosTest {
cacheHelperService.updateCacheKey(retrieveCk);
resp = cacheHelperService.forceSync(retrieveCk);
- assertEquals("forceSync", 500, resp.getStatus());
+ assertEquals("forceSync", 400, resp.getStatus());
retrieveCk.lastSyncStartTime = syncStartTime;
retrieveCk.lastSyncEndTime = syncEndTime;
assertTrue("isShouldTrigger2", cacheHelperService.isShouldTrigger(retrieveCk));
@@ -229,4 +203,12 @@ public class CacheHelperServiceScenariosTest {
assertEquals("buildExceptionResponse", 500, resp.getStatus());
}
+
+ @Test
+ public void buildMissingFieldResponseTest() throws Exception {
+ List<String> issueList = Arrays.asList("First Field", "Second Field");
+ Response resp = cacheHelperService.buildMissingFieldResponse(issueList);
+ assertEquals("buildMissingFieldResponse", 400, resp.getStatus());
+
+ }
}
diff --git a/src/test/java/org/onap/aai/cacher/service/rest/util/CacheKeyRequestValidationTest.java b/src/test/java/org/onap/aai/cacher/service/rest/util/CacheKeyRequestValidationTest.java
index 53f90a3..047ca05 100644
--- a/src/test/java/org/onap/aai/cacher/service/rest/util/CacheKeyRequestValidationTest.java
+++ b/src/test/java/org/onap/aai/cacher/service/rest/util/CacheKeyRequestValidationTest.java
@@ -25,6 +25,7 @@ import org.junit.Test;
import org.mockito.Mockito;
import org.onap.aai.cacher.service.helper.CacheHelperService;
+import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.assertEquals;
@@ -86,5 +87,14 @@ public class CacheKeyRequestValidationTest {
Mockito.when(cacheHelperService.isKeyPresent(Mockito.any(), Mockito.anyString())).thenReturn(true);
List<String> results = updateCacheKeyRequestValidation.validateCacheKeyRequest(parser.parse(nonEmptyPayload).getAsJsonObject(), cacheHelperService);
assertEquals("update existing CacheKey ok", 0, results.size());
- }
+ }
+
+ @Test
+ public void testAddNewCacheKeyMissingFields() {
+ List<String> results = addCacheKeyRequestValidation.checkMissingRequiredFields(parser.parse(nonEmptyPayload).getAsJsonObject(), cacheHelperService);
+ List<String> exp = new ArrayList<String>();
+ exp.add("baseUrl");
+ exp.add("URI");
+ assertEquals("missing rqd fields", exp, results);
+ }
}
diff --git a/src/test/resources/test/payloads/dmaapEvents/address-list.json b/src/test/resources/test/payloads/dmaapEvents/address-list.json
index b2ea6b8..f8835f3 100644
--- a/src/test/resources/test/payloads/dmaapEvents/address-list.json
+++ b/src/test/resources/test/payloads/dmaapEvents/address-list.json
@@ -4,14 +4,14 @@
"severity": "NORMAL",
"entity-type": "l3-interface-ipv4-address-list",
"top-entity-type": "generic-vnf",
- "entity-link": "/aai/v13/network/generic-vnfs/generic-vnf/generic-vnf-987654321-39-jenkins/l-interfaces/l-interface/interface-name-generic-vnf-987654321-39-jenkins/vlans/vlan/vlan-interface-generic-vnf-987654321-39-jenkins/l3-interface-ipv4-address-list/l3-interface-ipv4-address-generic-vnf-987654321-39-jenkins",
+ "entity-link": "/aai/v14/network/generic-vnfs/generic-vnf/generic-vnf-987654321-39-jenkins/l-interfaces/l-interface/interface-name-generic-vnf-987654321-39-jenkins/vlans/vlan/vlan-interface-generic-vnf-987654321-39-jenkins/l3-interface-ipv4-address-list/l3-interface-ipv4-address-generic-vnf-987654321-39-jenkins",
"event-type": "AAI-EVENT",
"domain": "uINT1",
"action": "DELETE",
"sequence-number": "0",
"id": "7a899562-a0c1-414e-83aa-0021a5c7646b",
"source-name": "FitNesse-Test-generic-vnf-AAI-9278-02",
- "version": "v13",
+ "version": "v14",
"timestamp": "20180625-00:05:26:664"
},
"entity": {
diff --git a/src/test/resources/test/payloads/dmaapEvents/allotted-resource.json b/src/test/resources/test/payloads/dmaapEvents/allotted-resource.json
new file mode 100644
index 0000000..19b12e3
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/allotted-resource.json
@@ -0,0 +1,53 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "allotted-resource",
+ "top-entity-type": "customer",
+ "entity-link": "/aai/v15/business/customers/customer/customer-12083-jenkins/service-subscriptions/service-subscription/HOSTED-COMMUNICATIONS/service-instances/service-instance/servInstance-12083-jenkins/allotted-resources/allotted-resource/vfModule2-12083-jenkins/",
+ "event-type": "AAI-EVENT",
+ "domain": "uINT5",
+ "action": "UPDATE",
+ "sequence-number": "0",
+ "id": "070f11ad-751e-43ba-a393-fd3380aba19e",
+ "source-name": "FitNesse-Test-jenkins",
+ "version": "v15",
+ "timestamp": "20190115-07:42:54:258"
+ },
+ "entity": {
+ "global-customer-id": "customer-12083-jenkins",
+ "service-subscriptions": {
+ "service-subscription": [{
+ "service-type": "HOSTED-COMMUNICATIONS",
+ "service-instances": {
+ "service-instance": [{
+ "service-instance-id": "servInstance-12083-jenkins",
+ "allotted-resources": {
+ "allotted-resource": [{
+ "selflink": "selflink-12083",
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "configuration",
+ "relationship-data": [{
+ "relationship-value": "config-12083-jenkins",
+ "relationship-key": "configuration.configuration-id"
+ }],
+ "related-link": "/aai/v15/network/configurations/configuration/config-12083-jenkins",
+ "relationship-label": "org.onap.relationships.inventory.Uses"
+ }]
+ },
+ "role": "role-12083",
+ "resource-version": "1547538174222",
+ "description": "description-12083",
+ "operational-status": "operational-status-12083",
+ "id": "vfModule2-12083-jenkins",
+ "type": "type-12083",
+ "orchestration-status": "orchestration-status-12083"
+ }]
+ }
+ }]
+ }
+ }]
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/create-generic-vnf-with-children-update-generic-vnf-property.json b/src/test/resources/test/payloads/dmaapEvents/create-generic-vnf-with-children-update-generic-vnf-property.json
new file mode 100644
index 0000000..299bd46
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/create-generic-vnf-with-children-update-generic-vnf-property.json
@@ -0,0 +1,710 @@
+{
+ "create-generic-vnf": {
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "generic-vnf",
+ "top-entity-type": "generic-vnf",
+ "entity-link": "/aai/v14/network/generic-vnfs/generic-vnf/generic-vnf-987654321-9-cleanup-later-PS2418",
+ "event-type": "AAI-EVENT",
+ "domain": "uINT4",
+ "action": "CREATE",
+ "sequence-number": "0",
+ "id": "034bcf6a-3d1c-4083-932e-368c1b9d7095",
+ "source-name": "FitNesse-Test-PS2418",
+ "version": "v14",
+ "timestamp": "20180925-14:20:58:309"
+ },
+ "entity": {
+ "entitlements": {
+ "entitlement": [{
+ "resource-version": "1537885258241",
+ "group-uuid": "entitlement-group-uuid-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "resource-uuid": "example-resource-uuid-val-23438"
+ }
+ ]
+ },
+ "service-id": "example-service-id-val-86237",
+ "vnf-id": "generic-vnf-987654321-9-cleanup-later-PS2418",
+ "nf-type": "example-nf-type-val-6894",
+ "l-interfaces": {
+ "l-interface": [{
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-89762",
+ "vlans": {
+ "vlan": [{
+ "vlan-description": "example-vlan-description-val-78275",
+ "vpn-key": "example-vpn-key-val-72775",
+ "prov-status": "example-prov-status-val-22546",
+ "vlan-id-inner": 99053100,
+ "vlan-id-outer": 78357943,
+ "orchestration-status": "example-orchestration-status-val-68023",
+ "speed-value": "example-speed-value-val-80431",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [{
+ "resource-version": "1537885258053",
+ "neutron-network-id": "example-neutron-network-id-val-3701",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-10882",
+ "l3-interface-ipv6-prefix-length": 59706574,
+ "vlan-id-inner": 15251621,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "l3-interface-ipv6-address-1-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vlan-id-outer": 53340121
+ }
+ ],
+ "resource-version": "1537885258033",
+ "is-ip-unnumbered": true,
+ "speed-units": "example-speed-units-val-39623",
+ "vlan-interface": "vlan-interface-1-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "backdoor-connection": "example-backdoor-connection-val-37365",
+ "l3-interface-ipv4-address-list": [{
+ "l3-interface-ipv4-prefix-length": 66218823,
+ "resource-version": "1537885258043",
+ "neutron-network-id": "example-neutron-network-id-val-88451",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-46196",
+ "vlan-id-inner": 15889692,
+ "l3-interface-ipv4-address": "l3-interface-ipv4-address-1-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "is-floating": true,
+ "vlan-id-outer": 74465804
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [{
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-69650",
+ "interface-name": "interface-name-2-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "allowed-address-pairs": "example-allowed-address-pairs-val-68306",
+ "prov-status": "example-prov-status-val-69853",
+ "macaddr": "example-macaddr-val-34300",
+ "interface-role": "example-interface-role-val-41338",
+ "selflink": "example-selflink-val-22090",
+ "in-maint": true,
+ "admin-status": "example-admin-status-val-98172",
+ "is-port-mirrored": true,
+ "resource-version": "1537885258078",
+ "is-ip-unnumbered": true,
+ "network-name": "example-network-name-val-33414",
+ "management-option": "example-management-option-val-72200",
+ "interface-id": "example-interface-id-val-92751",
+ "interface-description": "example-interface-description-val-86621"
+ }
+ ]
+ },
+ "interface-name": "interface-name-1-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "allowed-address-pairs": "example-allowed-address-pairs-val-88303",
+ "prov-status": "example-prov-status-val-30354",
+ "macaddr": "example-macaddr-val-74995",
+ "interface-role": "example-interface-role-val-62829",
+ "selflink": "example-selflink-val-34970",
+ "in-maint": true,
+ "admin-status": "example-admin-status-val-4462",
+ "l3-interface-ipv6-address-list": [{
+ "resource-version": "1537885258101",
+ "neutron-network-id": "example-neutron-network-id-val-32443",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-40815",
+ "l3-interface-ipv6-prefix-length": 19424600,
+ "vlan-id-inner": 92534837,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "l3-interface-ipv6-address-2-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vlan-id-outer": 78261005
+ }
+ ],
+ "is-port-mirrored": true,
+ "resource-version": "1537885258026",
+ "is-ip-unnumbered": true,
+ "sriov-vfs": {
+ "sriov-vf": [{
+ "vf-vlan-filter": "example-vf-vlan-filter-val-47642",
+ "vf-vlan-strip": true,
+ "neutron-network-id": "example-neutron-network-id-val-78281",
+ "vf-broadcast-allow": true,
+ "vf-mac-anti-spoof-check": true,
+ "vf-unknown-multicast-allow": true,
+ "pci-id": "pci-id-1-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vf-mirrors": "example-vf-mirrors-val-98879",
+ "resource-version": "1537885258066",
+ "vf-link-status": "example-vf-link-status-val-51961",
+ "vf-mac-filter": "example-vf-mac-filter-val-75865",
+ "vf-insert-stag": true,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-unknown-unicast-allow": true
+ }
+ ]
+ },
+ "network-name": "example-network-name-val-78237",
+ "management-option": "example-management-option-val-79362",
+ "interface-id": "example-interface-id-val-4824",
+ "interface-description": "example-interface-description-val-37355",
+ "l3-interface-ipv4-address-list": [{
+ "l3-interface-ipv4-prefix-length": 10115565,
+ "resource-version": "1537885258089",
+ "neutron-network-id": "example-neutron-network-id-val-77940",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-24000",
+ "vlan-id-inner": 23368411,
+ "l3-interface-ipv4-address": "l3-interface-ipv4-address-2-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "is-floating": true,
+ "vlan-id-outer": 32534763
+ }
+ ]
+ }
+ ]
+ },
+ "license-assignment-group-uuid": "example-license-assignment-group-uuid-val-60560",
+ "ipv4-loopback0-address": "example-ipv4-loopback0-address-val-37789",
+ "vnf-type": "example-vnf-type-val-46131",
+ "vlan-id-outer": 64688648,
+ "nf-function": "example-nf-function-val-27812",
+ "nm-profile-name": "example-nm-profile-name-val-6359",
+ "vmemory": 60496544,
+ "mso-catalog-key": "example-mso-catalog-key-val-35618",
+ "ipv4-oam-gateway-address": "example-ipv4-oam-gateway-address-val-18049",
+ "as-number": "example-as-number-val-65840",
+ "vmemory-units": "example-vmemory-units-val-98278",
+ "vnf-name2": "example-vnf-name2-val-8575",
+ "vcpu-units": "example-vcpu-units-val-32161",
+ "prov-status": "example-prov-status-val-99438",
+ "equipment-role": "example-equipment-role-val-75743",
+ "ipv4-oam-address": "example-ipv4-oam-address-val-14031",
+ "vf-modules": {
+ "vf-module": [{
+ "vf-module-name": "example-vf-module-name-val-34236",
+ "selflink": "example-selflink-val-53032",
+ "contrail-service-instance-fqdn": "example-contrail-service-instance-fqdn-val-9525",
+ "heat-stack-id": "example-heat-stack-id-val-30553",
+ "resource-version": "1537885258217",
+ "is-base-vf-module": true,
+ "vf-module-id": "vf-module-id-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "module-index": 511,
+ "orchestration-status": "example-orchestration-status-val-56709",
+ "automated-assignment": true
+ }
+ ]
+ },
+ "vnf-name": "example-vnf-name-val-45282",
+ "vdisk": 42236577,
+ "nf-role": "example-nf-role-val-66079",
+ "ipv4-oam-gateway-address-prefix-length": 54487,
+ "vcpu": 53671028,
+ "entitlement-assignment-group-uuid": "example-entitlement-assignment-group-uuid-val-15128",
+ "regional-resource-zone": "example-regional-resource-zone-val-73874",
+ "management-v6-address": "example-management-v6-address-val-25900",
+ "operational-status": "example-operational-status-val-17036",
+ "vdisk-units": "example-vdisk-units-val-96988",
+ "entitlement-resource-uuid": "example-entitlement-resource-uuid-val-20774",
+ "orchestration-status": "example-orchestration-status-val-19396",
+ "nf-naming-code": "example-nf-naming-code-val-92256",
+ "selflink": "example-selflink-val-44462",
+ "heat-stack-id": "example-heat-stack-id-val-37828",
+ "license-key-uuid": "example-license-key-uuid-val-66274",
+ "license-key": "example-license-key-val-66815",
+ "lag-interfaces": {
+ "lag-interface": [{
+ "interface-role": "example-interface-role-val-83678",
+ "speed-value": "example-speed-value-val-38117",
+ "in-maint": true,
+ "resource-version": "1537885258117",
+ "l-interfaces": {
+ "l-interface": [{
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-56250",
+ "vlans": {
+ "vlan": [{
+ "vlan-description": "example-vlan-description-val-47496",
+ "vpn-key": "example-vpn-key-val-38828",
+ "prov-status": "example-prov-status-val-99970",
+ "vlan-id-inner": 89782443,
+ "vlan-id-outer": 92728211,
+ "orchestration-status": "example-orchestration-status-val-65649",
+ "speed-value": "example-speed-value-val-87106",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [{
+ "resource-version": "1537885258152",
+ "neutron-network-id": "example-neutron-network-id-val-73096",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-80915",
+ "l3-interface-ipv6-prefix-length": 54785197,
+ "vlan-id-inner": 25109147,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "l3-interface-ipv6-address-3-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vlan-id-outer": 79074706
+ }
+ ],
+ "resource-version": "1537885258133",
+ "is-ip-unnumbered": true,
+ "speed-units": "example-speed-units-val-43767",
+ "vlan-interface": "vlan-interface-2-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "backdoor-connection": "example-backdoor-connection-val-42851",
+ "l3-interface-ipv4-address-list": [{
+ "l3-interface-ipv4-prefix-length": 95616468,
+ "resource-version": "1537885258142",
+ "neutron-network-id": "example-neutron-network-id-val-60156",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-25666",
+ "vlan-id-inner": 14957493,
+ "l3-interface-ipv4-address": "l3-interface-ipv4-address-3-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "is-floating": true,
+ "vlan-id-outer": 96248912
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [{
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-60751",
+ "interface-name": "interface-name-5-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "allowed-address-pairs": "example-allowed-address-pairs-val-66261",
+ "prov-status": "example-prov-status-val-79263",
+ "macaddr": "example-macaddr-val-54377",
+ "interface-role": "example-interface-role-val-57457",
+ "selflink": "example-selflink-val-7547",
+ "in-maint": true,
+ "admin-status": "example-admin-status-val-99281",
+ "is-port-mirrored": true,
+ "resource-version": "1537885258177",
+ "is-ip-unnumbered": true,
+ "network-name": "example-network-name-val-53451",
+ "management-option": "example-management-option-val-31869",
+ "interface-id": "example-interface-id-val-21202",
+ "interface-description": "example-interface-description-val-62128"
+ }
+ ]
+ },
+ "interface-name": "interface-name-4-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "allowed-address-pairs": "example-allowed-address-pairs-val-67284",
+ "prov-status": "example-prov-status-val-41209",
+ "macaddr": "example-macaddr-val-27005",
+ "interface-role": "example-interface-role-val-28263",
+ "selflink": "example-selflink-val-41633",
+ "in-maint": true,
+ "admin-status": "example-admin-status-val-66518",
+ "l3-interface-ipv6-address-list": [{
+ "resource-version": "1537885258199",
+ "neutron-network-id": "example-neutron-network-id-val-62532",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-98579",
+ "l3-interface-ipv6-prefix-length": 12026525,
+ "vlan-id-inner": 43455241,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "l3-interface-ipv6-address-4-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vlan-id-outer": 25084087
+ }
+ ],
+ "is-port-mirrored": true,
+ "resource-version": "1537885258127",
+ "is-ip-unnumbered": true,
+ "sriov-vfs": {
+ "sriov-vf": [{
+ "vf-vlan-filter": "example-vf-vlan-filter-val-18397",
+ "vf-vlan-strip": true,
+ "neutron-network-id": "example-neutron-network-id-val-15801",
+ "vf-broadcast-allow": true,
+ "vf-mac-anti-spoof-check": true,
+ "vf-unknown-multicast-allow": true,
+ "pci-id": "pci-id-2-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vf-mirrors": "example-vf-mirrors-val-361",
+ "resource-version": "1537885258167",
+ "vf-link-status": "example-vf-link-status-val-32153",
+ "vf-mac-filter": "example-vf-mac-filter-val-17599",
+ "vf-insert-stag": true,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-unknown-unicast-allow": true
+ }
+ ]
+ },
+ "network-name": "example-network-name-val-38641",
+ "management-option": "example-management-option-val-84248",
+ "interface-id": "example-interface-id-val-45628",
+ "interface-description": "example-interface-description-val-88021",
+ "l3-interface-ipv4-address-list": [{
+ "l3-interface-ipv4-prefix-length": 77529761,
+ "resource-version": "1537885258187",
+ "neutron-network-id": "example-neutron-network-id-val-58736",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-42120",
+ "vlan-id-inner": 60074034,
+ "l3-interface-ipv4-address": "l3-interface-ipv4-address-4-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "is-floating": true,
+ "vlan-id-outer": 97685113
+ }
+ ]
+ }
+ ]
+ },
+ "interface-name": "interface-name-3-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "speed-units": "example-speed-units-val-67991",
+ "prov-status": "example-prov-status-val-33056",
+ "interface-description": "example-interface-description-val-473",
+ "interface-id": "example-interface-id-val-12642"
+ }
+ ]
+ },
+ "summary-status": "example-summary-status-val-6834",
+ "encrypted-access-flag": true,
+ "licenses": {
+ "license": [{
+ "resource-version": "1537885258229",
+ "group-uuid": "license-group-uuid-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "resource-uuid": "example-resource-uuid-val-55651"
+ }
+ ]
+ },
+ "in-maint": true,
+ "nm-lan-v6-address": "example-nm-lan-v6-address-val-1909",
+ "resource-version": "1537885258008",
+ "regional-resource-subzone": "example-regional-resource-subzone-val-57379",
+ "management-option": "example-management-option-val-43163",
+ "is-closed-loop-disabled": true
+ }
+ },
+ "update-generic-vnf": {
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "generic-vnf",
+ "top-entity-type": "generic-vnf",
+ "entity-link": "/aai/v14/network/generic-vnfs/generic-vnf/generic-vnf-987654321-9-cleanup-later-PS2418",
+ "event-type": "AAI-EVENT",
+ "domain": "uINT4",
+ "action": "UPDATE",
+ "sequence-number": "0",
+ "id": "a1c98b90-7592-43ee-a68b-918201a0666b",
+ "source-name": "FitNesse-Relationship-Test-PS2418",
+ "version": "v14",
+ "timestamp": "20180925-14:20:59:170"
+ },
+ "entity": {
+ "entitlements": {
+ "entitlement": [{
+ "resource-version": "1537885258241",
+ "group-uuid": "entitlement-group-uuid-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "resource-uuid": "example-resource-uuid-val-23438"
+ }
+ ]
+ },
+ "service-id": "example-service-id-val-86237",
+ "vnf-id": "generic-vnf-987654321-9-cleanup-later-PS2418",
+ "nf-type": "example-nf-type-val-6894",
+ "l-interfaces": {
+ "l-interface": [{
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-89762",
+ "vlans": {
+ "vlan": [{
+ "vlan-description": "example-vlan-description-val-78275",
+ "vpn-key": "example-vpn-key-val-72775",
+ "prov-status": "example-prov-status-val-22546",
+ "vlan-id-inner": 99053100,
+ "vlan-id-outer": 78357943,
+ "orchestration-status": "example-orchestration-status-val-68023",
+ "speed-value": "example-speed-value-val-80431",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [{
+ "resource-version": "1537885258053",
+ "neutron-network-id": "example-neutron-network-id-val-3701",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-10882",
+ "l3-interface-ipv6-prefix-length": 59706574,
+ "vlan-id-inner": 15251621,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "l3-interface-ipv6-address-1-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vlan-id-outer": 53340121
+ }
+ ],
+ "resource-version": "1537885258033",
+ "is-ip-unnumbered": true,
+ "speed-units": "example-speed-units-val-39623",
+ "vlan-interface": "vlan-interface-1-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "backdoor-connection": "example-backdoor-connection-val-37365",
+ "l3-interface-ipv4-address-list": [{
+ "l3-interface-ipv4-prefix-length": 66218823,
+ "resource-version": "1537885258043",
+ "neutron-network-id": "example-neutron-network-id-val-88451",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-46196",
+ "vlan-id-inner": 15889692,
+ "l3-interface-ipv4-address": "l3-interface-ipv4-address-1-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "is-floating": true,
+ "vlan-id-outer": 74465804
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [{
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-69650",
+ "interface-name": "interface-name-2-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "allowed-address-pairs": "example-allowed-address-pairs-val-68306",
+ "prov-status": "example-prov-status-val-69853",
+ "macaddr": "example-macaddr-val-34300",
+ "interface-role": "example-interface-role-val-41338",
+ "selflink": "example-selflink-val-22090",
+ "in-maint": true,
+ "admin-status": "example-admin-status-val-98172",
+ "is-port-mirrored": true,
+ "resource-version": "1537885258078",
+ "is-ip-unnumbered": true,
+ "network-name": "example-network-name-val-33414",
+ "management-option": "example-management-option-val-72200",
+ "interface-id": "example-interface-id-val-92751",
+ "interface-description": "example-interface-description-val-86621"
+ }
+ ]
+ },
+ "interface-name": "interface-name-1-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "allowed-address-pairs": "example-allowed-address-pairs-val-88303",
+ "prov-status": "example-prov-status-val-30354",
+ "macaddr": "example-macaddr-val-74995",
+ "interface-role": "example-interface-role-val-62829",
+ "selflink": "example-selflink-val-34970",
+ "in-maint": true,
+ "admin-status": "example-admin-status-val-4462",
+ "l3-interface-ipv6-address-list": [{
+ "resource-version": "1537885258101",
+ "neutron-network-id": "example-neutron-network-id-val-32443",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-40815",
+ "l3-interface-ipv6-prefix-length": 19424600,
+ "vlan-id-inner": 92534837,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "l3-interface-ipv6-address-2-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vlan-id-outer": 78261005
+ }
+ ],
+ "is-port-mirrored": true,
+ "resource-version": "1537885258026",
+ "is-ip-unnumbered": true,
+ "sriov-vfs": {
+ "sriov-vf": [{
+ "vf-vlan-filter": "example-vf-vlan-filter-val-47642",
+ "vf-vlan-strip": true,
+ "neutron-network-id": "example-neutron-network-id-val-78281",
+ "vf-broadcast-allow": true,
+ "vf-mac-anti-spoof-check": true,
+ "vf-unknown-multicast-allow": true,
+ "pci-id": "pci-id-1-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vf-mirrors": "example-vf-mirrors-val-98879",
+ "resource-version": "1537885258066",
+ "vf-link-status": "example-vf-link-status-val-51961",
+ "vf-mac-filter": "example-vf-mac-filter-val-75865",
+ "vf-insert-stag": true,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-unknown-unicast-allow": true
+ }
+ ]
+ },
+ "network-name": "example-network-name-val-78237",
+ "management-option": "example-management-option-val-79362",
+ "interface-id": "example-interface-id-val-4824",
+ "interface-description": "example-interface-description-val-37355",
+ "l3-interface-ipv4-address-list": [{
+ "l3-interface-ipv4-prefix-length": 10115565,
+ "resource-version": "1537885258089",
+ "neutron-network-id": "example-neutron-network-id-val-77940",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-24000",
+ "vlan-id-inner": 23368411,
+ "l3-interface-ipv4-address": "l3-interface-ipv4-address-2-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "is-floating": true,
+ "vlan-id-outer": 32534763
+ }
+ ]
+ }
+ ]
+ },
+ "license-assignment-group-uuid": "example-license-assignment-group-uuid-val-60560",
+ "ipv4-loopback0-address": "example-ipv4-loopback0-address-val-37789",
+ "vnf-type": "example-vnf-type-val-46131-generic-vnf-987654321-9-cleanup-later-PS2418-patched",
+ "vlan-id-outer": 64688648,
+ "nf-function": "example-nf-function-val-27812",
+ "nm-profile-name": "example-nm-profile-name-val-6359",
+ "vmemory": 60496544,
+ "mso-catalog-key": "example-mso-catalog-key-val-35618",
+ "ipv4-oam-gateway-address": "example-ipv4-oam-gateway-address-val-18049",
+ "as-number": "example-as-number-val-65840",
+ "vmemory-units": "example-vmemory-units-val-98278",
+ "vnf-name2": "example-vnf-name2-val-8575-generic-vnf-987654321-9-cleanup-later-PS2418-patched",
+ "vcpu-units": "example-vcpu-units-val-32161",
+ "prov-status": "example-prov-status-val-99438",
+ "equipment-role": "example-equipment-role-val-75743",
+ "ipv4-oam-address": "example-ipv4-oam-address-val-14031",
+ "vf-modules": {
+ "vf-module": [{
+ "vf-module-name": "example-vf-module-name-val-34236",
+ "selflink": "example-selflink-val-53032",
+ "contrail-service-instance-fqdn": "example-contrail-service-instance-fqdn-val-9525",
+ "heat-stack-id": "example-heat-stack-id-val-30553",
+ "resource-version": "1537885258217",
+ "is-base-vf-module": true,
+ "vf-module-id": "vf-module-id-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "module-index": 511,
+ "orchestration-status": "example-orchestration-status-val-56709",
+ "automated-assignment": true
+ }
+ ]
+ },
+ "vnf-name": "example-vnf-name-val-45282-generic-vnf-987654321-9-cleanup-later-PS2418-patched",
+ "vdisk": 42236577,
+ "nf-role": "example-nf-role-val-66079",
+ "ipv4-oam-gateway-address-prefix-length": 54487,
+ "vcpu": 53671028,
+ "entitlement-assignment-group-uuid": "example-entitlement-assignment-group-uuid-val-15128",
+ "regional-resource-zone": "example-regional-resource-zone-val-73874",
+ "management-v6-address": "example-management-v6-address-val-25900",
+ "operational-status": "example-operational-status-val-17036",
+ "vdisk-units": "example-vdisk-units-val-96988",
+ "entitlement-resource-uuid": "example-entitlement-resource-uuid-val-20774",
+ "orchestration-status": "example-orchestration-status-val-19396",
+ "nf-naming-code": "example-nf-naming-code-val-92256",
+ "selflink": "example-selflink-val-44462",
+ "heat-stack-id": "example-heat-stack-id-val-37828",
+ "license-key-uuid": "example-license-key-uuid-val-66274",
+ "license-key": "example-license-key-val-66815",
+ "lag-interfaces": {
+ "lag-interface": [{
+ "interface-role": "example-interface-role-val-83678",
+ "speed-value": "example-speed-value-val-38117",
+ "in-maint": true,
+ "resource-version": "1537885258117",
+ "l-interfaces": {
+ "l-interface": [{
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-56250",
+ "vlans": {
+ "vlan": [{
+ "vlan-description": "example-vlan-description-val-47496",
+ "vpn-key": "example-vpn-key-val-38828",
+ "prov-status": "example-prov-status-val-99970",
+ "vlan-id-inner": 89782443,
+ "vlan-id-outer": 92728211,
+ "orchestration-status": "example-orchestration-status-val-65649",
+ "speed-value": "example-speed-value-val-87106",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [{
+ "resource-version": "1537885258152",
+ "neutron-network-id": "example-neutron-network-id-val-73096",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-80915",
+ "l3-interface-ipv6-prefix-length": 54785197,
+ "vlan-id-inner": 25109147,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "l3-interface-ipv6-address-3-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vlan-id-outer": 79074706
+ }
+ ],
+ "resource-version": "1537885258133",
+ "is-ip-unnumbered": true,
+ "speed-units": "example-speed-units-val-43767",
+ "vlan-interface": "vlan-interface-2-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "backdoor-connection": "example-backdoor-connection-val-42851",
+ "l3-interface-ipv4-address-list": [{
+ "l3-interface-ipv4-prefix-length": 95616468,
+ "resource-version": "1537885258142",
+ "neutron-network-id": "example-neutron-network-id-val-60156",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-25666",
+ "vlan-id-inner": 14957493,
+ "l3-interface-ipv4-address": "l3-interface-ipv4-address-3-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "is-floating": true,
+ "vlan-id-outer": 96248912
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [{
+ "v6-wan-link-ip": "example-v6-wan-link-ip-val-60751",
+ "interface-name": "interface-name-5-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "allowed-address-pairs": "example-allowed-address-pairs-val-66261",
+ "prov-status": "example-prov-status-val-79263",
+ "macaddr": "example-macaddr-val-54377",
+ "interface-role": "example-interface-role-val-57457",
+ "selflink": "example-selflink-val-7547",
+ "in-maint": true,
+ "admin-status": "example-admin-status-val-99281",
+ "is-port-mirrored": true,
+ "resource-version": "1537885258177",
+ "is-ip-unnumbered": true,
+ "network-name": "example-network-name-val-53451",
+ "management-option": "example-management-option-val-31869",
+ "interface-id": "example-interface-id-val-21202",
+ "interface-description": "example-interface-description-val-62128"
+ }
+ ]
+ },
+ "interface-name": "interface-name-4-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "allowed-address-pairs": "example-allowed-address-pairs-val-67284",
+ "prov-status": "example-prov-status-val-41209",
+ "macaddr": "example-macaddr-val-27005",
+ "interface-role": "example-interface-role-val-28263",
+ "selflink": "example-selflink-val-41633",
+ "in-maint": true,
+ "admin-status": "example-admin-status-val-66518",
+ "l3-interface-ipv6-address-list": [{
+ "resource-version": "1537885258199",
+ "neutron-network-id": "example-neutron-network-id-val-62532",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-98579",
+ "l3-interface-ipv6-prefix-length": 12026525,
+ "vlan-id-inner": 43455241,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "l3-interface-ipv6-address-4-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vlan-id-outer": 25084087
+ }
+ ],
+ "is-port-mirrored": true,
+ "resource-version": "1537885258127",
+ "is-ip-unnumbered": true,
+ "sriov-vfs": {
+ "sriov-vf": [{
+ "vf-vlan-filter": "example-vf-vlan-filter-val-18397",
+ "vf-vlan-strip": true,
+ "neutron-network-id": "example-neutron-network-id-val-15801",
+ "vf-broadcast-allow": true,
+ "vf-mac-anti-spoof-check": true,
+ "vf-unknown-multicast-allow": true,
+ "pci-id": "pci-id-2-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "vf-mirrors": "example-vf-mirrors-val-361",
+ "resource-version": "1537885258167",
+ "vf-link-status": "example-vf-link-status-val-32153",
+ "vf-mac-filter": "example-vf-mac-filter-val-17599",
+ "vf-insert-stag": true,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-unknown-unicast-allow": true
+ }
+ ]
+ },
+ "network-name": "example-network-name-val-38641",
+ "management-option": "example-management-option-val-84248",
+ "interface-id": "example-interface-id-val-45628",
+ "interface-description": "example-interface-description-val-88021",
+ "l3-interface-ipv4-address-list": [{
+ "l3-interface-ipv4-prefix-length": 77529761,
+ "resource-version": "1537885258187",
+ "neutron-network-id": "example-neutron-network-id-val-58736",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-42120",
+ "vlan-id-inner": 60074034,
+ "l3-interface-ipv4-address": "l3-interface-ipv4-address-4-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "is-floating": true,
+ "vlan-id-outer": 97685113
+ }
+ ]
+ }
+ ]
+ },
+ "interface-name": "interface-name-3-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "speed-units": "example-speed-units-val-67991",
+ "prov-status": "example-prov-status-val-33056",
+ "interface-description": "example-interface-description-val-473",
+ "interface-id": "example-interface-id-val-12642"
+ }
+ ]
+ },
+ "summary-status": "example-summary-status-val-6834",
+ "encrypted-access-flag": true,
+ "licenses": {
+ "license": [{
+ "resource-version": "1537885258229",
+ "group-uuid": "license-group-uuid-generic-vnf-987654321-9-cleanup-later-PS2418",
+ "resource-uuid": "example-resource-uuid-val-55651"
+ }
+ ]
+ },
+ "in-maint": true,
+ "nm-lan-v6-address": "example-nm-lan-v6-address-val-1909",
+ "resource-version": "1537885258942",
+ "regional-resource-subzone": "example-regional-resource-subzone-val-57379",
+ "management-option": "example-management-option-val-43163",
+ "is-closed-loop-disabled": true
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/createPserverCreateCRWithNestingAndRelsToUpdateRemovingARelTest.json b/src/test/resources/test/payloads/dmaapEvents/createPserverCreateCRWithNestingAndRelsToUpdateRemovingARelTest.json
new file mode 100644
index 0000000..729e0d8
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/createPserverCreateCRWithNestingAndRelsToUpdateRemovingARelTest.json
@@ -0,0 +1,151 @@
+{
+ "pserverCreate": {
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "pserver",
+ "top-entity-type": "pserver",
+ "entity-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1",
+ "event-type": "AAI-EVENT",
+ "domain": "JUNIT",
+ "action": "CREATE",
+ "sequence-number": "0",
+ "id": "0c3b336d-6554-4ddf-a4d7-90f97876a966",
+ "source-name": "JUNIT",
+ "version": "v14",
+ "timestamp": "20180209-21:02:20:344"
+ },
+ "entity": {
+ "hostname": "pserver-1",
+ "in-maint": false
+ }
+ },
+ "crWithNestingAndWithRels": {
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "cloud-region",
+ "top-entity-type": "cloud-region",
+ "entity-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6",
+ "event-type": "AAI-EVENT",
+ "domain": "JUNIT",
+ "action": "CREATE",
+ "sequence-number": "0",
+ "id": "3d567832-df00-49b5-b862-4d3a341dbec1",
+ "source-name": "JUNIT",
+ "version": "v14",
+ "timestamp": "20180515-10:57:55:750"
+ },
+ "entity": {
+ "tenants": {
+ "tenant": [
+ {
+ "vservers": {
+ "vserver": [
+ {
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "pserver",
+ "relationship-data": [
+ {
+ "relationship-value": "pserver-1",
+ "relationship-key": "pserver.hostname"
+ }
+ ],
+ "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1",
+ "relationship-label": "tosca.relationships.HostedOn"
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "l-int-1",
+ "interface-id": "l-int-1",
+ "l3-interface-ipv4-address-list": [
+ {
+ "neutron-network-id": "93fb399c-9bfc-4234-b2bb-a76eda38f117",
+ "neutron-subnet-id": "79e5bb69-24bb-4ea3-8d1d-c04fca5f5e1e",
+ "l3-interface-ipv4-address": "192.168.70.3"
+ }
+ ],
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "pserver",
+ "relationship-data": [
+ {
+ "relationship-value": "pserver-1",
+ "relationship-key": "pserver.hostname"
+ }
+ ],
+ "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1",
+ "relationship-label": "tosca.relationships.HostedOn"
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "vserver-id": "vserver-1"
+ }
+ ]
+ },
+ "tenant-id": "tenenat-1"
+ }
+ ]
+ },
+ "cloud-owner": "onap-cloud-owner",
+ "cloud-region-id": "mtn6"
+ }
+ },
+ "updatePserverWithoutInterfaceRel": {
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "pserver",
+ "top-entity-type": "pserver",
+ "entity-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1",
+ "event-type": "AAI-EVENT",
+ "domain": "JUNIT",
+ "action": "UPDATE",
+ "sequence-number": "0",
+ "id": "0c3b336d-6554-4ddf-a4d7-90f97876a966",
+ "source-name": "JUNIT",
+ "version": "v14",
+ "timestamp": "20180209-21:02:20:344"
+ },
+ "entity": {
+ "hostname": "pserver-1",
+ "in-maint": false,
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "vserver",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "onap-cloud-owner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenenat-1"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "vserver-1"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/createPserverRelationshipsToNonExistingTest.json b/src/test/resources/test/payloads/dmaapEvents/createPserverRelationshipsToNonExistingTest.json
new file mode 100644
index 0000000..98e5aac
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/createPserverRelationshipsToNonExistingTest.json
@@ -0,0 +1,90 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "pserver",
+ "top-entity-type": "pserver",
+ "entity-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1",
+ "event-type": "AAI-EVENT",
+ "domain": "JUNIT",
+ "action": "CREATE",
+ "sequence-number": "0",
+ "id": "0c3b336d-6554-4ddf-a4d7-90f97876a966",
+ "source-name": "JUNIT",
+ "version": "v14",
+ "timestamp": "20180209-21:02:20:344"
+ },
+ "entity": {
+ "hostname": "pserver-1",
+ "in-maint": false,
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "cloud-region",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "onap-cloud-owner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ }
+ ]
+ },
+ {
+ "related-to": "vserver",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "onap-cloud-owner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenenat-1"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "vserver-1"
+ }
+ ]
+ },
+ {
+ "related-to": "l-interface",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/mtn6/tenants/tenant/tenenat-1/vservers/vserver/vserver-1/l-interfaces/l-interface/l-int-1",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "onap-cloud-owner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "mtn6"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenenat-1"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "vserver-1"
+ },
+ {
+ "relationship-key": "l-interface.interface-name",
+ "relationship-value": "l-int-1"
+ }
+ ]
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/createPserverWithNestedDeleteNested.json b/src/test/resources/test/payloads/dmaapEvents/createPserverWithNestedDeleteNested.json
new file mode 100644
index 0000000..14fe9dc
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/createPserverWithNestedDeleteNested.json
@@ -0,0 +1,56 @@
+{
+ "createPserverWithNested": {
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "pserver",
+ "top-entity-type": "pserver",
+ "entity-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1",
+ "event-type": "AAI-EVENT",
+ "domain": "test",
+ "action": "CREATE",
+ "sequence-number": "0",
+ "id": "40925a50-b9d3-423a-8054-e772f9a1fde2",
+ "source-name": "test",
+ "version": "v14",
+ "timestamp": "20180927-05:02:12:378"
+ },
+ "entity": {
+ "hostname": "pserver-1",
+ "p-interfaces": {
+ "p-interface": [
+ {
+ "interface-name": "interface-1"
+ }
+ ]
+ }
+ }
+ },
+ "deletedNested": {
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "p-interface",
+ "top-entity-type": "pserver",
+ "entity-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1/p-interfaces/p-interface/interface-1",
+ "event-type": "AAI-EVENT",
+ "domain": "test",
+ "action": "DELETE",
+ "sequence-number": "0",
+ "id": "40925a50-b9d3-423a-8054-e772f9a1fde2",
+ "source-name": "test",
+ "version": "v14",
+ "timestamp": "20180927-05:02:12:378"
+ },
+ "entity": {
+ "hostname": "pserver-1",
+ "p-interfaces": {
+ "p-interface": [
+ {
+ "interface-name": "interface-1"
+ }
+ ]
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/createPserverWithoutNestedAddNested.json b/src/test/resources/test/payloads/dmaapEvents/createPserverWithoutNestedAddNested.json
new file mode 100644
index 0000000..de21ff1
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/createPserverWithoutNestedAddNested.json
@@ -0,0 +1,49 @@
+{
+ "createPserverWithoutNested": {
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "pserver",
+ "top-entity-type": "pserver",
+ "entity-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1",
+ "event-type": "AAI-EVENT",
+ "domain": "test",
+ "action": "CREATE",
+ "sequence-number": "0",
+ "id": "40925a50-b9d3-423a-8054-e772f9a1fde2",
+ "source-name": "test",
+ "version": "v14",
+ "timestamp": "20180927-05:02:12:378"
+ },
+ "entity": {
+ "hostname": "pserver-1"
+ }
+ },
+ "addNested": {
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "p-interface",
+ "top-entity-type": "pserver",
+ "entity-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-1/p-interfaces/p-interface/interface-1",
+ "event-type": "AAI-EVENT",
+ "domain": "test",
+ "action": "CREATE",
+ "sequence-number": "0",
+ "id": "40925a50-b9d3-423a-8054-e772f9a1fde2",
+ "source-name": "test",
+ "version": "v14",
+ "timestamp": "20180927-05:02:12:378"
+ },
+ "entity": {
+ "hostname": "pserver-1",
+ "p-interfaces": {
+ "p-interface": [
+ {
+ "interface-name": "interface-1"
+ }
+ ]
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/cvlan-tag-entry-create.json b/src/test/resources/test/payloads/dmaapEvents/cvlan-tag-entry-create.json
new file mode 100644
index 0000000..062d788
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/cvlan-tag-entry-create.json
@@ -0,0 +1,32 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "cvlan-tag",
+ "top-entity-type": "vce",
+ "entity-link": "/aai/v14/network/vces/vce/test-vnf-id/port-groups/port-group/test-interface-id/cvlan-tags/cvlan-tag/123321",
+ "event-type": "AAI-EVENT",
+ "domain": "uINT4",
+ "action": "CREATE",
+ "sequence-number": "0",
+ "id": "87c97593-dcd1-482e-afc5-d5d558e36a36",
+ "source-name": "sourcetest",
+ "version": "v14",
+ "timestamp": "20190103-22:05:33:786"
+ },
+ "entity": {
+ "vnf-id": "test-vnf-id",
+ "vnf-name": "test-vnf-name",
+ "port-groups": {
+ "port-group": [{
+ "cvlan-tags": {
+ "cvlan-tag-entry": [{
+ "resource-version": "1546553133766",
+ "cvlan-tag": 123321
+ }]
+ },
+ "interface-id": "test-interface-id"
+ }]
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/cvlan-tag-entry.json b/src/test/resources/test/payloads/dmaapEvents/cvlan-tag-entry.json
new file mode 100644
index 0000000..e6ac86f
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/cvlan-tag-entry.json
@@ -0,0 +1,61 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "service-instance",
+ "top-entity-type": "customer",
+ "entity-link": "/aai/v14/business/customers/customer/081/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%2F1810%2F25081%2FSW_INTERNET",
+ "event-type": "AAI-EVENT",
+ "domain": "IST4-1810",
+ "action": "UPDATE",
+ "sequence-number": "0",
+ "id": "fcecbaa8-3295-43f5-8560-e7caf2e89d01",
+ "source-name": "SDNC",
+ "version": "v14",
+ "timestamp": "20181129-19:41:57:088"
+ },
+ "entity": {
+ "global-customer-id": "081",
+ "subscriber-name": "1810_25_AT_PG_081",
+ "service-subscriptions": {
+ "service-subscription": [{
+ "service-type": "SDN-ETHERNET-INTERNET",
+ "service-instances": {
+ "service-instance": [{
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "cvlan-tag-entry",
+ "relationship-data": [{
+ "relationship-value": "3b61d9ad-7b88-4e21-87e6-c5e832da669a",
+ "relationship-key": "vce.vnf-id"
+ }, {
+ "relationship-value": "mtn08415vbc.ipag",
+ "relationship-key": "port-group.interface-id"
+ }, {
+ "relationship-value": "2006",
+ "relationship-key": "cvlan-tag-entry.cvlan-tag"
+ }],
+ "related-link": "/aai/v14/network/vces/vce/3b61d9ad-7b88-4e21-87e6-c5e832da669a/port-groups/port-group/mtn08415vbc.ipag/cvlan-tags/cvlan-tag-entry/2006",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf"
+ }, {
+ "related-to": "vce",
+ "relationship-data": [{
+ "relationship-value": "3b61d9ad-7b88-4e21-87e6-c5e832da669a",
+ "relationship-key": "vce.vnf-id"
+ }],
+ "related-link": "/aai/v14/network/vces/vce/3b61d9ad-7b88-4e21-87e6-c5e832da669a",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-to-property": [{
+ "property-key": "vce.vnf-name",
+ "property-value": "mtn08415vbc"
+ }]
+ }]
+ },
+ "service-instance-id": "MIS/1810/25081/SW_INTERNET",
+ "resource-version": "1543520517015"
+ }]
+ }
+ }]
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/cvlan-tag.json b/src/test/resources/test/payloads/dmaapEvents/cvlan-tag.json
new file mode 100644
index 0000000..5be2593
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/cvlan-tag.json
@@ -0,0 +1,61 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "service-instance",
+ "top-entity-type": "customer",
+ "entity-link": "/aai/v14/business/customers/customer/081/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%2F1810%2F25081%2FSW_INTERNET",
+ "event-type": "AAI-EVENT",
+ "domain": "IST4-1810",
+ "action": "UPDATE",
+ "sequence-number": "0",
+ "id": "fcecbaa8-3295-43f5-8560-e7caf2e89d01",
+ "source-name": "SDNC",
+ "version": "v14",
+ "timestamp": "20181129-19:41:57:088"
+ },
+ "entity": {
+ "global-customer-id": "081",
+ "subscriber-name": "1810_25_AT_PG_081",
+ "service-subscriptions": {
+ "service-subscription": [{
+ "service-type": "SDN-ETHERNET-INTERNET",
+ "service-instances": {
+ "service-instance": [{
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "cvlan-tag",
+ "relationship-data": [{
+ "relationship-value": "3b61d9ad-7b88-4e21-87e6-c5e832da669a",
+ "relationship-key": "vce.vnf-id"
+ }, {
+ "relationship-value": "mtn08415vbc.ipag",
+ "relationship-key": "port-group.interface-id"
+ }, {
+ "relationship-value": "2006",
+ "relationship-key": "cvlan-tag.cvlan-tag"
+ }],
+ "related-link": "/aai/v14/network/vces/vce/3b61d9ad-7b88-4e21-87e6-c5e832da669a/port-groups/port-group/mtn08415vbc.ipag/cvlan-tags/cvlan-tag/2006",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf"
+ }, {
+ "related-to": "vce",
+ "relationship-data": [{
+ "relationship-value": "3b61d9ad-7b88-4e21-87e6-c5e832da669a",
+ "relationship-key": "vce.vnf-id"
+ }],
+ "related-link": "/aai/v14/network/vces/vce/3b61d9ad-7b88-4e21-87e6-c5e832da669a",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-to-property": [{
+ "property-key": "vce.vnf-name",
+ "property-value": "mtn08415vbc"
+ }]
+ }]
+ },
+ "service-instance-id": "MIS/1810/25081/SW_INTERNET",
+ "resource-version": "1543520517015"
+ }]
+ }
+ }]
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/1-create-logical-link.json b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/1-create-logical-link.json
index 5277b3d..865a200 100644
--- a/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/1-create-logical-link.json
+++ b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/1-create-logical-link.json
@@ -4,14 +4,14 @@
"severity": "NORMAL",
"entity-type": "logical-link",
"top-entity-type": "logical-link",
- "entity-link": "/aai/v13/network/logical-links/logical-link/logical-link",
+ "entity-link": "/aai/v14/network/logical-links/logical-link/logical-link",
"event-type": "AAI-EVENT",
"domain": "uINT1",
"action": "CREATE",
"sequence-number": "0",
"id": "fe89fd6b-8b1b-4ab6-8b3a-d5bb7942dbee",
"source-name": "junit",
- "version": "v13",
+ "version": "v14",
"timestamp": "20180712-17:47:24:042"
},
"entity": {
diff --git a/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/2-create-generic-vnf.json b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/2-create-generic-vnf.json
index 57fe6a2..d723740 100644
--- a/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/2-create-generic-vnf.json
+++ b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/2-create-generic-vnf.json
@@ -4,14 +4,14 @@
"severity": "NORMAL",
"entity-type": "generic-vnf",
"top-entity-type": "generic-vnf",
- "entity-link": "/aai/v13/network/generic-vnfs/generic-vnf/generic-vnf-id",
+ "entity-link": "/aai/v14/network/generic-vnfs/generic-vnf/generic-vnf-id",
"event-type": "AAI-EVENT",
"domain": "uINT1",
"action": "CREATE",
"sequence-number": "0",
"id": "d56359e7-4dcb-471a-9a6a-2afbb353b5bd",
"source-name": "junit",
- "version": "v13",
+ "version": "v14",
"timestamp": "20180712-17:47:24:440"
},
"entity": {
diff --git a/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/3-create-rel-generic-vnf-vlan-to-logical-link.json b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/3-create-rel-generic-vnf-vlan-to-logical-link.json
index bdfabe8..1c542f9 100644
--- a/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/3-create-rel-generic-vnf-vlan-to-logical-link.json
+++ b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/3-create-rel-generic-vnf-vlan-to-logical-link.json
@@ -4,14 +4,14 @@
"severity": "NORMAL",
"entity-type": "vlan",
"top-entity-type": "generic-vnf",
- "entity-link": "/aai/v13/network/generic-vnfs/generic-vnf/generic-vnf-id/l-interfaces/l-interface/l-interface-name-1/vlans/vlan/vlan-1",
+ "entity-link": "/aai/v14/network/generic-vnfs/generic-vnf/generic-vnf-id/l-interfaces/l-interface/l-interface-name-1/vlans/vlan/vlan-1",
"event-type": "AAI-EVENT",
"domain": "uINT1",
"action": "UPDATE",
"sequence-number": "0",
"id": "bd2bc927-d28b-4472-a582-317c4c19c98b",
"source-name": "FitNesse-Relationship-Test-ps2418",
- "version": "v13",
+ "version": "v14",
"timestamp": "20180712-17:47:24:609"
},
"entity": {
@@ -28,7 +28,7 @@
"relationship-key": "logical-link.link-name"
}
],
- "related-link": "/aai/v13/network/logical-links/logical-link/logical-link",
+ "related-link": "/aai/v14/network/logical-links/logical-link/logical-link",
"relationship-label": "org.onap.relationships.inventory.Uses"
}
]
diff --git a/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/4-delete-rel-to-generic-vnf-vlan-from-logical-link.json b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/4-delete-rel-to-generic-vnf-vlan-from-logical-link.json
index 20c2278..341589e 100644
--- a/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/4-delete-rel-to-generic-vnf-vlan-from-logical-link.json
+++ b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/4-delete-rel-to-generic-vnf-vlan-from-logical-link.json
@@ -4,14 +4,14 @@
"severity": "NORMAL",
"entity-type": "logical-link",
"top-entity-type": "logical-link",
- "entity-link": "/aai/v13/network/logical-links/logical-link/logical-link",
+ "entity-link": "/aai/v14/network/logical-links/logical-link/logical-link",
"event-type": "AAI-EVENT",
"domain": "uINT1",
"action": "UPDATE",
"sequence-number": "0",
"id": "3f9ea0cf-da42-4a9e-817b-7fb1eab0cabe",
"source-name": "junit",
- "version": "v13",
+ "version": "v14",
"timestamp": "20180712-17:47:25:057"
},
"entity": {
diff --git a/src/test/resources/test/payloads/dmaapEvents/large-pserver.json b/src/test/resources/test/payloads/dmaapEvents/large-pserver.json
index 1d7cf14..0ca88b2 100644
--- a/src/test/resources/test/payloads/dmaapEvents/large-pserver.json
+++ b/src/test/resources/test/payloads/dmaapEvents/large-pserver.json
@@ -4,14 +4,14 @@
"severity": "NORMAL",
"entity-type": "pserver",
"top-entity-type": "pserver",
- "entity-link": "/aai/v13/cloud-infrastructure/pservers/pserver/c9e8ffb6-a360-4f9c-96c3-f5f0244dfe55-jenkins",
+ "entity-link": "/aai/v14/cloud-infrastructure/pservers/pserver/c9e8ffb6-a360-4f9c-96c3-f5f0244dfe55-jenkins",
"event-type": "AAI-EVENT",
"domain": "uINT1",
"action": "UPDATE",
"sequence-number": "0",
"id": "5cc57cd2-c55c-4bbc-bf92-cba20b6d2bf3",
"source-name": "FitNesse-Test-jenkins",
- "version": "v13",
+ "version": "v14",
"timestamp": "20180625-01:24:01:437"
},
"entity": {
diff --git a/src/test/resources/test/payloads/dmaapEvents/linterfaceWithLinterfaceTest.json b/src/test/resources/test/payloads/dmaapEvents/linterfaceWithLinterfaceTest.json
new file mode 100644
index 0000000..cd59e8e
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/linterfaceWithLinterfaceTest.json
@@ -0,0 +1,57 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "l-interface",
+ "top-entity-type": "pserver",
+ "entity-link": "/aai/v14/cloud-infrastructure/pservers/pserver/c9e8ffb6-a360-4f9c-96c3-f5f0244dfe55-jenkins/lag-interfaces/lag-interface/8806d30d-e5f5-409e-9e9e-9b1c1943058d-jenkins/l-interfaces/l-interface/f4f9b9c7-eb83-4622-9d6f-14027a556ff5-jenkins/l-interfaces/l-interface/89796dd1-89a5-4ddc-bd13-324ba9bce3b6-jenkins",
+ "event-type": "AAI-EVENT",
+ "domain": "uINT1",
+ "action": "DELETE",
+ "sequence-number": "0",
+ "id": "9060077e-00a3-4239-80ed-855331b4d551",
+ "source-name": "FitNesse-Test-jenkins",
+ "version": "v14",
+ "timestamp": "20180625-01:24:04:857"
+ },
+ "entity": {
+ "pserver-name2": "iqFmGNmNLM6",
+ "hostname": "c9e8ffb6-a360-4f9c-96c3-f5f0244dfe55-jenkins",
+ "lag-interfaces": {
+ "lag-interface": [
+ {
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "PuNFKRUUpd3",
+ "interface-name": "89796dd1-89a5-4ddc-bd13-324ba9bce3b6-jenkins",
+ "allowed-address-pairs": "RGo6MaADK",
+ "prov-status": "uot",
+ "macaddr": "xUj8TGre",
+ "interface-role": "SyT0hd9Uu4b",
+ "selflink": "HxDI",
+ "in-maint": false,
+ "admin-status": "GDgD",
+ "is-port-mirrored": true,
+ "resource-version": "1529889840462",
+ "is-ip-unnumbered": false,
+ "network-name": "RXCo3p3p5BhBS",
+ "management-option": "jNiTd",
+ "interface-id": "4n8niH",
+ "interface-description": "drnTF3"
+ }
+ ]
+ },
+ "interface-name": "f4f9b9c7-eb83-4622-9d6f-14027a556ff5-jenkins"
+ }
+ ]
+ },
+ "interface-name": "8806d30d-e5f5-409e-9e9e-9b1c1943058d-jenkins"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/nos.json b/src/test/resources/test/payloads/dmaapEvents/nos.json
index 3efe88f..74d2ae6 100644
--- a/src/test/resources/test/payloads/dmaapEvents/nos.json
+++ b/src/test/resources/test/payloads/dmaapEvents/nos.json
@@ -4,14 +4,14 @@
"severity": "NORMAL",
"entity-type": "nos-server",
"top-entity-type": "cloud-region",
- "entity-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/AAIAIC25/tenants/tenant/tenant-987654321-8991-ps2418/nos-servers/nos-server/nos-server-987654321-8991-ps2418",
+ "entity-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/AAIAIC25/tenants/tenant/tenant-987654321-8991-ps2418/nos-servers/nos-server/nos-server-987654321-8991-ps2418",
"event-type": "AAI-EVENT",
"domain": "uINT1",
"action": "CREATE",
"sequence-number": "0",
"id": "90105aab-78f6-4d83-83b4-48488998a9bd",
"source-name": "SDNC",
- "version": "v13",
+ "version": "v14",
"timestamp": "20180625-15:29:20:696"
},
"entity": {
@@ -32,7 +32,7 @@
"relationship-key": "generic-vnf.vnf-id"
}
],
- "related-link": "/aai/v13/network/generic-vnfs/generic-vnf/generic-vnf-987654321-89911-ps2418",
+ "related-link": "/aai/v14/network/generic-vnfs/generic-vnf/generic-vnf-987654321-89911-ps2418",
"relationship-label": "tosca.relationships.HostedOn",
"related-to-property": [
{
@@ -49,7 +49,7 @@
"relationship-key": "generic-vnf.vnf-id"
}
],
- "related-link": "/aai/v13/network/generic-vnfs/generic-vnf/generic-vnf-987654321-89922-ps2418",
+ "related-link": "/aai/v14/network/generic-vnfs/generic-vnf/generic-vnf-987654321-89922-ps2418",
"relationship-label": "tosca.relationships.HostedOn",
"related-to-property": [
{
@@ -66,7 +66,7 @@
"relationship-key": "pserver.hostname"
}
],
- "related-link": "/aai/v13/cloud-infrastructure/pservers/pserver/pserver-987654321-8991-ps2418",
+ "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-987654321-8991-ps2418",
"relationship-label": "tosca.relationships.HostedOn",
"related-to-property": [
{
diff --git a/src/test/resources/test/payloads/dmaapEvents/vce.json b/src/test/resources/test/payloads/dmaapEvents/vce.json
index adae7ee..2d466ec 100644
--- a/src/test/resources/test/payloads/dmaapEvents/vce.json
+++ b/src/test/resources/test/payloads/dmaapEvents/vce.json
@@ -4,14 +4,14 @@
"severity": "NORMAL",
"entity-type": "vce",
"top-entity-type": "vce",
- "entity-link": "/aai/v13/network/vces/vce/vce-987654321-311-ps2418",
+ "entity-link": "/aai/v14/network/vces/vce/vce-987654321-311-ps2418",
"event-type": "AAI-EVENT",
"domain": "uINT1",
"action": "DELETE",
"sequence-number": "0",
"id": "b10f1221-1c3f-42d2-987b-3071818cb613",
"source-name": "FitNesse-Test-ps2418",
- "version": "v13",
+ "version": "v14",
"timestamp": "20180627-16:35:28:464"
},
"entity": {
diff --git a/src/test/resources/test/payloads/json/generic-vnfs-one-with-nesting-with-address-list.json b/src/test/resources/test/payloads/json/generic-vnfs-one-with-nesting-with-address-list.json
new file mode 100644
index 0000000..76374c4
--- /dev/null
+++ b/src/test/resources/test/payloads/json/generic-vnfs-one-with-nesting-with-address-list.json
@@ -0,0 +1,86 @@
+{
+ "generic-vnf": [
+ {
+ "vnf-id": "69baf763-b82f-4904-b800-8f59f86d64c8",
+ "vnf-name": "vn2f0-SDN",
+ "vnf-type": "test-gvnf-type",
+ "service-id": "a92a77d5a0-123e-4",
+ "orchestration-status": "active",
+ "in-maint": true,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1506978203538",
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-id": "3a3ac831-4e53-4c2e-bec3-6703bc818f8a",
+ "vf-module-name": "example-vf-module-name",
+ "heat-stack-id": "example-heat-stack-id",
+ "orchestration-status": "example-orchestration-status",
+ "is-base-vf-module": true,
+ "automated-assignment": true,
+ "vip-ipv4-address-list": [
+ {
+ "vip-ipv4-address": "12345"
+ },
+ {
+ "vip-ipv4-address": "67890"
+ }
+ ]
+ },
+ {
+ "vf-module-id": "9eb3fb5d-7c9c-4ec0-ad73-e1ca6a4b45c4",
+ "vf-module-name": "example-vf-module-name",
+ "heat-stack-id": "example-heat-stack-id",
+ "orchestration-status": "example-orchestration-status",
+ "is-base-vf-module": true,
+ "automated-assignment": true
+ },
+ {
+ "vf-module-id": "d79f5d9e-fb3f-4b22-9392-8f6a0ede9348",
+ "vf-module-name": "example-vf-module-name",
+ "heat-stack-id": "example-heat-stack-id",
+ "orchestration-status": "example-orchestration-status",
+ "is-base-vf-module": true,
+ "automated-assignment": true
+ },
+ {
+ "vf-module-id": "fa5a1a04-16a6-4211-a6fe-7c3db50825fc",
+ "vf-module-name": "example-vf-module-name",
+ "heat-stack-id": "example-heat-stack-id",
+ "orchestration-status": "example-orchestration-status",
+ "is-base-vf-module": true,
+ "automated-assignment": true
+ },
+ {
+ "vf-module-id": "c8ea54eb-c28d-40a4-85fa-8f9005d9bf6e",
+ "vf-module-name": "example-vf-module-name",
+ "heat-stack-id": "example-heat-stack-id",
+ "orchestration-status": "example-orchestration-status",
+ "is-base-vf-module": true,
+ "automated-assignment": true
+ }
+ ]
+ }
+ },
+ {
+ "vnf-id": "e7cb342a-b1ca-4e58-80d5-1c92dd63730f",
+ "vnf-name": "vn2f0-SDN",
+ "vnf-type": "test-gvnf-type",
+ "service-id": "a92a77d5a0-123e-4",
+ "orchestration-status": "active",
+ "in-maint": true,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1506978203538"
+ },
+ {
+ "vnf-id": "bb580c02-dcb2-48e3-904f-379a25fb1d01",
+ "vnf-name": "vn2f0-SDN",
+ "vnf-type": "test-gvnf-type",
+ "service-id": "a92a77d5a0-123e-4",
+ "orchestration-status": "active",
+ "in-maint": true,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1506978203538"
+ }
+ ]
+}
diff --git a/src/test/resources/test/payloads/json/generic-vnfs-one-with-nesting.json b/src/test/resources/test/payloads/json/generic-vnfs-one-with-nesting.json
new file mode 100644
index 0000000..eba9a99
--- /dev/null
+++ b/src/test/resources/test/payloads/json/generic-vnfs-one-with-nesting.json
@@ -0,0 +1,78 @@
+{
+ "generic-vnf": [
+ {
+ "vnf-id": "69baf763-b82f-4904-b800-8f59f86d64c8",
+ "vnf-name": "vn2f0-SDN",
+ "vnf-type": "test-gvnf-type",
+ "service-id": "a92a77d5a0-123e-4",
+ "orchestration-status": "active",
+ "in-maint": true,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1506978203538",
+ "vf-modules": {
+ "vf-module": [
+ {
+ "vf-module-id": "3a3ac831-4e53-4c2e-bec3-6703bc818f8a",
+ "vf-module-name": "example-vf-module-name",
+ "heat-stack-id": "example-heat-stack-id",
+ "orchestration-status": "example-orchestration-status",
+ "is-base-vf-module": true,
+ "automated-assignment": true
+ },
+ {
+ "vf-module-id": "9eb3fb5d-7c9c-4ec0-ad73-e1ca6a4b45c4",
+ "vf-module-name": "example-vf-module-name",
+ "heat-stack-id": "example-heat-stack-id",
+ "orchestration-status": "example-orchestration-status",
+ "is-base-vf-module": true,
+ "automated-assignment": true
+ },
+ {
+ "vf-module-id": "d79f5d9e-fb3f-4b22-9392-8f6a0ede9348",
+ "vf-module-name": "example-vf-module-name",
+ "heat-stack-id": "example-heat-stack-id",
+ "orchestration-status": "example-orchestration-status",
+ "is-base-vf-module": true,
+ "automated-assignment": true
+ },
+ {
+ "vf-module-id": "fa5a1a04-16a6-4211-a6fe-7c3db50825fc",
+ "vf-module-name": "example-vf-module-name",
+ "heat-stack-id": "example-heat-stack-id",
+ "orchestration-status": "example-orchestration-status",
+ "is-base-vf-module": true,
+ "automated-assignment": true
+ },
+ {
+ "vf-module-id": "c8ea54eb-c28d-40a4-85fa-8f9005d9bf6e",
+ "vf-module-name": "example-vf-module-name",
+ "heat-stack-id": "example-heat-stack-id",
+ "orchestration-status": "example-orchestration-status",
+ "is-base-vf-module": true,
+ "automated-assignment": true
+ }
+ ]
+ }
+ },
+ {
+ "vnf-id": "e7cb342a-b1ca-4e58-80d5-1c92dd63730f",
+ "vnf-name": "vn2f0-SDN",
+ "vnf-type": "test-gvnf-type",
+ "service-id": "a92a77d5a0-123e-4",
+ "orchestration-status": "active",
+ "in-maint": true,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1506978203538"
+ },
+ {
+ "vnf-id": "bb580c02-dcb2-48e3-904f-379a25fb1d01",
+ "vnf-name": "vn2f0-SDN",
+ "vnf-type": "test-gvnf-type",
+ "service-id": "a92a77d5a0-123e-4",
+ "orchestration-status": "active",
+ "in-maint": true,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1506978203538"
+ }
+ ]
+}
diff --git a/src/test/resources/test/payloads/json/one-cr-with-nested-dupe-get-all.json b/src/test/resources/test/payloads/json/one-cr-with-nested-dupe-get-all.json
new file mode 100644
index 0000000..1b4dd96
--- /dev/null
+++ b/src/test/resources/test/payloads/json/one-cr-with-nested-dupe-get-all.json
@@ -0,0 +1,183 @@
+{
+ "cloud-region": [
+ {
+ "cloud-owner": "cloud-owner",
+ "cloud-region-id": "cloud-id",
+ "cloud-region-version": "2.5",
+ "cloud-type": "cloud-type-1",
+ "cloud-zone": "rs-CloudZone",
+ "owner-defined-type": "1",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/2abau-tessst.hostname4.test.com-rs804s",
+ "related-to": "pserver",
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ],
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "2abau-tessst.hostname4.test.com-rs804s"
+ }
+ ],
+ "relationship-label": "org.onap.relationships.inventory.LocatedIn"
+ }
+ ]
+ },
+ "resource-version": "1535381565645",
+ "tenants": {
+ "tenant": [
+ {
+ "resource-version": "1535381565926",
+ "tenant-id": "tenant-id",
+ "tenant-name": "tenant-name-987654321-09",
+ "vservers": {
+ "vserver": [
+ {
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "in-maint": false,
+ "interface-id": "ae3f7b37-1885-40ea-bbf4-e78edd7466a9",
+ "interface-name": "l-interface-key",
+ "is-ip-unnumbered": false,
+ "is-port-mirrored": false,
+ "macaddr": "fa:16:3e:77:0c:86",
+ "network-name": "VLAN_OVERLAY_422",
+ "resource-version": "1535381640126",
+ "selflink": "https://network-aic.pdk1.cci.att.com:9696/v2.0/ports/ae3f7b37-1885-40ea-bbf4-e78edd7466a9",
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "neutron-network-id": "example-neutron-network-id-val-22522",
+ "pci-id": "sirov-id",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/2abau-tessst.hostname4.test.com-rs804s/p-interfaces/p-interface/NA/sriov-pfs/sriov-pf/0000%3A81%3A00.30",
+ "related-to": "sriov-pf",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "2abau-tessst.hostname4.test.com-rs804s"
+ },
+ {
+ "relationship-key": "p-interface.interface-name",
+ "relationship-value": "NA"
+ },
+ {
+ "relationship-key": "sriov-pf.pf-pci-id",
+ "relationship-value": "0000:81:00.30"
+ }
+ ],
+ "relationship-label": "org.onap.relationships.inventory.Uses"
+ }
+ ]
+ },
+ "resource-version": "1535381640154",
+ "vf-insert-stag": true,
+ "vf-link-status": "example-vf-link-status-val-72770",
+ "vf-mac-filter": "example-vf-mac-filter-val-74354",
+ "vf-vlan-filter": "example-vf-vlan-filter-val-7707"
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/2abau-tessst.hostname4.test.com-rs804s",
+ "related-to": "pserver",
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ],
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "2abau-tessst.hostname4.test.com-rs804s"
+ }
+ ],
+ "relationship-label": "tosca.relationships.HostedOn"
+ }
+ ]
+ },
+ "resource-version": "1535381640077",
+ "vserver-id": "vserver-id",
+ "vserver-name": "rs804s",
+ "vserver-name2": "this-should-be-there",
+ "vserver-selflink": "https://compute-aic.pdk1.cci.att.com:8774/v2/9eee808655904f46b0c614dd1186baae/servers/b964a6fb-f57b-48d3-9220-e95a6bc27f1e"
+ },
+ {
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "in-maint": false,
+ "interface-id": "ae3f7b37-1885-40ea-bbf4-e78edd7466a9",
+ "interface-name": "l-interface-key",
+ "is-ip-unnumbered": false,
+ "is-port-mirrored": false,
+ "macaddr": "fa:16:3e:77:0c:86",
+ "network-name": "VLAN_OVERLAY_422",
+ "resource-version": "1535381640201",
+ "selflink": "https://network-aic.pdk1.cci.att.com:9696/v2.0/ports/ae3f7b37-1885-40ea-bbf4-e78edd7466a9",
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "neutron-network-id": "example-neutron-network-id-val-22522",
+ "pci-id": "sirov-id",
+ "resource-version": "1535381640214",
+ "vf-insert-stag": true,
+ "vf-link-status": "example-vf-link-status-val-72770",
+ "vf-mac-filter": "example-vf-mac-filter-val-74354",
+ "vf-vlan-filter": "example-vf-vlan-filter-val-7707"
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/2abau-tessst.hostname4.test.com-rs804s",
+ "related-to": "pserver",
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ],
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "2abau-tessst.hostname4.test.com-rs804s"
+ }
+ ],
+ "relationship-label": "tosca.relationships.HostedOn"
+ }
+ ]
+ },
+ "resource-version": "1535381640180",
+ "vserver-id": "vserver-id",
+ "vserver-name": "rs804s",
+ "vserver-name2": "this-should-be-there",
+ "vserver-selflink": "https://compute-aic.pdk1.cci.att.com:8774/v2/9eee808655904f46b0c614dd1186baae/servers/b964a6fb-f57b-48d3-9220-e95a6bc27f1e"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/json/pservers-one-with-nesting.json b/src/test/resources/test/payloads/json/pservers-one-with-nesting.json
new file mode 100644
index 0000000..73e6293
--- /dev/null
+++ b/src/test/resources/test/payloads/json/pservers-one-with-nesting.json
@@ -0,0 +1,143 @@
+{
+ "pserver": [
+ {
+ "hostname": "USAUTOUFTIL2001UJZZ01",
+ "p-interfaces": {
+ "p-interface": [
+ {
+ "interface-name": "ge-0/0/10",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-link": "/aai/v14/network/physical-links/physical-link/HIS.1702.03053.121",
+ "related-to": "physical-link",
+ "relationship-data": [
+ {
+ "relationship-key": "physical-link.link-name",
+ "relationship-value": "HIS.1702.03053.121"
+ }
+ ],
+ "relationship-label": "tosca.relationships.network.LinksTo"
+ }
+ ]
+ }
+ },
+ {
+ "interface-name": "ge-0/0/11",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-link": "/aai/v14/network/physical-links/physical-link/HIS.1702.03053.122",
+ "related-to": "physical-link",
+ "relationship-data": [
+ {
+ "relationship-key": "physical-link.link-name",
+ "relationship-value": "HIS.1702.03053.122"
+ }
+ ],
+ "relationship-label": "tosca.relationships.network.LinksTo"
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-link": "/aai/v14/network/generic-vnfs/generic-vnf/205c64eb-88b1-490a-a838-b0080e6902bc",
+ "related-to": "generic-vnf",
+ "related-to-property": [
+ {
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "USAUTOUFTIL2001UJDM02"
+ }
+ ],
+ "relationship-data": [
+ {
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "205c64eb-88b1-490a-a838-b0080e6902bc"
+ }
+ ],
+ "relationship-label": "tosca.relationships.HostedOn"
+ },
+ {
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USAUTOUFTIL2001UJZZ01%3A%3AuCPE/vservers/vserver/74a47c2c-b53f-4264-87fc-bb85c7f49207",
+ "related-to": "vserver",
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "USAUTOUFTIL2001UJZZ01-USAUTOUFTIL2001UJTE03"
+ }
+ ],
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "AAIAIC25"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "USAUTOUFTIL2001UJZZ01::uCPE"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "74a47c2c-b53f-4264-87fc-bb85c7f49207"
+ }
+ ],
+ "relationship-label": "tosca.relationships.HostedOn"
+ },
+ {
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/USAUTOUFTIL2001UJZZ01%3A%3AuCPE/vservers/vserver/afce2113-297a-436c-811a-acf9981fff68",
+ "related-to": "vserver",
+ "related-to-property": [
+ {
+ "property-key": "vserver.vserver-name",
+ "property-value": "USAUTOUFTIL2001UJZZ01-vjunos0"
+ }
+ ],
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-aic"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "AAIAIC25"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "USAUTOUFTIL2001UJZZ01::uCPE"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "afce2113-297a-436c-811a-acf9981fff68"
+ }
+ ],
+ "relationship-label": "tosca.relationships.HostedOn"
+ },
+ {
+ "related-link": "/aai/v14/cloud-infrastructure/complexes/complex/STLSMO0914",
+ "related-to": "complex",
+ "relationship-data": [
+ {
+ "relationship-key": "complex.physical-location-id",
+ "relationship-value": "STLSMO0914"
+ }
+ ],
+ "relationship-label": "org.onap.relationships.inventory.LocatedIn"
+ }
+ ]
+ }
+ },
+ {
+ "hostname": "pserver-2"
+ },
+ {
+ "hostname": "pserver-3"
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/json/test-empty.json b/src/test/resources/test/payloads/json/test-empty.json
new file mode 100644
index 0000000..07ab7ce
--- /dev/null
+++ b/src/test/resources/test/payloads/json/test-empty.json
@@ -0,0 +1,6 @@
+{
+ "_id" : "/business/customers/customer/testCustomer",
+ "service-subscriptions" : {
+ "service-subscription" : ["/business/customers/customer/testCustomer/service-subscriptions/service-subscription/testSS"]
+ }
+} \ No newline at end of file