aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorLaMont, William (wl2432) <wl2432@us.att.com>2018-08-31 10:56:17 -0400
committerLaMont, William (wl2432) <wl2432@us.att.com>2018-08-31 11:10:32 -0400
commit571d6f65cf5e0e5334956dbe11730fd47820b947 (patch)
treeca23e0f64ca2968b4a933cb6a0bb0b4781bc24e8 /src/test
parent6ed92ea7526678f245a9123d2ee97a6a9e2c3bf1 (diff)
initial code for cacher
Issue-ID: AAI-1473 Change-Id: I8babe91e79f5c1e6e97b0f5b6dc827b8c5caec80 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/MongoHelperSingletonNoFakeTest.java490
-rw-r--r--src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonTest.java417
-rw-r--r--src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorScenariosTest.java496
-rw-r--r--src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorTest.java80
-rw-r--r--src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIEventConsumerTest.java185
-rw-r--r--src/test/java/org/onap/aai/cacher/dmaap/consumer/DmaapConsumerSingletonTest.java39
-rw-r--r--src/test/java/org/onap/aai/cacher/egestion/printer/EgestionTestComponent.java35
-rw-r--r--src/test/java/org/onap/aai/cacher/injestion/parser/AAIResourcesUriTemplatesTest.java137
-rw-r--r--src/test/java/org/onap/aai/cacher/injestion/parser/InjestionTestComponent.java35
-rw-r--r--src/test/java/org/onap/aai/cacher/injestion/parser/PayloadParserServiceTest.java148
-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.java372
-rw-r--r--src/test/java/org/onap/aai/cacher/model/CacheKeyTest.java169
-rw-r--r--src/test/java/org/onap/aai/cacher/service/helper/CacheHelperServiceScenariosTest.java232
-rw-r--r--src/test/java/org/onap/aai/cacher/service/helper/CacheHelperServiceTest.java88
-rw-r--r--src/test/java/org/onap/aai/cacher/service/helper/CrudOperationsTest.java409
-rw-r--r--src/test/java/org/onap/aai/cacher/service/rest/util/CacheKeyRequestValidationTest.java90
-rw-r--r--src/test/resources/application-test.properties14
-rw-r--r--src/test/resources/test/payloads/dmaap-pserver-create.json100
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/address-list.json47
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/deleteRelationship/1-create-logical-link.json20
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/deleteRelationship/2-create-generic-vnf.json32
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/deleteRelationship/3-create-rel-generic-vnf-vlan-to-logical-link.json45
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/deleteRelationship/4-delete-rel-to-generic-vnf-vlan-from-logical-link.json20
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/large-pserver.json2088
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/nos.json96
-rw-r--r--src/test/resources/test/payloads/dmaapEvents/vce.json81
27 files changed, 6394 insertions, 0 deletions
diff --git a/src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonNoFakeTest.java b/src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonNoFakeTest.java
new file mode 100644
index 0000000..1a086bc
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonNoFakeTest.java
@@ -0,0 +1,490 @@
+/**
+ * ============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.JsonParser;
+import com.mongodb.DB;
+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.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.bson.Document;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.junit.*;
+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 java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+
+public class MongoHelperSingletonNoFakeTest {
+
+ private static final String DB_NAME = AAIDmaapEventProcessorScenariosTest.class.getSimpleName();
+ private static MongoDatabase mongoDatabase;
+ private static DB db;
+ private static MongodProcess mongod;
+ private static MongoClient mongoC;
+
+ private MongoHelperSingleton mongoHelperSingleton;
+ private JsonParser parser = new JsonParser();
+
+
+ @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 {
+ 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() {
+ if (mongod != null && mongod.isProcessRunning()) {
+ mongod.stop();
+ }
+ }
+
+ @Before
+ public void init() {
+ mongoHelperSingleton = new MongoHelperSingleton(db, mongoDatabase);
+ }
+
+ @After
+ 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());
+ }
+
+
+ private MongoCollection<Document> setupCollection(String collectionName) {
+
+ mongoDatabase.createCollection(collectionName);
+
+ MongoCollection<Document> collection = mongoDatabase.getCollection(collectionName);
+
+ Document findQuery = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'}");
+ Document obj = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1','hostname':'testPserver_1'," +
+ "'p-interfaces':{'p-interface':[" +
+ "{'interface-name':'interface-1','l-interfaces':{'l-interface':[{'interface-name':'l-interface-1','test':'test'}]}}," +
+ "{'interface-name':'interface-2'}" +
+ "]}}");
+ collection.replaceOne(findQuery, obj, new UpdateOptions().upsert(true));
+
+
+ findQuery = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'}");
+ obj = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2','hostname':'testPserver_2'," +
+ "'p-interfaces':{'p-interface':[" +
+ "{'interface-name':'interface-1','l-interfaces':{'l-interface':[{'interface-name':'l-interface-1'}]}}," +
+ "{'interface-name':'interface-2'}" +
+ "]}}");
+ collection.replaceOne(findQuery, obj, new UpdateOptions().upsert(true));
+
+ findQuery = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_99'}");
+ obj = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_99','hostname':'testPserver_99'," +
+ "'p-interfaces':{'p-interface':[" +
+ "{'interface-name':'interface-1','l-interfaces':{'l-interface':[{'interface-name':'l-interface-1','l3-interface-ipv4-address-list':[{'l3-interface-ipv4-address':'address'}]}]}}," +
+ "{'interface-name':'interface-2'}" +
+ "]}}");
+ collection.replaceOne(findQuery, obj, new UpdateOptions().upsert(true));
+
+ assertEquals("Pre " + collectionName + " test: collection contains 3 documents", 3L, collection.count());
+
+ return collection;
+ }
+
+ @Test
+ public void getNestedObjectAddressList() throws JSONException {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_99'," +
+ "'hostname':'testPserver_99'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'l-interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.l3-interface-ipv4-address-list.l3-interface-ipv4-address':'address'}";
+ CacheEntry ce = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .isNested(true)
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject()).build();
+
+ Optional<Document> nested = mongoHelperSingleton.getObject(ce);
+
+ assertTrue(nested.isPresent());
+
+ JSONAssert.assertEquals(
+ new JSONObject("{'l3-interface-ipv4-address':'address'}"),
+ new JSONObject(nested.get().toJson()),
+ true);
+
+
+ }
+
+ @Test
+ public void getNestedObject() throws JSONException {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_99'," +
+ "'hostname':'testPserver_99'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'l-interface-1'}";
+ CacheEntry ce = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .isNested(true)
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject()).build();
+
+ Optional<Document> nested = mongoHelperSingleton.getObject(ce);
+
+ assertTrue(nested.isPresent());
+ JSONAssert.assertEquals(
+ new JSONObject("{'interface-name':'l-interface-1','l3-interface-ipv4-address-list':[{'l3-interface-ipv4-address':'address'}]}"),
+ new JSONObject(nested.get().toJson()),
+ true);
+
+ }
+
+ @Test
+ public void insertNewTop() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.INSERT_REPLACE)
+ .isNested(false)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_3")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_3'}").getAsJsonObject())
+ .withPayload(parser.parse("{'hostname':'testPserver_1'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.insertReplace(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 4 document", 4L, collection.count());
+
+ }
+
+ @Test
+ public void insertNewNested() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-NEW'}";
+ Document nestedFind = Document.parse(nestedFindString);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.INSERT_REPLACE)
+ .isNested(true)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_1")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'}").getAsJsonObject())
+ .withPayload(parser.parse("{'interface-name':'interface-NEW'}").getAsJsonObject())
+ .withNestedField("p-interfaces.p-interface")
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject())
+ .withNestedFieldIdentifierObj(parser.parse("{'interface-name':'interface-NEW'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.insertReplace(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 1 document with new nested", 1L, collection.count(nestedFind));
+
+ }
+
+ @Test
+ public void insertNewTwoNested() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'l-interface-NEW'}";
+ Document nestedFind = Document.parse(nestedFindString);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.INSERT_REPLACE)
+ .isNested(true)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_1")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'}").getAsJsonObject())
+ .withPayload(parser.parse("{'interface-name':'l-interface-NEW','new-field':'NEW'}").getAsJsonObject())
+ .withNestedField("p-interfaces.p-interface.$.l-interfaces.l-interface")
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject())
+ .withNestedFieldIdentifierObj(parser.parse("{'interface-name':'l-interface-NEW'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.insertReplace(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 1 document with new nested", 1L, collection.count(nestedFind));
+
+ }
+
+ @Test
+ public void insertNewThreeNested() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'l-interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.vlans.vlan.vlan-interface':'vlan-NEW'}";
+ Document nestedFind = Document.parse(nestedFindString);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.INSERT_REPLACE)
+ .isNested(true)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_1")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'l-interface-1'}").getAsJsonObject())
+ .withPayload(parser.parse("{'vlan-interface':'vlan-NEW','new-field':'NEW4'}").getAsJsonObject())
+ .withNestedField("p-interfaces.p-interface.$.l-interfaces.l-interface.$.vlans.vlan")
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject())
+ .withNestedFieldIdentifierObj(parser.parse("{'vlan-interface':'vlan-NEW'}").getAsJsonObject())
+ .build();
+ assertTrue(mongoHelperSingleton.insertReplace(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 1 document with new nested", 1L, collection.count(nestedFind));
+
+ }
+
+
+ @Test
+ public void insertExstingNested() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'}";
+ Document nestedFind = Document.parse(nestedFindString);
+
+ String newNestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.new-field':'NEW'}";
+ Document newNestedFind = Document.parse(newNestedFindString);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.INSERT_REPLACE)
+ .isNested(true)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_1")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'}").getAsJsonObject())
+ .withPayload(parser.parse("{'interface-name':'interface-1','new-field':'NEW'}").getAsJsonObject())
+ .withNestedField("p-interfaces.p-interface")
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject())
+ .withNestedFieldIdentifierObj(parser.parse("{'interface-name':'interface-1'}").getAsJsonObject())
+ .build();
+
+ assertEquals("Pre " + collectionName + " test: collection contains 1 document with new nested", 1L, collection.count(nestedFind));
+ assertTrue(mongoHelperSingleton.insertReplace(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 1 document with new nested", 1L, collection.count(nestedFind));
+ assertEquals("Post " + collectionName + " test: collection contains 1 document with new nested property", 1L, collection.count(newNestedFind));
+
+ }
+
+ @Test
+ public void replaceTop() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.INSERT_REPLACE)
+ .isNested(false)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_2")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'}").getAsJsonObject())
+ .withPayload(parser.parse("{'hostname':'testPserver_2','new-property':'NEW'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.insertReplace(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 3 document", 3L, collection.count());
+ assertEquals("Post " + collectionName + " test: collection contains 1 document with new property",
+ 1L,
+ collection.count(Document.parse("{'new-property':'NEW'}")));
+
+
+ }
+
+ @Test
+ public void deleteTopLevel() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.DELETE)
+ .isNested(false)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_2")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.delete(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 2 document", 2L, collection.count());
+
+ }
+
+ @Test
+ public void deleteNestedOneLevel() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'}";
+ Document nestedFind = Document.parse(nestedFindString);
+
+ assertEquals("Pre " + collectionName + " test: collection contains 1 document with filter",
+ 1L,
+ collection.count(nestedFind));
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.DELETE)
+ .isNested(true)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_2")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'}").getAsJsonObject())
+ .withNestedField("p-interfaces.p-interface")
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject())
+ .withNestedFieldIdentifierObj(parser.parse("{'interface-name':'interface-1'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.delete(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 0 document",
+ 0L,
+ collection.count(nestedFind));
+
+ }
+
+ @Test
+ public void deleteNestedTwoLevel() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'l-interface-1'}";
+ Document nestedFind = Document.parse(nestedFindString);
+
+ assertEquals("Pre " + collectionName + " test: collection contains 1 document with filter",
+ 1L,
+ collection.count(nestedFind));
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.DELETE)
+ .isNested(true)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_2")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'}").getAsJsonObject())
+ .withNestedField("p-interfaces.p-interface.$.l-interfaces.l-interface")
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject())
+ .withNestedFieldIdentifierObj(parser.parse("{'interface-name':'l-interface-1'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.delete(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 0 document",
+ 0L,
+ collection.count(nestedFind));
+
+
+ }
+
+ //TODO delete non existent top
+
+
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonTest.java b/src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonTest.java
new file mode 100644
index 0000000..872f099
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/common/MongoHelperSingletonTest.java
@@ -0,0 +1,417 @@
+/**
+ * ============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.github.fakemongo.Fongo;
+import com.google.gson.JsonParser;
+import com.mongodb.DB;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
+import com.mongodb.client.model.UpdateOptions;
+import org.bson.Document;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.aai.cacher.model.CacheEntry;
+import org.onap.aai.cacher.model.DBAction;
+import org.skyscreamer.jsonassert.JSONAssert;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class MongoHelperSingletonTest {
+
+ private static final String DB_NAME = "testDb";
+ private static MongoDatabase mongoDatabase;
+ private static DB db;
+ private MongoHelperSingleton mongoHelperSingleton;
+ private JsonParser parser = new JsonParser();
+
+
+ @BeforeClass
+ public static void setup() {
+ Fongo fongo = new Fongo(DB_NAME);
+ mongoDatabase = fongo.getDatabase(DB_NAME);
+ db = fongo.getDB(DB_NAME);
+ }
+
+ @Before
+ public void init() {
+ mongoHelperSingleton = new MongoHelperSingleton(db, mongoDatabase);
+ }
+
+ @After
+ 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());
+ }
+
+ private MongoCollection<Document> setupCollection(String collectionName) {
+
+ mongoDatabase.createCollection(collectionName);
+
+ MongoCollection<Document> collection = mongoDatabase.getCollection(collectionName);
+
+ Document findQuery = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'}");
+ Document obj = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1','hostname':'testPserver_1'," +
+ "'p-interfaces':{'p-interface':[" +
+ "{'interface-name':'interface-1','l-interfaces':{'l-interface':[{'interface-name':'l-interface-1','test':'test'}]}}," +
+ "{'interface-name':'interface-2'}" +
+ "]}}");
+ collection.replaceOne(findQuery, obj, new UpdateOptions().upsert(true));
+
+
+ findQuery = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'}");
+ obj = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2','hostname':'testPserver_2'," +
+ "'p-interfaces':{'p-interface':[" +
+ "{'interface-name':'interface-1','l-interfaces':{'l-interface':[{'interface-name':'l-interface-1'}]}}," +
+ "{'interface-name':'interface-2'}" +
+ "]}}");
+ collection.replaceOne(findQuery, obj, new UpdateOptions().upsert(true));
+
+ findQuery = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_99'}");
+ obj = Document.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_99','hostname':'testPserver_99'," +
+ "'p-interfaces':{'p-interface':[" +
+ "{'interface-name':'interface-1','l-interfaces':{'l-interface':[{'interface-name':'l-interface-1','l3-interface-ipv4-address-list':[{'l3-interface-ipv4-address':'address'}]}]}}," +
+ "{'interface-name':'interface-2'}" +
+ "]}}");
+ collection.replaceOne(findQuery, obj, new UpdateOptions().upsert(true));
+
+ assertEquals("Pre " + collectionName + " test: collection contains 3 documents", 3L, collection.count());
+
+ return collection;
+ }
+
+ @Test
+ public void getNestedObjectAddressList() throws JSONException {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+ setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_99'," +
+ "'hostname':'testPserver_99'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'l-interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.l3-interface-ipv4-address-list.l3-interface-ipv4-address':'address'}";
+ CacheEntry ce = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .isNested(true)
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject()).build();
+
+ Optional<Document> nested = mongoHelperSingleton.getObject(ce);
+
+ assertTrue(nested.isPresent());
+
+ JSONAssert.assertEquals(
+ new JSONObject("{'l3-interface-ipv4-address':'address'}"),
+ new JSONObject(nested.get().toJson()),
+ true);
+
+
+ }
+
+ @Test
+ public void getNestedObject() throws JSONException {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+ setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_99'," +
+ "'hostname':'testPserver_99'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'l-interface-1'}";
+ CacheEntry ce = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .isNested(true)
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject()).build();
+
+ Optional<Document> nested = mongoHelperSingleton.getObject(ce);
+
+ assertTrue(nested.isPresent());
+ JSONAssert.assertEquals(
+ new JSONObject("{'interface-name':'l-interface-1','l3-interface-ipv4-address-list':[{'l3-interface-ipv4-address':'address'}]}"),
+ new JSONObject(nested.get().toJson()),
+ true);
+ }
+
+ @Test
+ public void insertNewTop() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+ setupCollection(collectionName);
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.INSERT_REPLACE)
+ .isNested(false)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_3")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_3'}").getAsJsonObject())
+ .withPayload(parser.parse("{'hostname':'testPserver_1'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.insertReplace(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 4 document", 4L, collection.count());
+
+ }
+
+ @Test
+ public void insertNewNested() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+ setupCollection(collectionName);
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-NEW'}";
+ Document nestedFind = Document.parse(nestedFindString);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.INSERT_REPLACE)
+ .isNested(true)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_1")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'}").getAsJsonObject())
+ .withPayload(parser.parse("{'interface-name':'interface-NEW'}").getAsJsonObject())
+ .withNestedField("p-interfaces.p-interface")
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject())
+ .withNestedFieldIdentifierObj(parser.parse("{'interface-name':'interface-NEW'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.insertReplace(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 1 document with new nested", 1L, collection.count(nestedFind));
+
+ }
+
+ @Test
+ public void insertNewTwoNested() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+ setupCollection(collectionName);
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'l-interface-NEW'}";
+ Document nestedFind = Document.parse(nestedFindString);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.INSERT_REPLACE)
+ .isNested(true)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_1")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'}").getAsJsonObject())
+ .withPayload(parser.parse("{'interface-name':'l-interface-NEW','new-field':'NEW'}").getAsJsonObject())
+ .withNestedField("p-interfaces.p-interface.$.l-interfaces.l-interface")
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject())
+ .withNestedFieldIdentifierObj(parser.parse("{'interface-name':'l-interface-NEW'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.insertReplace(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 1 document with new nested", 1L, collection.count(nestedFind));
+
+ }
+
+
+ @Test
+ public void insertExstingNested() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+ setupCollection(collectionName);
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'}";
+ Document nestedFind = Document.parse(nestedFindString);
+
+ String newNestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.new-field':'NEW'}";
+ Document newNestedFind = Document.parse(newNestedFindString);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.INSERT_REPLACE)
+ .isNested(true)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_1")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'}").getAsJsonObject())
+ .withPayload(parser.parse("{'interface-name':'interface-1','new-field':'NEW'}").getAsJsonObject())
+ .withNestedField("p-interfaces.p-interface")
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject())
+ .withNestedFieldIdentifierObj(parser.parse("{'interface-name':'interface-1'}").getAsJsonObject())
+ .build();
+
+ assertEquals("Pre " + collectionName + " test: collection contains 1 document with new nested", 1L, collection.count(nestedFind));
+ assertTrue(mongoHelperSingleton.insertReplace(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 1 document with new nested", 1L, collection.count(nestedFind));
+ assertEquals("Post " + collectionName + " test: collection contains 1 document with new nested property", 1L, collection.count(newNestedFind));
+
+ }
+
+ @Test
+ public void replaceTop() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+ setupCollection(collectionName);
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.INSERT_REPLACE)
+ .isNested(false)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_2")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'}").getAsJsonObject())
+ .withPayload(parser.parse("{'hostname':'testPserver_2','new-property':'NEW'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.insertReplace(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 3 document", 3L, collection.count());
+ assertEquals("Post " + collectionName + " test: collection contains 1 document with new property",
+ 1L,
+ collection.count(Document.parse("{'new-property':'NEW'}")));
+
+
+ }
+
+ @Test
+ public void deleteTopLevel() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.DELETE)
+ .isNested(false)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_2")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.delete(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 2 document", 2L, collection.count());
+
+ }
+
+ @Test
+ public void deleteNestedOneLevel() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'}";
+ Document nestedFind = Document.parse(nestedFindString);
+
+ assertEquals("Pre " + collectionName + " test: collection contains 1 document with filter",
+ 1L,
+ collection.count(nestedFind));
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.DELETE)
+ .isNested(true)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_2")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'}").getAsJsonObject())
+ .withNestedField("p-interfaces.p-interface")
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject())
+ .withNestedFieldIdentifierObj(parser.parse("{'interface-name':'interface-1'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.delete(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 0 document",
+ 0L,
+ collection.count(nestedFind));
+
+ }
+
+ @Test
+ public void deleteNestedTwoLevel() throws Exception {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ MongoCollection<Document> collection = setupCollection(collectionName);
+
+ String nestedFindString = "{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_1'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'," +
+ "'p-interfaces.p-interface.l-interfaces.l-interface.interface-name':'l-interface-1'}";
+ Document nestedFind = Document.parse(nestedFindString);
+
+ assertEquals("Pre " + collectionName + " test: collection contains 1 document with filter",
+ 1L,
+ collection.count(nestedFind));
+
+ CacheEntry cacheEntry = CacheEntry.CacheEntryBuilder.createCacheEntry()
+ .inCollection(collectionName)
+ .withDbAction(DBAction.DELETE)
+ .isNested(true)
+ .withId("/cloud-infrastructure/pservers/pserver/testPserver_2")
+ .withFindQuery(parser.parse("{'_id':'/cloud-infrastructure/pservers/pserver/testPserver_2'," +
+ "'p-interfaces.p-interface.interface-name':'interface-1'}").getAsJsonObject())
+ .withNestedField("p-interfaces.p-interface.$.l-interfaces.l-interface")
+ .withNestedFind(parser.parse(nestedFindString).getAsJsonObject())
+ .withNestedFieldIdentifierObj(parser.parse("{'interface-name':'l-interface-1'}").getAsJsonObject())
+ .build();
+
+ assertTrue(mongoHelperSingleton.delete(cacheEntry));
+ assertEquals("Post " + collectionName + " test: collection contains 0 document",
+ 0L,
+ collection.count(nestedFind));
+
+ }
+
+ //TODO delete non existent top
+
+
+} \ No newline at end of file
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
new file mode 100644
index 0000000..2c01f5a
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorScenariosTest.java
@@ -0,0 +1,496 @@
+/**
+ * ============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.dmaap.consumer;
+
+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.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.injestion.parser.InjestionTestComponent;
+import org.onap.aai.cacher.injestion.parser.PayloadParserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import static junit.framework.TestCase.assertFalse;
+import static org.junit.Assert.*;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@Configuration
+@ContextConfiguration(classes = {InjestionTestComponent.class, AAIDmaapEventProcessorScenariosTest.class})
+public class AAIDmaapEventProcessorScenariosTest {
+
+ private static final String DB_NAME = AAIDmaapEventProcessorScenariosTest.class.getSimpleName();
+ private static MongoDatabase mongoDb;
+ private static DB db;
+ private static MongodProcess mongod;
+ private static MongoClient mongoC;
+
+ private JsonParser parser = new JsonParser();
+
+ @Autowired
+ private AAIDmaapEventProcessor aaiDmaapEventProcessor;
+
+ @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);
+ }
+
+ @Bean
+ public AAIDmaapEventProcessor aaiDmaapEventProcessor(MongoHelperSingleton mongoHelperSingleton, PayloadParserService payloadParserService) {
+ return new AAIDmaapEventProcessor(mongoHelperSingleton, payloadParserService);
+ }
+
+ @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();
+ }
+
+ @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 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}}";
+
+ aaiDmaapEventProcessor.process(pserverCreate);
+ assertNotEquals("pserver collection exists", mongoDatabase().getCollection("pserver"), null);
+ assertEquals("pserver collection contains 1", mongoDatabase().getCollection("pserver").count(), 1);
+ assertTrue("pserver collection contains the pserver in the event",
+ mongoDatabase().getCollection("pserver")
+ .find(Document.parse("{" +
+ "'hostname':'pserver-1'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ assertFalse("pserver should not have relationship to vserver",
+ 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'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ assertFalse("pserver should not have relationship to l-interface",
+ 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'" +
+ "}"))
+ .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'}}";
+
+ aaiDmaapEventProcessor.process(crWithNestingAndWithRels);
+
+ assertNotEquals("cloud-region collection exists", mongoDatabase().getCollection("cloud-region"), null);
+ assertTrue("Now pserver has relationship to vserver",
+ 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'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ assertTrue("Now pserver has relationship to l-interface",
+ 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'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ }
+
+
+ @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'}}";
+
+ 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'}]}]}}}";
+
+ 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'" +
+ "}"))
+ .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'" +
+ "}"))
+ .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}}";
+
+ aaiDmaapEventProcessor.process(pserverCreate);
+ assertNotEquals("pserver collection exists", mongoDatabase().getCollection("pserver"), null);
+ assertEquals("pserver collection contains 1", mongoDatabase().getCollection("pserver").count(), 1);
+ assertTrue("pserver collection contains the pserver in the event",
+ mongoDatabase().getCollection("pserver")
+ .find(Document.parse("{" +
+ "'hostname':'pserver-1'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ assertFalse("pserver should not have relationship to vserver",
+ 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'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ assertFalse("pserver should not have relationship to l-interface",
+ 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'" +
+ "}"))
+ .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'}}";
+
+ aaiDmaapEventProcessor.process(crWithNestingAndWithRels);
+
+ assertNotEquals("cloud-region collection exists", mongoDatabase().getCollection("cloud-region"), null);
+ assertTrue("Now pserver has relationship to vserver",
+ 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'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ assertTrue("Now pserver has relationship to l-interface",
+ 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'" +
+ "}"))
+ .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'}]}]}}}";
+
+ 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'" +
+ "}"))
+ .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'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ }
+
+ @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}}";
+
+ aaiDmaapEventProcessor.process(pserverCreate);
+ assertNotEquals("pserver collection exists", mongoDatabase().getCollection("pserver"), null);
+ assertEquals("pserver collection contains 1", mongoDatabase().getCollection("pserver").count(), 1);
+ assertTrue("pserver collection contains the pserver in the event",
+ mongoDatabase().getCollection("pserver")
+ .find(Document.parse("{" +
+ "'hostname':'pserver-1'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ assertFalse("pserver should not have relationship to vserver",
+ 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'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ assertFalse("pserver should not have relationship to l-interface",
+ 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'" +
+ "}"))
+ .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'}}";
+
+ aaiDmaapEventProcessor.process(crWithNestingAndWithRels);
+
+ assertNotEquals("cloud-region collection exists", mongoDatabase().getCollection("cloud-region"), null);
+ assertTrue("Now pserver has relationship to vserver",
+ 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'" +
+ "}"))
+ .iterator().hasNext()
+ );
+ assertTrue("Now pserver has relationship to l-interface",
+ 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'" +
+ "}"))
+ .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'}]}]}}}";
+
+ aaiDmaapEventProcessor.process(pserverDelete);
+ assertNotEquals("pserver collection exists", mongoDatabase().getCollection("pserver"), null);
+ assertEquals("pserver collection contains 1", mongoDatabase().getCollection("pserver").count(), 0);
+
+ 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'" +
+ "}"))
+ .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'" +
+ "}"))
+ .iterator().hasNext()
+ );
+
+ }
+
+
+ @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'}]}]}}}";
+
+ aaiDmaapEventProcessor.process(pserverWithRelsToNested);
+
+ }
+
+ @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'}]}}}";
+
+ aaiDmaapEventProcessor.process(linterfaceWithLinterface);
+
+ }
+
+ @Test
+ public void nosTest() throws Exception {
+
+ String nos = getEventPayload("nos");
+
+ aaiDmaapEventProcessor.process(nos);
+
+ }
+
+ @Test
+ public void addressListTest() throws Exception {
+
+ String event = getEventPayload("address-list");
+ aaiDmaapEventProcessor.process(event);
+
+ }
+
+ @Test
+ public void vceTest() throws Exception {
+
+ String event = getEventPayload("vce");
+ aaiDmaapEventProcessor.process(event);
+
+ }
+
+ @Test
+ public void largePserverTest() throws Exception {
+
+ String event = getEventPayload("large-pserver");
+ aaiDmaapEventProcessor.process(event);
+
+ }
+
+ @Test
+ public void delRel() throws Exception {
+
+ String event = getEventPayload("deleteRelationship/1-create-logical-link");
+ aaiDmaapEventProcessor.process(event);
+
+ event = getEventPayload("deleteRelationship/2-create-generic-vnf");
+ aaiDmaapEventProcessor.process(event);
+
+ event = getEventPayload("deleteRelationship/3-create-rel-generic-vnf-vlan-to-logical-link");
+ aaiDmaapEventProcessor.process(event);
+
+ event = getEventPayload("deleteRelationship/4-delete-rel-to-generic-vnf-vlan-from-logical-link");
+ aaiDmaapEventProcessor.process(event);
+
+ 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'" +
+ "}"))
+ .iterator().hasNext());
+
+ }
+
+ protected String getEventPayload(String eventpayloadName) throws IOException {
+ return getPayload("test/payloads/dmaapEvents/" + eventpayloadName + ".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/dmaap/consumer/AAIDmaapEventProcessorTest.java b/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorTest.java
new file mode 100644
index 0000000..8fcd7e2
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIDmaapEventProcessorTest.java
@@ -0,0 +1,80 @@
+/**
+ * ============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.dmaap.consumer;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+
+public class AAIDmaapEventProcessorTest {
+ private AAIDmaapEventProcessor eventProcessor;
+
+ private String validEventMessage = "{'cambria.partition': 'AAI','event-header': {'id': 'ABC','source-name': 'sourceName'},'entity': {'hostname': 'hostName'}}";
+ private String invalidEventMessageHeader = "{'cambria.partition': 'AAI','Xevent-header': {'id': 'ABC','source-name': 'sourceName'},'entity': {'hostname': 'hostName'}}";
+ private String invalidEventMessageHeaderMissingId = "{'cambria.partition': 'AAI','event-header': {'idX': 'ABC','source-name': 'sourceName'},'entity': {'hostname': 'hostName'}}";
+ private String invalidEventMessageHeaderMissingSourceName = "{'cambria.partition': 'AAI','event-header': {'id': 'ABC','source-nameX': 'sourceName'},'entity': {'hostname': 'hostName'}}";
+ private String invalidEventMessageBody = "{'cambria.partition': 'AAI','event-header': {'id': 'ABC','source-name': 'sourceName'},'Xentity': {'hostname': 'hostName'}}";
+
+
+ @Before
+ public void setUp() throws Exception {
+ 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)
+ public void testJSONException() throws Exception {
+ eventProcessor.process("invalidJson");
+ }
+
+ @Test(expected = JSONException.class)
+ public void testInvalidHeader() throws Exception {
+ eventProcessor.process(invalidEventMessageHeader);
+ }
+
+ @Test(expected = JSONException.class)
+ public void testInvalidHeaderMissingId() throws Exception {
+ eventProcessor.process(invalidEventMessageHeaderMissingId);
+ }
+
+ @Test(expected = JSONException.class)
+ public void testInvalidHeaderMissingSourceName() throws Exception {
+ eventProcessor.process(invalidEventMessageHeaderMissingSourceName);
+ }
+
+ @Test(expected = JSONException.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
new file mode 100644
index 0000000..3ca3390
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/dmaap/consumer/AAIEventConsumerTest.java
@@ -0,0 +1,185 @@
+/**
+ * ============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.dmaap.consumer;
+
+import com.att.nsa.mr.client.MRConsumer;
+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.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.injestion.parser.InjestionTestComponent;
+import org.onap.aai.cacher.injestion.parser.PayloadParserService;
+import org.onap.aai.cacher.service.helper.RestClientHelperService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+//@Ignore
+@RunWith(SpringJUnit4ClassRunner.class)
+@Configuration
+@ContextConfiguration(classes = {InjestionTestComponent.class, AAIEventConsumerTest.class})
+public class AAIEventConsumerTest {
+ private static final String DB_NAME = AAIEventConsumerTest.class.getSimpleName();
+ private static MongoDatabase mongoDb;
+ private static RestClientHelperService restClientHelperService;
+ private static DB db;
+ private static MongodProcess mongod;
+ private static MongoClient mongoC;
+
+ private AAIEventConsumer aaiEventConsumer;
+
+ @Autowired
+ private AAIDmaapEventProcessor aaiDmaapEventProcessor;
+
+ @Bean
+ public DB db() {
+ return db;
+ }
+
+ @Bean
+ public MongoDatabase mongoDatabase() {
+ return mongoDb;
+ }
+
+ @Bean
+ public RestClientHelperService restClientHelperService() {
+ return restClientHelperService;
+ }
+
+ @Bean
+ public MongoHelperSingleton mongoHelperSingleton(DB db, MongoDatabase mongoDb) {
+ return new MongoHelperSingleton(db, mongoDb);
+ }
+
+ @Bean
+ public AAIDmaapEventProcessor aaiDmaapEventProcessor(MongoHelperSingleton mongoHelperSingleton, PayloadParserService payloadParserService) {
+ return new AAIDmaapEventProcessor(mongoHelperSingleton, payloadParserService);
+ }
+
+
+ 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}}";
+ 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);
+
+ }
+
+ @Before
+ public void init() throws Exception {
+ eventMessageList.add(validEventMessage);
+ //super.setupBundleconfig();
+ aaiEventConsumer = new AAIEventConsumer("aaiDmaaPEventConsumer.properties", true);
+ Properties prop = aaiEventConsumer.getDmaapEventConsumerProperties();
+ 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() {
+ 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 startProcessing() throws IOException, Exception {
+ Mockito.when(client.fetch()).thenReturn(eventMessageList);
+ aaiEventConsumer.startProcessing(aaiDmaapEventProcessor);
+ }
+
+ @Test
+ public void startProcessingWaitWithHeldEventMessage() throws IOException, Exception {
+ singleton.setIsInitialized(true);
+ singleton.setFirstEventMessage(validHeldEventMessage);
+ Mockito.when(client.fetch()).thenReturn(eventMessageList);
+ aaiEventConsumer.startProcessing(aaiDmaapEventProcessor);
+ }
+
+ @Test
+ public void startProcessingNoWaitWithHeldEventMessage() throws IOException, Exception {
+ singleton.setProcessEvents(true);
+ singleton.setFirstEventMessage(validHeldEventMessage);
+ Mockito.when(client.fetch()).thenReturn(eventMessageList);
+ aaiEventConsumer.startProcessing(aaiDmaapEventProcessor);
+ }
+
+}
+
diff --git a/src/test/java/org/onap/aai/cacher/dmaap/consumer/DmaapConsumerSingletonTest.java b/src/test/java/org/onap/aai/cacher/dmaap/consumer/DmaapConsumerSingletonTest.java
new file mode 100644
index 0000000..60ee2e1
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/dmaap/consumer/DmaapConsumerSingletonTest.java
@@ -0,0 +1,39 @@
+/**
+ * ============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.dmaap.consumer;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class DmaapConsumerSingletonTest {
+
+ static final String firstEventMessage = "firstMessageValue";
+ @Test
+ public void testSingleton() {
+ DmaapConsumerSingleton dmaapConsumerSingleton = DmaapConsumerSingleton.getInstance();
+ dmaapConsumerSingleton.setIsInitialized(true);
+ dmaapConsumerSingleton.setProcessEvents(false);
+ dmaapConsumerSingleton.setFirstEventMessage(firstEventMessage);
+ assertTrue("isInitialized", dmaapConsumerSingleton.getIsInitialized());
+ assertFalse("processEvents", dmaapConsumerSingleton.getProcessEvents());
+ assertEquals("firstEventMessage", firstEventMessage, dmaapConsumerSingleton.getFirstEventMessage());
+ }
+}
diff --git a/src/test/java/org/onap/aai/cacher/egestion/printer/EgestionTestComponent.java b/src/test/java/org/onap/aai/cacher/egestion/printer/EgestionTestComponent.java
new file mode 100644
index 0000000..fa4ce13
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/egestion/printer/EgestionTestComponent.java
@@ -0,0 +1,35 @@
+/**
+ * ============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.egestion.printer;
+
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+import java.nio.file.FileSystems;
+
+@Configuration
+@ComponentScan(basePackages = {"org.onap.aai.cacher.egestion.printer"})
+public class EgestionTestComponent {
+ public EgestionTestComponent() {
+ System.setProperty("AJSC_HOME", FileSystems.getDefault().getPath(".").toAbsolutePath().toString());
+ System.setProperty("BUNDLECONFIG_DIR", "src/main/resources");
+
+ }
+}
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
new file mode 100644
index 0000000..a48712f
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/injestion/parser/AAIResourcesUriTemplatesTest.java
@@ -0,0 +1,137 @@
+/**
+ * ============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;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+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 static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.*;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = InjestionTestComponent.class)
+public class AAIResourcesUriTemplatesTest {
+
+ @Autowired
+ AAIResourcesUriTemplates aaiResourcesUriTemplates;
+
+ @Test
+ public void getUriTemplateByType() throws Exception {
+
+ assertEquals("Service template is returned",
+ "/service-design-and-creation/services/service/{service-id}",
+ aaiResourcesUriTemplates.getUriTemplateByType("service"));
+
+ assertFalse(aaiResourcesUriTemplates.getUriTemplateByType("does not exist") != null);
+
+ }
+
+ @Test
+ public void getMatchingStartingTemplate() throws Exception {
+ String uri = "/service-design-and-creation/services/service/id/l-interfaces/l-interface/name/p-interfaces/p-interface/name2";
+ assertEquals("Service template is returned",
+ "/service-design-and-creation/services/service/{service-id}",
+ aaiResourcesUriTemplates.getMatchingStartingTemplate(uri).get());
+
+ uri = "/l-interfaces/l-interface/name/p-interfaces/p-interface/name2";
+ assertEquals("l-interface template is returned",
+ "/l-interfaces/l-interface/{interface-name}",
+ aaiResourcesUriTemplates.getMatchingStartingTemplate(uri).get());
+
+ uri = "/l-interface/name/p-interfaces/p-interface/name2";
+ assertFalse(aaiResourcesUriTemplates.getMatchingStartingTemplate(uri).isPresent());
+ }
+
+ @Test
+ public void uriToTemplatesValidTest() throws Exception {
+ String uri = "/service-design-and-creation/services/service/id/l-interfaces/l-interface/name/p-interfaces/p-interface/name2";
+ List<String> expected = Arrays.asList(
+ "/service-design-and-creation/services/service/{service-id}",
+ "/l-interfaces/l-interface/{interface-name}",
+ "/p-interfaces/p-interface/{interface-name}"
+ );
+
+ assertThat(aaiResourcesUriTemplates.uriToTemplates(uri), is(expected));
+ }
+
+ @Test
+ public void uriToTemplatesRepeatedValidTest() throws Exception {
+ String uri = "/service-design-and-creation/services/service/id/l-interfaces/l-interface/name/l-interfaces/l-interface/name2";
+ List<String> expected = Arrays.asList(
+ "/service-design-and-creation/services/service/{service-id}",
+ "/l-interfaces/l-interface/{interface-name}",
+ "/l-interfaces/l-interface/{interface-name}"
+ );
+
+ assertThat(aaiResourcesUriTemplates.uriToTemplates(uri), is(expected));
+ }
+
+ @Test
+ public void uriToSegmentsValidTest() throws Exception {
+ String uri = "/service-design-and-creation/services/service/id/l-interfaces/l-interface/name/p-interfaces/p-interface/name2";
+ List<String> expected = Arrays.asList(
+ "/service-design-and-creation/services/service/id",
+ "/l-interfaces/l-interface/name",
+ "/p-interfaces/p-interface/name2"
+ );
+
+ assertThat(aaiResourcesUriTemplates.uriToSegments(uri), is(expected));
+ }
+
+ @Test
+ public void uriAndTemplateToKeyValueMappingTest() throws Exception {
+ String uri = "/service-design-and-creation/services/service/id";
+ String template = "/service-design-and-creation/services/service/{service-id}";
+ Map<String, String> expected = new HashMap<>();
+ expected.put("service-id", "id");
+
+ assertThat(aaiResourcesUriTemplates.getUriTemplateMappings(uri, template), is(expected));
+ }
+
+ @Test
+ public void uriAndTemplateToKeyValueMappingWithEncodingTest() throws Exception {
+ String uri = "/service-design-and-creation/services/service/i%3Ad";
+ String template = "/service-design-and-creation/services/service/{service-id}";
+ Map<String, String> expected = new HashMap<>();
+ expected.put("service-id", "i:d");
+
+ assertThat(aaiResourcesUriTemplates.getUriTemplateMappings(uri, template), is(expected));
+ }
+
+ @Test
+ public void uriAndTemplateToKeyValueMappingWihtMultipleTest() throws Exception {
+ String uri = "/cloud-infrastructure/cloud-regions/cloud-region/owner/i%3Ad";
+ String template = "/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}";
+ Map<String, String> expected = new HashMap<>();
+ expected.put("cloud-owner", "owner");
+ expected.put("cloud-region-id", "i:d");
+
+ assertThat(aaiResourcesUriTemplates.getUriTemplateMappings(uri, template), is(expected));
+ }
+
+} \ 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
new file mode 100644
index 0000000..34cc8a3
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/injestion/parser/InjestionTestComponent.java
@@ -0,0 +1,35 @@
+/**
+ * ============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;
+
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+import java.nio.file.FileSystems;
+
+@Configuration
+@ComponentScan(basePackages = {"org.onap.aai.cacher.injestion"})
+public class InjestionTestComponent {
+ public InjestionTestComponent() {
+ System.setProperty("AJSC_HOME", FileSystems.getDefault().getPath(".").toAbsolutePath().toString());
+ System.setProperty("BUNDLECONFIG_DIR", "src/main/resources");
+
+ }
+}
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
new file mode 100644
index 0000000..1579323
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/injestion/parser/PayloadParserServiceTest.java
@@ -0,0 +1,148 @@
+/**
+ * ============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;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+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.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = InjestionTestComponent.class)
+public class PayloadParserServiceTest {
+
+ @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'" +
+ " }" +
+ " ]" +
+ "}";
+ private JsonObject aaiGetAllServiceResponseJson = parser.parse(aaiGetAllServiceResponse).getAsJsonObject();
+
+
+
+ private void print(List<CacheEntry> result) {
+ Gson gson = new GsonBuilder().setPrettyPrinting().create();
+ result.forEach(e -> System.out.println("Collection: " + e.getCollection() + "\nKey: " + e.getId() + "\n" + gson.toJson(e.getPayload())));
+ }
+
+ @Test
+ public void testGetAllAAIResourceTest() throws JSONException {
+ String expectedUri = "/service-design-and-creation/services/service/service-id-1%3A1";
+
+ List<CacheEntry> result = parserService.doParse("service", aaiGetAllServiceResponseJson, "aai-resource-get-all");
+ print(result);
+
+ assertTrue(result.stream().map(cacheIdentifier -> cacheIdentifier.getId()).anyMatch(id -> id.equals(expectedUri)));
+ JSONAssert.assertEquals(
+ new JSONObject(aaiGetAllServiceResponseJson.getAsJsonArray("service").get(0).getAsJsonObject().toString()),
+ new JSONObject(result.stream().filter(e -> e.getId().equals(expectedUri)).map(CacheEntry::getPayload).findFirst().get().toString()),
+ false);
+
+ }
+
+ @Test
+ public void testGetAllAAIResourceStringTest() throws JSONException {
+ String expectedUri = "/service-design-and-creation/services/service/service-id-2";
+
+ List<CacheEntry> result = parserService.doParse("service", aaiGetAllServiceResponse, PayloadParserType.AAI_RESOURCE_GET_ALL);
+ print(result);
+
+ assertTrue(result.stream().map(cacheIdentifier -> cacheIdentifier.getId()).anyMatch(id -> id.equals(expectedUri)));
+ JSONAssert.assertEquals(
+ new JSONObject(aaiGetAllServiceResponseJson.getAsJsonArray("service").get(1).getAsJsonObject().toString()),
+ new JSONObject(result.stream().filter(e -> e.getId().equals(expectedUri)).map(CacheEntry::getPayload).findFirst().get().toString()),
+ false);
+ }
+
+ @Test
+ public void testNoneStrategyTest1() throws JSONException {
+ String cacheKey = "service";
+ List<CacheEntry> result = parserService.doParse(cacheKey, aaiGetAllServiceResponse);
+ print(result);
+ noneTests(cacheKey, result);
+ }
+
+ @Test
+ public void testNoneStrategyTest2() throws JSONException {
+ String cacheKey = "service";
+ List<CacheEntry> result = parserService.doParse(cacheKey, aaiGetAllServiceResponseJson);
+ print(result);
+ noneTests(cacheKey, result);
+ }
+
+ @Test
+ public void testNoneStrategyTest3() throws JSONException {
+ String cacheKey = "service";
+ List<CacheEntry> result = parserService.doParse(cacheKey, aaiGetAllServiceResponse, PayloadParserType.NONE);
+ print(result);
+ noneTests(cacheKey, result);
+ }
+
+ @Test
+ public void testNoneStrategyTest4() throws JSONException {
+ String cacheKey = "service";
+ List<CacheEntry> result = parserService.doParse(cacheKey, aaiGetAllServiceResponse, "none");
+ print(result);
+ noneTests(cacheKey, result);
+ }
+
+ private void noneTests(String cacheKey, List<CacheEntry> result) throws JSONException {
+ assertThat(result.size(), is(1));
+ assertTrue(result.stream().map(cacheIdentifier -> cacheIdentifier.getId()).anyMatch(id -> id.equals(cacheKey)));
+ JSONAssert.assertEquals(
+ new JSONObject(aaiGetAllServiceResponse),
+ new JSONObject(result.get(0).getPayload().toString()),
+ false);
+ }
+
+
+}
+
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
new file mode 100644
index 0000000..8a4ab0b
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/AAIResourceDmaapParserStrategyTest.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.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
new file mode 100644
index 0000000..659c881
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/injestion/parser/strategy/AAIResourceDmaapParserStrategyTestConstants.java
@@ -0,0 +1,372 @@
+/**
+ * ============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;
+
+public class AAIResourceDmaapParserStrategyTestConstants {
+
+ public static final String VSERVER_URI = "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/AAIAIC25/tenants/tenant/SERVERNAME%3A%3AXXXX/vservers/vserver/afce2113-297a-436c-811a-acf9981fff68";
+ public static final String VSERVER_RELATIONSHIP_OBJ = "{" +
+ " 'related-to': 'vserver'," +
+ " 'relationship-label': 'tosca.relationships.HostedOn'," +
+ " 'related-link': '/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/AAIAIC25/tenants/tenant/SERVERNAME%3A%3AXXXX/vservers/vserver/afce2113-297a-436c-811a-acf9981fff68'," +
+ " 'relationship-data': [" +
+ " {" +
+ " 'relationship-key': 'cloud-region.cloud-owner'," +
+ " 'relationship-value': 'onap-cloud-owner'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'cloud-region.cloud-region-id'," +
+ " 'relationship-value': 'AAIAIC25'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'tenant.tenant-id'," +
+ " 'relationship-value': 'SERVERNAME::XXXX'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'vserver.vserver-id'," +
+ " 'relationship-value': 'afce2113-297a-436c-811a-acf9981fff68'" +
+ " }" +
+ " ]" +
+ "}";
+
+ public static final String FULL_PSERVER_URI = "/aai/v12/cloud-infrastructure/pservers/pserver/SERVERNAME";
+ public static final String FULL_PSERVER = "{" +
+ " 'hostname': 'SERVERNAME'," +
+ " 'relationship-list':" +
+ " {" +
+ " 'relationship': [" +
+ " {" +
+ " 'related-to': 'generic-vnf'," +
+ " 'relationship-label': 'tosca.relationships.HostedOn'," +
+ " 'related-link': '/aai/v12/network/generic-vnfs/generic-vnf/205c64eb-88b1-490a-a838-b0080e6902bc'," +
+ " 'relationship-data': [" +
+ " {" +
+ " 'relationship-key': 'generic-vnf.vnf-id'," +
+ " 'relationship-value': '205c64eb-88b1-490a-a838-b0080e6902bc'" +
+ " }" +
+ " ]," +
+ " 'related-to-property': [" +
+ " {" +
+ " 'property-key': 'generic-vnf.vnf-name'," +
+ " 'property-value': 'USAUTOUFTIL2001UJDM02'" +
+ " }" +
+ " ]" +
+ " }," +
+ " {" +
+ " 'related-to': 'vserver'," +
+ " 'relationship-label': 'tosca.relationships.HostedOn'," +
+ " 'related-link': '/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/AAIAIC25/tenants/tenant/SERVERNAME%3A%3AXXXX/vservers/vserver/74a47c2c-b53f-4264-87fc-bb85c7f49207'," +
+ " 'relationship-data': [" +
+ " {" +
+ " 'relationship-key': 'cloud-region.cloud-owner'," +
+ " 'relationship-value': 'onap-cloud-owner'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'cloud-region.cloud-region-id'," +
+ " 'relationship-value': 'AAIAIC25'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'tenant.tenant-id'," +
+ " 'relationship-value': 'SERVERNAME::XXXX'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'vserver.vserver-id'," +
+ " 'relationship-value': '74a47c2c-b53f-4264-87fc-bb85c7f49207'" +
+ " }" +
+ " ]," +
+ " 'related-to-property': [" +
+ " {" +
+ " 'property-key': 'vserver.vserver-name'," +
+ " 'property-value': 'SERVERNAME-USAUTOUFTIL2001UJTE03'" +
+ " }" +
+ " ]" +
+ " }," +
+ " {" +
+ " 'related-to': 'vserver'," +
+ " 'relationship-label': 'tosca.relationships.HostedOn'," +
+ " 'related-link': '/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/AAIAIC25/tenants/tenant/SERVERNAME%3A%3AXXXX/vservers/vserver/afce2113-297a-436c-811a-acf9981fff68'," +
+ " 'relationship-data': [" +
+ " {" +
+ " 'relationship-key': 'cloud-region.cloud-owner'," +
+ " 'relationship-value': 'onap-cloud-owner'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'cloud-region.cloud-region-id'," +
+ " 'relationship-value': 'AAIAIC25'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'tenant.tenant-id'," +
+ " 'relationship-value': 'SERVERNAME::XXXX'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'vserver.vserver-id'," +
+ " 'relationship-value': 'afce2113-297a-436c-811a-acf9981fff68'" +
+ " }" +
+ " ]," +
+ " 'related-to-property': [" +
+ " {" +
+ " 'property-key': 'vserver.vserver-name'," +
+ " 'property-value': 'SERVERNAME-vjunos0'" +
+ " }" +
+ " ]" +
+ " }," +
+ " {" +
+ " 'related-to': 'complex'," +
+ " 'relationship-label': 'org.onap.relationships.inventory.LocatedIn'," +
+ " 'related-link': '/aai/v12/cloud-infrastructure/complexes/complex/STLSMO0914'," +
+ " 'relationship-data': [" +
+ " {" +
+ " 'relationship-key': 'complex.physical-location-id'," +
+ " 'relationship-value': 'STLSMO0914'" +
+ " }" +
+ " ]" +
+ " }" +
+ " ]" +
+ " }," +
+ " 'p-interfaces':" +
+ " {" +
+ " 'p-interface': [" +
+ " {" +
+ " 'interface-name': 'ge-0/0/10'," +
+ " 'relationship-list':" +
+ " {" +
+ " 'relationship': [" +
+ " {" +
+ " 'related-to': 'physical-link'," +
+ " 'relationship-label': 'tosca.relationships.network.LinksTo'," +
+ " 'related-link': '/aai/v12/network/physical-links/physical-link/HIS.1702.03053.121'," +
+ " 'relationship-data': [" +
+ " {" +
+ " 'relationship-key': 'physical-link.link-name'," +
+ " 'relationship-value': 'HIS.1702.03053.121'" +
+ " }" +
+ " ]" +
+ " }" +
+ " ]" +
+ " }" +
+ " }," +
+ " {" +
+ " 'interface-name': 'ge-0/0/11'," +
+ " 'relationship-list':" +
+ " {" +
+ " 'relationship': [" +
+ " {" +
+ " 'related-to': 'physical-link'," +
+ " 'relationship-label': 'tosca.relationships.network.LinksTo'," +
+ " 'related-link': '/aai/v12/network/physical-links/physical-link/HIS.1702.03053.122'," +
+ " 'relationship-data': [" +
+ " {" +
+ " 'relationship-key': 'physical-link.link-name'," +
+ " 'relationship-value': 'HIS.1702.03053.122'" +
+ " }" +
+ " ]" +
+ " }" +
+ " ]" +
+ " }" +
+ " }" +
+ " ]" +
+ " }" +
+ "}";
+
+
+ public final static String GENERIC_VNF_EVENT_WITH_2_RELAT = "{" +
+ " 'cambria.partition': 'AAI'," +
+ " 'event-header':" +
+ " {" +
+ " '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'," +
+ " 'event-type': 'AAI-EVENT'," +
+ " 'domain': 'e2e1'," +
+ " 'action': 'UPDATE'," +
+ " 'sequence-number': '0'," +
+ " 'id': '35717064-c145-4172-941a-ae71dced750e'," +
+ " 'version': 'v12'," +
+ " 'timestamp': '20180523-15:41:19:570'" +
+ " }," +
+ " 'entity':" +
+ " {" +
+ " 'vnf-id': 'cc1703a9-a63f-46c5-a6b1-7ff67f3a9848'," +
+ " 'vf-modules':" +
+ " {" +
+ " 'vf-module': [" +
+ " {" +
+ " 'vf-module-id': 'eb792c93-d7e6-481c-8a78-e63d39f63e3a'" +
+ " }," +
+ " {" +
+ " 'vf-module-id': '43448d88-099f-4a33-8860-889773440675'" +
+ " }" +
+ " ]" +
+ " }," +
+ " 'relationship-list':" +
+ " {" +
+ " 'relationship': [" +
+ " {" +
+ " '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'," +
+ " 'relationship-data': [" +
+ " {" +
+ " 'relationship-key': 'customer.global-customer-id'," +
+ " 'relationship-value': '1702_IT3_SubscGblID_20170426162928'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'service-subscription.service-type'," +
+ " 'relationship-value': 'XXXX-VMS'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'service-instance.service-instance-id'," +
+ " 'relationship-value': 'SERVERNAME'" +
+ " }" +
+ " ]," +
+ " 'related-to-property': [" +
+ " {" +
+ " 'property-key': 'service-instance.service-instance-name'" +
+ " }" +
+ " ]" +
+ " }," +
+ " {" +
+ " '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'," +
+ " 'relationship-data': [" +
+ " {" +
+ " 'relationship-key': 'cloud-region.cloud-owner'," +
+ " 'relationship-value': 'onap-cloud-owner'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'cloud-region.cloud-region-id'," +
+ " 'relationship-value': 'AAIAIC25'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'tenant.tenant-id'," +
+ " 'relationship-value': 'SERVERNAME::XXXX-VMS'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'vserver.vserver-id'," +
+ " 'relationship-value': 'e77451f2-1c07-4db4-b92b-9907b840fc8f'" +
+ " }" +
+ " ]," +
+ " 'related-to-property': [" +
+ " {" +
+ " 'property-key': 'vserver.vserver-name'," +
+ " 'property-value': 'SERVERNAME-vsrx'" +
+ " }" +
+ " ]" +
+ " }" +
+ " ]" +
+ " }" +
+ " }," +
+ " 'existing-obj':" +
+ " {" +
+ " 'vnf-id': 'cc1703a9-a63f-46c5-a6b1-7ff67f3a9848'," +
+ " 'vf-modules':" +
+ " {" +
+ " 'vf-module': [" +
+ " {" +
+ " 'vf-module-id': 'eb792c93-d7e6-481c-8a78-e63d39f63e3a'" +
+ " }," +
+ " {" +
+ " 'vf-module-id': '43448d88-099f-4a33-8860-889773440675'," +
+ " 'relationship-list':" +
+ " {" +
+ " 'relationship': [" +
+ " {" +
+ " 'related-to': 'l3-network'," +
+ " 'relationship-data': [" +
+ " {" +
+ " 'relationship-value': '91eae07d-6f38-4fd8-b929-e7c04614c8c3'," +
+ " 'relationship-key': 'l3-network.network-id'" +
+ " }" +
+ " ]," +
+ " 'related-link': '/aai/v13/network/l3-networks/l3-network/91eae07d-6f38-4fd8-b929-e7c04614c8c3'," +
+ " 'relationship-label': 'org.onap.relationships.inventory.Uses'," +
+ " 'related-to-property': [" +
+ " {" +
+ " 'property-key': 'l3-network.network-name'," +
+ " 'property-value': 'ADIODvPE-24388-T-E2E-001_int_AdiodVpeTenantOamNetwork.vpeNodMisOam_net_2'" +
+ " }" +
+ " ]" +
+ " }" +
+ " ]" +
+ " }" +
+ " }" +
+ " ]" +
+ " }," +
+ " 'relationship-list':" +
+ " {" +
+ " 'relationship': [" +
+ " {" +
+ " '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'," +
+ " 'relationship-data': [" +
+ " {" +
+ " 'relationship-key': 'cloud-region.cloud-owner'," +
+ " 'relationship-value': 'onap-cloud-owner'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'cloud-region.cloud-region-id'," +
+ " 'relationship-value': 'AAIAIC25'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'tenant.tenant-id'," +
+ " 'relationship-value': 'SERVERNAME::XXXX-VMS'" +
+ " }," +
+ " {" +
+ " 'relationship-key': 'vserver.vserver-id'," +
+ " 'relationship-value': 'e77451f2-1c07-4db4-b92b-9907b840fc8f'" +
+ " }" +
+ " ]," +
+ " 'related-to-property': [" +
+ " {" +
+ " 'property-key': 'vserver.vserver-name'," +
+ " 'property-value': 'SERVERNAME-vsrx'" +
+ " }" +
+ " ]" +
+ " }" +
+ " ]" +
+ " }" +
+ " }" +
+ "}";
+
+ public final static String GENERIC_VNF_EVENT = "{" +
+ " 'cambria.partition': 'AAI'," +
+ " 'event-header':" +
+ " {" +
+ " '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'," +
+ " 'event-type': 'AAI-EVENT'," +
+ " 'domain': 'e2e1'," +
+ " 'action': 'UPDATE'," +
+ " 'sequence-number': '0'," +
+ " 'id': '35717064-c145-4172-941a-ae71dced750e'," +
+ " 'version': 'v12'," +
+ " 'timestamp': '20180523-15:41:19:570'" +
+ " }," +
+ " 'entity':" +
+ " {" +
+ " 'vnf-id': 'cc1703a9-a63f-46c5-a6b1-7ff67f3a9848'" +
+ " }" +
+ "}";
+}
diff --git a/src/test/java/org/onap/aai/cacher/model/CacheKeyTest.java b/src/test/java/org/onap/aai/cacher/model/CacheKeyTest.java
new file mode 100644
index 0000000..19a3b3b
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/model/CacheKeyTest.java
@@ -0,0 +1,169 @@
+/**
+ * ============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.model;
+
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class CacheKeyTest {
+
+ public String inputGETOnInit = "{" +
+ "'cacheKey': 'cloud-region'," +
+ "'baseUrl': 'http://localhost:8447'," +
+ "'module': '/aai/v13/'," +
+ "'URI': 'cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3'," +
+ "'timingIndicator': 'onInit'," +
+ "'httpMethod': 'GET'}";
+
+ public String inputGETFirstHitDefault = "{" +
+ "'cacheKey': 'cloud-region'," +
+ "'baseUrl': 'http://localhost:8447'," +
+ "'module': '/aai/v13/'," +
+ "'URI': 'cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3'}";
+
+ public String inputGETScheduledDefault = "{" +
+ "'cacheKey': 'cloud-region'," +
+ "'baseUrl': 'http://localhost:8447'," +
+ "'module': '/aai/v13/'," +
+ "'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/'," +
+ "'syncInterval': '2'," +
+ "'timingIndicator': 'scheduled'," +
+ "'URI': 'cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3'}";
+
+ public String inputGETScheduledWithSyncIntervalWithId = "{" +
+ "'_id': 'cloud-region'," +
+ "'baseUrl': 'http://localhost:8447'," +
+ "'module': '/aai/v13/'," +
+ "'syncInterval': '2'," +
+ "'timingIndicator': 'scheduled'," +
+ "'URI': 'cloud-infrastructure/cloud-regions?depth=0&resultIndex=1&resultSize=3'}";
+
+
+ @Test
+ public void testCacheKeyObjectGETOnInit() {
+ JsonParser parser = new JsonParser();
+ JsonObject ckJson = (JsonObject) parser.parse(inputGETOnInit);
+ 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("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());
+ assertEquals("Http Body was incorrect", "-1", ck.getHttpBody());
+ assertEquals("Sync Interval was incorrect", "-1", ck.getSyncInterval());
+ assertEquals("Last Sync Start Time was incorrect", "-1", ck.getLastSyncStartTime());
+ assertEquals("Last Sync Success Time was incorrect", "-1", ck.getLastSyncSuccessTime());
+ }
+
+ @Test
+ public void testCacheKeyObjectGETFirstHitDefault() {
+ JsonParser parser = new JsonParser();
+ JsonObject ckJson = (JsonObject) parser.parse(inputGETFirstHitDefault);
+ 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("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());
+ assertEquals("Http Body was incorrect", "-1", ck.getHttpBody());
+ assertEquals("Sync Interval was incorrect", "-1", ck.getSyncInterval());
+ assertEquals("Last Sync Start Time was incorrect", "-1", ck.getLastSyncStartTime());
+ assertEquals("Last Sync Success Time was incorrect", "-1", ck.getLastSyncSuccessTime());
+ }
+
+ @Test
+ public void testCacheKeyObjectDefaults() {
+ JsonParser parser = new JsonParser();
+ JsonObject ckJson = (JsonObject) parser.parse("{}");
+ CacheKey ck = CacheKey.fromJson(ckJson);
+ assertEquals("cacheKey was incorrect", "-1", ck.getCacheKey());
+ assertEquals("baseUrl was incorrect", "-1", ck.getBaseUrl());
+ assertEquals("Module was incorrect", "-1", ck.getModule());
+ assertEquals("URI was incorrect", "-1", ck.getURI());
+ assertEquals("timingIndicator was incorrect", "firstHit", ck.getTimingIndicator());
+ assertEquals("Http Method was incorrect", "GET", ck.getHttpMethod());
+ assertEquals("Http Body was incorrect", "-1", ck.getHttpBody());
+ assertEquals("Sync Interval was incorrect", "-1", ck.getSyncInterval());
+ assertEquals("Last Sync Start Time was incorrect", "-1", ck.getLastSyncStartTime());
+ assertEquals("Last Sync Success Time was incorrect", "-1", ck.getLastSyncSuccessTime());
+ }
+
+ @Test
+ public void testCacheKeyObjectGETScheduled() {
+ JsonParser parser = new JsonParser();
+ JsonObject ckJson = (JsonObject) parser.parse(inputGETScheduledDefault);
+ 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("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());
+ assertEquals("Http Body was incorrect", "-1", ck.getHttpBody());
+ assertEquals("Sync Interval was incorrect", "1440", ck.getSyncInterval());
+ assertEquals("Last Sync Start Time was incorrect", "-1", ck.getLastSyncStartTime());
+ assertEquals("Last Sync Success Time was incorrect", "-1", ck.getLastSyncSuccessTime());
+ }
+
+ @Test
+ public void testCacheKeyObjectGETScheduledWithSyncInterval() {
+ JsonParser parser = new JsonParser();
+ JsonObject ckJson = (JsonObject) parser.parse(inputGETScheduledWithSyncInterval);
+ 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("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());
+ assertEquals("Http Body was incorrect", "-1", ck.getHttpBody());
+ assertEquals("Sync Interval was incorrect", "2", ck.getSyncInterval());
+ assertEquals("Last Sync Start Time was incorrect", "-1", ck.getLastSyncStartTime());
+ assertEquals("Last Sync Success Time was incorrect", "-1", ck.getLastSyncSuccessTime());
+ }
+
+ @Test
+ public void testCacheKeyObjectGETScheduledWithSyncIntervalWithId() {
+ JsonParser parser = new JsonParser();
+ JsonObject ckJson = (JsonObject) parser.parse(inputGETScheduledWithSyncIntervalWithId);
+ 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("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());
+ assertEquals("Http Body was incorrect", "-1", ck.getHttpBody());
+ assertEquals("Sync Interval was incorrect", "2", ck.getSyncInterval());
+ assertEquals("Last Sync Start Time was incorrect", "-1", ck.getLastSyncStartTime());
+ assertEquals("Last Sync Success Time was incorrect", "-1", ck.getLastSyncSuccessTime());
+ }
+}
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
new file mode 100644
index 0000000..f4543ad
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/service/helper/CacheHelperServiceScenariosTest.java
@@ -0,0 +1,232 @@
+/**
+ * ============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.service.helper;
+
+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;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.aai.cacher.common.MongoHelperSingleton;
+import org.onap.aai.cacher.egestion.printer.EgestionTestComponent;
+import org.onap.aai.cacher.injestion.parser.InjestionTestComponent;
+import org.onap.aai.cacher.injestion.parser.strategy.PayloadParserType;
+import org.onap.aai.cacher.model.CacheKey;
+import org.onap.aai.cacher.util.AAIConstants;
+import org.onap.aai.exceptions.AAIException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.ws.rs.core.Response;
+
+import static org.junit.Assert.*;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@Configuration
+@ContextConfiguration(classes = {InjestionTestComponent.class, EgestionTestComponent.class, CacheHelperServiceScenariosTest.class})
+public class CacheHelperServiceScenariosTest {
+
+ private String aaiGetAllComplexResponse =
+ "{" +
+ " 'complex': [" +
+ " {" +
+ " 'physical-location-id': 'physical-location-id-1'," +
+ " 'resource-version': '1'" +
+ " }," +
+ " {" +
+ " 'physical-location-id': 'physical-location-id-2'," +
+ " 'resource-version': '2'" +
+ " }" +
+ " ]" +
+ "}";
+
+ private String idForDeleteCache = "/cloud-infrastructure/complexes/complex/physical-location-id-2";
+
+
+ private static final String DB_NAME = CacheHelperServiceScenariosTest.class.getSimpleName();
+ private static MongoDatabase mongoDb;
+ private static RestClientHelperService restClientHelperService;
+ private static DB db;
+ private static MongodProcess mongod;
+ private static MongoClient mongoC;
+
+
+ @Autowired
+ private CacheHelperService cacheHelperService;
+
+ @Bean
+ public DB db() {
+ return db;
+ }
+
+ @Bean
+ public MongoDatabase mongoDatabase() {
+ return mongoDb;
+ }
+
+ @Bean
+ public RestClientHelperService restClientHelperService() {
+ return restClientHelperService;
+ }
+
+ @Bean
+ public MongoHelperSingleton mongoHelperSingleton(DB db, MongoDatabase mongoDb) {
+ return new MongoHelperSingleton(db, mongoDb);
+ }
+
+ @Bean
+ public CacheHelperService cacheHelperService() {
+ return new CacheHelperService();
+ }
+
+ @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();
+ }
+
+ @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 cacheKeyProcessingTest() throws Exception {
+
+ CacheKey ck = new CacheKey("complex");
+ cacheHelperService.addCacheKey(ck);
+ Response resp = cacheHelperService.getAllKeys();
+ assertEquals("getAllKeys", 200, resp.getStatus());
+ CacheKey ck1 = new CacheKey("pserver");
+ ck1.timingIndicator = "scheduled";
+ cacheHelperService.addCacheKey(ck1);
+ resp = cacheHelperService.getAllKeys();
+ assertEquals("getAllKeys", 200, resp.getStatus());
+ CacheKey retrieveCk = cacheHelperService.retrieveCacheKeyObject(ck);
+ assertEquals("retrieved cacheKey complex", "complex", retrieveCk.getCacheKey());
+
+ retrieveCk.setParserStrategy(PayloadParserType.AAI_RESOURCE_GET_ALL.toString());
+ cacheHelperService.updateCacheKey(retrieveCk);
+ assertEquals("retrieved cacheKey complex", PayloadParserType.AAI_RESOURCE_GET_ALL.toString(), retrieveCk.getParserStrategy());
+ assertEquals("getScheduledCaches", 1, cacheHelperService.getScheduledCaches().size());
+
+ resp = cacheHelperService.populateCache(retrieveCk, aaiGetAllComplexResponse);
+ assertEquals("populateCache", 201, resp.getStatus());
+ resp = cacheHelperService.getData(retrieveCk);
+ assertEquals("getData", 200, resp.getStatus());
+ resp = cacheHelperService.retrieveCollectionByKey(retrieveCk, AAIConstants.COLLECTION_CACHEKEY);
+ assertEquals("retrieveCollectionByKey", 200, resp.getStatus());
+ resp = cacheHelperService.deleteCache(idForDeleteCache, "complex");
+ assertEquals("deleteCache1", 204, resp.getStatus());
+ resp = cacheHelperService.deleteCache("noSuchId", "complex");
+ assertEquals("deleteCache2", 404, resp.getStatus());
+
+
+ assertTrue("isShouldTrigger1", cacheHelperService.isShouldTrigger(retrieveCk));
+ long current = System.currentTimeMillis();
+ DateFormat formatter = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss.SSSZ");
+ String syncStartTime = formatter.format(current - 61000);
+ String syncEndTime = formatter.format(current - 60500);
+ // setup sync in progress
+ retrieveCk.syncInterval = "1";
+ retrieveCk.lastSyncStartTime = syncEndTime;
+ retrieveCk.lastSyncEndTime = syncStartTime;
+ cacheHelperService.updateCacheKey(retrieveCk);
+
+ resp = cacheHelperService.forceSync(retrieveCk);
+ assertEquals("forceSync", 500, resp.getStatus());
+ retrieveCk.lastSyncStartTime = syncStartTime;
+ retrieveCk.lastSyncEndTime = syncEndTime;
+ assertTrue("isShouldTrigger2", cacheHelperService.isShouldTrigger(retrieveCk));
+
+ resp = cacheHelperService.deleteCacheKeyAndAssociatedCache("complex");
+ assertEquals("deleteCacheKeyAndAssociatedCache", 204, resp.getStatus());
+ List<CacheKey> ckList = new ArrayList<CacheKey>();
+ ck = new CacheKey("pnf");
+ ck1 = new CacheKey("logical-link");
+ ckList.add(ck);
+ ckList.add(ck1);
+ assertTrue(cacheHelperService.bulkAddCacheKeys(ckList));
+
+ }
+
+ @Test
+ public void buildResponseTest() throws Exception {
+ List<String> issueList = Arrays.asList("First Issue", "Second Issue");
+ Response resp = cacheHelperService.buildValidationResponse(issueList);
+ assertEquals("buildValidationResponse", 400, resp.getStatus());
+ AAIException ex = new AAIException("AAI_4000");
+ resp = cacheHelperService.buildExceptionResponse(ex);
+ assertEquals("buildExceptionResponse", 500, resp.getStatus());
+
+ }
+}
diff --git a/src/test/java/org/onap/aai/cacher/service/helper/CacheHelperServiceTest.java b/src/test/java/org/onap/aai/cacher/service/helper/CacheHelperServiceTest.java
new file mode 100644
index 0000000..4a2ed94
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/service/helper/CacheHelperServiceTest.java
@@ -0,0 +1,88 @@
+/**
+ * ============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.service.helper;
+
+import org.junit.Test;
+import org.onap.aai.cacher.model.CacheKey;
+
+import java.text.SimpleDateFormat;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class CacheHelperServiceTest {
+
+ private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss.SSSZ");
+
+ @Test
+ public void isShouldTrigger1() throws Exception {
+
+ CacheKey cacheKey = new CacheKey("test");
+ cacheKey.setLastSyncStartTime("-1");
+ cacheKey.setLastSyncEndTime("-1");
+ cacheKey.setLastSyncSuccessTime("-1");
+ cacheKey.setSyncInterval("1");
+
+ CacheHelperService cacheHelperService = new CacheHelperService();
+ assertTrue("No timings set (should trigger)", cacheHelperService.isShouldTrigger(cacheKey));
+ }
+
+ @Test
+ public void isShouldTrigger2() throws Exception {
+
+ CacheKey cacheKey = new CacheKey("test");
+ cacheKey.setLastSyncStartTime(sdf.format(System.currentTimeMillis()-300000)); //5 mins ago
+ cacheKey.setLastSyncEndTime("-1"); // has not ended
+ cacheKey.setLastSyncSuccessTime("-1");
+ cacheKey.setSyncInterval("1"); //1 min interval
+
+ CacheHelperService cacheHelperService = new CacheHelperService();
+ assertFalse("Start time set (should not trigger)", cacheHelperService.isShouldTrigger(cacheKey));
+ }
+
+ @Test
+ public void isShouldTrigger3() throws Exception {
+
+ CacheKey cacheKey = new CacheKey("test");
+ cacheKey.setLastSyncStartTime(sdf.format(System.currentTimeMillis()-300000)); //5 mins ago
+ cacheKey.setLastSyncEndTime(sdf.format(System.currentTimeMillis()-240000)); // 4 mins ago
+ cacheKey.setLastSyncSuccessTime("-1");
+ cacheKey.setSyncInterval("1"); //1 min interval
+
+ CacheHelperService cacheHelperService = new CacheHelperService();
+ assertTrue("Start time less than endtime (should trigger)", cacheHelperService.isShouldTrigger(cacheKey));
+ }
+
+ @Test
+ public void isShouldTrigger4() throws Exception {
+
+ CacheKey cacheKey = new CacheKey("test");
+ cacheKey.setLastSyncStartTime(sdf.format(System.currentTimeMillis()-300000)); //5 mins ago
+ cacheKey.setLastSyncEndTime(sdf.format(System.currentTimeMillis()-360000)); // 6 mins ago
+ cacheKey.setLastSyncSuccessTime("-1");
+ cacheKey.setSyncInterval("1"); //1 min interval
+
+ CacheHelperService cacheHelperService = new CacheHelperService();
+ assertFalse("Start time greater than endtime (should not trigger)", cacheHelperService.isShouldTrigger(cacheKey));
+ }
+
+
+
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/aai/cacher/service/helper/CrudOperationsTest.java b/src/test/java/org/onap/aai/cacher/service/helper/CrudOperationsTest.java
new file mode 100644
index 0000000..1aa1d81
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/service/helper/CrudOperationsTest.java
@@ -0,0 +1,409 @@
+/**
+ * ============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.service.helper;
+
+import com.github.fakemongo.Fongo;
+import com.mongodb.client.FindIterable;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
+import com.mongodb.client.model.FindOneAndUpdateOptions;
+import com.mongodb.client.model.UpdateOptions;
+import org.bson.Document;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class CrudOperationsTest {
+
+ public static final String DB_NAME = "testDb";
+ private static MongoDatabase mongoDatabase;
+
+ @BeforeClass
+ public static void setup() {
+ Fongo fongo = new Fongo(DB_NAME);
+ mongoDatabase = fongo.getDatabase(DB_NAME);
+ }
+
+ @Test
+ public void insertOrUpdateObjInCollection() {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ mongoDatabase.createCollection(collectionName);
+
+ MongoCollection<Document> collection = mongoDatabase.getCollection(collectionName);
+
+ Document findQuery1 = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"}");
+ Document newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\",\"hostname\":\"testPserver_1\",\"equip-type\":\"JUNIPER XXXX\",\"p-interfaces\":{\"p-interface\":[{\"interface-name\":\"interface-1\"}]}}");
+ collection.replaceOne(findQuery1, newObj, new UpdateOptions().upsert(true));
+
+ Document findQuery2 = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_2\"}");
+ newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_2\",\"hostname\":\"testPserver_2\",\"equip-type\":\"JUNIPER XXXX\",\"p-interfaces\":{\"p-interface\":[{\"interface-name\":\"interface-1\"}]}}");
+ collection.replaceOne(findQuery2, newObj, new UpdateOptions().upsert(true));
+
+ newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_2\",\"hostname\":\"testPserver_2\",\"equip-type\":\"NEW\",\"p-interfaces\":{\"p-interface\":[{\"interface-name\":\"interface-1\"}]}}");
+ collection.replaceOne(findQuery2, newObj, new UpdateOptions().upsert(true));
+
+ FindIterable<Document> docs = collection.find();
+ int counter = 0;
+ for (Document doc : docs) {
+ counter++;
+ }
+ assertEquals("collection contains 2 document", 2, counter);
+
+ Document doc = collection.find(findQuery1).first();
+ assertEquals("Found testPserver_1", "testPserver_1", doc.getString("hostname"));
+
+ doc = collection.find(findQuery2).first();
+ assertEquals("Found testPserver_2", "testPserver_2", doc.getString("hostname"));
+ assertEquals("testPserver_2 has NEW as equip-type", "NEW", doc.getString("equip-type"));
+ }
+
+ @Test
+ public void removeObjectFromCollection() {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ mongoDatabase.createCollection(collectionName);
+
+ MongoCollection<Document> collection = mongoDatabase.getCollection(collectionName);
+
+ Document findQuery1 = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"}");
+ Document newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\",\"hostname\":\"testPserver_1\",\"equip-type\":\"JUNIPER XXXX\",\"p-interfaces\":{\"p-interface\":[{\"interface-name\":\"interface-1\"}]}}");
+ collection.replaceOne(findQuery1, newObj, new UpdateOptions().upsert(true));
+
+ Document findQuery2 = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_2\"}");
+ newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_2\",\"hostname\":\"testPserver_2\",\"equip-type\":\"JUNIPER XXXX\",\"p-interfaces\":{\"p-interface\":[{\"interface-name\":\"interface-1\"}]}}");
+ collection.replaceOne(findQuery2, newObj, new UpdateOptions().upsert(true));
+
+ assertEquals("PRE DELETE: collection contains 2 documents", 2, collection.count());
+
+ collection.deleteOne(findQuery1);
+
+ assertEquals("POST DELETE: collection contains 1 documents", 1, collection.count());
+
+
+ }
+
+ @Test
+ public void findOneFromCollection() {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ mongoDatabase.createCollection(collectionName);
+
+ MongoCollection<Document> collection = mongoDatabase.getCollection(collectionName);
+
+ Document findQuery1 = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"}");
+ Document newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\",\"hostname\":\"testPserver_1\",\"equip-type\":\"JUNIPER XXXX\",\"p-interfaces\":{\"p-interface\":[{\"interface-name\":\"interface-1\"}]}}");
+ collection.replaceOne(findQuery1, newObj, new UpdateOptions().upsert(true));
+
+ Document findQuery2 = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_2\"}");
+ newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_2\",\"hostname\":\"testPserver_2\",\"equip-type\":\"JUNIPER XXXX\",\"p-interfaces\":{\"p-interface\":[{\"interface-name\":\"interface-1\"}]}}");
+ collection.replaceOne(findQuery2, newObj, new UpdateOptions().upsert(true));
+
+ Document findQuery = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_2\"}");
+
+ assertEquals("collection contains 1 document with id /cloud-infrastructure/pservers/pserver/testPserver_2",
+ 1L, collection.count(findQuery));
+ }
+
+ @Test
+ public void findFromCollectionWithNested() {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ mongoDatabase.createCollection(collectionName);
+
+ MongoCollection<Document> collection = mongoDatabase.getCollection(collectionName);
+
+ Document findQuery1 = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"}");
+ Document newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\",\"hostname\":\"testPserver_1\",\"equip-type\":\"JUNIPER XXXX\",\"p-interfaces\":{\"p-interface\":[{\"interface-name\":\"interface-1\"}]}}");
+ collection.replaceOne(findQuery1, newObj, new UpdateOptions().upsert(true));
+
+ Document findQuery = Document.parse(
+ "{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"," +
+ "\"p-interfaces.p-interface.interface-name\":\"interface-1\"}"
+ );
+
+ assertEquals("collection contains 1 document with id /cloud-infrastructure/pservers/pserver/testPserver_2",
+ 1L, collection.count(findQuery));
+
+
+ }
+
+ @Test
+ public void findFromCollectionWithNestedFail() {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ mongoDatabase.createCollection(collectionName);
+
+ MongoCollection<Document> collection = mongoDatabase.getCollection(collectionName);
+
+ Document findQuery1 = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"}");
+ Document newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\",\"hostname\":\"testPserver_1\",\"equip-type\":\"JUNIPER XXXX\",\"p-interfaces\":{\"p-interface\":[{\"interface-name\":\"interface-1\"}]}}");
+ collection.replaceOne(findQuery1, newObj, new UpdateOptions().upsert(true));
+
+ Document findQuery = Document.parse(
+ "{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"," +
+ "\"p-interfaces.p-interface.interface-name\":\"interface-NONE\"}"
+ );
+
+ assertEquals("collection contains 1 document with id /cloud-infrastructure/pservers/pserver/testPserver_2",
+ 0L, collection.count(findQuery));
+
+ }
+
+
+ @Test
+ public void addToNestedListWithNonExistingList() {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ mongoDatabase.createCollection(collectionName);
+
+ MongoCollection<Document> collection = mongoDatabase.getCollection(collectionName);
+
+ Document findQuery = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"}");
+ Document newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\",\"hostname\":\"testPserver_1\",\"equip-type\":\"JUNIPER XXXX\"}");
+ collection.replaceOne(findQuery, newObj, new UpdateOptions().upsert(true));
+
+ //Check for existing obj
+ String field = "p-interfaces.p-interface";
+ String obj = "{\"interface-name\":\"interface-NEW\"}";
+ String nestedFindString = "{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"," +
+ "\"p-interfaces.p-interface.interface-name\":\"interface-NEW\"}";
+
+ Document nestedFind = Document.parse(nestedFindString);
+
+ assertEquals("PRE UPDATE: collection contains 0 document with id and nested field",
+ Long.valueOf(0L),
+ Long.valueOf(collection.count(nestedFind)));
+
+ Document doc = new Document();
+ doc.put(field, Document.parse(obj));
+ Document push = new Document();
+ push.put("$push", doc);
+
+ System.out.println(collection.find(findQuery).first().toJson());
+
+ collection.findOneAndUpdate(findQuery, push, new FindOneAndUpdateOptions().upsert(true));
+
+ System.out.println(collection.find(findQuery).first().toJson());
+
+ assertEquals("POST UPDATE: collection contains 1 document with id and nested field",
+ Long.valueOf(1L),
+ Long.valueOf(collection.count(nestedFind)));
+
+ }
+
+ @Test
+ public void addToNestedExistingList() {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ mongoDatabase.createCollection(collectionName);
+
+ MongoCollection<Document> collection = mongoDatabase.getCollection(collectionName);
+
+ Document findQuery = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"}");
+ Document newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\",\"hostname\":\"testPserver_1\",\"equip-type\":\"JUNIPER XXXX\",\"p-interfaces\":{\"p-interface\":[{\"interface-name\":\"interface-1\"}]}}");
+ collection.replaceOne(findQuery, newObj, new UpdateOptions().upsert(true));
+
+ //Check for existing obj
+ String field = "p-interfaces.p-interface";
+ String obj = "{\"interface-name\":\"interface-NEW\"}";
+ String nestedFindString = "{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"," +
+ "\"p-interfaces.p-interface.interface-name\":\"interface-NEW\"}";
+
+ Document nestedFind = Document.parse(nestedFindString);
+
+ assertEquals("PRE UPDATE: collection contains 0 document with id and nested field",
+ Long.valueOf(0L),
+ Long.valueOf(collection.count(nestedFind)));
+
+ Document doc = new Document();
+ doc.put(field, Document.parse(obj));
+ Document push = new Document();
+ push.put("$push", doc);
+
+ System.out.println(collection.find(findQuery).first().toJson());
+
+ collection.findOneAndUpdate(findQuery, push, new FindOneAndUpdateOptions().upsert(true));
+
+ System.out.println(collection.find(findQuery).first().toJson());
+
+ assertEquals("POST UPDATE: collection contains 1 document with id and nested field",
+ Long.valueOf(1L),
+ Long.valueOf(collection.count(nestedFind)));
+
+ }
+
+ @Test
+ public void addToNestedWhereNestedObjExists() {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ mongoDatabase.createCollection(collectionName);
+
+ MongoCollection<Document> collection = mongoDatabase.getCollection(collectionName);
+
+ Document findQuery = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"}");
+ Document newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\",\"hostname\":\"testPserver_1\",\"equip-type\":\"JUNIPER XXXX\",\"p-interfaces\":{\"p-interface\":[{\"interface-name\":\"interface-1\"}]}}");
+ collection.replaceOne(findQuery, newObj, new UpdateOptions().upsert(true));
+
+ //Check for existing obj
+ String field = "p-interfaces.p-interface";
+ String obj = "{\"interface-name\":\"interface-NEW\",\"new-field\":\"NEW\"}";
+ String nestedFindString = "{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"," +
+ "\"p-interfaces.p-interface.interface-name\":\"interface-1\"}";
+ String nestedFindUsingNewFieldString = "{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"," +
+ "\"p-interfaces.p-interface.new-field\":\"NEW\"}";
+ String nestedFieldPull = "{\"p-interfaces.p-interface\":{\"interface-name\":\"interface-1\"}}";
+
+ Document nestedFind = Document.parse(nestedFindString);
+
+ assertEquals("PRE UPDATE: collection contains 1 document with id and nested field",
+ Long.valueOf(1L),
+ Long.valueOf(collection.count(nestedFind)));
+ assertEquals("PRE UPDATE: collection contains 0 document with id and new nested field",
+ Long.valueOf(0L),
+ Long.valueOf(collection.count(Document.parse(nestedFindUsingNewFieldString))));
+
+ //REMOVE existing
+ Document pull = new Document();
+ pull.put("$pull", Document.parse(nestedFieldPull));
+
+ collection.findOneAndUpdate(nestedFind, pull);
+
+ assertEquals("PRE UPDATE POST DELETE: collection no longer the nested obj that will be inserted",
+ Long.valueOf(0L),
+ Long.valueOf(collection.count(nestedFind)));
+
+
+ Document doc = new Document();
+ doc.put(field, Document.parse(obj));
+ Document push = new Document();
+ push.put("$push", doc);
+
+ System.out.println(collection.find(findQuery).first().toJson());
+
+ collection.findOneAndUpdate(findQuery, push, new FindOneAndUpdateOptions().upsert(true));
+
+ System.out.println(collection.find(findQuery).first().toJson());
+
+ assertEquals("POST UPDATE: collection contains 1 document with id and nested field",
+ Long.valueOf(1L),
+ Long.valueOf(collection.count(Document.parse(nestedFindUsingNewFieldString))));
+
+ }
+
+ @Test
+ public void addToNestedWhereNestedObjExistsTwoLevels() {
+ String collectionName = new Object() {}
+ .getClass()
+ .getEnclosingMethod()
+ .getName();
+
+ mongoDatabase.createCollection(collectionName);
+
+ MongoCollection<Document> collection = mongoDatabase.getCollection(collectionName);
+
+ Document newObj = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\",\"hostname\":\"testPserver_1\"," +
+ "\"p-interfaces\":{\"p-interface\":[" +
+ "{\"interface-name\":\"interface-1\",\"l-interfaces\":{\"l-interface\":[{\"interface-name\":\"l-interface-1\"}]}}," +
+ "{\"interface-name\":\"interface-2\"}" +
+ "]}}");
+
+ Document findQuery = Document.parse("{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"," +
+ "\"p-interfaces.p-interface.interface-name\":\"interface-1\"}");
+
+ collection.replaceOne(findQuery, newObj, new UpdateOptions().upsert(true));
+
+ //Check for existing obj
+ String field = "p-interfaces.p-interface.$.l-interfaces.l-interface";
+ String obj = "{\"interface-name\":\"l-interface-1\",\"new-field\":\"NEW\"}";
+
+ String nestedFindString = "{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"," +
+ "\"p-interfaces.p-interface.interface-name\":\"interface-1\"," +
+ "\"p-interfaces.p-interface.l-interfaces.l-interface.interface-name\":\"l-interface-1\"}";
+
+ String nestedFindUsingNewFieldString = "{\"_id\":\"/cloud-infrastructure/pservers/pserver/testPserver_1\"," +
+ "\"p-interfaces.p-interface.interface-name\":\"interface-1\"" +
+ "\"p-interfaces.p-interface.l-interfaces.l-interface.new-field\":\"NEW\"}";
+
+ String nestedFieldPull = "{\"p-interfaces.p-interface.$.l-interfaces.l-interface\":{\"interface-name\":\"l-interface-1\"}}";
+
+ Document nestedFind = Document.parse(nestedFindString);
+
+ assertEquals("PRE UPDATE: collection contains 1 document with id and nested field",
+ Long.valueOf(1L),
+ Long.valueOf(collection.count(nestedFind)));
+ assertEquals("PRE UPDATE: collection contains 0 document with id and new nested field",
+ Long.valueOf(0L),
+ Long.valueOf(collection.count(Document.parse(nestedFindUsingNewFieldString))));
+
+ //REMOVE existing
+ Document pull = new Document();
+ pull.put("$pull", Document.parse(nestedFieldPull));
+
+ collection.findOneAndUpdate(nestedFind, pull);
+
+ assertEquals("PRE UPDATE POST DELETE: collection no longer the nested obj that will be inserted",
+ Long.valueOf(0L),
+ Long.valueOf(collection.count(nestedFind)));
+
+
+ Document doc = new Document();
+ doc.put(field, Document.parse(obj));
+ Document push = new Document();
+ push.put("$push", doc);
+
+ System.out.println(collection.find(findQuery).first().toJson());
+
+ collection.findOneAndUpdate(findQuery, push, new FindOneAndUpdateOptions().upsert(true));
+
+ System.out.println(collection.find(findQuery).first().toJson());
+
+ assertEquals("POST UPDATE: collection contains 1 document with id and nested field",
+ Long.valueOf(1L),
+ Long.valueOf(collection.count(Document.parse(nestedFindUsingNewFieldString))));
+
+ }
+
+} \ No newline at end of file
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
new file mode 100644
index 0000000..53f90a3
--- /dev/null
+++ b/src/test/java/org/onap/aai/cacher/service/rest/util/CacheKeyRequestValidationTest.java
@@ -0,0 +1,90 @@
+/**
+ * ============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.service.rest.util;
+
+import com.google.gson.JsonParser;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.aai.cacher.service.helper.CacheHelperService;
+
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+public class CacheKeyRequestValidationTest {
+
+ protected CacheHelperService cacheHelperService;
+ protected CacheKeyRequestValidation addCacheKeyRequestValidation;
+ protected CacheKeyRequestValidation updateCacheKeyRequestValidation;
+
+ private String emptyPayload = "{}";
+ private String nonEmptyPayload = "{\"cacheKey\" : \"complex\"}";
+ private JsonParser parser;
+
+ @Before
+ public void setup() {
+ cacheHelperService = Mockito.mock(CacheHelperService.class);
+ addCacheKeyRequestValidation = new CacheKeyRequestValidation(CacheKeyRequestValidationType.ADD);
+ updateCacheKeyRequestValidation = new CacheKeyRequestValidation(CacheKeyRequestValidationType.UPDATE);
+ parser = new JsonParser();
+ }
+
+ @Test
+ public void testNullPayload() {
+ List<String> results = addCacheKeyRequestValidation.validateCacheKeyRequest(null, cacheHelperService);
+ assertEquals("null payload ok", "Unsupported CacheKey request format, empty payload.", results.get(0));
+ }
+
+ @Test
+ public void testEmptyPayload() {
+ List<String> results = addCacheKeyRequestValidation.validateCacheKeyRequest(parser.parse(emptyPayload).getAsJsonObject(), cacheHelperService);
+ assertEquals("empty payload ok", "Unsupported CacheKey request format, unspecified cacheKey.", results.get(0));
+ }
+
+ @Test
+ public void testAddNewCacheKey() {
+ Mockito.when(cacheHelperService.isKeyPresent(Mockito.any(), Mockito.anyString())).thenReturn(false);
+ List<String> results = addCacheKeyRequestValidation.validateCacheKeyRequest(parser.parse(nonEmptyPayload).getAsJsonObject(), cacheHelperService);
+ assertEquals("add new CacheKey ok", 0, results.size());
+ }
+
+ @Test
+ public void testAddExistingCacheKey() {
+ Mockito.when(cacheHelperService.isKeyPresent(Mockito.any(), Mockito.anyString())).thenReturn(true);
+ List<String> results = addCacheKeyRequestValidation.validateCacheKeyRequest(parser.parse(nonEmptyPayload).getAsJsonObject(), cacheHelperService);
+ assertEquals("add existing CacheKey ok", "Invalid request to add cacheKey complex, cacheKey exists.", results.get(0));
+ }
+
+
+ @Test
+ public void testUpdateNewCacheKey() {
+ Mockito.when(cacheHelperService.isKeyPresent(Mockito.any(), Mockito.anyString())).thenReturn(false);
+ List<String> results = updateCacheKeyRequestValidation.validateCacheKeyRequest(parser.parse(nonEmptyPayload).getAsJsonObject(), cacheHelperService);
+ assertEquals("update new CacheKey ok", "Invalid request to update cacheKey complex, cacheKey does not exist.", results.get(0));
+ }
+
+ @Test
+ public void testUpdateExistingCacheKey() {
+ 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());
+ }
+}
diff --git a/src/test/resources/application-test.properties b/src/test/resources/application-test.properties
new file mode 100644
index 0000000..5439e9f
--- /dev/null
+++ b/src/test/resources/application-test.properties
@@ -0,0 +1,14 @@
+info.build.artifact=@project.artifactId@
+info.build.name=@project.name@
+info.build.description=@project.description@
+info.build.version=@project.version@
+
+spring.jersey.type=filter
+
+logging.level.root=info
+logging.level.org.glassfish=info
+logging.level.org.glassfish.jersey=info
+
+spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
+
+logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr($ threadId: {PID:- }){magenta} %clr(---){faint} %clr([ hostname: %X{hostname} serviceName: %X{serviceName} version: %X{version} transactionId: %X{transactionId} requestTimeStamp: %X{requestTimestamp} responseTimeStamp: %X{responseTimestamp} duration: %X{duration}]){yellow} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaap-pserver-create.json b/src/test/resources/test/payloads/dmaap-pserver-create.json
new file mode 100644
index 0000000..735817d
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaap-pserver-create.json
@@ -0,0 +1,100 @@
+{
+ "cambria.partition": "AAI",
+ "event-header":
+ {
+ "severity": "NORMAL",
+ "entity-type": "pserver",
+ "top-entity-type": "pserver",
+ "entity-link": "/aai/v12/cloud-infrastructure/pservers/pserver/dmaap-pserver-create",
+ "event-type": "AAI-EVENT",
+ "domain": "test",
+ "action": "CREATE",
+ "sequence-number": "0",
+ "id": "id-dmaap-pserver-create",
+ "source-name": "test",
+ "version": "v12",
+ "timestamp": "20180508-17:50:11:681"
+ },
+ "entity":
+ {
+ "hostname": "dmaap-pserver-create",
+ "equip-type": "JUNIPER XXXX",
+ "relationship-list":
+ {
+ "relationship": [
+ {
+ "related-to": "complex",
+ "relationship-data": [
+ {
+ "relationship-value": "CHARILWJNA0",
+ "relationship-key": "complex.physical-location-id"
+ }
+ ],
+ "related-link": "/aai/v12/cloud-infrastructure/complexes/complex/CHARILWJNA0",
+ "relationship-label": "org.onap.relationships.inventory.LocatedIn"
+ }
+ ]
+ },
+ "equip-vendor": "JUNIPER",
+ "equip-model": "NFX250-XYZ-LS1",
+ "in-maint": false,
+ "serial-number": "",
+ "resource-version": "1525801811662",
+ "pserver-id": "0A47B945-9C74-4CBE-AD72-0DECB966EB94",
+ "p-interfaces":
+ {
+ "p-interface": [
+ {
+ "interface-name": "ge-0/0/10",
+ "relationship-list":
+ {
+ "relationship": [
+ {
+ "related-to": "physical-link",
+ "relationship-label": "tosca.relationships.network.LinksTo",
+ "related-link": "/aai/v12/network/physical-links/physical-link/HIS.1702.03053.121",
+ "relationship-data": [
+ {
+ "relationship-key": "physical-link.link-name",
+ "relationship-value": "HIS.1702.03053.121"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "interface-name": "ge-0/0/11",
+ "relationship-list":
+ {
+ "relationship": [
+ {
+ "related-to": "vserver",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/onap-cloud-owner/AAIAIC25/tenants/tenant/SERVERNAME%3A%3AXXXX/vservers/vserver/afce2113-297a-436c-811a-acf9981fff68",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "onap-cloud-owner"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "AAIAIC25"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "SERVERNAME::XXXX"
+ },
+ {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "afce2113-297a-436c-811a-acf9981fff68"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/src/test/resources/test/payloads/dmaapEvents/address-list.json b/src/test/resources/test/payloads/dmaapEvents/address-list.json
new file mode 100644
index 0000000..b2ea6b8
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/address-list.json
@@ -0,0 +1,47 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "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",
+ "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",
+ "timestamp": "20180625-00:05:26:664"
+ },
+ "entity": {
+ "vnf-id": "generic-vnf-987654321-39-jenkins",
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-interface": "vlan-interface-generic-vnf-987654321-39-jenkins",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 79781362,
+ "resource-version": "1529885125714",
+ "neutron-network-id": "example-neutron-network-id-val-73336",
+ "neutron-subnet-id": "example-neutron-subnet-id-val-86272",
+ "vlan-id-inner": 8858186,
+ "l3-interface-ipv4-address": "l3-interface-ipv4-address-generic-vnf-987654321-39-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 5350919
+ }
+ ]
+ }
+ ]
+ },
+ "interface-name": "interface-name-generic-vnf-987654321-39-jenkins"
+ }
+ ]
+ },
+ "vnf-name": "example-vnf-name-val-21021"
+ }
+} \ 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
new file mode 100644
index 0000000..5277b3d
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/1-create-logical-link.json
@@ -0,0 +1,20 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "logical-link",
+ "top-entity-type": "logical-link",
+ "entity-link": "/aai/v13/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",
+ "timestamp": "20180712-17:47:24:042"
+ },
+ "entity": {
+ "link-name": "logical-link"
+ }
+} \ No newline at end of file
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
new file mode 100644
index 0000000..57fe6a2
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/2-create-generic-vnf.json
@@ -0,0 +1,32 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "generic-vnf",
+ "top-entity-type": "generic-vnf",
+ "entity-link": "/aai/v13/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",
+ "timestamp": "20180712-17:47:24:440"
+ },
+ "entity": {
+ "vnf-id": "generic-vnf-id",
+ "l-interfaces": {
+ "l-interface": [{
+ "vlans": {
+ "vlan": [{
+ "vlan-interface": "vlan-1"
+ }
+ ]
+ },
+ "interface-name": "l-interface-name-1"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
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
new file mode 100644
index 0000000..bdfabe8
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/3-create-rel-generic-vnf-vlan-to-logical-link.json
@@ -0,0 +1,45 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "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",
+ "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",
+ "timestamp": "20180712-17:47:24:609"
+ },
+ "entity": {
+ "vnf-id": "generic-vnf-id",
+ "l-interfaces": {
+ "l-interface": [{
+ "vlans": {
+ "vlan": [{
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "logical-link",
+ "relationship-data": [{
+ "relationship-value": "logical-link",
+ "relationship-key": "logical-link.link-name"
+ }
+ ],
+ "related-link": "/aai/v13/network/logical-links/logical-link/logical-link",
+ "relationship-label": "org.onap.relationships.inventory.Uses"
+ }
+ ]
+ },
+ "vlan-interface": "vlan-1"
+ }
+ ]
+ },
+ "interface-name": "l-interface-name-1"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
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
new file mode 100644
index 0000000..20c2278
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/deleteRelationship/4-delete-rel-to-generic-vnf-vlan-from-logical-link.json
@@ -0,0 +1,20 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "logical-link",
+ "top-entity-type": "logical-link",
+ "entity-link": "/aai/v13/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",
+ "timestamp": "20180712-17:47:25:057"
+ },
+ "entity": {
+ "link-name": "logical-link"
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/large-pserver.json b/src/test/resources/test/payloads/dmaapEvents/large-pserver.json
new file mode 100644
index 0000000..1d7cf14
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/large-pserver.json
@@ -0,0 +1,2088 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "pserver",
+ "top-entity-type": "pserver",
+ "entity-link": "/aai/v13/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",
+ "timestamp": "20180625-01:24:01:437"
+ },
+ "entity": {
+ "ptnii-equip-name": "ly3mdbqA7Gaha",
+ "ipaddress-v6-loopback-0": "VWN",
+ "equip-vendor": "zfK",
+ "purpose": "pxyHYQ6",
+ "pserver-selflink": "xS4YnSMvWpX",
+ "number-of-cpus": 359,
+ "ipaddress-v6-aim": "7vxG9SYzaH",
+ "pserver-name2": "iqFmGNmNLM6",
+ "hostname": "c9e8ffb6-a360-4f9c-96c3-f5f0244dfe55-jenkins",
+ "inv-status": "pS24ORbjyauE",
+ "disk-in-gigabytes": 509,
+ "equip-type": "41kdNkU",
+ "fqdn": "ldTOgy",
+ "serial-number": "5iYx0byET",
+ "ipaddress-v6-oam": "pc910",
+ "pserver-id": "RswqQD",
+ "prov-status": "pMB6hQ2XA35gL",
+ "ipv4-oam-address": "dQn9sGTx8T",
+ "ipaddress-v4-loopback-0": "qKCu9dNYq",
+ "lag-interfaces": {
+ "lag-interface": [
+ {
+ "interface-role": "TA0roiR2Dlstf",
+ "speed-value": "bs6yh1DIrc",
+ "in-maint": true,
+ "resource-version": "1529889840378",
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "pRl0e9CWJ",
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-description": "RRiCxGpYLE7IG",
+ "vpn-key": "dENkRyQ6",
+ "prov-status": "YipbUEnORoUR",
+ "vlan-id-inner": 708,
+ "vlan-id-outer": 715,
+ "orchestration-status": "f28",
+ "speed-value": "nQ7rxAY1",
+ "in-maint": false,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840437",
+ "neutron-network-id": "2OkhCFUDCWz",
+ "neutron-subnet-id": "rAkO7",
+ "l3-interface-ipv6-prefix-length": 880,
+ "vlan-id-inner": 441,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "c72250d4-3718-458f-8a78-18b60ba84981-jenkins",
+ "vlan-id-outer": 334
+ },
+ {
+ "resource-version": "1529889840443",
+ "neutron-network-id": "Fjk5w3x",
+ "neutron-subnet-id": "CoGV7pgh0L0w",
+ "l3-interface-ipv6-prefix-length": 930,
+ "vlan-id-inner": 343,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "2e33be8a-ebe9-46b9-9ed8-b68fd7fafa37-jenkins",
+ "vlan-id-outer": 276
+ }
+ ],
+ "resource-version": "1529889840421",
+ "is-ip-unnumbered": false,
+ "speed-units": "9gi0",
+ "vlan-interface": "624adb22-bcf6-4efe-bc20-a1fa2fcdc8b5-jenkins",
+ "backdoor-connection": "VtvN8kWyDNAY",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 723,
+ "resource-version": "1529889840432",
+ "neutron-network-id": "0iGBId",
+ "neutron-subnet-id": "7Wv9mkgSgQMep",
+ "vlan-id-inner": 903,
+ "l3-interface-ipv4-address": "a69c17e3-9902-4ad8-9bf0-547a12144944-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 40
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 816,
+ "resource-version": "1529889840425",
+ "neutron-network-id": "OHzi6OHC",
+ "neutron-subnet-id": "z6cy",
+ "vlan-id-inner": 156,
+ "l3-interface-ipv4-address": "efb60dd0-2f6d-40b9-9aec-f123c900088f-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 678
+ }
+ ]
+ },
+ {
+ "vlan-description": "dko1ww",
+ "vpn-key": "tTnYmdtMuvj",
+ "prov-status": "LXwvfjKwggY",
+ "vlan-id-inner": 785,
+ "vlan-id-outer": 64,
+ "orchestration-status": "YDueDsc",
+ "speed-value": "rnq",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840413",
+ "neutron-network-id": "9GwSXJO",
+ "neutron-subnet-id": "MLw92oJx",
+ "l3-interface-ipv6-prefix-length": 416,
+ "vlan-id-inner": 619,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "290c0ffd-8b30-4447-b3d0-15fd7aaf3a0a-jenkins",
+ "vlan-id-outer": 266
+ },
+ {
+ "resource-version": "1529889840407",
+ "neutron-network-id": "7mhjNSDw",
+ "neutron-subnet-id": "CfIbyRJVK",
+ "l3-interface-ipv6-prefix-length": 980,
+ "vlan-id-inner": 15,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "fe62bfe1-bb1f-430c-a73a-17129a774006-jenkins",
+ "vlan-id-outer": 538
+ }
+ ],
+ "resource-version": "1529889840390",
+ "is-ip-unnumbered": true,
+ "speed-units": "NZnxJ0",
+ "vlan-interface": "ba6322cc-8a92-4c52-9f1c-e1ed151685f4-jenkins",
+ "backdoor-connection": "hknHtwrQ8",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 123,
+ "resource-version": "1529889840395",
+ "neutron-network-id": "S1lm",
+ "neutron-subnet-id": "ArbSTda9",
+ "vlan-id-inner": 433,
+ "l3-interface-ipv4-address": "39f4c806-0a69-44ce-801e-6e788dde996c-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 454
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 874,
+ "resource-version": "1529889840402",
+ "neutron-network-id": "4eQNt",
+ "neutron-subnet-id": "jcbWZEE1iuIxo",
+ "vlan-id-inner": 179,
+ "l3-interface-ipv4-address": "bc0f320b-307f-40f0-a985-83adab31ceae-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 274
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "RtXRWVNEJADY",
+ "interface-name": "dc917efb-f045-4250-b3e3-1f13de0c50c6-jenkins",
+ "allowed-address-pairs": "xXhZud",
+ "prov-status": "ESgNJKvFRBbJ",
+ "macaddr": "J3BfKm",
+ "interface-role": "tRCKYmQWZr",
+ "selflink": "zqJy",
+ "in-maint": false,
+ "admin-status": "BbiEg3U",
+ "is-port-mirrored": false,
+ "resource-version": "1529889840457",
+ "is-ip-unnumbered": true,
+ "network-name": "p03hQIJEj",
+ "management-option": "qI4hY9rO",
+ "interface-id": "M1mVymxqCG9B",
+ "interface-description": "X0ylXoZxd8"
+ },
+ {
+ "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",
+ "allowed-address-pairs": "tsZfdO6K",
+ "prov-status": "3arI73HikM",
+ "macaddr": "0q6FMAB",
+ "interface-role": "4cyrEGb5ldY",
+ "selflink": "baX",
+ "in-maint": true,
+ "admin-status": "NbXMnykI",
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840487",
+ "neutron-network-id": "IHaNS4GYk8We",
+ "neutron-subnet-id": "Avamy",
+ "l3-interface-ipv6-prefix-length": 980,
+ "vlan-id-inner": 995,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "91e884de-b2b7-471a-a245-44aeb7c134a6-jenkins",
+ "vlan-id-outer": 9
+ },
+ {
+ "resource-version": "1529889840481",
+ "neutron-network-id": "Nus6ae0m",
+ "neutron-subnet-id": "fA3l0lvnHdtb",
+ "l3-interface-ipv6-prefix-length": 809,
+ "vlan-id-inner": 340,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "ce4f5d92-0522-4c36-9d42-57e9138a177e-jenkins",
+ "vlan-id-outer": 753
+ }
+ ],
+ "is-port-mirrored": true,
+ "resource-version": "1529889840382",
+ "is-ip-unnumbered": false,
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "vf-vlan-filter": "0BKVj51qatJhI",
+ "vf-vlan-strip": false,
+ "neutron-network-id": "s8H",
+ "vf-broadcast-allow": false,
+ "vf-mac-anti-spoof-check": true,
+ "vf-unknown-multicast-allow": true,
+ "pci-id": "7e5a9324-386f-4328-aa77-a4f6cf7f0dbe-jenkins",
+ "vf-mirrors": "agzCT75g3Vg",
+ "resource-version": "1529889840451",
+ "vf-link-status": "bwtQlepGf",
+ "vf-mac-filter": "EkaVjcgrNl",
+ "vf-insert-stag": false,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-unknown-unicast-allow": true
+ }
+ ]
+ },
+ "network-name": "8BqQdZOAl2lo",
+ "management-option": "CY2Ta8s",
+ "interface-id": "6Ch",
+ "interface-description": "VlMDLY2l7z",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 251,
+ "resource-version": "1529889840474",
+ "neutron-network-id": "K52",
+ "neutron-subnet-id": "7CZjzB",
+ "vlan-id-inner": 790,
+ "l3-interface-ipv4-address": "a82b6014-8aa2-4bd8-b6e7-01c5f7a19c33-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 58
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 404,
+ "resource-version": "1529889840468",
+ "neutron-network-id": "LqT0cwY4tdE",
+ "neutron-subnet-id": "Imj2rt0HAMGG",
+ "vlan-id-inner": 525,
+ "l3-interface-ipv4-address": "e7c633df-9024-493e-8b7f-5b10415cb1aa-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 108
+ }
+ ]
+ },
+ {
+ "v6-wan-link-ip": "Ln26J5hGX7M",
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-description": "I9JkId",
+ "vpn-key": "LRdP",
+ "prov-status": "APYZv",
+ "vlan-id-inner": 35,
+ "vlan-id-outer": 831,
+ "orchestration-status": "T1wt2oC",
+ "speed-value": "GHxANnX",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840558",
+ "neutron-network-id": "emLOUy0Qmmo",
+ "neutron-subnet-id": "fzgS9OJ",
+ "l3-interface-ipv6-prefix-length": 752,
+ "vlan-id-inner": 998,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "1bfe762c-4c38-431b-b15f-ca66c8a31a28-jenkins",
+ "vlan-id-outer": 293
+ },
+ {
+ "resource-version": "1529889840564",
+ "neutron-network-id": "20qzZFzb",
+ "neutron-subnet-id": "RWfDmt",
+ "l3-interface-ipv6-prefix-length": 400,
+ "vlan-id-inner": 427,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "4ea1cc4f-1400-494e-99c7-820b213a4c03-jenkins",
+ "vlan-id-outer": 270
+ }
+ ],
+ "resource-version": "1529889840541",
+ "is-ip-unnumbered": false,
+ "speed-units": "9CDfulUnymX1x",
+ "vlan-interface": "0016f9ca-1ef3-4b14-bed0-fd9d7a5f7020-jenkins",
+ "backdoor-connection": "hIq",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 12,
+ "resource-version": "1529889840546",
+ "neutron-network-id": "sYe5FRwMDe",
+ "neutron-subnet-id": "snexxGpM",
+ "vlan-id-inner": 834,
+ "l3-interface-ipv4-address": "eae2bc5c-e72e-41b6-93f7-73a3db342e2f-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 934
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 687,
+ "resource-version": "1529889840552",
+ "neutron-network-id": "OyNhYSJ",
+ "neutron-subnet-id": "iAE",
+ "vlan-id-inner": 820,
+ "l3-interface-ipv4-address": "c16e3d11-45cf-4ae2-aa7e-e40e23d4a454-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 12
+ }
+ ]
+ },
+ {
+ "vlan-description": "HFZ0s1sqrx",
+ "vpn-key": "DA3vkcsmXoNa",
+ "prov-status": "PLXCq2sZr",
+ "vlan-id-inner": 349,
+ "vlan-id-outer": 230,
+ "orchestration-status": "tIlhc9",
+ "speed-value": "9rk46hsxtjUJY",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840534",
+ "neutron-network-id": "uzY",
+ "neutron-subnet-id": "hevG",
+ "l3-interface-ipv6-prefix-length": 188,
+ "vlan-id-inner": 247,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "418916cc-8123-4b24-8879-9f512e771c70-jenkins",
+ "vlan-id-outer": 995
+ },
+ {
+ "resource-version": "1529889840528",
+ "neutron-network-id": "9sqJYket",
+ "neutron-subnet-id": "TA0Ir2iH",
+ "l3-interface-ipv6-prefix-length": 313,
+ "vlan-id-inner": 619,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "1812bc12-be5c-4cca-9b87-03bd19277b04-jenkins",
+ "vlan-id-outer": 627
+ }
+ ],
+ "resource-version": "1529889840511",
+ "is-ip-unnumbered": true,
+ "speed-units": "siXy4hm",
+ "vlan-interface": "010547b9-4495-4fb5-a1b2-d4dbb8833e83-jenkins",
+ "backdoor-connection": "1F0cNOsS",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 780,
+ "resource-version": "1529889840522",
+ "neutron-network-id": "jwWHQK7",
+ "neutron-subnet-id": "UsxImV5pL9LL",
+ "vlan-id-inner": 637,
+ "l3-interface-ipv4-address": "d814d5bd-a23c-4f21-9f3d-2c631f424aac-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 418
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 262,
+ "resource-version": "1529889840516",
+ "neutron-network-id": "JDuBaq3Cbhd",
+ "neutron-subnet-id": "1DFTpWjFLzcZ6",
+ "vlan-id-inner": 191,
+ "l3-interface-ipv4-address": "a1dc02f5-11eb-46cd-81e8-6e51e82f7eff-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 426
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "3J1Z18yxgQ004",
+ "interface-name": "9471edc4-3e56-43c1-987b-a7d50b831ffa-jenkins",
+ "allowed-address-pairs": "QXWns3Qp",
+ "prov-status": "FacORXn",
+ "macaddr": "hp9PJwVAD",
+ "interface-role": "17o1WXMEldX8",
+ "selflink": "brAO",
+ "in-maint": true,
+ "admin-status": "04KWsIfV3",
+ "is-port-mirrored": false,
+ "resource-version": "1529889840583",
+ "is-ip-unnumbered": false,
+ "network-name": "8xX9B4eSfixos",
+ "management-option": "m2w0o5B",
+ "interface-id": "zzbAbZvn6sT",
+ "interface-description": "qkWDaz1Qix"
+ },
+ {
+ "v6-wan-link-ip": "PxVRinMq5Vgq4",
+ "interface-name": "a11a5207-4fb1-4dc2-a167-95c2712fdc35-jenkins",
+ "allowed-address-pairs": "oG7yZKSv6KONP",
+ "prov-status": "tCy3ilKzFIR",
+ "macaddr": "ttHiTiLtkN25z",
+ "interface-role": "OpQ3C",
+ "selflink": "dZe4nCK",
+ "in-maint": false,
+ "admin-status": "PqB6G3n16lEG",
+ "is-port-mirrored": false,
+ "resource-version": "1529889840578",
+ "is-ip-unnumbered": true,
+ "network-name": "6PQItO",
+ "management-option": "PK28FqG",
+ "interface-id": "Gpy8kn1QXK",
+ "interface-description": "HLG0XZ"
+ }
+ ]
+ },
+ "interface-name": "02dc1675-e1c3-4cfb-a2e6-8aa67b6f1c2d-jenkins",
+ "allowed-address-pairs": "7xJnB",
+ "prov-status": "cMv3MM0GPOk",
+ "macaddr": "JVQ8SS6",
+ "interface-role": "r1hnvD02Xgs",
+ "selflink": "r3F",
+ "in-maint": true,
+ "admin-status": "4iU",
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840608",
+ "neutron-network-id": "oLuz7jf",
+ "neutron-subnet-id": "ouBsOQ",
+ "l3-interface-ipv6-prefix-length": 421,
+ "vlan-id-inner": 864,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "95782900-e9e2-459f-8039-e8c165a22688-jenkins",
+ "vlan-id-outer": 760
+ },
+ {
+ "resource-version": "1529889840602",
+ "neutron-network-id": "yT9BgKa5Q",
+ "neutron-subnet-id": "4wuHUPFV",
+ "l3-interface-ipv6-prefix-length": 454,
+ "vlan-id-inner": 775,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "af360d6d-06c6-44af-ab10-7f3e253d6f5c-jenkins",
+ "vlan-id-outer": 733
+ }
+ ],
+ "is-port-mirrored": true,
+ "resource-version": "1529889840504",
+ "is-ip-unnumbered": true,
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "vf-vlan-filter": "szyj3DJNs",
+ "vf-vlan-strip": true,
+ "neutron-network-id": "oe0yQEK2pt",
+ "vf-broadcast-allow": false,
+ "vf-mac-anti-spoof-check": false,
+ "vf-unknown-multicast-allow": false,
+ "pci-id": "1e9a98ce-5235-47d3-ab4b-d106c77eac4f-jenkins",
+ "vf-mirrors": "RLPA",
+ "resource-version": "1529889840572",
+ "vf-link-status": "7cbMLgWUQCA",
+ "vf-mac-filter": "6MFqin1N10K",
+ "vf-insert-stag": true,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-unknown-unicast-allow": false
+ }
+ ]
+ },
+ "network-name": "sf6cI7Fb",
+ "management-option": "GZl1Yw",
+ "interface-id": "pZNGvpNZ",
+ "interface-description": "jiPT6esm7",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 268,
+ "resource-version": "1529889840589",
+ "neutron-network-id": "BTsABqXg",
+ "neutron-subnet-id": "qjg5eZlk",
+ "vlan-id-inner": 877,
+ "l3-interface-ipv4-address": "a64ab58a-26ea-464b-a32d-c30d6bf1d40f-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 31
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 395,
+ "resource-version": "1529889840596",
+ "neutron-network-id": "v2LUT",
+ "neutron-subnet-id": "VTknAqDz",
+ "vlan-id-inner": 205,
+ "l3-interface-ipv4-address": "0076fd8f-ecb3-4527-b3ee-fee132be8db6-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 461
+ }
+ ]
+ }
+ ]
+ },
+ "interface-name": "8806d30d-e5f5-409e-9e9e-9b1c1943058d-jenkins",
+ "speed-units": "dtp",
+ "prov-status": "2zeuU",
+ "interface-description": "hvVs",
+ "interface-id": "KFxtMnPc5yK0B"
+ },
+ {
+ "interface-role": "XY4Wle1e0",
+ "speed-value": "pK4kfeQqTNFh4",
+ "in-maint": true,
+ "resource-version": "1529889840619",
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "MsEqgBrWffZ",
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-description": "LfyQImV4m0",
+ "vpn-key": "bYw0P",
+ "prov-status": "JQCyvJ",
+ "vlan-id-inner": 566,
+ "vlan-id-outer": 558,
+ "orchestration-status": "HIF",
+ "speed-value": "Ar7CSlrCY",
+ "in-maint": false,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840646",
+ "neutron-network-id": "PoZ",
+ "neutron-subnet-id": "y7SaFxU9te4O",
+ "l3-interface-ipv6-prefix-length": 631,
+ "vlan-id-inner": 207,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "8466bb52-7984-4792-a37f-b522a0b49f83-jenkins",
+ "vlan-id-outer": 941
+ },
+ {
+ "resource-version": "1529889840652",
+ "neutron-network-id": "NcYrcVwTCtEH",
+ "neutron-subnet-id": "370eM",
+ "l3-interface-ipv6-prefix-length": 137,
+ "vlan-id-inner": 830,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "e291654f-f843-470c-9888-e5ed0e751a8b-jenkins",
+ "vlan-id-outer": 351
+ }
+ ],
+ "resource-version": "1529889840629",
+ "is-ip-unnumbered": false,
+ "speed-units": "iPOB5",
+ "vlan-interface": "67dd28da-6b2b-420b-8586-d50ad2832b16-jenkins",
+ "backdoor-connection": "Sm8BM",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 455,
+ "resource-version": "1529889840634",
+ "neutron-network-id": "ILjdNY7FyDFTa",
+ "neutron-subnet-id": "l5D",
+ "vlan-id-inner": 499,
+ "l3-interface-ipv4-address": "5724d3ec-a533-4dda-821d-564fa6f1bd9c-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 863
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 129,
+ "resource-version": "1529889840640",
+ "neutron-network-id": "ShC4WNzIO",
+ "neutron-subnet-id": "vg73RjKeCDqdL",
+ "vlan-id-inner": 947,
+ "l3-interface-ipv4-address": "3e843120-b62d-4c97-bb41-7f0219db7b14-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 634
+ }
+ ]
+ },
+ {
+ "vlan-description": "jQcFXNZd",
+ "vpn-key": "SWZEIY6YS",
+ "prov-status": "3CGAI",
+ "vlan-id-inner": 277,
+ "vlan-id-outer": 527,
+ "orchestration-status": "zPNrcQLm4uv6P",
+ "speed-value": "EnMy3",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840682",
+ "neutron-network-id": "odwHBa91BM1q",
+ "neutron-subnet-id": "gyUcUX10",
+ "l3-interface-ipv6-prefix-length": 712,
+ "vlan-id-inner": 88,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "039308d2-d148-427b-b5fd-10674761c44d-jenkins",
+ "vlan-id-outer": 367
+ },
+ {
+ "resource-version": "1529889840676",
+ "neutron-network-id": "Gza",
+ "neutron-subnet-id": "pIq",
+ "l3-interface-ipv6-prefix-length": 466,
+ "vlan-id-inner": 230,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "b88fd72b-daaf-4501-ae0e-03ae6dd908fb-jenkins",
+ "vlan-id-outer": 881
+ }
+ ],
+ "resource-version": "1529889840659",
+ "is-ip-unnumbered": false,
+ "speed-units": "kCGl",
+ "vlan-interface": "b765805d-a9ee-4b67-9878-b9ce5393afcd-jenkins",
+ "backdoor-connection": "3Uj",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 464,
+ "resource-version": "1529889840670",
+ "neutron-network-id": "dCij",
+ "neutron-subnet-id": "JsAH2B",
+ "vlan-id-inner": 806,
+ "l3-interface-ipv4-address": "6c72d28b-2068-4421-b434-c91aed94d05f-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 944
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 409,
+ "resource-version": "1529889840664",
+ "neutron-network-id": "K7Iu55Aeg7",
+ "neutron-subnet-id": "Szh5oyDazQxx",
+ "vlan-id-inner": 574,
+ "l3-interface-ipv4-address": "9bd8b783-fa5f-464f-8c70-c2b7073aaa31-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 901
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "9JOASEc",
+ "interface-name": "1f2c5777-382d-42a1-95dd-ad46dd3970b6-jenkins",
+ "allowed-address-pairs": "cj7hTo",
+ "prov-status": "esrpGpgM66MA",
+ "macaddr": "ABRk4hv1fYAvm",
+ "interface-role": "fOx5Ci",
+ "selflink": "bNOyib",
+ "in-maint": false,
+ "admin-status": "aflI2BZ",
+ "is-port-mirrored": true,
+ "resource-version": "1529889840695",
+ "is-ip-unnumbered": false,
+ "network-name": "W9ikzRrF7mB",
+ "management-option": "qHHbFL",
+ "interface-id": "O4z",
+ "interface-description": "UYX398gN8i"
+ },
+ {
+ "v6-wan-link-ip": "oSFHmh2phxen",
+ "interface-name": "17e6f113-b3e2-48a1-bb53-dbaa7318c3f2-jenkins",
+ "allowed-address-pairs": "B0LqLPi",
+ "prov-status": "ZMERs2idY",
+ "macaddr": "iavYQQ8D0",
+ "interface-role": "LWDdQz9ooY",
+ "selflink": "NaTAzh6",
+ "in-maint": false,
+ "admin-status": "Rwba4Pyl",
+ "is-port-mirrored": true,
+ "resource-version": "1529889840701",
+ "is-ip-unnumbered": false,
+ "network-name": "qVNOCDe",
+ "management-option": "mYzH",
+ "interface-id": "6xOTvBMzb4A",
+ "interface-description": "xNHFfbZ"
+ }
+ ]
+ },
+ "interface-name": "1d6289a3-7dda-42d7-ad36-b8aa82c3527a-jenkins",
+ "allowed-address-pairs": "SDWi77k0TXOfD",
+ "prov-status": "ce9dCt",
+ "macaddr": "pg3ALUfE6T",
+ "interface-role": "FTsH1RM9",
+ "selflink": "dWkOVoX",
+ "in-maint": true,
+ "admin-status": "Mn3",
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840719",
+ "neutron-network-id": "Ac9ESt",
+ "neutron-subnet-id": "Z7Lj",
+ "l3-interface-ipv6-prefix-length": 711,
+ "vlan-id-inner": 961,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "de537e8b-b42c-4543-a680-7b24cd96262c-jenkins",
+ "vlan-id-outer": 143
+ },
+ {
+ "resource-version": "1529889840726",
+ "neutron-network-id": "n8HSAX",
+ "neutron-subnet-id": "71QevzBBwqbhw",
+ "l3-interface-ipv6-prefix-length": 479,
+ "vlan-id-inner": 845,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "b425a520-6389-4382-aa0b-aa2585e8960c-jenkins",
+ "vlan-id-outer": 57
+ }
+ ],
+ "is-port-mirrored": false,
+ "resource-version": "1529889840623",
+ "is-ip-unnumbered": false,
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "vf-vlan-filter": "NzCY2ZFza",
+ "vf-vlan-strip": true,
+ "neutron-network-id": "XVyTFfI",
+ "vf-broadcast-allow": true,
+ "vf-mac-anti-spoof-check": true,
+ "vf-unknown-multicast-allow": true,
+ "pci-id": "8e034ca2-4f11-4c8e-98cf-d6463986fe4d-jenkins",
+ "vf-mirrors": "u0FdegnEMsC",
+ "resource-version": "1529889840690",
+ "vf-link-status": "CEiqnhy",
+ "vf-mac-filter": "9QXQosf6",
+ "vf-insert-stag": true,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-unknown-unicast-allow": true
+ }
+ ]
+ },
+ "network-name": "ZOxPNuwY",
+ "management-option": "7NmUPH",
+ "interface-id": "Hq3BuQ7",
+ "interface-description": "5Sr3zVcb",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 284,
+ "resource-version": "1529889840713",
+ "neutron-network-id": "BGv8mmqI",
+ "neutron-subnet-id": "55SW",
+ "vlan-id-inner": 672,
+ "l3-interface-ipv4-address": "26e40e8b-8e00-43a4-9050-5b9eadc90305-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 946
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 623,
+ "resource-version": "1529889840707",
+ "neutron-network-id": "voGoxHzyuDW",
+ "neutron-subnet-id": "PYStGvpuliOY",
+ "vlan-id-inner": 224,
+ "l3-interface-ipv4-address": "20ff73f0-4169-43b9-b0c6-ceea0c54a24e-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 913
+ }
+ ]
+ },
+ {
+ "v6-wan-link-ip": "orgs2voeaiET",
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-description": "AE75zek",
+ "vpn-key": "bka0W79",
+ "prov-status": "gF8zBYGKLFI1t",
+ "vlan-id-inner": 620,
+ "vlan-id-outer": 162,
+ "orchestration-status": "CzCJsuBNc",
+ "speed-value": "JQvUCFr",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840757",
+ "neutron-network-id": "lrYktUQ4B",
+ "neutron-subnet-id": "87JiirHx",
+ "l3-interface-ipv6-prefix-length": 244,
+ "vlan-id-inner": 568,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "97f083b3-5cf3-414e-89a6-dd1b20ef06b8-jenkins",
+ "vlan-id-outer": 201
+ },
+ {
+ "resource-version": "1529889840763",
+ "neutron-network-id": "smMgUDmt",
+ "neutron-subnet-id": "WfemGm8N5",
+ "l3-interface-ipv6-prefix-length": 566,
+ "vlan-id-inner": 43,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "4dfd97ec-d11c-40ac-9bc0-a906b50b5095-jenkins",
+ "vlan-id-outer": 282
+ }
+ ],
+ "resource-version": "1529889840740",
+ "is-ip-unnumbered": false,
+ "speed-units": "zv1",
+ "vlan-interface": "7006e23b-aa18-491c-94f1-9ccbdb1216c1-jenkins",
+ "backdoor-connection": "XvPt0D7",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 345,
+ "resource-version": "1529889840745",
+ "neutron-network-id": "WkVtQi",
+ "neutron-subnet-id": "iiE",
+ "vlan-id-inner": 585,
+ "l3-interface-ipv4-address": "237dfc24-c581-460f-9e31-608ae9cf07db-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 752
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 664,
+ "resource-version": "1529889840751",
+ "neutron-network-id": "BMpMnD",
+ "neutron-subnet-id": "AgrOLB",
+ "vlan-id-inner": 523,
+ "l3-interface-ipv4-address": "3ec034d2-5c77-492c-8c63-a2ebda389e5d-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 884
+ }
+ ]
+ },
+ {
+ "vlan-description": "atAWwI4a3Z9nn",
+ "vpn-key": "lhN",
+ "prov-status": "xTREV",
+ "vlan-id-inner": 687,
+ "vlan-id-outer": 963,
+ "orchestration-status": "aZmqJkmVe",
+ "speed-value": "CxGo",
+ "in-maint": false,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840793",
+ "neutron-network-id": "vmmpW",
+ "neutron-subnet-id": "QmsUCT7Z9",
+ "l3-interface-ipv6-prefix-length": 869,
+ "vlan-id-inner": 444,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "f694a211-1144-4ac0-8a18-841e4e9b6496-jenkins",
+ "vlan-id-outer": 307
+ },
+ {
+ "resource-version": "1529889840788",
+ "neutron-network-id": "h3JpE02Qol",
+ "neutron-subnet-id": "1LP1wI",
+ "l3-interface-ipv6-prefix-length": 699,
+ "vlan-id-inner": 695,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "d382a20e-6c27-4e3f-a79a-670519ff8091-jenkins",
+ "vlan-id-outer": 162
+ }
+ ],
+ "resource-version": "1529889840770",
+ "is-ip-unnumbered": true,
+ "speed-units": "3lGVeAq",
+ "vlan-interface": "4ce368d2-ec9b-4e92-8b7f-031edcec30cc-jenkins",
+ "backdoor-connection": "3XjveRtVEEBud",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 996,
+ "resource-version": "1529889840776",
+ "neutron-network-id": "rXeE0QspfKY",
+ "neutron-subnet-id": "38sj3w",
+ "vlan-id-inner": 62,
+ "l3-interface-ipv4-address": "16a23c8d-1a92-49a9-b03b-09eec176d3eb-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 735
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 703,
+ "resource-version": "1529889840782",
+ "neutron-network-id": "4AyvZ5hNZ",
+ "neutron-subnet-id": "1ssFocSaqQo",
+ "vlan-id-inner": 616,
+ "l3-interface-ipv4-address": "b96e59ab-e272-4586-857f-b5b6ef8bf3c5-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 857
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "hxz",
+ "interface-name": "1bf29baf-8a7a-4bef-9e65-60afd4aa4bc5-jenkins",
+ "allowed-address-pairs": "m5q",
+ "prov-status": "2jq0q",
+ "macaddr": "RIoHQVpg",
+ "interface-role": "AOUF02ImxkTN",
+ "selflink": "tFX",
+ "in-maint": false,
+ "admin-status": "mgaWPPl3y3",
+ "is-port-mirrored": true,
+ "resource-version": "1529889840807",
+ "is-ip-unnumbered": false,
+ "network-name": "UMXmDlnia43zq",
+ "management-option": "Vlnc",
+ "interface-id": "mtfnhl6ONlg40",
+ "interface-description": "Ow5JhDaD"
+ },
+ {
+ "v6-wan-link-ip": "8N8zazXz1R",
+ "interface-name": "76ff110f-6967-4d27-bd9d-4d053f9c344b-jenkins",
+ "allowed-address-pairs": "bnrD6",
+ "prov-status": "pPxhpmA0mNMDW",
+ "macaddr": "IM8RYRdp",
+ "interface-role": "3gxROfeT",
+ "selflink": "YcZhmOgXU",
+ "in-maint": true,
+ "admin-status": "oSSwcVT7Z",
+ "is-port-mirrored": false,
+ "resource-version": "1529889840812",
+ "is-ip-unnumbered": true,
+ "network-name": "fqxZ6e1iSI",
+ "management-option": "e8iCRmtU",
+ "interface-id": "nYGg",
+ "interface-description": "7zDWMD0s2"
+ }
+ ]
+ },
+ "interface-name": "b654cb26-070e-437a-b04e-7f07d44fdc52-jenkins",
+ "allowed-address-pairs": "70JS",
+ "prov-status": "HH4Y",
+ "macaddr": "m0Xnah2pf1Bpy",
+ "interface-role": "naRsTm",
+ "selflink": "fC0AtzLXWIL",
+ "in-maint": true,
+ "admin-status": "HAWquxE",
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840839",
+ "neutron-network-id": "Gc3bhBf4bpJ0",
+ "neutron-subnet-id": "BysFFJ",
+ "l3-interface-ipv6-prefix-length": 348,
+ "vlan-id-inner": 170,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "0d4500e9-869e-4cb4-9cb4-3819d2c6bbbc-jenkins",
+ "vlan-id-outer": 383
+ },
+ {
+ "resource-version": "1529889840845",
+ "neutron-network-id": "FZObd3YO",
+ "neutron-subnet-id": "MJMH2LPtW3N",
+ "l3-interface-ipv6-prefix-length": 986,
+ "vlan-id-inner": 907,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "2b6c8e63-031b-45cd-b4c4-fe4bc9c73415-jenkins",
+ "vlan-id-outer": 150
+ }
+ ],
+ "is-port-mirrored": false,
+ "resource-version": "1529889840734",
+ "is-ip-unnumbered": true,
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "vf-vlan-filter": "81VYb1i",
+ "vf-vlan-strip": false,
+ "neutron-network-id": "5hrpHU",
+ "vf-broadcast-allow": true,
+ "vf-mac-anti-spoof-check": true,
+ "vf-unknown-multicast-allow": true,
+ "pci-id": "47a35b64-d6b5-438e-a36e-67527c7adacb-jenkins",
+ "vf-mirrors": "LVDF81V6wFJFi",
+ "resource-version": "1529889840801",
+ "vf-link-status": "j4G9oyAtL8W",
+ "vf-mac-filter": "loye",
+ "vf-insert-stag": false,
+ "vf-vlan-anti-spoof-check": false,
+ "vf-unknown-unicast-allow": false
+ }
+ ]
+ },
+ "network-name": "TTsan6YwMM",
+ "management-option": "Vm4JdgeI",
+ "interface-id": "bNt",
+ "interface-description": "m16u",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 322,
+ "resource-version": "1529889840827",
+ "neutron-network-id": "MTRM",
+ "neutron-subnet-id": "6rhZMmstG4i",
+ "vlan-id-inner": 134,
+ "l3-interface-ipv4-address": "f1964d77-7b60-4b52-af29-7e862b35eabc-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 150
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 936,
+ "resource-version": "1529889840833",
+ "neutron-network-id": "WierCB0r5",
+ "neutron-subnet-id": "FIhbraamzpd0O",
+ "vlan-id-inner": 395,
+ "l3-interface-ipv4-address": "43d2e200-525c-460e-b437-8abd201b6fca-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 688
+ }
+ ]
+ }
+ ]
+ },
+ "interface-name": "2ac48363-21fd-485a-8088-c8de995396a3-jenkins",
+ "speed-units": "lLgzNBkg",
+ "prov-status": "l299JsuJhY",
+ "interface-description": "G1C1H",
+ "interface-id": "w6FY"
+ }
+ ]
+ },
+ "equip-model": "e2IFGT",
+ "in-maint": false,
+ "p-interfaces": {
+ "p-interface": [
+ {
+ "equipment-identifier": "fLsqKh",
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "MBw16c7s",
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-description": "Fa8BU8",
+ "vpn-key": "c3PkMMd",
+ "prov-status": "fJ3DOFSk7",
+ "vlan-id-inner": 402,
+ "vlan-id-outer": 34,
+ "orchestration-status": "eHkM4C",
+ "speed-value": "zSqye71RT",
+ "in-maint": false,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889839959",
+ "neutron-network-id": "Ee9qO6PQ7zi5",
+ "neutron-subnet-id": "l2A7T",
+ "l3-interface-ipv6-prefix-length": 684,
+ "vlan-id-inner": 209,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "8914f8ff-e0e7-4835-ad2a-cfa7f0dab948-jenkins",
+ "vlan-id-outer": 711
+ },
+ {
+ "resource-version": "1529889839965",
+ "neutron-network-id": "eOeaaX",
+ "neutron-subnet-id": "kv6",
+ "l3-interface-ipv6-prefix-length": 470,
+ "vlan-id-inner": 298,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "62e3e5aa-adff-48e3-8ec3-fc50ca37864d-jenkins",
+ "vlan-id-outer": 952
+ }
+ ],
+ "resource-version": "1529889839942",
+ "is-ip-unnumbered": true,
+ "speed-units": "tCdCihW7p4K",
+ "vlan-interface": "697fa57d-87b6-4ee8-a4cd-83ae7fde814b-jenkins",
+ "backdoor-connection": "jRx4Vij6fhbmU",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 934,
+ "resource-version": "1529889839953",
+ "neutron-network-id": "2augUNUhqiZ",
+ "neutron-subnet-id": "anWVuz",
+ "vlan-id-inner": 814,
+ "l3-interface-ipv4-address": "e72991d7-9397-49fe-8ff2-0b24f5da6601-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 120
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 544,
+ "resource-version": "1529889839947",
+ "neutron-network-id": "GLBUVmQ",
+ "neutron-subnet-id": "qJaRGA3xGQ05N",
+ "vlan-id-inner": 144,
+ "l3-interface-ipv4-address": "638b0014-0550-4f8f-a182-0f25c7a49094-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 860
+ }
+ ]
+ },
+ {
+ "vlan-description": "kpjS8p9",
+ "vpn-key": "K797abgqJPJ",
+ "prov-status": "VVjAwvGkYn6",
+ "vlan-id-inner": 145,
+ "vlan-id-outer": 472,
+ "orchestration-status": "U4bPZ",
+ "speed-value": "K3YJXZpVAWlNk",
+ "in-maint": false,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889839935",
+ "neutron-network-id": "2M6x",
+ "neutron-subnet-id": "FtZ6iJ72JPxOp",
+ "l3-interface-ipv6-prefix-length": 705,
+ "vlan-id-inner": 360,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "d46aee86-d8d1-4f50-95c0-dba97accf2b2-jenkins",
+ "vlan-id-outer": 91
+ },
+ {
+ "resource-version": "1529889839929",
+ "neutron-network-id": "CfzdGpL",
+ "neutron-subnet-id": "7NTTSE",
+ "l3-interface-ipv6-prefix-length": 342,
+ "vlan-id-inner": 423,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "ea3e330f-9868-4cbf-aa99-c57281cdbff8-jenkins",
+ "vlan-id-outer": 414
+ }
+ ],
+ "resource-version": "1529889839912",
+ "is-ip-unnumbered": false,
+ "speed-units": "eWavRsG",
+ "vlan-interface": "e270589c-0f82-4213-adff-7edb6eda511a-jenkins",
+ "backdoor-connection": "ONvEI4XvtvJN",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 384,
+ "resource-version": "1529889839917",
+ "neutron-network-id": "kNHGesT",
+ "neutron-subnet-id": "yA9FTecLecooy",
+ "vlan-id-inner": 553,
+ "l3-interface-ipv4-address": "4baec833-d46e-4141-a144-9a69d2995083-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 743
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 766,
+ "resource-version": "1529889839923",
+ "neutron-network-id": "lY4i8I2h",
+ "neutron-subnet-id": "nH360LQ",
+ "vlan-id-inner": 575,
+ "l3-interface-ipv4-address": "dbce2579-771e-45dd-9eeb-fcfd8abb59a3-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 659
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "VtXT",
+ "interface-name": "22ba20ad-4f1c-4530-ab9d-fc091051bd84-jenkins",
+ "allowed-address-pairs": "9mbMpE4l",
+ "prov-status": "H5E8157",
+ "macaddr": "BWuWkvhtW8",
+ "interface-role": "R1EKN",
+ "selflink": "hUEY5Uw6ZBH",
+ "in-maint": true,
+ "admin-status": "DF03UHHd8",
+ "is-port-mirrored": false,
+ "resource-version": "1529889839978",
+ "is-ip-unnumbered": false,
+ "network-name": "7W2QE34D",
+ "management-option": "Vkx",
+ "interface-id": "fGaA",
+ "interface-description": "i4i"
+ },
+ {
+ "v6-wan-link-ip": "BC0ksb1bI1EK",
+ "interface-name": "4c7fe9ad-f5e2-4cc3-8b03-792ae7289154-jenkins",
+ "allowed-address-pairs": "3oyqp9iyD7",
+ "prov-status": "C0p5fH6lfcAb",
+ "macaddr": "WK2Qd",
+ "interface-role": "w5sQ4P",
+ "selflink": "6h6qQjMR",
+ "in-maint": false,
+ "admin-status": "pYhXCCf83pvO",
+ "is-port-mirrored": false,
+ "resource-version": "1529889839984",
+ "is-ip-unnumbered": true,
+ "network-name": "GGToGGIWb",
+ "management-option": "XeKuav",
+ "interface-id": "zHWzodA2Dy8",
+ "interface-description": "uvVfwQuN"
+ }
+ ]
+ },
+ "interface-name": "7bd89b2e-e723-4d50-a4a2-4a0d1fe69069-jenkins",
+ "allowed-address-pairs": "JCAK8XN2PNw",
+ "prov-status": "qlSKW",
+ "macaddr": "QfkSxy1VuCour",
+ "interface-role": "nf1rP4iNKUP",
+ "selflink": "ZSWul0",
+ "in-maint": false,
+ "admin-status": "qMVSn68C3QONM",
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840003",
+ "neutron-network-id": "1fuU",
+ "neutron-subnet-id": "r2oLjsNWsep",
+ "l3-interface-ipv6-prefix-length": 97,
+ "vlan-id-inner": 251,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "a811422b-b69c-473d-ba0d-6d757d6ebfc7-jenkins",
+ "vlan-id-outer": 903
+ },
+ {
+ "resource-version": "1529889840009",
+ "neutron-network-id": "0HxL0QUeL",
+ "neutron-subnet-id": "7mSCgN",
+ "l3-interface-ipv6-prefix-length": 611,
+ "vlan-id-inner": 514,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "710b2053-4be6-44c7-a2db-833862f398c1-jenkins",
+ "vlan-id-outer": 441
+ }
+ ],
+ "is-port-mirrored": true,
+ "resource-version": "1529889839905",
+ "is-ip-unnumbered": false,
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "vf-vlan-filter": "9Be4",
+ "vf-vlan-strip": true,
+ "neutron-network-id": "OkbLwv534",
+ "vf-broadcast-allow": true,
+ "vf-mac-anti-spoof-check": false,
+ "vf-unknown-multicast-allow": true,
+ "pci-id": "40672a3c-11df-49d8-ba6c-4266366f81a6-jenkins",
+ "vf-mirrors": "LHRZR",
+ "resource-version": "1529889839973",
+ "vf-link-status": "dL3n6",
+ "vf-mac-filter": "wTYL",
+ "vf-insert-stag": true,
+ "vf-vlan-anti-spoof-check": false,
+ "vf-unknown-unicast-allow": false
+ }
+ ]
+ },
+ "network-name": "9zXzqY2",
+ "management-option": "zVscglva0VC",
+ "interface-id": "GND6v7N9BUKdL",
+ "interface-description": "H2OPAj",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 610,
+ "resource-version": "1529889839996",
+ "neutron-network-id": "RYKV1Q",
+ "neutron-subnet-id": "vr92NIO7V",
+ "vlan-id-inner": 159,
+ "l3-interface-ipv4-address": "d9597d04-1bc5-4d62-876f-ed30524bb46f-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 40
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 969,
+ "resource-version": "1529889839990",
+ "neutron-network-id": "TA6",
+ "neutron-subnet-id": "f5mhuX2bvOEso",
+ "vlan-id-inner": 269,
+ "l3-interface-ipv4-address": "86a9090a-f49c-4734-8a67-8b595e04f647-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 206
+ }
+ ]
+ },
+ {
+ "v6-wan-link-ip": "JErpT",
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-description": "wLNn",
+ "vpn-key": "hHCbqshyhg",
+ "prov-status": "Y9420",
+ "vlan-id-inner": 121,
+ "vlan-id-outer": 663,
+ "orchestration-status": "t9S8rSP7p",
+ "speed-value": "i9cLXv",
+ "in-maint": false,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840042",
+ "neutron-network-id": "8jiEnSajGx",
+ "neutron-subnet-id": "FOVkSB",
+ "l3-interface-ipv6-prefix-length": 496,
+ "vlan-id-inner": 558,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "e83bed12-5dd7-4d9a-929f-9cf57d728376-jenkins",
+ "vlan-id-outer": 12
+ },
+ {
+ "resource-version": "1529889840047",
+ "neutron-network-id": "sdOb55dAzQt",
+ "neutron-subnet-id": "HqtvNrbOW",
+ "l3-interface-ipv6-prefix-length": 823,
+ "vlan-id-inner": 62,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "49d8a3d2-2f2e-4f2a-a236-2eedabcbae1f-jenkins",
+ "vlan-id-outer": 341
+ }
+ ],
+ "resource-version": "1529889840025",
+ "is-ip-unnumbered": false,
+ "speed-units": "0yC0mR",
+ "vlan-interface": "e1159280-5843-412c-9ac6-4b95c1a76f3b-jenkins",
+ "backdoor-connection": "ZYtmgZrUF6vzS",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 314,
+ "resource-version": "1529889840029",
+ "neutron-network-id": "8jHyNtYT7",
+ "neutron-subnet-id": "9NBJS3AORrVpW",
+ "vlan-id-inner": 788,
+ "l3-interface-ipv4-address": "9e56f7a7-1241-4cde-ab06-6166c4208454-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 627
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 586,
+ "resource-version": "1529889840036",
+ "neutron-network-id": "V5hCkUWfVQNH",
+ "neutron-subnet-id": "bNHGIvjnK",
+ "vlan-id-inner": 486,
+ "l3-interface-ipv4-address": "66eb2cfa-03c5-424d-a992-2e77bf31ddd0-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 230
+ }
+ ]
+ },
+ {
+ "vlan-description": "PMgsvKp7",
+ "vpn-key": "jrDeBGUBhtkBC",
+ "prov-status": "eMkpM1Nq",
+ "vlan-id-inner": 847,
+ "vlan-id-outer": 644,
+ "orchestration-status": "ermPPN",
+ "speed-value": "mbBs40CypPU4",
+ "in-maint": false,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840073",
+ "neutron-network-id": "TYINcC7C55H",
+ "neutron-subnet-id": "cMVQPrD",
+ "l3-interface-ipv6-prefix-length": 248,
+ "vlan-id-inner": 326,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "1c054bd3-9e68-48fd-bc6d-e3c3554a7dce-jenkins",
+ "vlan-id-outer": 110
+ },
+ {
+ "resource-version": "1529889840079",
+ "neutron-network-id": "ZAKaJQsTlgA",
+ "neutron-subnet-id": "DqmXwxPdIpKQ",
+ "l3-interface-ipv6-prefix-length": 655,
+ "vlan-id-inner": 57,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "3ae4f973-70d6-4ef3-b006-526e518192b9-jenkins",
+ "vlan-id-outer": 299
+ }
+ ],
+ "resource-version": "1529889840055",
+ "is-ip-unnumbered": false,
+ "speed-units": "zPO9liNdSX0",
+ "vlan-interface": "e3d61c90-c6a4-4fcb-93c0-2f568af7ab6f-jenkins",
+ "backdoor-connection": "jtS6nsN9EBxA",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 982,
+ "resource-version": "1529889840061",
+ "neutron-network-id": "2Y8",
+ "neutron-subnet-id": "vLDZaT",
+ "vlan-id-inner": 415,
+ "l3-interface-ipv4-address": "1bb8f77d-8ea7-4893-8c15-a43e3369c67d-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 960
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 104,
+ "resource-version": "1529889840067",
+ "neutron-network-id": "cSuTgMAjn3r",
+ "neutron-subnet-id": "sha47kCBHMpo",
+ "vlan-id-inner": 580,
+ "l3-interface-ipv4-address": "bcacf13b-0067-420d-953f-e22d84ee3af1-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 687
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "qTVCOp5ygayI0",
+ "interface-name": "9b13abff-cd24-4bed-8a74-e0e06308a5ce-jenkins",
+ "allowed-address-pairs": "IVhz",
+ "prov-status": "olrrQ6Ii",
+ "macaddr": "2iUmJTqseGCD",
+ "interface-role": "KFYUN3C",
+ "selflink": "WZoU",
+ "in-maint": false,
+ "admin-status": "VrOUU",
+ "is-port-mirrored": false,
+ "resource-version": "1529889840098",
+ "is-ip-unnumbered": true,
+ "network-name": "BJX",
+ "management-option": "lN4SRVrP",
+ "interface-id": "QL6",
+ "interface-description": "f0mnjC7ajOATc"
+ },
+ {
+ "v6-wan-link-ip": "TmD",
+ "interface-name": "4590458e-0cc9-4e5b-ae64-01410b33eea7-jenkins",
+ "allowed-address-pairs": "eGq6czv1yR",
+ "prov-status": "DAwBJiDRwvtCT",
+ "macaddr": "ZT3YwlcUJE",
+ "interface-role": "UMD",
+ "selflink": "yTmWD",
+ "in-maint": true,
+ "admin-status": "DxzN",
+ "is-port-mirrored": false,
+ "resource-version": "1529889840092",
+ "is-ip-unnumbered": true,
+ "network-name": "D3aCxtR7zv",
+ "management-option": "n3PD",
+ "interface-id": "iuHyae",
+ "interface-description": "95TF5HyDT"
+ }
+ ]
+ },
+ "interface-name": "a5d58888-7f18-4532-bb9f-cff44f21f764-jenkins",
+ "allowed-address-pairs": "UMBKF",
+ "prov-status": "UjcdQWRP",
+ "macaddr": "mVw",
+ "interface-role": "UP3MbarHtY5",
+ "selflink": "srP",
+ "in-maint": false,
+ "admin-status": "sgSdzaI",
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840123",
+ "neutron-network-id": "b5qrgF24RBQM",
+ "neutron-subnet-id": "1516aM83RE",
+ "l3-interface-ipv6-prefix-length": 841,
+ "vlan-id-inner": 60,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "209a1acb-31bb-454b-a803-1975e14a2b79-jenkins",
+ "vlan-id-outer": 47
+ },
+ {
+ "resource-version": "1529889840117",
+ "neutron-network-id": "swcjYuHNH1kLF",
+ "neutron-subnet-id": "6Is",
+ "l3-interface-ipv6-prefix-length": 341,
+ "vlan-id-inner": 472,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "a1a566eb-0f32-47b1-89c0-97b9e71a5bd1-jenkins",
+ "vlan-id-outer": 907
+ }
+ ],
+ "is-port-mirrored": false,
+ "resource-version": "1529889840017",
+ "is-ip-unnumbered": false,
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "vf-vlan-filter": "Mu5iYcFtXJO",
+ "vf-vlan-strip": false,
+ "neutron-network-id": "1NyV0W",
+ "vf-broadcast-allow": false,
+ "vf-mac-anti-spoof-check": false,
+ "vf-unknown-multicast-allow": false,
+ "pci-id": "a73b8fbc-51df-4856-a9b1-1fdab27eb1c2-jenkins",
+ "vf-mirrors": "Xzff495",
+ "resource-version": "1529889840087",
+ "vf-link-status": "e3o",
+ "vf-mac-filter": "weB9RW0kOj",
+ "vf-insert-stag": true,
+ "vf-vlan-anti-spoof-check": false,
+ "vf-unknown-unicast-allow": false
+ }
+ ]
+ },
+ "network-name": "EfhznvHgA9sc",
+ "management-option": "Z3tcQs1t",
+ "interface-id": "XJFnP9b",
+ "interface-description": "4EW",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 415,
+ "resource-version": "1529889840104",
+ "neutron-network-id": "f6P8vI0vF",
+ "neutron-subnet-id": "FFTJTHg",
+ "vlan-id-inner": 118,
+ "l3-interface-ipv4-address": "4bec049a-3389-4eac-a2aa-366fba5ce65e-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 854
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 182,
+ "resource-version": "1529889840110",
+ "neutron-network-id": "3DGUAT",
+ "neutron-subnet-id": "SOsxiS7G",
+ "vlan-id-inner": 955,
+ "l3-interface-ipv4-address": "7488692d-58df-41c8-90da-ad740c5ee1c4-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 44
+ }
+ ]
+ }
+ ]
+ },
+ "interface-name": "d3ee5116-2a24-4eec-ac0c-5bd4c0d8b591-jenkins",
+ "prov-status": "KNuQwh3R18IcL",
+ "interface-role": "n5Ggwbql",
+ "sriov-pfs": {
+ "sriov-pf": [
+ {
+ "resource-version": "1529889839900",
+ "pf-pci-id": "2415ba55-f754-43f3-8549-8367e12292df-jenkins"
+ }
+ ]
+ },
+ "selflink": "hlcIkDbgLsj5",
+ "speed-value": "eZ9SI",
+ "in-maint": false,
+ "interface-type": "2d47g",
+ "port-description": "zSexZ",
+ "resource-version": "1529889839896",
+ "inv-status": "GCqk",
+ "speed-units": "lhQBqM8rf2HXu"
+ },
+ {
+ "equipment-identifier": "cXNyuU8Lg6TK",
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "kGD",
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-description": "rnsklwtzFgYY",
+ "vpn-key": "TKb",
+ "prov-status": "xQUPC1z",
+ "vlan-id-inner": 267,
+ "vlan-id-outer": 699,
+ "orchestration-status": "2T0C",
+ "speed-value": "S4xMNeI",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840210",
+ "neutron-network-id": "CQWLp",
+ "neutron-subnet-id": "8MrdSbIszDA",
+ "l3-interface-ipv6-prefix-length": 707,
+ "vlan-id-inner": 344,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "ba6b944c-05e8-4cb1-959e-b42d5cb70c5a-jenkins",
+ "vlan-id-outer": 961
+ },
+ {
+ "resource-version": "1529889840205",
+ "neutron-network-id": "Hsw4nXwZLQ",
+ "neutron-subnet-id": "JW9lhSp55wX",
+ "l3-interface-ipv6-prefix-length": 325,
+ "vlan-id-inner": 702,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "695e343f-eaea-4a43-bfcb-3d67ec24e090-jenkins",
+ "vlan-id-outer": 232
+ }
+ ],
+ "resource-version": "1529889840187",
+ "is-ip-unnumbered": true,
+ "speed-units": "JhSHmjEpRvYYm",
+ "vlan-interface": "1520c860-c608-4696-a2f4-705b65f6046f-jenkins",
+ "backdoor-connection": "bLB",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 564,
+ "resource-version": "1529889840199",
+ "neutron-network-id": "5BczOGn",
+ "neutron-subnet-id": "eLBW1qhzO3",
+ "vlan-id-inner": 8,
+ "l3-interface-ipv4-address": "8496dd5a-3ad7-4557-8dd6-a433db32615d-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 658
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 228,
+ "resource-version": "1529889840192",
+ "neutron-network-id": "bEA",
+ "neutron-subnet-id": "Tw9wDLBP",
+ "vlan-id-inner": 215,
+ "l3-interface-ipv4-address": "b3482d39-db51-444e-813e-14118a752171-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 805
+ }
+ ]
+ },
+ {
+ "vlan-description": "n8bWn",
+ "vpn-key": "oRujs5y",
+ "prov-status": "SXiegHT",
+ "vlan-id-inner": 513,
+ "vlan-id-outer": 296,
+ "orchestration-status": "INf",
+ "speed-value": "IIbmsMCpmQ",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840166",
+ "neutron-network-id": "hyxtLRv",
+ "neutron-subnet-id": "DA6JkUle",
+ "l3-interface-ipv6-prefix-length": 76,
+ "vlan-id-inner": 681,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "5a9be38a-b064-40f1-a253-314fded08cdf-jenkins",
+ "vlan-id-outer": 996
+ },
+ {
+ "resource-version": "1529889840171",
+ "neutron-network-id": "tQQTGDZQj",
+ "neutron-subnet-id": "XbHEt",
+ "l3-interface-ipv6-prefix-length": 266,
+ "vlan-id-inner": 3,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "fd2f49c0-8b02-466a-9395-37fb54037f16-jenkins",
+ "vlan-id-outer": 205
+ }
+ ],
+ "resource-version": "1529889840149",
+ "is-ip-unnumbered": false,
+ "speed-units": "oZUZAVfm64",
+ "vlan-interface": "710ec65a-0d70-45bc-afc8-6ed029670ec2-jenkins",
+ "backdoor-connection": "MzNnZT7R5X1pO",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 769,
+ "resource-version": "1529889840160",
+ "neutron-network-id": "qTcDiVF2ttvIW",
+ "neutron-subnet-id": "qIZMW4Jk512a",
+ "vlan-id-inner": 122,
+ "l3-interface-ipv4-address": "c3b954f9-3948-4d8b-a894-6eb7cc91f607-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 910
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 830,
+ "resource-version": "1529889840154",
+ "neutron-network-id": "fBBC",
+ "neutron-subnet-id": "oXETpyvUOs",
+ "vlan-id-inner": 91,
+ "l3-interface-ipv4-address": "cf5af1e4-3f86-4162-9f43-01ef659282d4-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 90
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "McYNumNy4",
+ "interface-name": "5ab57276-62ba-4fb8-a99a-f4cc64fe1f6b-jenkins",
+ "allowed-address-pairs": "TVGpW77UF8i",
+ "prov-status": "FRKsQoZx",
+ "macaddr": "pyKHSVQTgpnEw",
+ "interface-role": "lN90EX",
+ "selflink": "tWy30",
+ "in-maint": false,
+ "admin-status": "V6SYyFt",
+ "is-port-mirrored": false,
+ "resource-version": "1529889840224",
+ "is-ip-unnumbered": true,
+ "network-name": "8b3x",
+ "management-option": "IiJ4Ex",
+ "interface-id": "qgH",
+ "interface-description": "77c"
+ },
+ {
+ "v6-wan-link-ip": "BxSqzB3k",
+ "interface-name": "d7193628-997f-4cb8-9772-3ef82d08f7c3-jenkins",
+ "allowed-address-pairs": "wCxdxBIr",
+ "prov-status": "GXcP",
+ "macaddr": "QWcOomv4ZA91",
+ "interface-role": "l5eAS8RS",
+ "selflink": "O9RgzEEvn",
+ "in-maint": true,
+ "admin-status": "ug2XllNOh",
+ "is-port-mirrored": false,
+ "resource-version": "1529889840229",
+ "is-ip-unnumbered": true,
+ "network-name": "la6oQgvjY4Z5",
+ "management-option": "PGNlqnpH",
+ "interface-id": "8otuL737oC7",
+ "interface-description": "BqEJ3h"
+ }
+ ]
+ },
+ "interface-name": "57964a2a-8d5e-48af-9ac0-089af4d8c968-jenkins",
+ "allowed-address-pairs": "cwJk0af9GN3",
+ "prov-status": "CPok",
+ "macaddr": "0vMHIE",
+ "interface-role": "Kkyw",
+ "selflink": "OLNd",
+ "in-maint": false,
+ "admin-status": "0dyKQiCmX",
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840254",
+ "neutron-network-id": "uPOdktFWuZjH",
+ "neutron-subnet-id": "1Vy9Xgxjds",
+ "l3-interface-ipv6-prefix-length": 431,
+ "vlan-id-inner": 313,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "64e3996d-7b54-4e05-b07e-fb5f2f2966c8-jenkins",
+ "vlan-id-outer": 972
+ },
+ {
+ "resource-version": "1529889840247",
+ "neutron-network-id": "H29D9C2hy",
+ "neutron-subnet-id": "sD4RTy",
+ "l3-interface-ipv6-prefix-length": 800,
+ "vlan-id-inner": 597,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "a80bd4b0-93b9-421d-a7a1-0da425116a1a-jenkins",
+ "vlan-id-outer": 584
+ }
+ ],
+ "is-port-mirrored": false,
+ "resource-version": "1529889840143",
+ "is-ip-unnumbered": true,
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "vf-vlan-filter": "RNYicsjOHW39H",
+ "vf-vlan-strip": false,
+ "neutron-network-id": "pbj6W",
+ "vf-broadcast-allow": false,
+ "vf-mac-anti-spoof-check": false,
+ "vf-unknown-multicast-allow": true,
+ "pci-id": "ef272d07-37f2-4c42-934f-36b7ea9f40bb-jenkins",
+ "vf-mirrors": "Oc3iPkPk",
+ "resource-version": "1529889840218",
+ "vf-link-status": "fYgzXpWSskZ06",
+ "vf-mac-filter": "xgRUu",
+ "vf-insert-stag": true,
+ "vf-vlan-anti-spoof-check": false,
+ "vf-unknown-unicast-allow": false
+ }
+ ]
+ },
+ "network-name": "qlnWBvDxGh",
+ "management-option": "zvkV4w",
+ "interface-id": "doAsSV",
+ "interface-description": "rS4CU",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 665,
+ "resource-version": "1529889840235",
+ "neutron-network-id": "dQO32ksNO1i",
+ "neutron-subnet-id": "fIRPuXsfHl3RH",
+ "vlan-id-inner": 899,
+ "l3-interface-ipv4-address": "5c11ec1e-1d13-4f28-99f6-71fcfdb8f600-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 458
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 226,
+ "resource-version": "1529889840241",
+ "neutron-network-id": "8C2IrMoc",
+ "neutron-subnet-id": "6RGtdz",
+ "vlan-id-inner": 835,
+ "l3-interface-ipv4-address": "edf54c12-22e9-4ff3-9ae4-1b2ac66e6ac0-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 905
+ }
+ ]
+ },
+ {
+ "v6-wan-link-ip": "UBtvQADW",
+ "vlans": {
+ "vlan": [
+ {
+ "vlan-description": "iK8n",
+ "vpn-key": "hfhIuxo4",
+ "prov-status": "P2KBr",
+ "vlan-id-inner": 952,
+ "vlan-id-outer": 335,
+ "orchestration-status": "tVaURe9iKl",
+ "speed-value": "et4UkQPTAh8N",
+ "in-maint": false,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840323",
+ "neutron-network-id": "uCLrTQcl7",
+ "neutron-subnet-id": "dCqtBvKBlmX",
+ "l3-interface-ipv6-prefix-length": 613,
+ "vlan-id-inner": 117,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "230b181d-717f-43d7-9bb4-9ad1bf957a91-jenkins",
+ "vlan-id-outer": 427
+ },
+ {
+ "resource-version": "1529889840317",
+ "neutron-network-id": "yAk",
+ "neutron-subnet-id": "qXcN",
+ "l3-interface-ipv6-prefix-length": 396,
+ "vlan-id-inner": 964,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "d525c688-69c3-48df-b4ef-5f5a4c791598-jenkins",
+ "vlan-id-outer": 640
+ }
+ ],
+ "resource-version": "1529889840300",
+ "is-ip-unnumbered": false,
+ "speed-units": "dSElck",
+ "vlan-interface": "63adb4ad-4349-4bbf-8e16-62b1d245ac4a-jenkins",
+ "backdoor-connection": "FdE3",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 418,
+ "resource-version": "1529889840311",
+ "neutron-network-id": "qwlh3SoZoj",
+ "neutron-subnet-id": "7fAwEuJ",
+ "vlan-id-inner": 753,
+ "l3-interface-ipv4-address": "99bb541b-7614-4cda-a74f-acebdf50d60e-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 220
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 811,
+ "resource-version": "1529889840305",
+ "neutron-network-id": "wH1eb",
+ "neutron-subnet-id": "ncQ8T9",
+ "vlan-id-inner": 265,
+ "l3-interface-ipv4-address": "1f80bd34-aa39-400e-b8d9-a858cc4bec25-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 381
+ }
+ ]
+ },
+ {
+ "vlan-description": "AmUPyMpoz",
+ "vpn-key": "zS9eKhmKY",
+ "prov-status": "bW2IFjyyrb",
+ "vlan-id-inner": 852,
+ "vlan-id-outer": 777,
+ "orchestration-status": "sjwcTB",
+ "speed-value": "1tE5qyCpE",
+ "in-maint": true,
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840292",
+ "neutron-network-id": "j866pg4Pm",
+ "neutron-subnet-id": "6Wyki",
+ "l3-interface-ipv6-prefix-length": 307,
+ "vlan-id-inner": 182,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "f6d75e58-37d6-4b7e-acb8-2e99f9b4f3c6-jenkins",
+ "vlan-id-outer": 204
+ },
+ {
+ "resource-version": "1529889840286",
+ "neutron-network-id": "1PkEbG6dYqTfi",
+ "neutron-subnet-id": "JZh6Tirqre",
+ "l3-interface-ipv6-prefix-length": 110,
+ "vlan-id-inner": 655,
+ "is-floating": true,
+ "l3-interface-ipv6-address": "36dcfb46-a281-43ec-9f19-57ad77388b86-jenkins",
+ "vlan-id-outer": 260
+ }
+ ],
+ "resource-version": "1529889840269",
+ "is-ip-unnumbered": true,
+ "speed-units": "Vde",
+ "vlan-interface": "64aefea8-d550-4328-9528-c6c20ebdcc83-jenkins",
+ "backdoor-connection": "1IYINR4x",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 807,
+ "resource-version": "1529889840274",
+ "neutron-network-id": "IOCxD0A",
+ "neutron-subnet-id": "fmUBSv4xn",
+ "vlan-id-inner": 695,
+ "l3-interface-ipv4-address": "ca68fb8b-47f5-452b-9297-5bb1bf3df3cb-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 320
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 412,
+ "resource-version": "1529889840280",
+ "neutron-network-id": "825jJkD4",
+ "neutron-subnet-id": "xm9E",
+ "vlan-id-inner": 730,
+ "l3-interface-ipv4-address": "0e19582a-6f8b-4fb5-bf49-b8ee1d94b300-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 796
+ }
+ ]
+ }
+ ]
+ },
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "v6-wan-link-ip": "fRVDB",
+ "interface-name": "1afbcfe1-fd3f-45e9-8c10-c03687bd155e-jenkins",
+ "allowed-address-pairs": "pt1w8Myf3CMX",
+ "prov-status": "aEeKbHcU13Bya",
+ "macaddr": "W6w1yt4XkZc",
+ "interface-role": "cqr1D",
+ "selflink": "0Q1th8cWl",
+ "in-maint": true,
+ "admin-status": "FyxEvTkdiprO",
+ "is-port-mirrored": true,
+ "resource-version": "1529889840342",
+ "is-ip-unnumbered": false,
+ "network-name": "NABSQ7",
+ "management-option": "4seC3CZ0zmyox",
+ "interface-id": "vM1",
+ "interface-description": "hML"
+ },
+ {
+ "v6-wan-link-ip": "wWDvY3k",
+ "interface-name": "e1f17f18-2415-4af9-b503-337117a3895a-jenkins",
+ "allowed-address-pairs": "PoPZQKwe5",
+ "prov-status": "lrbHN1Glz",
+ "macaddr": "z1z1PLeAU",
+ "interface-role": "MZW4",
+ "selflink": "8MXx36",
+ "in-maint": true,
+ "admin-status": "Togx",
+ "is-port-mirrored": false,
+ "resource-version": "1529889840336",
+ "is-ip-unnumbered": false,
+ "network-name": "IgN0B6",
+ "management-option": "kYE1hmpQcbv",
+ "interface-id": "RISQle6r",
+ "interface-description": "HxiEkqQeZOJ"
+ }
+ ]
+ },
+ "interface-name": "55595739-f1c1-40fd-8e02-ed26c8a5a273-jenkins",
+ "allowed-address-pairs": "Ku1FptLLsb",
+ "prov-status": "swt3YHhr68",
+ "macaddr": "SFuEED5Q4",
+ "interface-role": "j1Szdb",
+ "selflink": "TWML",
+ "in-maint": true,
+ "admin-status": "13qB1qn1IYJHY",
+ "l3-interface-ipv6-address-list": [
+ {
+ "resource-version": "1529889840360",
+ "neutron-network-id": "Q2jys",
+ "neutron-subnet-id": "qfV9kgabkzxT",
+ "l3-interface-ipv6-prefix-length": 408,
+ "vlan-id-inner": 856,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "33d879a4-cffc-4c9e-b3e3-ca8285904837-jenkins",
+ "vlan-id-outer": 343
+ },
+ {
+ "resource-version": "1529889840367",
+ "neutron-network-id": "lMt10eoK2AQoa",
+ "neutron-subnet-id": "1skENPqW",
+ "l3-interface-ipv6-prefix-length": 320,
+ "vlan-id-inner": 89,
+ "is-floating": false,
+ "l3-interface-ipv6-address": "86fac1bc-375d-4d9f-97e7-1e7bef843039-jenkins",
+ "vlan-id-outer": 203
+ }
+ ],
+ "is-port-mirrored": true,
+ "resource-version": "1529889840262",
+ "is-ip-unnumbered": false,
+ "sriov-vfs": {
+ "sriov-vf": [
+ {
+ "vf-vlan-filter": "ZzMNbVF3sT",
+ "vf-vlan-strip": false,
+ "neutron-network-id": "yThOSXDJtt",
+ "vf-broadcast-allow": false,
+ "vf-mac-anti-spoof-check": true,
+ "vf-unknown-multicast-allow": true,
+ "pci-id": "bf38b0ee-0d9e-4aac-b51d-4e0091063616-jenkins",
+ "vf-mirrors": "zRC0L4imSH",
+ "resource-version": "1529889840331",
+ "vf-link-status": "XMxqQi5QhOrW",
+ "vf-mac-filter": "bieb3t",
+ "vf-insert-stag": false,
+ "vf-vlan-anti-spoof-check": true,
+ "vf-unknown-unicast-allow": true
+ }
+ ]
+ },
+ "network-name": "QLvohj",
+ "management-option": "fCIqRUOOdh",
+ "interface-id": "iGkiFK",
+ "interface-description": "ERxXZI",
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-prefix-length": 153,
+ "resource-version": "1529889840348",
+ "neutron-network-id": "JehiIKkHvx",
+ "neutron-subnet-id": "Mj6TT",
+ "vlan-id-inner": 333,
+ "l3-interface-ipv4-address": "c8fe829f-04e1-448b-bebc-bd519b2750c8-jenkins",
+ "is-floating": true,
+ "vlan-id-outer": 145
+ },
+ {
+ "l3-interface-ipv4-prefix-length": 657,
+ "resource-version": "1529889840354",
+ "neutron-network-id": "PYwcY36hEY",
+ "neutron-subnet-id": "17Hs1AFpT",
+ "vlan-id-inner": 815,
+ "l3-interface-ipv4-address": "26764e8a-ad03-46e0-9031-4cbc400b1911-jenkins",
+ "is-floating": false,
+ "vlan-id-outer": 435
+ }
+ ]
+ }
+ ]
+ },
+ "interface-name": "dfa51737-16a5-4061-a295-bc5e51b31238-jenkins",
+ "prov-status": "KyURisF3pLj",
+ "interface-role": "IEn2AUkIiYlh",
+ "sriov-pfs": {
+ "sriov-pf": [
+ {
+ "resource-version": "1529889840138",
+ "pf-pci-id": "99c1731b-7ea5-4af0-9b49-fc447fc02a7f-jenkins"
+ }
+ ]
+ },
+ "selflink": "dCPBnieGuf",
+ "speed-value": "3kz6VhwJf",
+ "in-maint": true,
+ "interface-type": "sqBpLbc",
+ "port-description": "5kzHuoA",
+ "resource-version": "1529889840133",
+ "inv-status": "kH1",
+ "speed-units": "saqVmt9"
+ }
+ ]
+ },
+ "resource-version": "1529889839890",
+ "ram-in-megabytes": 886,
+ "ipaddress-v4-aim": "14Ku",
+ "management-option": "qBr",
+ "internet-topology": "eNTF",
+ "host-profile": "cd3AI9U2izq6"
+ }
+} \ 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
new file mode 100644
index 0000000..3efe88f
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/nos.json
@@ -0,0 +1,96 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "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",
+ "event-type": "AAI-EVENT",
+ "domain": "uINT1",
+ "action": "CREATE",
+ "sequence-number": "0",
+ "id": "90105aab-78f6-4d83-83b4-48488998a9bd",
+ "source-name": "SDNC",
+ "version": "v13",
+ "timestamp": "20180625-15:29:20:696"
+ },
+ "entity": {
+ "tenants": {
+ "tenant": [
+ {
+ "nos-servers": {
+ "nos-server": [
+ {
+ "nos-server-selflink": "example-nos-server-selflink-val-56832",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "generic-vnf",
+ "relationship-data": [
+ {
+ "relationship-value": "generic-vnf-987654321-89911-ps2418",
+ "relationship-key": "generic-vnf.vnf-id"
+ }
+ ],
+ "related-link": "/aai/v13/network/generic-vnfs/generic-vnf/generic-vnf-987654321-89911-ps2418",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-to-property": [
+ {
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "example-vnf-name-val-21594"
+ }
+ ]
+ },
+ {
+ "related-to": "generic-vnf",
+ "relationship-data": [
+ {
+ "relationship-value": "generic-vnf-987654321-89922-ps2418",
+ "relationship-key": "generic-vnf.vnf-id"
+ }
+ ],
+ "related-link": "/aai/v13/network/generic-vnfs/generic-vnf/generic-vnf-987654321-89922-ps2418",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-to-property": [
+ {
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "example-vnf-name-val-21594"
+ }
+ ]
+ },
+ {
+ "related-to": "pserver",
+ "relationship-data": [
+ {
+ "relationship-value": "pserver-987654321-8991-ps2418",
+ "relationship-key": "pserver.hostname"
+ }
+ ],
+ "related-link": "/aai/v13/cloud-infrastructure/pservers/pserver/pserver-987654321-8991-ps2418",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ }
+ ]
+ }
+ ]
+ },
+ "in-maint": true,
+ "vendor": "example-vendor-val-78053",
+ "resource-version": "1529940560508",
+ "nos-server-name": "example-nos-server-name-val-4811-nos-server-987654321-8991-ps2418",
+ "nos-server-id": "nos-server-987654321-8991-ps2418",
+ "prov-status": "example-prov-status-val-20734"
+ }
+ ]
+ },
+ "tenant-id": "tenant-987654321-8991-ps2418",
+ "tenant-name": "example-tenant-name-val-19302"
+ }
+ ]
+ },
+ "cloud-owner": "onap-cloud-owner",
+ "cloud-region-id": "AAIAIC25"
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/test/payloads/dmaapEvents/vce.json b/src/test/resources/test/payloads/dmaapEvents/vce.json
new file mode 100644
index 0000000..adae7ee
--- /dev/null
+++ b/src/test/resources/test/payloads/dmaapEvents/vce.json
@@ -0,0 +1,81 @@
+{
+ "cambria.partition": "AAI",
+ "event-header": {
+ "severity": "NORMAL",
+ "entity-type": "vce",
+ "top-entity-type": "vce",
+ "entity-link": "/aai/v13/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",
+ "timestamp": "20180627-16:35:28:464"
+ },
+ "entity": {
+ "entitlements": {
+ "entitlement": [
+ {
+ "resource-version": "1530117237423",
+ "group-uuid": "group-uuid-2-vce-987654321-311-ps2418",
+ "resource-uuid": "example-resource-uuid-val-8433"
+ }
+ ]
+ },
+ "service-id": "example-service-id-val-62283",
+ "vnf-id": "vce-987654321-311-ps2418",
+ "vnf-name2": "example-vnf-name2-val-9403",
+ "regional-resource-zone": "example-regional-resource-zone-val-78515",
+ "v6-vce-wan-address": "example-v6-vce-wan-address-val-36157",
+ "prov-status": "example-prov-status-val-30289",
+ "operational-status": "example-operational-status-val-52645",
+ "vpe-id": "example-vpe-id-val-22112",
+ "equipment-role": "example-equipment-role-val-15655",
+ "license-key": "example-license-key-val-94096",
+ "ipv4-oam-address": "example-ipv4-oam-address-val-38828",
+ "ipv4-loopback0-address": "example-ipv4-loopback0-address-val-22629",
+ "entitlement-resource-uuid": "example-entitlement-resource-uuid-val-545",
+ "vnf-type": "example-vnf-type-val-4945",
+ "orchestration-status": "example-orchestration-status-val-89335",
+ "licenses": {
+ "license": [
+ {
+ "resource-version": "1530117237414",
+ "group-uuid": "group-uuid-vce-987654321-311-ps2418",
+ "resource-uuid": "example-resource-uuid-val-72009"
+ }
+ ]
+ },
+ "heat-stack-id": "example-heat-stack-id-val-97607",
+ "resource-version": "1530117237387",
+ "mso-catalog-key": "example-mso-catalog-key-val-27829",
+ "vnf-name": "example-vnf-name-val-72342",
+ "port-groups": {
+ "port-group": [
+ {
+ "interface-role": "example-interface-role-val-37524",
+ "cvlan-tags": {
+ "cvlan-tag-entry": [
+ {
+ "resource-version": "1530117237399",
+ "cvlan-tag": 37491872
+ }
+ ]
+ },
+ "resource-version": "1530117237394",
+ "heat-stack-id": "example-heat-stack-id-val-90634",
+ "port-group-name": "example-port-group-name-val-2717",
+ "neutron-network-id": "example-neutron-network-id-val-27420",
+ "port-group-id": "example-port-group-id-val-16749",
+ "mso-catalog-key": "example-mso-catalog-key-val-96458",
+ "neutron-network-name": "example-neutron-network-name-val-98499",
+ "switch-name": "example-switch-name-val-78257",
+ "interface-id": "port-group-interface-id-vce-987654321-311-ps2418",
+ "orchestration-status": "example-orchestration-status-val-54586"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file