summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java4
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java14
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java13
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java4
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java5
-rw-r--r--common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java53
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java1
-rw-r--r--common/src/main/java/org/onap/so/client/cds/CDSProperties.java3
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java72
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java7
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java11
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java41
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java2
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java15
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java5
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java5
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java40
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java36
-rw-r--r--common/src/main/java/org/onap/so/logger/MsoLogger.java80
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java65
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java9
-rw-r--r--common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java29
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java2
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java4
-rw-r--r--common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java9
-rw-r--r--common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java15
-rw-r--r--common/src/test/resources/__files/aai/query/pathed-result.json12
-rw-r--r--common/src/test/resources/__files/aai/query/single-query-result.json80
28 files changed, 516 insertions, 120 deletions
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index 76134a42f4..4284cea847 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -262,6 +262,10 @@ public abstract class RestClient {
public <T> T put(Object obj, Class<T> resultClass) {
return format(method("PUT", obj), resultClass).orElse(null);
}
+
+ public <T> T put(Object obj, GenericType<T> resultClass) {
+ return format(method("PUT", obj), resultClass).orElse(null);
+ }
public <T> T delete(Class<T> resultClass) {
return format(method("DELETE", null), resultClass).orElse(null);
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java b/common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java
index 4cee4f3df7..5f2c623d57 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java
@@ -20,12 +20,13 @@
package org.onap.so.client.aai;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryQueryClient;
import org.onap.so.client.graphinventory.entities.DSLQuery;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
-public class AAIDSLQueryClient extends GraphInventoryQueryClient<AAIDSLQueryClient, DSLQuery> {
+public class AAIDSLQueryClient extends GraphInventoryQueryClient<AAIDSLQueryClient, DSLQuery, AAIResultWrapper, AAIObjectType> {
public AAIDSLQueryClient() {
super(new AAIClient());
@@ -40,4 +41,15 @@ public class AAIDSLQueryClient extends GraphInventoryQueryClient<AAIDSLQueryClie
return AAIUriFactory.createResourceUri(AAIObjectType.DSL);
}
+
+ @Override
+ public AAIResultWrapper createWrapper(String json) {
+ return new AAIResultWrapper(json);
+ }
+
+ @Override
+ public AAIObjectType createType(String name) {
+ return AAIObjectType.fromTypeName(name);
+ }
+
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java b/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
index 66d5d1f5cb..cc855e444a 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
@@ -20,12 +20,13 @@
package org.onap.so.client.aai;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.CustomQuery;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.GraphInventoryQueryClient;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
-public class AAIQueryClient extends GraphInventoryQueryClient<AAIQueryClient, CustomQuery> {
+public class AAIQueryClient extends GraphInventoryQueryClient<AAIQueryClient, CustomQuery, AAIResultWrapper, AAIObjectType> {
public AAIQueryClient() {
super(new AAIClient());
@@ -44,5 +45,15 @@ public class AAIQueryClient extends GraphInventoryQueryClient<AAIQueryClient, Cu
protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) {
return super.setupQueryParams(uri);
}
+
+ @Override
+ public AAIResultWrapper createWrapper(String json) {
+ return new AAIResultWrapper(json);
+ }
+
+ @Override
+ public AAIObjectType createType(String name) {
+ return AAIObjectType.fromTypeName(name);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
index 434dbf946b..eb6d0d0b43 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
@@ -25,8 +25,8 @@ import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
public enum AAIEdgeLabel implements GraphInventoryEdgeLabel {
BELONGS_TO("org.onap.relationships.inventory.BelongsTo"),
- USES("org.onap.relationships.inventory.Uses");
-
+ USES("org.onap.relationships.inventory.Uses"),
+ COMPOSED_OF("org.onap.relationships.inventory.ComposedOf");
private final String label;
private AAIEdgeLabel(String label) {
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
index 324bb8abad..a627480d5d 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
@@ -33,6 +33,7 @@ import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.Results;
import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.entities.Pathed;
import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException;
import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
@@ -82,9 +83,9 @@ public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri
Optional<String> result;
ObjectMapper mapper = new ObjectMapper();
- Results<Map<String, String>> results = mapper.readValue(jsonString, new TypeReference<Results<Map<String, String>>>(){});
+ Results<Pathed> results = mapper.readValue(jsonString, new TypeReference<Results<Pathed>>(){});
if (results.getResult().size() == 1) {
- String uriString = results.getResult().get(0).get("resource-link");
+ String uriString = results.getResult().get(0).getResourceLink();
URI uri = UriBuilder.fromUri(uriString).build();
String rawPath = uri.getRawPath();
result = Optional.of(rawPath.replaceAll("/aai/v\\d+", ""));
diff --git a/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java b/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java
new file mode 100644
index 0000000000..384d479501
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
+ * 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.
+ */
+package org.onap.so.client.cds;
+
+import io.grpc.CallOptions;
+import io.grpc.Channel;
+import io.grpc.ClientCall;
+import io.grpc.ClientCall.Listener;
+import io.grpc.ClientInterceptor;
+import io.grpc.ForwardingClientCall;
+import io.grpc.Metadata;
+import io.grpc.Metadata.Key;
+import io.grpc.MethodDescriptor;
+
+public class BasicAuthClientInterceptor implements ClientInterceptor {
+
+ private CDSProperties props;
+
+ public BasicAuthClientInterceptor(CDSProperties props) {
+ this.props = props;
+ }
+
+ @Override
+ public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
+ MethodDescriptor<ReqT, RespT> method,
+ CallOptions callOptions,
+ Channel channel) {
+
+ Key<String> authHeader = Key.of("Authorization", Metadata.ASCII_STRING_MARSHALLER);
+
+ return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(
+ channel.newCall(method, callOptions)) {
+ @Override
+ public void start(Listener<RespT> responseListener, Metadata headers) {
+ headers.put(authHeader, props.getBasicAuth());
+ super.start(responseListener, headers);
+ }
+ };
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
index 0901cf589b..1e372112f1 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
@@ -73,6 +73,7 @@ public class CDSProcessingClient implements AutoCloseable {
.forAddress(props.getHost(), props.getPort())
.nameResolverFactory(new DnsNameResolverProvider())
.loadBalancerFactory(new PickFirstLoadBalancerProvider())
+ .intercept(new BasicAuthClientInterceptor(props))
.usePlaintext()
.build();
this.handler = new CDSProcessingHandler(listener);
diff --git a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
index bb2a54ec98..52d1d614ed 100644
--- a/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
+++ b/common/src/main/java/org/onap/so/client/cds/CDSProperties.java
@@ -21,5 +21,8 @@ import org.onap.so.client.RestProperties;
public interface CDSProperties extends RestProperties {
String getHost();
+
int getPort();
+
+ String getBasicAuth();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java
index c4bf0f0beb..152e9d7a36 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java
@@ -20,17 +20,33 @@
package org.onap.so.client.graphinventory;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
import java.util.Optional;
+import java.util.stream.Collectors;
-import org.onap.so.client.aai.entities.CustomQuery;
+import javax.ws.rs.core.GenericType;
+
+import org.onap.so.client.aai.entities.Results;
+import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper;
+import org.onap.so.client.graphinventory.entities.Pathed;
+import org.onap.so.client.graphinventory.entities.ResourceAndUrl;
import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
-public abstract class GraphInventoryQueryClient<S, I> {
+import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public abstract class GraphInventoryQueryClient<S, I, Wrapper extends GraphInventoryResultWrapper<?>, Type extends GraphInventoryObjectType> {
private Optional<String> depth = Optional.empty();
private boolean nodesOnly = false;
private Optional<GraphInventorySubgraphType> subgraph = Optional.empty();
private GraphInventoryClient client;
+ private GraphInventoryCommonObjectMapperProvider mapperProvider = new GraphInventoryCommonObjectMapperProvider();
public GraphInventoryQueryClient(GraphInventoryClient client) {
this.client = client;
@@ -42,6 +58,58 @@ public abstract class GraphInventoryQueryClient<S, I> {
return client.createClient(setupQueryParams(getQueryUri().queryParam("format", format.toString()))).put(query, String.class);
}
+ protected <R> List<R> querySingleType(Format format, I query, Class<R> clazz) {
+ return client.createClient(
+ setupQueryParams(getQueryUri().queryParam("format", format.toString()))).put(
+ query, new GenericType<Results<Object>>(){}).getResult()
+ .stream().map(item -> {
+ try {
+ return mapperProvider.getMapper().readValue(mapperProvider.getMapper().writeValueAsString(item), clazz);
+ } catch (IOException e) {
+ throw new IllegalArgumentException("could not map values from json", e);
+ }
+ }).collect(Collectors.toList());
+ }
+
+ public List<Pathed> queryPathed(I query) {
+ return querySingleType(Format.PATHED, query, Pathed.class);
+ }
+
+ public List<Id> queryId(I query) {
+ return querySingleType(Format.ID, query, Id.class);
+ }
+
+ public <R> List<R> querySingleResource(I query, Class<R> clazz) {
+ try {
+ return getResourceAndUrl(query).stream().map(item -> item.getWrapper().asBean(clazz).get()).collect(Collectors.toList());
+ } catch (IOException e) {
+ throw new IllegalArgumentException("could not map values from json", e);
+ }
+ }
+
+ public List<ResourceAndUrl<Wrapper>> getResourceAndUrl(I query) throws IOException {
+ List<ResourceAndUrl<Wrapper>> result = new ArrayList<>();
+ ObjectMapper mapper = mapperProvider.getMapper();
+ Results<Map<String, Object>> resultsFromJson = mapper.readValue(query(Format.RESOURCE_AND_URL, query),
+ new TypeReference<Results<Map<String, Object>>>() {
+ });
+ for (Map<String, Object> m : resultsFromJson.getResult()) {
+ for(Entry<String, Object> entrySet : m.entrySet()) {
+ if (!entrySet.getKey().equals("url")) {
+ String url = (String)m.get("url");
+ String stringJson = mapper.writeValueAsString(entrySet.getValue());
+ result.add(new ResourceAndUrl<Wrapper>(url, createType(entrySet.getKey()), createWrapper(stringJson)));
+ }
+ }
+ }
+
+ return result;
+ }
+
+ public abstract Wrapper createWrapper(String json);
+
+ public abstract Type createType(String name);
+
public S depth (String depth) {
this.depth = Optional.of(depth);
return (S) this;
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java
index 7da1408f2d..1e4750d2cf 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java
@@ -64,13 +64,14 @@ public class DSLNode implements QueryStep {
@Override
public String build() {
+ StringBuilder result = new StringBuilder(query);
if (output) {
- query.append("*");
+ result.append("*");
}
for (DSLNodeKey key : nodeKeys) {
- query.append(key.build());
+ result.append(key.build());
}
- return query.toString();
+ return result.toString();
}
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
index 159bfb1c29..c40a3e6f96 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
@@ -49,11 +49,12 @@ public class DSLNodeKey implements QueryStep {
@Override
public String build() {
-
+ StringBuilder result = new StringBuilder(query);
+
if (not) {
- query.append(" !");
+ result.append(" !");
}
- query.append("('").append(keyName).append("', ");
+ result.append("('").append(keyName).append("', ");
List<String> temp = new ArrayList<>();
for (String item : values) {
if (item.equals("null")) {
@@ -64,8 +65,8 @@ public class DSLNodeKey implements QueryStep {
temp.add(String.format("'%s'", item));
}
}
- query.append(Joiner.on(", ").join(temp)).append(")");
+ result.append(Joiner.on(", ").join(temp)).append(")");
- return query.toString();
+ return result.toString();
}
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
index 73dccea8e6..3a47c38444 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.stream.Collectors;
import org.onap.so.client.aai.entities.QueryStep;
+import org.onap.so.client.graphinventory.GraphInventoryObjectName;
import com.google.common.base.Joiner;
@@ -33,7 +34,7 @@ import com.google.common.base.Joiner;
public class DSLQueryBuilder<S, E> implements QueryStep {
private List<QueryStep> steps = new ArrayList<>();
-
+ private String suffix = "";
public DSLQueryBuilder() {
@@ -94,8 +95,17 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
return this;
}
- public String limit(int limit) {
- return compile() + " LIMIT " + limit;
+ public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name) {
+ return to(__.node(name));
+ }
+
+ public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name, DSLNodeKey... key) {
+ return to(__.node(name, key));
+ }
+
+ public DSLQueryBuilder<S, E> limit(int limit) {
+ suffix = " LIMIT " + limit;
+ return this;
}
@Override
@@ -103,8 +113,31 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
return compile();
}
+ @Override
+ public String toString() {
+ return build();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o != null) {
+ if (o instanceof QueryStep) {
+ return ((QueryStep)o).build().equals(this.build());
+ } else if (o instanceof String) {
+ return o.equals(this.build());
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+
+ return build().hashCode();
+ }
+
private String compile() {
- return Joiner.on(" ").join(steps.stream().map(item -> item.build()).collect(Collectors.toList()));
+ return Joiner.on(" ").join(steps.stream().map(item -> item.build()).collect(Collectors.toList())) + suffix;
}
protected QueryStep getFirst() {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
index 759fad7e54..752a743247 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
@@ -126,7 +126,7 @@ public abstract class GraphInventoryRelationships<Wrapper extends GraphInventory
protected List<String> getRelatedLinks(Optional<GraphInventoryObjectName> type) {
String matcher = "";
if (type.isPresent()) {
- matcher = "[?(@.related-to=='" + type.get() + "')]";
+ matcher = "[?(@.related-to=='" + type.get().typeName() + "')]";
}
return JsonPathUtil.getInstance().locateResultList(this.jsonBody, String.format("$.relationship%s.related-link", matcher));
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java
index c5651c0d26..c0b29e46c2 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java
@@ -86,22 +86,27 @@ public abstract class GraphInventoryResultWrapper<R extends GraphInventoryRelati
}
public Map<String, Object> asMap() {
+
+ return asBean(new TypeReference<Map<String, Object>>(){}).orElse(new HashMap<>());
+ }
+
+ public <T> Optional<T> asBean(Class<T> clazz) {
if (isEmpty()) {
- return new HashMap<>();
+ return Optional.empty();
}
try {
- return mapper.readValue(this.jsonBody, new TypeReference<Map<String, Object>>(){});
+ return Optional.of(mapper.readValue(this.jsonBody, clazz));
} catch (IOException e) {
- return new HashMap<>();
+ return Optional.empty();
}
}
- public <T> Optional<T> asBean(Class<T> clazz) {
+ public <T> Optional<T> asBean(TypeReference<T> reference) {
if (isEmpty()) {
return Optional.empty();
}
try {
- return Optional.of(mapper.readValue(this.jsonBody, clazz));
+ return Optional.of(mapper.readValue(this.jsonBody, reference));
} catch (IOException e) {
return Optional.empty();
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java
new file mode 100644
index 0000000000..76492dc38b
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java
@@ -0,0 +1,5 @@
+package org.onap.so.client.graphinventory.entities;
+
+public class Id extends Resource {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java
new file mode 100644
index 0000000000..a53bdc0259
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java
@@ -0,0 +1,5 @@
+package org.onap.so.client.graphinventory.entities;
+
+public class Pathed extends Resource {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java
new file mode 100644
index 0000000000..5c53f2cbf1
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java
@@ -0,0 +1,40 @@
+package org.onap.so.client.graphinventory.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "resource-type",
+ "resource-link"
+})
+public class Resource {
+
+ @JsonProperty("resource-type")
+ private String resourceType;
+ @JsonProperty("resource-link")
+ private String resourceLink;
+
+ @JsonProperty("resource-type")
+ public String getResourceType() {
+ return resourceType;
+ }
+
+ @JsonProperty("resource-type")
+ public void setResourceType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ @JsonProperty("resource-link")
+ public String getResourceLink() {
+ return resourceLink;
+ }
+
+ @JsonProperty("resource-link")
+ public void setResourceLink(String resourceLink) {
+ this.resourceLink = resourceLink;
+ }
+
+}
+
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java
new file mode 100644
index 0000000000..e53fc02da7
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java
@@ -0,0 +1,36 @@
+package org.onap.so.client.graphinventory.entities;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+public class ResourceAndUrl<Wrapper extends GraphInventoryResultWrapper> {
+
+ private String url;
+ private GraphInventoryObjectType type;
+ private Wrapper wrapper;
+
+ public ResourceAndUrl(String url, GraphInventoryObjectType type, Wrapper wrapper) {
+ this.url = url;
+ this.type = type;
+ this.wrapper = wrapper;
+ }
+ public String getUrl() {
+ return url;
+ }
+ public void setUrl(String url) {
+ this.url = url;
+ }
+ public Wrapper getWrapper() {
+ return wrapper;
+ }
+ public void setWrapper(Wrapper wrapper) {
+ this.wrapper = wrapper;
+ }
+ public GraphInventoryObjectType getType() {
+ return type;
+ }
+
+ public void setType(GraphInventoryObjectType type) {
+ this.type = type;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java
index 39a23b5c3e..341d7996a9 100644
--- a/common/src/main/java/org/onap/so/logger/MsoLogger.java
+++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java
@@ -96,12 +96,6 @@ public class MsoLogger {
public static final String PARTNER_NAME = "PartnerName";
-
-
-
-
-
-
// Audit/Metric log specific
public static final String BEGINTIME = "BeginTimestamp";
public static final String STARTTIME = "StartTimeMilis";
@@ -184,9 +178,7 @@ public class MsoLogger {
this.value = value;
}
}
-
- public static final Marker ENTRY = MarkerFactory.getMarker("ENTRY");
- public static final Marker EXIT = MarkerFactory.getMarker("EXIT");
+
private Logger logger;
private Logger metricsLogger;
@@ -194,9 +186,6 @@ public class MsoLogger {
private static String instanceUUID, serverIP, serverName;
private MessageEnum exceptionArg, defaultException, defaultWarning, defaultAudit, defaultMetrics;
- // For internal logging of the initialization of MSO logs
- private static final Logger initLOGGER = LoggerFactory.getLogger(MsoLogger.class.getName());
-
private MsoLogger() {
this(MsoLogger.Catalog.GENERAL);
}
@@ -236,12 +225,6 @@ public class MsoLogger {
* @param targetVEntity
* Target VNF or VM acted opon by the component, if available
*/
- public void recordMetricEvent() {
- metricsLogger.info("");
- MDC.remove(TIMER);
- MDC.remove(TARGETENTITY);
- MDC.remove(TARGETSERVICENAME);
- }
public void recordMetricEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode, String responseDesc,
String targetEntity, String targetServiceName, String targetVEntity) {
@@ -266,10 +249,7 @@ public class MsoLogger {
* @param responseDesc
* Human redable description of the application response code
*/
- public void recordAuditEvent(){
- auditLogger.info("");
- }
-
+
public void recordAuditEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode,
String responseDesc) {
if (StringUtils.isEmpty(MDC.get(MsoLogger.PARTNERNAME))) {
@@ -1060,15 +1040,6 @@ public class MsoLogger {
return classArr[0].getMethodName();
}
- // Based on the discussion with Adrian, instanceUUID is used to identifiy
- // the mso instance,
- // it is generated during mso instance initialization period
- // The same mso instnace will use the same instanceUUID value, even after
- // restart
- private static String getInstanceUUID() {
- return System.getProperty("mso-instance-id");
- }
-
/**
* Set the requestId and serviceInstanceId
*
@@ -1088,36 +1059,6 @@ public class MsoLogger {
}
/**
- * Set the remoteIp and the basic HTTP Authentication user
- *
- * @param remoteIpp
- * The remote ip address
- * @param userp
- * The basic http authencitation user
- */
- public static void setLoggerParameters(String remoteIpp, String userp) {
- if (null != remoteIpp) {
- MDC.put(REMOTE_HOST, remoteIpp);
- }
- if (null != userp) {
- MDC.put(USER, userp);
- }
- }
-
- /**
- * Set the serviceName
- *
- * @param serviceNamep
- * The service name
- */
- public static void setServiceName(String serviceNamep) {
- if (null != serviceNamep) {
- MDC.put(SERVICE_NAME, serviceNamep);
- MDC.remove(SERVICE_NAME_IS_METHOD_NAME);
- }
- }
-
- /**
* Get the serviceName
*
* @return The service name
@@ -1127,13 +1068,6 @@ public class MsoLogger {
}
/**
- * Reset the serviceName
- */
- public static void resetServiceName() {
- MDC.remove(SERVICE_NAME);
- }
-
- /**
* Set the requestId and serviceInstanceId based on the mso request
*
* @param msoRequest
@@ -1191,14 +1125,4 @@ public class MsoLogger {
defaultMetrics = MessageEnum.GENERAL_METRICS;
}
}
-
- public void warnSimple(String message, Exception e) {
- logger.warn(message,e);
-
- }
-
-
-
-
-
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
index 84c3cad0f9..e648ea38da 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
@@ -20,47 +20,65 @@
package org.onap.so.client.aai;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
-import javax.ws.rs.core.Response;
+import javax.ws.rs.core.GenericType;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.Complex;
import org.onap.so.client.RestClient;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.CustomQuery;
+import org.onap.so.client.aai.entities.Results;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.Format;
import org.onap.so.client.graphinventory.GraphInventoryClient;
import org.onap.so.client.graphinventory.GraphInventorySubgraphType;
+import org.onap.so.client.graphinventory.entities.Pathed;
+import org.onap.so.client.graphinventory.entities.ResourceAndUrl;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
public class AAIQueryClientTest {
@Mock
- Response response;
-
- @Mock
- RestClient restClient;
+ private RestClient restClient;
@Mock
- GraphInventoryClient client;
+ private GraphInventoryClient client;
@InjectMocks
- AAIQueryClient aaiQueryClient = new AAIQueryClient();
+ @Spy
+ private AAIQueryClient aaiQueryClient = new AAIQueryClient();
+ private String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/query/";
+
+ private ObjectMapper mapper = new ObjectMapper();
@Test
public void testQuery() {
List<AAIResourceUri> uris = Arrays.asList(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY));
@@ -91,4 +109,37 @@ public class AAIQueryClientTest {
verify(aaiUri, times(1)).queryParam("nodesOnly", "");
verify(aaiUri, times(1)).queryParam("subgraph", subgraph.toString());
}
+
+ @Test
+ public void querySingleResourceTest() throws IOException {
+ doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL), any(CustomQuery.class));
+ List<Complex> result = aaiQueryClient.querySingleResource(new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))), Complex.class);
+ assertEquals(2, result.size());
+ assertEquals("complex-id-15100-jc689q2", result.get(1).getPhysicalLocationId());
+ }
+
+ @Test
+ public void getResourceAndUrlTest() throws IOException {
+ doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL), any(CustomQuery.class));
+ List<ResourceAndUrl<AAIResultWrapper>> result = aaiQueryClient.getResourceAndUrl(new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))));
+ assertEquals(2, result.size());
+
+ assertEquals(1, result.get(1).getWrapper().getRelationships().get().getRelatedUris(AAIObjectType.PSERVER).size());
+ }
+
+ @Test
+ public void querySingleTypeTest() throws IOException {
+ when(client.createClient(isA(AAIUri.class))).thenReturn(restClient);
+ when(restClient.put(any(Object.class), any(GenericType.class))).thenReturn(mapper.readValue(getJson("pathed-result.json"), new TypeReference<Results<Map<String, Object>>>(){}));
+
+
+ List<Pathed> results = aaiQueryClient.queryPathed(new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))));
+
+ assertEquals(2, results.size());
+ assertEquals("service-instance", results.get(1).getResourceType());
+ }
+
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename)));
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
index 73fbff6e4f..174c76b1ef 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
@@ -33,9 +33,9 @@ import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
import javax.ws.rs.BadRequestException;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -50,7 +50,6 @@ import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
-import org.onap.so.client.graphinventory.GraphInventoryClient;
import com.github.tomakehurst.wiremock.admin.NotFoundException;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
@@ -60,7 +59,7 @@ public class AAIResourcesClientTest {
@Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443));
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -72,9 +71,11 @@ public class AAIResourcesClientTest {
@InjectMocks
public AAIResourcesClient aaiClient = new AAIResourcesClient();
+ private String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/query/";
+
@Before
public void beforeTest() {
- doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
+ doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties();
}
@Test
diff --git a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
index 69d46de96a..a5bbc64eb9 100644
--- a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
@@ -21,6 +21,7 @@
package org.onap.so.client.aai;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.onap.so.client.graphinventory.entities.DSLNode;
@@ -80,4 +81,32 @@ public class DSLQueryBuilderTest {
assertEquals("cloud-region* !('cloud-owner', ' ', ' null ')", builder.build());
}
+
+ @Test
+ public void shortCutToTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER,
+ __.key("hostname", "my-hostname")).output());
+
+ builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
+ assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')", builder.build());
+ }
+
+ @Test
+ public void limitTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER,
+ __.key("hostname", "my-hostname")).output());
+
+ builder.to(AAIObjectType.P_INTERFACE).limit(2).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
+ assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id') LIMIT 2", builder.build());
+ }
+
+ @Test
+ public void equalsTest() {
+ DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER,
+ __.key("hostname", "my-hostname")).output());
+
+ builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
+ assertTrue(builder.equals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')"));
+ assertTrue(builder.equals(builder));
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java b/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
index 1ce6e4377c..8d11f69308 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
@@ -44,7 +44,7 @@ public class RelationshipsTest {
AAIResultWrapper wrapper = new AAIResultWrapper(content);
Relationships relationships = wrapper.getRelationships().get();
- List<AAIResourceUri> test = relationships.getRelatedAAIUris(AAIObjectType.VCE);
+ List<AAIResourceUri> test = relationships.getRelatedUris(AAIObjectType.VCE);
System.out.println(test.get(0).build());
List<AAIResourceUri> uris = Arrays.asList(
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
index 15c1c24ae2..979ca39489 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
@@ -69,7 +69,7 @@ public class ServiceInstanceUriTest {
private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/";
@Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443));
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
@Rule
public final ExpectedException exception = ExpectedException.none();
@@ -82,7 +82,7 @@ public class ServiceInstanceUriTest {
@Before
public void beforeTest() {
- doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
+ doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties();
}
@Test
public void found() throws IOException {
diff --git a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
index efb9b07871..a2937869c8 100644
--- a/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
+++ b/common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
@@ -26,12 +26,17 @@ public class TestCDSPropertiesImpl implements CDSProperties {
@Override
public String getHost() {
- return "endpoint";
+ return "localhost";
}
@Override
public int getPort() {
- return 9999;
+ return 9111;
+ }
+
+ @Override
+ public String getBasicAuth() {
+ return "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==";
}
@Override
diff --git a/common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java b/common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java
index 77e1dfee7d..65c76561dc 100644
--- a/common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java
+++ b/common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java
@@ -50,6 +50,21 @@ public class DefaultAAIPropertiesImpl implements AAIProperties {
this.props = temp;
}
+
+ public DefaultAAIPropertiesImpl(int port) {
+ File initialFile = new File("src/test/resources/aai.properties");
+ Map<Object, Object> temp;
+ try (InputStream targetStream = new FileInputStream(initialFile)) {
+ Properties properties = new Properties();
+ properties.load(targetStream);
+ temp = properties;
+ } catch (IOException e) {
+ temp = new HashMap<>();
+ }
+ this.props = temp;
+ this.props.put("aai.endpoint", this.props.get("aai.endpoint").toString().replaceFirst(":\\d+", ":" + port));
+
+ }
@Override
public URL getEndpoint() throws MalformedURLException {
return new URL(props.get("aai.endpoint").toString());
diff --git a/common/src/test/resources/__files/aai/query/pathed-result.json b/common/src/test/resources/__files/aai/query/pathed-result.json
new file mode 100644
index 0000000000..e9a3e65c73
--- /dev/null
+++ b/common/src/test/resources/__files/aai/query/pathed-result.json
@@ -0,0 +1,12 @@
+{
+ "results": [
+ {
+ "resource-type": "service-instance",
+ "resource-link": "https://localhost:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"
+ },
+ {
+ "resource-type": "service-instance",
+ "resource-link": "https://localhost:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"
+ }
+ ]
+} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/query/single-query-result.json b/common/src/test/resources/__files/aai/query/single-query-result.json
new file mode 100644
index 0000000000..eb12deae80
--- /dev/null
+++ b/common/src/test/resources/__files/aai/query/single-query-result.json
@@ -0,0 +1,80 @@
+{
+ "results": [
+ {
+ "url": "/aai/v14/cloud-infrastructure/complexes/complex/complex-id-15100-jc689q",
+ "complex": {
+ "physical-location-id": "complex-id-15100-jc689q",
+ "resource-version": "1541786379243",
+ "physical-location-type": "lvXHWJC",
+ "street1": "uAAi5qjc1",
+ "street2": "vkK6XQjc2",
+ "city": "3Ec8JSW0JC",
+ "state": "COczHmeJC",
+ "postal-code": "D4J1",
+ "country": "K0JC1",
+ "region": "JzHqJC1",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "pserver",
+ "relationship-label": "org.onap.relationships.inventory.LocatedIn",
+ "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-15100-jc689q",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "pserver-15100-jc689q"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ },
+ {
+ "property-key": "pserver.fqdn"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ },
+ {
+ "url": "/aai/v14/cloud-infrastructure/complexes/complex/complex-id-15100-jc689q2",
+ "complex": {
+ "physical-location-id": "complex-id-15100-jc689q2",
+ "resource-version": "1541786379243",
+ "physical-location-type": "lvXHWJC",
+ "street1": "uAAi5qjc1",
+ "street2": "vkK6XQjc2",
+ "city": "3Ec8JSW0JC",
+ "state": "COczHmeJC",
+ "postal-code": "D4J1",
+ "country": "K0JC1",
+ "region": "JzHqJC1",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "pserver",
+ "relationship-label": "org.onap.relationships.inventory.LocatedIn",
+ "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-15100-jc689q",
+ "relationship-data": [
+ {
+ "relationship-key": "pserver.hostname",
+ "relationship-value": "pserver-15100-jc689q"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "pserver.pserver-name2"
+ },
+ {
+ "property-key": "pserver.fqdn"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ ]
+} \ No newline at end of file