2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.aai.rest.search;
24 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
25 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
26 import org.apache.tinkerpop.gremlin.structure.T;
27 import org.apache.tinkerpop.gremlin.structure.Vertex;
28 import org.junit.Test;
29 import org.onap.aai.exceptions.AAIException;
30 import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
32 public class UcpeInstanceQueryTest extends QueryTest {
34 public UcpeInstanceQueryTest() throws AAIException, NoEdgeRuleFoundException {
44 protected void createGraph() throws AAIException, NoEdgeRuleFoundException {
45 Vertex complex = graph.addVertex(T.label, "complex", T.id, "0", "aai-node-type", "complex",
46 "physical-location-id", "clli");
47 Vertex pserver = graph.addVertex(T.label, "pserver", T.id, "1", "aai-node-type", "pserver",
48 "hostname", "pservername");
49 Vertex pnf = graph.addVertex(T.label, "pnf", T.id, "11", "aai-node-type", "pnf", "pnf-name",
51 Vertex vnf = graph.addVertex(T.label, "generic-vnf", T.id, "7", "aai-node-type",
52 "generic-vnf", "vnf-id", "vnfuuid");
53 Vertex pserverint = graph.addVertex(T.label, "p-interface", T.id, "2", "aai-node-type",
54 "p-interface", "interface-name", "xe0/0/0");
55 Vertex pnfint = graph.addVertex(T.label, "p-interface", T.id, "12", "aai-node-type",
56 "p-interface", "interface-name", "ge0/0/0");
58 GraphTraversalSource g = graph.traversal();
59 rules.addEdge(g, pserver, complex);
60 rules.addEdge(g, pnf, complex);
61 rules.addEdge(g, vnf, pserver);
62 rules.addTreeEdge(g, pserver, pserverint);
63 rules.addTreeEdge(g, pnf, pnfint);
65 expectedResult.add(complex);
66 expectedResult.add(pserver);
67 // expectedResult.add(pnf);
72 protected String getQueryName() {
73 return "ucpe-instance";
77 protected void addStartNode(GraphTraversal<Vertex, Vertex> g) {
78 g.has("hostname", "pservername");
79 // g.has("pnf-name", "pnfname");
83 protected void addParam(Map<String, Object> params) {