summaryrefslogtreecommitdiffstats
path: root/aai-traversal/src/test
diff options
context:
space:
mode:
authorLin, Jerry (jl319x) <jl319x@att.com>2017-08-14 12:47:28 -0400
committerLin, Jerry (jl319x) <jl319x@att.com>2017-08-14 12:54:04 -0400
commite82cd004e6f3f80bac4b7c9a00a453a27fca7790 (patch)
tree6c47c9aed0e343ed2ba9e43b0d8b6ee1d0109504 /aai-traversal/src/test
parentc97cd7981fe0c68477623af9e1268a50d6f279d6 (diff)
[AAI-147 Amsterdam] add custom queries
Change-Id: I0f03b5c63629a305d1156ff62902f872d50ff92d Signed-off-by: Lin, Jerry (jl319x) <jl319x@att.com>
Diffstat (limited to 'aai-traversal/src/test')
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/rest/search/CloudRegionFromNfTypeVendorVersionTest.java20
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/rest/search/CloudRegionFromNfTypeVendorVersion_withOptionalTest.java20
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/rest/search/ImageFromCloudRegionNfTypeTest.java20
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/rest/search/ServiceFromPserverAndSubsNameTest.java111
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/rest/search/TopologyFromCloudRegionIdAndServiceIdTest.java159
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/rest/search/TopologyFromSubscriberNameAndServiceTypeTest.java250
-rw-r--r--aai-traversal/src/test/java/org/openecomp/aai/rest/search/VserverLogicallinkFromPServerTest.java67
7 files changed, 617 insertions, 30 deletions
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/rest/search/CloudRegionFromNfTypeVendorVersionTest.java b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/CloudRegionFromNfTypeVendorVersionTest.java
index 5a39f12..e13e266 100644
--- a/aai-traversal/src/test/java/org/openecomp/aai/rest/search/CloudRegionFromNfTypeVendorVersionTest.java
+++ b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/CloudRegionFromNfTypeVendorVersionTest.java
@@ -5,16 +5,16 @@
* Copyright (C) 2017 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.
+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=========================================================
*/
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/rest/search/CloudRegionFromNfTypeVendorVersion_withOptionalTest.java b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/CloudRegionFromNfTypeVendorVersion_withOptionalTest.java
index 08a24a9..ff5e742 100644
--- a/aai-traversal/src/test/java/org/openecomp/aai/rest/search/CloudRegionFromNfTypeVendorVersion_withOptionalTest.java
+++ b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/CloudRegionFromNfTypeVendorVersion_withOptionalTest.java
@@ -5,16 +5,16 @@
* Copyright (C) 2017 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.
+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=========================================================
*/
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/rest/search/ImageFromCloudRegionNfTypeTest.java b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/ImageFromCloudRegionNfTypeTest.java
index d93f183..6bb55d6 100644
--- a/aai-traversal/src/test/java/org/openecomp/aai/rest/search/ImageFromCloudRegionNfTypeTest.java
+++ b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/ImageFromCloudRegionNfTypeTest.java
@@ -5,16 +5,16 @@
* Copyright (C) 2017 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.
+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=========================================================
*/
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/rest/search/ServiceFromPserverAndSubsNameTest.java b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/ServiceFromPserverAndSubsNameTest.java
new file mode 100644
index 0000000..264e462
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/ServiceFromPserverAndSubsNameTest.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.aai.rest.search;
+
+import java.util.Map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.Test;
+
+import org.openecomp.aai.exceptions.AAIException;
+import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+
+public class ServiceFromPserverAndSubsNameTest extends QueryTest {
+ public ServiceFromPserverAndSubsNameTest() throws AAIException, NoEdgeRuleFoundException {
+ super();
+ }
+
+ @Test
+ public void run() {
+ super.run();
+ }
+ @Override
+ protected void createGraph() throws AAIException, NoEdgeRuleFoundException {
+
+
+ //Set up the test graph
+ Vertex pserver1 = graph.addVertex(T.label, "pserver", T.id, "1", "aai-node-type", "pserver", "hostname", "pservername01");
+ Vertex pserver2 = graph.addVertex(T.label, "pserver", T.id, "2", "aai-node-type", "pserver", "hostname", "pservername02-wrong");
+
+ Vertex vserver1 = graph.addVertex(T.label, "vserver", T.id, "3", "aai-node-type", "vserver", "vserver-id", "vserverid01");
+ Vertex vserver2 = graph.addVertex(T.label, "vserver", T.id, "4", "aai-node-type", "vserver", "vserver-id", "vserverid02");
+ Vertex vserver3 = graph.addVertex(T.label, "vserver", T.id, "5", "aai-node-type", "vserver", "vserver-id", "vserverid03");
+
+ Vertex vnf1 = graph.addVertex(T.label, "generic-vnf", T.id, "8", "aai-node-type", "generic-vnf", "vnf-id", "vnfid01");
+ Vertex vnf2 = graph.addVertex(T.label, "generic-vnf", T.id, "9", "aai-node-type", "generic-vnf", "vnf-id", "vnfid02");
+ Vertex vnf3 = graph.addVertex(T.label, "generic-vnf", T.id, "10", "aai-node-type", "generic-vnf", "vnf-id", "vnfid03");
+
+ Vertex servinst1 = graph.addVertex(T.label, "service-instance", T.id, "61", "aai-node-type", "service-instance", "service-instance-id", "servInstId01", "service-type", "servType01");
+ Vertex servinst2 = graph.addVertex(T.label, "service-instance", T.id, "12", "aai-node-type", "service-instance", "service-instance-id", "servInstId02", "service-type", "servType02", "service-role", "servRole02");
+ Vertex servinst3 = graph.addVertex(T.label, "service-instance", T.id, "13", "aai-node-type", "service-instance", "service-instance-id", "servInstId03-wrong", "service-type", "servType03", "service-role", "servRole03");
+
+ Vertex servsub1 = graph.addVertex(T.label, "service-subscription", T.id, "14", "aai-node-type", "service-subscription", "service-type", "servType01");
+ Vertex servsub2 = graph.addVertex(T.label, "service-subscription", T.id, "15", "aai-node-type", "service-subscription", "service-type", "servType02");
+ Vertex servsub3 = graph.addVertex(T.label, "service-subscription", T.id, "16", "aai-node-type", "service-subscription", "service-type", "servType03-wrong");
+
+ Vertex customer1 = graph.addVertex(T.label, "customer", T.id, "17", "aai-node-type", "customer", "global-customer-id", "custid01", "subscriber-name", "subscriberName01");
+ Vertex customer2 = graph.addVertex(T.label, "customer", T.id, "18", "aai-node-type", "customer", "global-customer-id", "custid02-wrong", "subscriber-name", "subscriberName-wrong");
+
+ GraphTraversalSource g = graph.traversal();
+ rules.addEdge(g, vserver1, pserver1); //true
+ rules.addEdge(g, vnf1, vserver1); //true
+ rules.addEdge(g, vnf1, servinst1); //true
+ rules.addTreeEdge(g, servinst1, servsub1); //true
+ rules.addTreeEdge(g, servsub1, customer1); //true
+
+ rules.addEdge(g, vserver2, pserver1); //true
+ rules.addEdge(g, vnf2, vserver2); //true
+ rules.addEdge(g, vnf2, servinst2); //true
+ rules.addEdge(g, vnf2, servinst3); //false
+ rules.addTreeEdge(g, servinst2, servsub2); //true
+ rules.addTreeEdge(g, servsub2, customer1); //true
+
+ rules.addEdge(g, vserver3, pserver2); //false
+ rules.addEdge(g, vnf3, vserver3); //false
+ rules.addEdge(g, vnf3, servinst3); //false
+ rules.addTreeEdge(g, servinst3, servsub3); //false
+ rules.addTreeEdge(g, servsub3, customer2); //false
+
+
+ expectedResult.add(servinst1);
+ expectedResult.add(servsub1);
+ expectedResult.add(servinst2);
+ expectedResult.add(servsub2);
+
+ }
+
+ @Override
+ protected String getQueryName() {
+ return "service-fromPserverandSubsName";
+ }
+ @Override
+ protected void addStartNode(GraphTraversal<Vertex, Vertex> g) {
+ g.has("aai-node-type","pserver").has("hostname", "pservername01");
+ }
+
+ @Override
+ protected void addParam(Map<String, Object> params) {
+ params.put("subscriberName","subscriberName01");
+ }
+}
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/rest/search/TopologyFromCloudRegionIdAndServiceIdTest.java b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/TopologyFromCloudRegionIdAndServiceIdTest.java
new file mode 100644
index 0000000..5f560c6
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/TopologyFromCloudRegionIdAndServiceIdTest.java
@@ -0,0 +1,159 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.aai.rest.search;
+
+import java.util.Map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.Test;
+
+import org.openecomp.aai.exceptions.AAIException;
+import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+
+public class TopologyFromCloudRegionIdAndServiceIdTest extends QueryTest {
+ public TopologyFromCloudRegionIdAndServiceIdTest() throws AAIException, NoEdgeRuleFoundException {
+ super();
+ }
+
+ @Test
+ public void run() {
+ super.run();
+ }
+
+ @Override
+ protected void createGraph() throws AAIException, NoEdgeRuleFoundException {
+ //Set up the test graph
+ Vertex serviceinstance1 = graph.addVertex(T.label, "service-instance", T.id, "61", "aai-node-type", "service-instance", "service-instance-id", "service-instance-id-1", "service-instance-name", "service-instance-name-1");
+ Vertex cloudregion1 = graph.addVertex(T.label, "cloud-region", T.id, "1", "aai-node-type", "cloud-region", "cloud-region-id", "cloud-region-id-1", "cloud-owner", "cloud-owner-1");
+ Vertex availibityzone1 = graph.addVertex(T.label, "cloud-region", T.id, "2", "aai-node-type", "availability-zone", "availability-zone-name", "az-name-1", "hypervisor-type", "hypervisortype-1");
+ Vertex gnvf1 = graph.addVertex(T.label, "generic-vnf", T.id, "3", "aai-node-type", "generic-vnf", "vnf-id", "vnf-id-1", "vnf-name", "vnf-name-1", "service-id", "service-id-1");
+
+ Vertex vserver1 = graph.addVertex(T.label, "vserver", T.id, "7", "aai-node-type", "vserver", "vserver-id", "vserver-id-1", "vserver-name", "vserver-name-1", "vserver-selflink", "vserver-selflink-1");
+ Vertex flavor1 = graph.addVertex(T.label, "flavor", T.id, "8", "aai-node-type", "flavor", "flavor-id", "flavor-id-1", "flavor-name", "flavor-name-1", "flavor-selflink", "flavor-selflink-1");
+ Vertex image1 = graph.addVertex(T.label, "image", T.id, "9", "aai-node-type", "image", "image-id", "image-id-1", "image-name", "image-name-1", "image-os-distro", "image-os-distro-1", "image-os-version", "image-os-version-1");
+ Vertex volume1 = graph.addVertex(T.label, "volume", T.id, "10", "aai-node-type", "volume", "volume-id", "volume-id-1", "volume-selflink", "volume-selflink-1");
+ Vertex vnfc1 = graph.addVertex(T.label, "vnfc", T.id, "11", "aai-node-type", "vnfc", "vnfc-name", "vnfc-name-1", "nfc-naming-code", "nfc-naming-code-1");
+ Vertex snapshot1 = graph.addVertex(T.label, "snapshot", T.id, "12", "aai-node-type", "snapshot", "snapshot-id", "snapshot-id-1");
+ Vertex vfmodule1 = graph.addVertex(T.label, "vf-module", T.id, "13", "aai-node-type", "vf-module", "vf-module-id", "vf-module-id-1", "vf-module-name", "vf-module-name1");
+ Vertex linter1 = graph.addVertex(T.label, "l-interface", T.id, "14", "aai-node-type", "l-interface", "l-interface-id", "l-interface-id-1", "l-interface-name", "l-interface-name1");
+ Vertex logicallink1 = graph.addVertex(T.label, "logical-link", T.id, "15", "aai-node-type", "logical-link", "link-name", "link-name-1", "l-interface-name", "l-interface-name1");
+ Vertex l3inter1ipv4addresslist = graph.addVertex(T.label, "interface-ipv4-address-list", T.id, "16", "aai-node-type", "l3-interface-ipv4-address-list", "l3-interface-ipv4-address", "l3-interface-ipv4-address-1");
+ Vertex subnet14 = graph.addVertex(T.label, "subnet", T.id, "17", "aai-node-type", "subnet", "subnet-id", "subnet-id-14");
+ Vertex l3network14 = graph.addVertex(T.label, "l3-network", T.id, "18", "aai-node-type", "l3-network", "network-id", "network-id-14", "network-name", "network-name-14");
+ Vertex l3inter1ipv6addresslist = graph.addVertex(T.label, "l3-interface-ipv6-address-list", T.id, "19", "aai-node-type", "l3-interface-ipv6-address-list", "l3-interface-ipv6-address", "l3-interface-ipv6-address-1");
+ Vertex subnet16 = graph.addVertex(T.label, "subnet", T.id, "20", "aai-node-type", "subnet", "subnet-id", "subnet-id-16");
+ Vertex l3network16 = graph.addVertex(T.label, "l3-network", T.id, "21", "aai-node-type", "l3-network", "network-id", "network-id-16", "network-name", "network-name16");
+
+ Vertex gnvf2 = graph.addVertex(T.label, "generic-vnf", T.id, "33", "aai-node-type", "generic-vnf", "vnf-id", "vnf-id-2", "vnf-name", "vnf-name-2", "service-id", "service-id-wrong");
+ Vertex serviceinstance2 = graph.addVertex(T.label, "service-instance", T.id, "36", "aai-node-type", "service-instance", "service-instance-id", "servInstId-2", "service-type", "servType-2", "service-role", "servRole-2");
+ Vertex vserver2 = graph.addVertex(T.label, "vserver", T.id, "37", "aai-node-type", "vserver", "vserver-id", "vserver-id-2", "vserver-name", "vserver-name-2", "vserver-selflink", "vserver-selflink-2");
+ Vertex flavor2 = graph.addVertex(T.label, "flavor", T.id, "38", "aai-node-type", "flavor", "flavor-id", "flavor-id-2", "flavor-name", "flavor-name-2", "flavor-selflink", "flavor-selflink-2");
+ Vertex image2 = graph.addVertex(T.label, "image", T.id, "39", "aai-node-type", "image", "image-id", "image-id-2", "image-name", "image-name-2", "image-os-distro", "image-os-distro-2", "image-os-version", "image-os-version-2");
+ Vertex volume2 = graph.addVertex(T.label, "volume", T.id, "40", "aai-node-type", "volume", "volume-id", "volume-id-2", "volume-selflink", "volume-selflink-2");
+ Vertex vnfc2 = graph.addVertex(T.label, "vnfc", T.id, "41", "aai-node-type", "vnfc", "vnfc-name", "vnfc-name-2", "nfc-naming-code", "nfc-naming-code-2");
+ Vertex snapshot2 = graph.addVertex(T.label, "snapshot", T.id, "42", "aai-node-type", "snapshot", "snapshot-id", "snapshot-id-2");
+ Vertex vfmodule2 = graph.addVertex(T.label, "vf-module", T.id, "43", "aai-node-type", "vf-module", "vf-module-id", "vf-module-id-2", "vf-module-name", "vf-module-name2");
+ Vertex linter2 = graph.addVertex(T.label, "l-interface", T.id, "44", "aai-node-type", "l-interface", "l-interface-id", "l-interface-id-2", "l-interface-name", "l-interface-name2");
+ Vertex logicallink2 = graph.addVertex(T.label, "logical-link", T.id, "45", "aai-node-type", "logical-link", "link-name", "link-name-2", "l-interface-name", "l-interface-name2");
+ Vertex l3inter1ipv4addresslist2 = graph.addVertex(T.label, "interface-ipv4-address-list", T.id, "46", "aai-node-type", "l3-interface-ipv4-address-list", "l3-interface-ipv4-address", "l3-interface-ipv4-address-2");
+ Vertex subnet24 = graph.addVertex(T.label, "subnet", T.id, "47", "aai-node-type", "subnet", "subnet-id", "subnet-id-24");
+ Vertex l3network24 = graph.addVertex(T.label, "l3-network", T.id, "48", "aai-node-type", "l3-network", "network-id", "network-id-24", "network-name", "network-name-24");
+ Vertex l3inter1ipv6addresslist2 = graph.addVertex(T.label, "l3-interface-ipv6-address-list", T.id, "49", "aai-node-type", "l3-interface-ipv6-address-list", "l3-interface-ipv6-address", "l3-interface-ipv6-address-2");
+ Vertex subnet26 = graph.addVertex(T.label, "subnet", T.id, "50", "aai-node-type", "subnet", "subnet-id", "subnet-id-26");
+ Vertex l3network26 = graph.addVertex(T.label, "l3-network", T.id, "51", "aai-node-type", "l3-network", "network-id", "network-id-26", "network-name", "network-name26");
+
+ GraphTraversalSource g = graph.traversal();
+ rules.addTreeEdge(g, cloudregion1, availibityzone1);//true
+ rules.addEdge(g, availibityzone1, gnvf1);//true
+ rules.addEdge(g, gnvf1, serviceinstance1);//true
+ rules.addEdge(g, gnvf1, vserver1);//true
+
+ rules.addEdge(g, vserver1, flavor1);//true
+ rules.addEdge(g, vserver1, image1);//true
+ rules.addTreeEdge(g, vserver1, volume1);//true
+ rules.addEdge(g, vserver1, vnfc1);//true
+ rules.addEdge(g, vserver1, snapshot1);//true
+ rules.addEdge(g, vserver1, vfmodule1);//true
+ rules.addEdge(g, linter1, logicallink1);//true
+ rules.addTreeEdge(g, vserver1, linter1);//true
+ rules.addTreeEdge(g, linter1, l3inter1ipv4addresslist);//true
+ rules.addTreeEdge(g, linter1, l3inter1ipv6addresslist);//true
+ rules.addEdge(g, l3inter1ipv4addresslist, subnet14);//true
+ rules.addTreeEdge(g, subnet14, l3network14);//true
+ rules.addEdge(g, l3inter1ipv6addresslist, subnet16);//true
+ rules.addTreeEdge(g, subnet16, l3network16);//true
+
+ // false
+ rules.addEdge(g, availibityzone1, gnvf2);
+ rules.addEdge(g, gnvf2, serviceinstance2);
+ rules.addEdge(g, gnvf2, vserver2);
+ rules.addEdge(g, vserver2, flavor2);
+ rules.addEdge(g, vserver2, image2);
+ rules.addTreeEdge(g, vserver2, volume2);
+ rules.addEdge(g, vserver2, vnfc2);
+ rules.addEdge(g, vserver2, snapshot2);
+ rules.addEdge(g, vserver2, vfmodule2);
+ rules.addEdge(g, linter2, logicallink2);
+ rules.addTreeEdge(g, vserver2, linter2);
+ rules.addTreeEdge(g, linter2, l3inter1ipv4addresslist2);
+ rules.addTreeEdge(g, linter2, l3inter1ipv6addresslist2);
+ rules.addEdge(g, l3inter1ipv4addresslist2, subnet24);
+ rules.addTreeEdge(g, subnet24, l3network24);
+ rules.addEdge(g, l3inter1ipv6addresslist2, subnet26);
+ rules.addTreeEdge(g, subnet26, l3network26);
+
+
+ expectedResult.add(serviceinstance1);
+ expectedResult.add(vserver1);
+ expectedResult.add(flavor1);
+ expectedResult.add(image1);
+ expectedResult.add(volume1);
+ expectedResult.add(vnfc1);
+ expectedResult.add(snapshot1);
+ expectedResult.add(vfmodule1);
+ expectedResult.add(linter1);
+ expectedResult.add(logicallink1);
+ expectedResult.add(l3inter1ipv4addresslist);
+ expectedResult.add(subnet14);
+ expectedResult.add(l3network14);
+ expectedResult.add(l3inter1ipv6addresslist);
+ expectedResult.add(subnet16);
+ expectedResult.add(l3network16);
+
+ }
+
+ @Override
+ protected String getQueryName() {
+ return "topology-fromCloudRegionIdandServiceId";
+ }
+ @Override
+ protected void addStartNode(GraphTraversal<Vertex, Vertex> g) {
+ g.has("aai-node-type","cloud-region").has("cloud-owner","cloud-owner-1").has("cloud-region-id","cloud-region-id-1");
+
+ }
+ @Override
+ protected void addParam(Map<String, Object> params) {
+ params.put("serviceId", "service-id-1");
+ }
+}
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/rest/search/TopologyFromSubscriberNameAndServiceTypeTest.java b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/TopologyFromSubscriberNameAndServiceTypeTest.java
new file mode 100644
index 0000000..e0ac233
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/TopologyFromSubscriberNameAndServiceTypeTest.java
@@ -0,0 +1,250 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.openecomp.aai
+ * ================================================================================
+ * Copyright (C) 2017 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.openecomp.aai.rest.search;
+
+import java.util.Map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.common.base.CaseFormat;
+import org.junit.Test;
+
+import org.openecomp.aai.exceptions.AAIException;
+import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+
+public class TopologyFromSubscriberNameAndServiceTypeTest extends QueryTest {
+ private static final EELFLogger LOGGER = EELFManager.getInstance()
+ .getLogger(TopologyFromSubscriberNameAndServiceTypeTest.class);
+
+ public TopologyFromSubscriberNameAndServiceTypeTest() throws AAIException, NoEdgeRuleFoundException {
+ super();
+ }
+
+ @Test
+ public void run() {
+ super.run();
+ }
+
+ @Override
+ protected void createGraph() throws AAIException, NoEdgeRuleFoundException {
+ // Set up the test graph
+ Vertex customer1 = graph.addVertex(T.label, "customer", T.id, "1", "aai-node-type", "customer",
+ "global-customer-id", "global-customer-id-1", "subscriber-name", "subscriber-name-1");
+ //Customer has 2 subscriptions - we filter by subscription-type
+ Vertex servicesubscription1 = graph.addVertex(T.label, "service-subscription", T.id, "2", "aai-node-type",
+ "service-subscription", "service-type", "service-type-1");
+ Vertex servicesubscription112 = graph.addVertex(T.label, "service-subscription", T.id, "112", "aai-node-type",
+ "service-subscription", "service-type", "service-type-112");
+
+ Vertex serviceinstance1 = graph.addVertex(T.label, "service-instance", T.id, "3", "aai-node-type",
+ "service-instance", "service-instance-id", "service-instance-id-1", "service-instance-name",
+ "service-instance-name-1");
+ Vertex serviceinstance113 = graph.addVertex(T.label, "service-instance", T.id, "113", "aai-node-type",
+ "service-instance", "service-instance-id", "service-instance-id-113", "service-instance-name",
+ "service-instance-name-113");
+
+ Vertex gnvf1 = graph.addVertex(T.label, "generic-vnf", T.id, "4", "aai-node-type", "generic-vnf", "vnf-id",
+ "vnf-id-1", "vnf-name", "vnf-name-1", "service-id", "service-id-1");
+ Vertex gnvf114 = graph.addVertex(T.label, "generic-vnf", T.id, "114", "aai-node-type", "generic-vnf", "vnf-id",
+ "vnf-id-114", "vnf-name", "vnf-name-2", "service-id", "service-id-2");
+
+ Vertex pserver1 = graph.addVertex(T.label, "pserver", T.id, "5", "aai-node-type", "pserver", "hostname",
+ "pservername1");
+ Vertex pserver115 = graph.addVertex(T.label, "pserver", T.id, "115", "aai-node-type", "pserver", "hostname",
+ "pservername115");
+
+ Vertex complex1 = graph.addVertex(T.label, "complex", T.id, "6", "aai-node-type", "complex",
+ "physical-location-id", "physical-location-id-1", "country", "US");
+
+ Vertex pnfint1 = graph.addVertex(T.label, "p-interface", T.id, "7", "aai-node-type", "p-interface",
+ "interface-name", "ge0/0/0");
+
+ Vertex vserver1 = graph.addVertex(T.label, "vserver", T.id, "8", "aai-node-type", "vserver", "vserver-id",
+ "vserver-id-1", "vserver-name", "vserver-name-1", "vserver-selflink", "vserver-selflink-1");
+
+ Vertex vserver116 = graph.addVertex(T.label, "vserver", T.id, "116", "aai-node-type", "vserver", "vserver-id",
+ "vserver-id-116", "vserver-name", "vserver-name-116", "vserver-selflink", "vserver-selflink-116");
+
+ Vertex flavor1 = graph.addVertex(T.label, "flavor", T.id, "9", "aai-node-type", "flavor", "flavor-id",
+ "flavor-id-1", "flavor-name", "flavor-name-1", "flavor-selflink", "flavor-selflink-1");
+ Vertex image1 = graph.addVertex(T.label, "image", T.id, "10", "aai-node-type", "image", "image-id",
+ "image-id-1", "image-name", "image-name-1", "image-os-distro", "image-os-distro-1", "image-os-version",
+ "image-os-version-1");
+
+ Vertex linter1 = graph.addVertex(T.label, "l-interface", T.id, "11", "aai-node-type", "l-interface",
+ "l-interface-id", "l-interface-id-1", "l-interface-name", "l-interface-name1");
+ Vertex logicallink1 = graph.addVertex(T.label, "logical-link", T.id, "12", "aai-node-type", "logical-link",
+ "link-name", "link-name-1", "l-interface-name", "l-interface-name1");
+ Vertex l3inter1ipv4addresslist = graph.addVertex(T.label, "interface-ipv4-address-list", T.id, "13",
+ "aai-node-type", "l3-interface-ipv4-address-list", "l3-interface-ipv4-address",
+ "l3-interface-ipv4-address-1");
+ Vertex subnet1 = graph.addVertex(T.label, "subnet", T.id, "14", "aai-node-type", "subnet", "subnet-id",
+ "subnet-id-1");
+ Vertex l3network1 = graph.addVertex(T.label, "l3-network", T.id, "15", "aai-node-type", "l3-network",
+ "network-id", "network-id-1", "network-name", "network-name-1");
+ Vertex l3inter1ipv6addresslist = graph.addVertex(T.label, "l3-interface-ipv6-address-list", T.id, "16",
+ "aai-node-type", "l3-interface-ipv6-address-list", "l3-interface-ipv6-address",
+ "l3-interface-ipv6-address-1");
+ Vertex subnet2 = graph.addVertex(T.label, "subnet", T.id, "17", "aai-node-type", "subnet", "subnet-id",
+ "subnet-id-2");
+ Vertex l3network2 = graph.addVertex(T.label, "l3-network", T.id, "18", "aai-node-type", "l3-network",
+ "network-id", "network-id-2", "network-name", "network-name2");
+
+ Vertex customer2 = graph.addVertex(T.label, "customer", T.id, "19", "aai-node-type", "customer",
+ "global-customer-id", "global-customer-id-2", "subscriber-name", "subscriber-name-2");
+ Vertex servicesubscription2 = graph.addVertex(T.label, "service-subscription", T.id, "20", "aai-node-type",
+ "service-subscription", "service-type", "service-type-2");
+ Vertex serviceinstance2 = graph.addVertex(T.label, "service-instance", T.id, "21", "aai-node-type",
+ "service-instance", "service-instance-id", "service-instance-id-2", "service-instance-name",
+ "service-instance-name-2");
+ Vertex gnvf2 = graph.addVertex(T.label, "generic-vnf", T.id, "22", "aai-node-type", "generic-vnf", "vnf-id",
+ "vnf-id-2", "vnf-name", "vnf-name-2", "service-id", "service-id-2");
+
+ Vertex pserver2 = graph.addVertex(T.label, "pserver", T.id, "23", "aai-node-type", "pserver", "hostname",
+ "pservername1");
+ Vertex complex2 = graph.addVertex(T.label, "complex", T.id, "24", "aai-node-type", "complex",
+ "physical-location-id", "physical-location-id-2", "country", "US");
+ Vertex pnfint2 = graph.addVertex(T.label, "p-interface", T.id, "25", "aai-node-type", "p-interface",
+ "interface-name", "ge0/0/0");
+
+ Vertex plink1 = graph.addVertex(T.label, "physical-link", T.id, "251", "aai-node-type", "physical-link", "link-name", "ge0/0/0-to-xe0/0/0");
+
+ Vertex vserver2 = graph.addVertex(T.label, "vserver", T.id, "26", "aai-node-type", "vserver", "vserver-id",
+ "vserver-id-2", "vserver-name", "vserver-name-2", "vserver-selflink", "vserver-selflink-2");
+ Vertex flavor2 = graph.addVertex(T.label, "flavor", T.id, "27", "aai-node-type", "flavor", "flavor-id",
+ "flavor-id-2", "flavor-name", "flavor-name-2", "flavor-selflink", "flavor-selflink-2");
+ Vertex image2 = graph.addVertex(T.label, "image", T.id, "28", "aai-node-type", "image", "image-id",
+ "image-id-2", "image-name", "image-name-2", "image-os-distro", "image-os-distro-2", "image-os-version",
+ "image-os-version-2");
+
+ Vertex linter2 = graph.addVertex(T.label, "l-interface", T.id, "29", "aai-node-type", "l-interface",
+ "l-interface-id", "l-interface-id-2", "l-interface-name", "l-interface-name2");
+ Vertex logicallink2 = graph.addVertex(T.label, "logical-link", T.id, "30", "aai-node-type", "logical-link",
+ "link-name", "link-name-2", "l-interface-name", "l-interface-name2");
+ Vertex l3inter1ipv4addresslist2 = graph.addVertex(T.label, "interface-ipv4-address-list", T.id, "31",
+ "aai-node-type", "l3-interface-ipv4-address-list", "l3-interface-ipv4-address",
+ "l3-interface-ipv4-address-2");
+ Vertex subnet3 = graph.addVertex(T.label, "subnet", T.id, "32", "aai-node-type", "subnet", "subnet-id",
+ "subnet-id-3");
+ Vertex l3network3 = graph.addVertex(T.label, "l3-network", T.id, "33", "aai-node-type", "l3-network",
+ "network-id", "network-id-3", "network-name", "network-name-3");
+ Vertex l3inter1ipv6addresslist2 = graph.addVertex(T.label, "l3-interface-ipv6-address-list", T.id, "34",
+ "aai-node-type", "l3-interface-ipv6-address-list", "l3-interface-ipv6-address",
+ "l3-interface-ipv6-address-2");
+ Vertex subnet4 = graph.addVertex(T.label, "subnet", T.id, "35", "aai-node-type", "subnet", "subnet-id",
+ "subnet-id-4");
+ Vertex l3network4 = graph.addVertex(T.label, "l3-network", T.id, "36", "aai-node-type", "l3-network",
+ "network-id", "network-id-4", "network-name", "network-name4");
+
+ GraphTraversalSource g = graph.traversal();
+ rules.addTreeEdge(g, customer1, servicesubscription1);// true
+
+ rules.addTreeEdge(g, customer1, servicesubscription112);// true
+
+ rules.addTreeEdge(g, servicesubscription1, serviceinstance1);// true
+ rules.addTreeEdge(g, servicesubscription1, serviceinstance113);// true
+
+
+ rules.addEdge(g, serviceinstance1, gnvf1);// true
+ rules.addEdge(g, serviceinstance113, gnvf114);// true
+
+ rules.addEdge(g, gnvf1, vserver1);// true
+ rules.addEdge(g, gnvf114, vserver116);// true
+
+ rules.addEdge(g, gnvf1, pserver1);// true
+ rules.addEdge(g, gnvf114, pserver115);// true
+
+ rules.addEdge(g, pserver1, complex1);// true
+ rules.addTreeEdge(g, pserver1, pnfint1);
+ rules.addEdge(g, pnfint1, plink1);
+
+ rules.addEdge(g, vserver1, flavor1);// true
+ rules.addEdge(g, vserver1, image1);// true
+ rules.addEdge(g, vserver1, pserver1);// true
+ rules.addEdge(g, linter1, logicallink1);// true
+ rules.addTreeEdge(g, vserver1, linter1);// true
+ rules.addTreeEdge(g, linter1, l3inter1ipv4addresslist);// true
+ rules.addTreeEdge(g, linter1, l3inter1ipv6addresslist);// true
+ rules.addEdge(g, l3inter1ipv4addresslist, subnet1);// true
+ rules.addTreeEdge(g, subnet1, l3network1);// true
+ rules.addEdge(g, l3inter1ipv6addresslist, subnet2);// true
+ rules.addTreeEdge(g, subnet2, l3network2);// true
+ // false
+
+ rules.addTreeEdge(g, customer2, servicesubscription2);// true
+ rules.addTreeEdge(g, servicesubscription2, serviceinstance2);// true
+ rules.addEdge(g, serviceinstance2, gnvf2);// true
+ rules.addEdge(g, gnvf2, pserver2);// true
+ rules.addEdge(g, pserver2, complex2);// true
+ rules.addTreeEdge(g, pserver2, pnfint2);// true
+
+ rules.addEdge(g, gnvf2, vserver2);// true
+
+ rules.addEdge(g, vserver2, flavor2);// true
+ rules.addEdge(g, vserver2, image2);// true
+ rules.addEdge(g, linter2, logicallink2);// true
+ rules.addTreeEdge(g, vserver2, linter2);// true
+ rules.addTreeEdge(g, linter2, l3inter1ipv4addresslist2);// true
+ rules.addTreeEdge(g, linter2, l3inter1ipv6addresslist2);// true
+ rules.addEdge(g, l3inter1ipv4addresslist2, subnet3);// true
+ rules.addTreeEdge(g, subnet3, l3network3);// true
+ rules.addEdge(g, l3inter1ipv6addresslist2, subnet4);// true
+ rules.addTreeEdge(g, subnet4, l3network4);// true
+
+ expectedResult.add(complex1);
+ expectedResult.add(vserver1);
+ expectedResult.add(vserver116);
+ expectedResult.add(pserver1);
+ expectedResult.add(flavor1);
+ expectedResult.add(image1);
+ expectedResult.add(linter1);
+ expectedResult.add(logicallink1);
+ expectedResult.add(plink1);
+ expectedResult.add(l3inter1ipv4addresslist);
+ expectedResult.add(subnet1);
+ expectedResult.add(l3network1);
+ expectedResult.add(l3inter1ipv6addresslist);
+ expectedResult.add(subnet2);
+ expectedResult.add(l3network2);
+
+ }
+
+ @Override
+ protected String getQueryName() {
+ return "spaas-topology-fromServiceInstance";
+ }
+
+ @Override
+ protected void addStartNode(GraphTraversal<Vertex, Vertex> g) {
+ g.has("aai-node-type", "customer").has("global-customer-id", "global-customer-id-1").out("subscribesTo").has("aai-node-type","service-subscription").has("service-type", "service-type-1").out("hasInstance").has("aai-node-type","service-instance");
+ }
+
+ @Override
+ protected void addParam(Map<String, Object> params) {
+ //params.put("serviceType", "service-type-1");
+ //params.put("subscriberName", "subscriber-name-1");
+ }
+}
diff --git a/aai-traversal/src/test/java/org/openecomp/aai/rest/search/VserverLogicallinkFromPServerTest.java b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/VserverLogicallinkFromPServerTest.java
new file mode 100644
index 0000000..510be9b
--- /dev/null
+++ b/aai-traversal/src/test/java/org/openecomp/aai/rest/search/VserverLogicallinkFromPServerTest.java
@@ -0,0 +1,67 @@
+package org.openecomp.aai.rest.search;
+
+import static org.junit.Assert.*;
+
+import java.util.Map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.junit.Test;
+import org.openecomp.aai.exceptions.AAIException;
+import org.openecomp.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
+
+public class VserverLogicallinkFromPServerTest extends QueryTest {
+
+ public VserverLogicallinkFromPServerTest() throws AAIException, NoEdgeRuleFoundException {
+ super();
+ }
+
+ @Test
+ public void test() {
+ super.run();
+ }
+
+ @Override
+ protected void createGraph() throws AAIException, NoEdgeRuleFoundException {
+ //Set up the test graph
+ Vertex pserver1 = graph.addVertex(T.label, "pserver", T.id, "1", "aai-node-type", "pserver", "hostname", "hostname-1");
+ Vertex vserver1 = graph.addVertex(T.label, "vserver", T.id, "2", "aai-node-type", "vserver", "vserver-id", "vserver-id-1", "vserver-name", "vserver-name-1");
+ Vertex lInterface1 = graph.addVertex(T.label, "l-interface", T.id, "3", "aai-node-type", "l-interface", "interface-name", "interface-name-1");
+ Vertex logicalLink1 = graph.addVertex(T.label, "l", T.id, "4", "aai-node-type", "logical-link", "link-name", "link-name-1");
+
+ Vertex pserver2 = graph.addVertex(T.label, "pserver", T.id, "5", "aai-node-type", "pserver", "hostname", "hostname-2");
+ Vertex vserver2 = graph.addVertex(T.label, "vserver", T.id, "6", "aai-node-type", "vserver", "vserver-id", "vserver-id-2", "vserver-name", "vserver-name-2");
+ Vertex lInterface2 = graph.addVertex(T.label, "l-interface", T.id, "7", "aai-node-type", "l-interface", "interface-name", "interface-name-2");
+ Vertex logicalLink2 = graph.addVertex(T.label, "l", T.id, "8", "aai-node-type", "logical-link", "link-name", "link-name-2");
+
+ GraphTraversalSource g = graph.traversal();
+ rules.addEdge(g, pserver1, vserver1);
+ rules.addTreeEdge(g, vserver1, lInterface1);
+ rules.addEdge(g, lInterface1, logicalLink1);
+
+ rules.addEdge(g, pserver2, vserver2);
+ rules.addTreeEdge(g, vserver2, lInterface2);
+ rules.addEdge(g, lInterface2, logicalLink2);
+
+ expectedResult.add(vserver1);
+ expectedResult.add(logicalLink1);
+ }
+
+ @Override
+ protected String getQueryName() {
+ return "vserverlogicallink-frompServer";
+ }
+
+ @Override
+ protected void addStartNode(GraphTraversal<Vertex, Vertex> g) {
+ g.has("hostname", "hostname-1");
+ }
+
+ @Override
+ protected void addParam(Map<String, Object> params) {
+ return;
+ }
+
+}