summaryrefslogtreecommitdiffstats
path: root/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai
diff options
context:
space:
mode:
Diffstat (limited to 'graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai')
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java78
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapper.java59
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperPatchProvider.java31
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperProvider.java31
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java56
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIErrorFormatter.java57
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAINamespaceConstants.java31
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectBase.java7
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java117
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java322
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIProperties.java37
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryClient.java60
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryObjectMapperProvider.java39
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesClient.java88
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesObjectMapperProvider.java29
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java67
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java43
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java100
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAISingleTransactionClient.java175
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAITransactionalClient.java228
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdator.java29
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdatorImpl.java49
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidator.java32
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidatorImpl.java71
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java50
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEdgeLabel.java42
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntity.java25
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntityObject.java29
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIError.java44
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapper.java45
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Configuration.java153
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/CustomQuery.java79
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/QueryStep.java28
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Relationships.java74
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/RequestError.java44
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Results.java49
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/ServiceException.java70
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBody.java68
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBodySerializer.java54
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transaction.java90
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transactions.java51
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequest.java84
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java54
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyResponse.java73
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionRequest.java44
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionResponse.java46
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIBaseResourceUri.java29
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralResourceUri.java9
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java10
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimplePluralUri.java68
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java73
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUri.java32
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java114
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java54
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java174
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesPluralUri.java19
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesSingleUri.java21
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesUri.java26
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java54
59 files changed, 3815 insertions, 0 deletions
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java
new file mode 100644
index 0000000000..1cd23614b5
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import java.net.URI;
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.UriBuilder;
+import org.onap.so.client.RestClient;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryClient;
+import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AAIClient extends GraphInventoryClient {
+
+ private static final String AAI_ROOT = "/aai";
+ protected static Logger logger = LoggerFactory.getLogger(AAIClient.class);
+ protected AAIVersion version;
+
+ protected AAIClient() {
+ super(AAIProperties.class);
+ }
+
+ protected AAIClient(AAIVersion version) {
+ super(AAIProperties.class);
+ this.version = version;
+ }
+
+ @Override
+ protected URI constructPath(URI uri) {
+
+ return UriBuilder.fromUri(AAI_ROOT + "/" + this.getVersion().toString() + uri.toString()).build();
+ }
+
+ @Override
+ protected RestClient createClient(URI uri) {
+ try {
+
+ return new AAIRestClient(getRestProperties(), constructPath(uri));
+ } catch (GraphInventoryUriComputationException | NotFoundException e) {
+ logger.debug("failed to construct A&AI uri", e);
+ throw e;
+ }
+ }
+
+ @Override
+ public AAIVersion getVersion() {
+ if (version == null) {
+ return this.<AAIProperties>getRestProperties().getDefaultVersion();
+ } else {
+ return this.version;
+ }
+ }
+
+
+ @Override
+ public String getGraphDBName() {
+ return "A&AI";
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapper.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapper.java
new file mode 100644
index 0000000000..24a4ba8510
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClientResponseExceptionMapper.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import java.io.IOException;
+import java.util.Optional;
+import javax.annotation.Priority;
+import javax.ws.rs.ext.Provider;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.client.ResponseExceptionMapper;
+import org.onap.aaiclient.client.aai.entities.AAIError;
+import org.slf4j.MDC;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Provider
+@Priority(Integer.MIN_VALUE)
+public class AAIClientResponseExceptionMapper extends ResponseExceptionMapper {
+
+ private final String requestId;
+
+ public AAIClientResponseExceptionMapper() {
+ this.requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
+ }
+
+ @Override
+ public Optional<String> extractMessage(String entity) {
+
+ String errorString = "Error calling A&AI. Request-Id=" + this.getRequestId() + " ";
+ try {
+ AAIError error = new ObjectMapper().readValue(entity, AAIError.class);
+ AAIErrorFormatter formatter = new AAIErrorFormatter(error);
+ return Optional.of(errorString + formatter.getMessage());
+ } catch (IOException e) {
+ return Optional.of(errorString + entity);
+ }
+ }
+
+ protected String getRequestId() {
+ return this.requestId;
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperPatchProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperPatchProvider.java
new file mode 100644
index 0000000000..3e198a6375
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperPatchProvider.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.aaiclient.client.aai;
+
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperPatchProvider;
+
+public class AAICommonObjectMapperPatchProvider extends GraphInventoryCommonObjectMapperPatchProvider {
+
+
+ public AAICommonObjectMapperPatchProvider() {
+ super();
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperProvider.java
new file mode 100644
index 0000000000..8cc7f7d1ee
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAICommonObjectMapperProvider.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+
+public class AAICommonObjectMapperProvider extends GraphInventoryCommonObjectMapperProvider {
+
+ public AAICommonObjectMapperProvider() {
+ super();
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java
new file mode 100644
index 0000000000..4c45a675b2
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryQueryClient;
+import org.onap.aaiclient.client.graphinventory.entities.DSLQuery;
+import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri;
+
+public class AAIDSLQueryClient
+ extends GraphInventoryQueryClient<AAIDSLQueryClient, DSLQuery, AAIResultWrapper, AAIObjectType> {
+
+ public AAIDSLQueryClient() {
+ super(new AAIClient());
+ }
+
+ public AAIDSLQueryClient(AAIVersion version) {
+ super(new AAIClient(version));
+ }
+
+ @Override
+ protected GraphInventoryUri getQueryUri() {
+ 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/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIErrorFormatter.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIErrorFormatter.java
new file mode 100644
index 0000000000..5282da8184
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIErrorFormatter.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import java.util.List;
+import org.onap.aaiclient.client.aai.entities.AAIError;
+import org.onap.aaiclient.client.aai.entities.ServiceException;
+
+public class AAIErrorFormatter {
+
+ private final AAIError error;
+
+ public AAIErrorFormatter(AAIError error) {
+ this.error = error;
+ }
+
+ public String getMessage() {
+ if (error.getRequestError() != null && error.getRequestError().getServiceException() != null) {
+ ServiceException serviceException = error.getRequestError().getServiceException();
+ return this.fillInTemplate(serviceException.getText(), serviceException.getVariables());
+ }
+
+ return "no parsable error message found";
+ }
+
+ protected String fillInTemplate(String text, List<String> variables) {
+ for (int i = 0; i < variables.size(); i++) {
+ variables.set(i, this.format(variables.get(i), variables));
+ }
+
+ return format(text, variables);
+ }
+
+ protected String format(String s, List<String> variables) {
+ s = s.replaceAll("%(\\d(?!\\d))", "%$1\\$s");
+ s = s.replaceAll("%(\\d{2})", "%%$1");
+ return String.format(s, variables.toArray());
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAINamespaceConstants.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAINamespaceConstants.java
new file mode 100644
index 0000000000..c098402076
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAINamespaceConstants.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+public class AAINamespaceConstants {
+
+ public static final String CLOUD_INFRASTRUCTURE = "/cloud-infrastructure";
+ public static final String NETWORK = "/network";
+ public static final String BUSINESS = "/business";
+ public static final String SERVICE_DESIGN_AND_CREATION = "/service-design-and-creation";
+ public static final String EXTERNAL_SYSTEM = "/external-system";
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectBase.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectBase.java
new file mode 100644
index 0000000000..c1dbd29de0
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectBase.java
@@ -0,0 +1,7 @@
+package org.onap.aaiclient.client.aai;
+
+import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase;
+
+public interface AAIObjectBase extends GraphInventoryObjectBase {
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java
new file mode 100644
index 0000000000..fcda3c8ad4
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectPlurals.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import java.io.Serializable;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectPlurals;
+import org.onap.so.constants.Defaults;
+import com.google.common.base.CaseFormat;
+
+public class AAIObjectPlurals implements AAIObjectBase, GraphInventoryObjectPlurals, Serializable {
+
+ private static final long serialVersionUID = 5312713297525740746L;
+
+ public static final AAIObjectPlurals CUSTOMER =
+ new AAIObjectPlurals(AAIObjectType.CUSTOMER, AAINamespaceConstants.BUSINESS, "/customers");
+ public static final AAIObjectPlurals GENERIC_VNF =
+ new AAIObjectPlurals(AAIObjectType.GENERIC_VNF, AAINamespaceConstants.NETWORK, "/generic-vnfs");
+ public static final AAIObjectPlurals PORT_GROUP =
+ new AAIObjectPlurals(AAIObjectType.PORT_GROUP, AAIObjectType.VCE.uriTemplate(), "/port-groups");
+ public static final AAIObjectPlurals PSERVER =
+ new AAIObjectPlurals(AAIObjectType.PSERVER, AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers");
+ public static final AAIObjectPlurals P_INTERFACE =
+ new AAIObjectPlurals(AAIObjectType.P_INTERFACE, AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces");
+ public static final AAIObjectPlurals L3_NETWORK =
+ new AAIObjectPlurals(AAIObjectType.L3_NETWORK, AAINamespaceConstants.NETWORK, "/l3-networks");
+ public static final AAIObjectPlurals NETWORK_POLICY =
+ new AAIObjectPlurals(AAIObjectType.NETWORK_POLICY, AAINamespaceConstants.NETWORK, "/network-policies");
+ public static final AAIObjectPlurals VPN_BINDING =
+ new AAIObjectPlurals(AAIObjectType.VPN_BINDING, AAINamespaceConstants.NETWORK, "/vpn-bindings");
+ public static final AAIObjectPlurals SERVICE_SUBSCRIPTION = new AAIObjectPlurals(AAIObjectType.SERVICE_SUBSCRIPTION,
+ AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions");
+ public static final AAIObjectPlurals SERVICE_INSTANCE = new AAIObjectPlurals(AAIObjectType.SERVICE_INSTANCE,
+ AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances");
+ public static final AAIObjectPlurals OWNING_ENTITY =
+ new AAIObjectPlurals(AAIObjectType.OWNING_ENTITY, AAINamespaceConstants.BUSINESS, "/owning-entities");
+ public static final AAIObjectPlurals VOLUME_GROUP = new AAIObjectPlurals(AAIObjectType.VOLUME_GROUP,
+ AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups");
+ public static final AAIObjectPlurals AVAILIBILITY_ZONE = new AAIObjectPlurals(AAIObjectType.AVAILIBILITY_ZONE,
+ AAIObjectType.CLOUD_REGION.uriTemplate(), "/availability-zones");
+ public static final AAIObjectPlurals VF_MODULE =
+ new AAIObjectPlurals(AAIObjectType.VF_MODULE, AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules");
+ public static final AAIObjectPlurals CONFIGURATION =
+ new AAIObjectPlurals(AAIObjectType.CONFIGURATION, AAINamespaceConstants.NETWORK, "/configurations");
+ public static final AAIObjectPlurals DEFAULT_TENANT =
+ new AAIObjectPlurals(AAIObjectType.DEFAULT_TENANT, AAINamespaceConstants.CLOUD_INFRASTRUCTURE
+ + "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants");
+ public static final AAIObjectPlurals NETWORK_TECHNOLOGY = new AAIObjectPlurals(AAIObjectType.NETWORK_TECHNOLOGY,
+ AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/network-technologies");
+ public static final AAIObjectPlurals LOGICAL_LINK =
+ new AAIObjectPlurals(AAIObjectType.LOGICAL_LINK, AAINamespaceConstants.NETWORK, "/logical-links");
+ public static final AAIObjectPlurals L_INTERFACE =
+ new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.VSERVER.uriTemplate(), "/l-interfaces");
+ public static final AAIObjectPlurals SUB_L_INTERFACE =
+ new AAIObjectPlurals(AAIObjectType.L_INTERFACE, AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces");
+ public static final AAIObjectPlurals INSTANCE_GROUP =
+ new AAIObjectPlurals(AAIObjectType.INSTANCE_GROUP, AAINamespaceConstants.NETWORK, "/instance-groups");
+ public static final AAIObjectPlurals PNF =
+ new AAIObjectPlurals(AAIObjectType.PNF, AAINamespaceConstants.NETWORK, "/pnfs");
+
+ private final String uriTemplate;
+ private final String partialUri;
+ private final AAIObjectType type;
+
+ protected AAIObjectPlurals(AAIObjectType type, String parentUri, String partialUri) {
+ this.uriTemplate = parentUri + partialUri;
+ this.partialUri = partialUri;
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return this.uriTemplate();
+ }
+
+ @Override
+ public String uriTemplate() {
+ return this.uriTemplate;
+ }
+
+ @Override
+ public String partialUri() {
+ return this.partialUri;
+ }
+
+ @Override
+ public AAIObjectType getType() {
+ return this.type;
+ }
+
+ @Override
+ public String typeName() {
+ return this.getType().typeName();
+ }
+
+ @Override
+ public String typeName(CaseFormat format) {
+ return this.getType().typeName(format);
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java
new file mode 100644
index 0000000000..8045a220a3
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java
@@ -0,0 +1,322 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import com.google.common.base.CaseFormat;
+import org.onap.aai.annotations.Metadata;
+import org.onap.aai.domain.yang.AggregateRoute;
+import org.onap.aai.domain.yang.AllottedResource;
+import org.onap.aai.domain.yang.AvailabilityZone;
+import org.onap.aai.domain.yang.CloudRegion;
+import org.onap.aai.domain.yang.Collection;
+import org.onap.aai.domain.yang.CommunicationServiceProfile;
+import org.onap.aai.domain.yang.Complex;
+import org.onap.aai.domain.yang.Configuration;
+import org.onap.aai.domain.yang.Connector;
+import org.onap.aai.domain.yang.Customer;
+import org.onap.aai.domain.yang.Device;
+import org.onap.aai.domain.yang.EsrVnfm;
+import org.onap.aai.domain.yang.ExtAaiNetwork;
+import org.onap.aai.domain.yang.Flavor;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Image;
+import org.onap.aai.domain.yang.InstanceGroup;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.LInterface;
+import org.onap.aai.domain.yang.LineOfBusiness;
+import org.onap.aai.domain.yang.LogicalLink;
+import org.onap.aai.domain.yang.ModelVer;
+import org.onap.aai.domain.yang.NetworkPolicy;
+import org.onap.aai.domain.yang.NetworkTechnology;
+import org.onap.aai.domain.yang.OperationalEnvironment;
+import org.onap.aai.domain.yang.OwningEntity;
+import org.onap.aai.domain.yang.PInterface;
+import org.onap.aai.domain.yang.PhysicalLink;
+import org.onap.aai.domain.yang.Platform;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.aai.domain.yang.PortGroup;
+import org.onap.aai.domain.yang.Project;
+import org.onap.aai.domain.yang.Pserver;
+import org.onap.aai.domain.yang.RouteTableReference;
+import org.onap.aai.domain.yang.Service;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.ServiceProfile;
+import org.onap.aai.domain.yang.ServiceSubscription;
+import org.onap.aai.domain.yang.SliceProfile;
+import org.onap.aai.domain.yang.SpPartner;
+import org.onap.aai.domain.yang.SriovPf;
+import org.onap.aai.domain.yang.Subnet;
+import org.onap.aai.domain.yang.Tenant;
+import org.onap.aai.domain.yang.TunnelXconnect;
+import org.onap.aai.domain.yang.Vce;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VlanTag;
+import org.onap.aai.domain.yang.Vnfc;
+import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.aai.domain.yang.Vserver;
+import org.onap.aai.domain.yang.Zone;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
+import org.onap.so.constants.Defaults;
+import org.reflections.Reflections;
+import org.reflections.scanners.SubTypesScanner;
+import org.reflections.util.ClasspathHelper;
+import org.reflections.util.ConfigurationBuilder;
+import java.io.Serializable;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+
+public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, Serializable {
+
+ private static final long serialVersionUID = -2877184776691514600L;
+ private static Map<String, AAIObjectType> map = new HashMap<>();
+
+ public static final AAIObjectType DEFAULT_CLOUD_REGION = new AAIObjectType(
+ AAINamespaceConstants.CLOUD_INFRASTRUCTURE,
+ "/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER + "/{cloud-region-id}", "default-cloud-region");
+ public static final AAIObjectType CUSTOMER = new AAIObjectType(AAINamespaceConstants.BUSINESS, Customer.class);
+ public static final AAIObjectType GENERIC_QUERY = new AAIObjectType("/search", "/generic-query", "generic-query");
+ public static final AAIObjectType BULK_PROCESS = new AAIObjectType("/bulkprocess", "", "bulkprocess");
+ public static final AAIObjectType SINGLE_TRANSACTION =
+ new AAIObjectType("/bulk/single-transaction", "", "single-transaction");
+ public static final AAIObjectType GENERIC_VNF = new AAIObjectType(AAINamespaceConstants.NETWORK, GenericVnf.class);
+ public static final AAIObjectType GENERIC_VNFS =
+ new AAIObjectType(AAINamespaceConstants.NETWORK, "/generic-vnfs", "generic-vnfs");
+ public static final AAIObjectType VF_MODULE =
+ new AAIObjectType(AAIObjectType.GENERIC_VNF.uriTemplate(), VfModule.class);
+ public static final AAIObjectType L3_NETWORK = new AAIObjectType(AAINamespaceConstants.NETWORK, L3Network.class);
+ public static final AAIObjectType NETWORK_POLICY =
+ new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkPolicy.class);
+ public static final AAIObjectType NODES_QUERY = new AAIObjectType("/search", "/nodes-query", "nodes-query");
+ public static final AAIObjectType CUSTOM_QUERY = new AAIObjectType("/query", "", "query");
+ public static final AAIObjectType ROUTE_TABLE_REFERENCE =
+ new AAIObjectType(AAINamespaceConstants.NETWORK, RouteTableReference.class);
+ public static final AAIObjectType DEFAULT_TENANT =
+ new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/"
+ + Defaults.CLOUD_OWNER + "/AAIAIC25", "/tenants/tenant/{tenant-id}", "default-tenant");
+ public static final AAIObjectType VCE = new AAIObjectType(AAINamespaceConstants.NETWORK, Vce.class);
+ public static final AAIObjectType PORT_GROUP = new AAIObjectType(AAIObjectType.VCE.uriTemplate(), PortGroup.class);
+ public static final AAIObjectType VPN_BINDING = new AAIObjectType(AAINamespaceConstants.NETWORK, VpnBinding.class);
+ public static final AAIObjectType CONFIGURATION =
+ new AAIObjectType(AAINamespaceConstants.NETWORK, Configuration.class);
+ public static final AAIObjectType PSERVER =
+ new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Pserver.class);
+ public static final AAIObjectType SERVICE_SUBSCRIPTION =
+ new AAIObjectType(AAIObjectType.CUSTOMER.uriTemplate(), ServiceSubscription.class);
+
+ public static final AAIObjectType SERVICE_INSTANCE_METADATA = new AAIObjectType(
+ AAIObjectType.SERVICE_INSTANCE + "/metadata", org.onap.aai.domain.yang.v13.Metadata.class);
+
+ public static final AAIObjectType SERVICE = new AAIObjectType(
+ AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/services/service/{service-id}", Service.class);
+ public static final AAIObjectType SERVICE_INSTANCE =
+ new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class);
+ public static final AAIObjectType PROJECT = new AAIObjectType(AAINamespaceConstants.BUSINESS, Project.class);
+ public static final AAIObjectType LINE_OF_BUSINESS =
+ new AAIObjectType(AAINamespaceConstants.BUSINESS, LineOfBusiness.class);
+ public static final AAIObjectType PLATFORM = new AAIObjectType(AAINamespaceConstants.BUSINESS, Platform.class);
+ public static final AAIObjectType OWNING_ENTITY =
+ new AAIObjectType(AAINamespaceConstants.BUSINESS, OwningEntity.class);
+ public static final AAIObjectType ALLOTTED_RESOURCE =
+ new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), AllottedResource.class);
+ public static final AAIObjectType ALLOTTED_RESOURCE_ALL =
+ new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources", "allottedResources");
+ public static final AAIObjectType PNF = new AAIObjectType(AAINamespaceConstants.NETWORK, Pnf.class);
+ public static final AAIObjectType OPERATIONAL_ENVIRONMENT =
+ new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, OperationalEnvironment.class);
+ public static final AAIObjectType CLOUD_REGION =
+ new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, CloudRegion.class);
+ public static final AAIObjectType TENANT =
+ new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Tenant.class);
+ public static final AAIObjectType VOLUME_GROUP =
+ new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), VolumeGroup.class);
+ public static final AAIObjectType VSERVER = new AAIObjectType(AAIObjectType.TENANT.uriTemplate(), Vserver.class);
+ public static final AAIObjectType MODEL_VER = new AAIObjectType(
+ AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", ModelVer.class);
+ public static final AAIObjectType TUNNEL_XCONNECT =
+ new AAIObjectType(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), TunnelXconnect.class);
+ public static final AAIObjectType P_INTERFACE =
+ new AAIObjectType(AAIObjectType.PSERVER.uriTemplate(), PInterface.class);
+ public static final AAIObjectType SRIOV_PF =
+ new AAIObjectType(AAIObjectType.P_INTERFACE.uriTemplate(), SriovPf.class);
+ public static final AAIObjectType LOGICAL_LINK =
+ new AAIObjectType(AAINamespaceConstants.NETWORK, LogicalLink.class);
+ public static final AAIObjectType PHYSICAL_LINK =
+ new AAIObjectType(AAINamespaceConstants.NETWORK, PhysicalLink.class);
+ public static final AAIObjectType INSTANCE_GROUP =
+ new AAIObjectType(AAINamespaceConstants.NETWORK, InstanceGroup.class);
+ public static final AAIObjectType COLLECTION = new AAIObjectType(AAINamespaceConstants.NETWORK, Collection.class);
+ public static final AAIObjectType VNFC = new AAIObjectType(AAINamespaceConstants.NETWORK, Vnfc.class);
+ public static final AAIObjectType VLAN_TAG = new AAIObjectType(AAINamespaceConstants.NETWORK, VlanTag.class);
+ public static final AAIObjectType COMPLEX =
+ new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Complex.class);
+ public static final AAIObjectType CONNECTOR = new AAIObjectType(AAINamespaceConstants.BUSINESS, Connector.class);
+ public static final AAIObjectType NETWORK_TECHNOLOGY =
+ new AAIObjectType(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, NetworkTechnology.class);
+ public static final AAIObjectType SUBNET = new AAIObjectType(AAIObjectType.L3_NETWORK.uriTemplate(), Subnet.class);
+ public static final AAIObjectType SP_PARTNER = new AAIObjectType(AAINamespaceConstants.BUSINESS, SpPartner.class);
+ public static final AAIObjectType DEVICE = new AAIObjectType(AAINamespaceConstants.NETWORK, Device.class);
+ public static final AAIObjectType EXT_AAI_NETWORK =
+ new AAIObjectType(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class);
+ public static final AAIObjectType AGGREGATE_ROUTE =
+ new AAIObjectType(AAINamespaceConstants.NETWORK, AggregateRoute.class);
+ public static final AAIObjectType L_INTERFACE =
+ new AAIObjectType(AAIObjectType.VSERVER.uriTemplate(), LInterface.class);
+ public static final AAIObjectType SUB_L_INTERFACE = new AAIObjectType(AAIObjectType.L_INTERFACE.uriTemplate(),
+ "/l-interfaces/l-interface/{sub-interface-name}", "sub-l-interface");
+ public static final AAIObjectType IMAGE = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Image.class);
+ public static final AAIObjectType FLAVOR =
+ new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Flavor.class);
+ public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown") {
+
+ private static final long serialVersionUID = 9208984071038447607L;
+
+ @Override
+ public boolean passThrough() {
+ return true;
+ }
+ };
+ public static final AAIObjectType DSL = new AAIObjectType("/dsl", "", "dsl");
+ public static final AAIObjectType VNFM = new AAIObjectType(
+ AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list/esr-vnfm/{vnfm-id}", EsrVnfm.class);
+ public static final AAIObjectType VNFM_LIST =
+ new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM, "/esr-vnfm-list", "vnfm-list");
+ public static final AAIObjectType VNFM_ESR_SYSTEM_INFO_LIST =
+ new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list",
+ "/esr-vnfm/{vnfm-id}/esr-system-info-list", "vnfm-esr-system-info-list");
+ public static final AAIObjectType CLOUD_ESR_SYSTEM_INFO_LIST = new AAIObjectType(
+ AAIObjectType.CLOUD_REGION.uriTemplate(), "/esr-system-info-list", "cloud-esr-system-info-list");
+ public static final AAIObjectType ZONE = new AAIObjectType(AAINamespaceConstants.NETWORK, Zone.class);
+ public static final AAIObjectType AVAILIBILITY_ZONE =
+ new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), AvailabilityZone.class);
+ public static final AAIObjectType THIRDPARTY_SDNC_LIST = new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM,
+ "/esr-thirdparty-sdnc-list", "thirdparty-sdnc-list");
+ public static final AAIObjectType THIRDPARTY_SDNC_SYSTEM_INFO_LIST =
+ new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-thirdparty-sdnc-list",
+ "/esr-thirdparty-sdnc/{sdnc-id}/esr-system-info-list", "thirdparty-sdnc-system-info-list");
+ public static final AAIObjectType COMMUNICATION_SERVICE_PROFILE =
+ new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), CommunicationServiceProfile.class);
+ public static final AAIObjectType SERVICE_PROFILE =
+ new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceProfile.class);
+ public static final AAIObjectType SERVICE_PROFILE_ALL =
+ new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/service-profiles", "serviceProfiles");
+ public static final AAIObjectType SLICE_PROFILE =
+ new AAIObjectType(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), SliceProfile.class);
+ public static final AAIObjectType SLICE_PROFILE_ALL =
+ new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/slice-profiles", "sliceProfiles");
+ public static final AAIObjectType COMMUNICATION_PROFILE_ALL = new AAIObjectType(
+ AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/communication-service-profiles", "communicationProfiles");
+ public static final AAIObjectType QUERY_ALLOTTED_RESOURCE =
+ new AAIObjectType(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "?depth=2", "service-Instance");
+
+ private final String uriTemplate;
+ private final String parentUri;
+ private final String partialUri;
+ private final Class<?> aaiObjectClass;
+ private final String name;
+
+ static {
+ /* Locate any AAIObjectTypes on the classpath and add them to our map */
+ java.util.Collection<URL> packages = ClasspathHelper.forPackage("");
+ Reflections r =
+ new Reflections(new ConfigurationBuilder().setUrls(packages).setScanners(new SubTypesScanner()));
+
+ Set<Class<? extends AAIObjectType>> resources = r.getSubTypesOf(AAIObjectType.class);
+
+ for (Class<? extends AAIObjectType> customTypeClass : resources) {
+ AAIObjectType customType;
+ try {
+ customType = customTypeClass.newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
+ }
+ }
+ }
+
+ protected AAIObjectType() {
+ this.parentUri = null;
+ this.partialUri = null;
+ this.uriTemplate = null;
+ this.aaiObjectClass = null;
+ this.name = null;
+ }
+
+ protected AAIObjectType(String parentUri, String partialUri, String name) {
+ this.parentUri = parentUri;
+ this.partialUri = partialUri;
+ this.uriTemplate = parentUri + partialUri;
+ this.aaiObjectClass = null;
+ this.name = name;
+ if (!AAIObjectType.map.containsKey(name)) {
+ AAIObjectType.map.put(name, this);
+ }
+ }
+
+ protected AAIObjectType(String parentUri, Class<?> aaiObjectClass) {
+ this.parentUri = parentUri;
+ this.partialUri = removeParentUri(aaiObjectClass, parentUri);
+ this.uriTemplate = parentUri + partialUri;
+ this.aaiObjectClass = aaiObjectClass;
+ this.name = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, aaiObjectClass.getSimpleName());
+ if (!AAIObjectType.map.containsKey(name)) {
+ AAIObjectType.map.put(name, this);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return this.uriTemplate();
+ }
+
+ public static AAIObjectType fromTypeName(String name) {
+ if (map.containsKey(name)) {
+ return map.get(name);
+ } else {
+ return AAIObjectType.UNKNOWN;
+ }
+ }
+
+ @Override
+ public String typeName() {
+ return this.typeName(CaseFormat.LOWER_HYPHEN);
+ }
+
+ @Override
+ public String typeName(CaseFormat format) {
+ return CaseFormat.LOWER_HYPHEN.to(format, this.name.replace("default-", ""));
+ }
+
+ @Override
+ public String uriTemplate() {
+ return this.uriTemplate;
+ }
+
+ @Override
+ public String partialUri() {
+ return this.partialUri;
+ }
+
+ protected String removeParentUri(Class<?> aaiObjectClass, String parentUri) {
+ return aaiObjectClass.getAnnotation(Metadata.class).uriTemplate().replaceFirst(Pattern.quote(parentUri), "");
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIProperties.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIProperties.java
new file mode 100644
index 0000000000..ac8a6e6e52
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIProperties.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import org.onap.so.client.RestProperties;
+
+public interface AAIProperties extends RestProperties {
+
+ public AAIVersion getDefaultVersion();
+
+ public String getAuth();
+
+ public String getKey();
+
+ @Override
+ public default boolean mapNotFoundToEmpty() {
+ return true;
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryClient.java
new file mode 100644
index 0000000000..5e8b052146
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryClient.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.CustomQuery;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryQueryClient;
+import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri;
+
+public class AAIQueryClient
+ extends GraphInventoryQueryClient<AAIQueryClient, CustomQuery, AAIResultWrapper, AAIObjectType> {
+
+ public AAIQueryClient() {
+ super(new AAIClient());
+ }
+
+ public AAIQueryClient(AAIVersion version) {
+ super(new AAIClient(version));
+ }
+
+ @Override
+ protected GraphInventoryUri getQueryUri() {
+ return AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY);
+ }
+
+ @Override
+ 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/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryObjectMapperProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryObjectMapperProvider.java
new file mode 100644
index 0000000000..ed17937db8
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIQueryObjectMapperProvider.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import com.fasterxml.jackson.databind.AnnotationIntrospector;
+import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
+
+public class AAIQueryObjectMapperProvider extends AAICommonObjectMapperProvider {
+
+ public AAIQueryObjectMapperProvider() {
+ super();
+ AnnotationIntrospector aiJaxb = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
+ AnnotationIntrospector aiJackson = new JacksonAnnotationIntrospector();
+ // first Jaxb, second Jackson annotations
+ mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(aiJaxb, aiJackson));
+
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesClient.java
new file mode 100644
index 0000000000..e879a84dd7
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesClient.java
@@ -0,0 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import java.util.Optional;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryResourcesClient;
+import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryEdgeLabel;
+
+public class AAIResourcesClient extends
+ GraphInventoryResourcesClient<AAIResourcesClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIPluralResourceUri, AAIEdgeLabel, AAIResultWrapper, AAITransactionalClient, AAISingleTransactionClient> {
+
+ private AAIClient aaiClient;
+
+ public AAIResourcesClient() {
+ super(new AAIClient());
+ aaiClient = (AAIClient) super.client;
+ }
+
+ public AAIResourcesClient(AAIVersion version) {
+ super(new AAIClient(version));
+ aaiClient = (AAIClient) super.client;
+ }
+
+ public AAIResourcesClient(AAIClient client) {
+ super(client);
+ aaiClient = (AAIClient) super.client;
+ }
+
+ @Override
+ public AAIResultWrapper createWrapper(String json) {
+ return new AAIResultWrapper(json);
+ }
+
+ @Override
+ public AAIResultWrapper createWrapper(Object obj) {
+ return new AAIResultWrapper(obj);
+ }
+
+ @Override
+ public AAITransactionalClient beginTransaction() {
+ return new AAITransactionalClient(this, aaiClient);
+ }
+
+ @Override
+ public AAISingleTransactionClient beginSingleTransaction() {
+ return new AAISingleTransactionClient(this, aaiClient);
+ }
+
+ @Override
+ protected Relationship buildRelationship(AAIResourceUri uri) {
+ return super.buildRelationship(uri, Optional.empty());
+ }
+
+ @Override
+ protected Relationship buildRelationship(AAIResourceUri uri, GraphInventoryEdgeLabel label) {
+ return super.buildRelationship(uri, Optional.of(label));
+ }
+
+ @Override
+ protected Relationship buildRelationship(AAIResourceUri uri, Optional<GraphInventoryEdgeLabel> label) {
+ return super.buildRelationship(uri, label);
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesObjectMapperProvider.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesObjectMapperProvider.java
new file mode 100644
index 0000000000..6fc122896c
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIResourcesObjectMapperProvider.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+public class AAIResourcesObjectMapperProvider extends AAICommonObjectMapperProvider {
+
+ public AAIResourcesObjectMapperProvider() {
+ super();
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java
new file mode 100644
index 0000000000..9a8a2a53c0
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import java.net.URI;
+import java.util.Map;
+import java.util.Optional;
+import org.onap.so.client.ResponseExceptionMapper;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryRestClient;
+import org.onap.logging.filter.base.ONAPComponents;
+
+public class AAIRestClient extends GraphInventoryRestClient {
+
+ private final AAIProperties aaiProperties;
+
+ protected AAIRestClient(AAIProperties props, URI uri) {
+ super(props, uri);
+ this.aaiProperties = props;
+ }
+
+ @Override
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.AAI;
+ }
+
+ @Override
+ protected void initializeHeaderMap(Map<String, String> headerMap) {
+ headerMap.put("X-FromAppId", aaiProperties.getSystemName());
+ headerMap.put("X-TransactionId", requestId);
+ String auth = aaiProperties.getAuth();
+ String key = aaiProperties.getKey();
+
+ if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
+ addBasicAuthHeader(auth, key);
+ }
+ }
+
+ @Override
+ protected Optional<ResponseExceptionMapper> addResponseExceptionMapper() {
+
+ return Optional.of(new AAIClientResponseExceptionMapper());
+ }
+
+ protected GraphInventoryPatchConverter getPatchConverter() {
+ return this.patchConverter;
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java
new file mode 100644
index 0000000000..ef6ca00a32
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientI.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Optional;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.aai.domain.yang.Pserver;
+
+public interface AAIRestClientI {
+
+ List<Pserver> getPhysicalServerByVnfId(String vnfId) throws IOException;
+
+ void updateMaintenceFlagVnfId(String vnfId, boolean inMaint);
+
+ GenericVnf getVnfByName(String vnfId);
+
+ Optional<Pnf> getPnfByName(String pnfId);
+
+ void createPnf(String pnfId, Pnf pnf);
+
+ void updatePnf(String pnfId, Pnf pnf);
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java
new file mode 100644
index 0000000000..886891a34e
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClientImpl.java
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import javax.ws.rs.core.Response;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.aai.domain.yang.Pserver;
+import org.onap.aaiclient.client.aai.entities.CustomQuery;
+import org.onap.aaiclient.client.aai.entities.Results;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.graphinventory.Format;
+
+public class AAIRestClientImpl implements AAIRestClientI {
+
+ private static final String PSERVER_VNF_QUERY = "pservers-fromVnf";
+
+ @Override
+ public List<Pserver> getPhysicalServerByVnfId(String vnfId) throws IOException {
+ List<AAIResourceUri> startNodes = new ArrayList<>();
+ startNodes.add(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ String jsonInput = new AAIQueryClient().query(Format.RESOURCE, new CustomQuery(startNodes, PSERVER_VNF_QUERY));
+
+ return this.getListOfPservers(jsonInput);
+
+ }
+
+ protected List<Pserver> getListOfPservers(String jsonInput) throws IOException {
+ ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper();
+ Results<Map<String, Pserver>> resultsFromJson =
+ mapper.readValue(jsonInput, new TypeReference<Results<Map<String, Pserver>>>() {});
+ List<Pserver> results = new ArrayList<>();
+ for (Map<String, Pserver> m : resultsFromJson.getResult()) {
+ results.add(m.get("pserver"));
+ }
+ return results;
+ }
+
+ @Override
+ public void updateMaintenceFlagVnfId(String vnfId, boolean inMaint) {
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setInMaint(inMaint);
+ new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId), genericVnf);
+
+ }
+
+ @Override
+ public GenericVnf getVnfByName(String vnfId) {
+ return new AAIResourcesClient()
+ .get(GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)).orElse(null);
+ }
+
+ @Override
+ public Optional<Pnf> getPnfByName(String pnfId) {
+ Response response =
+ new AAIResourcesClient().getFullResponse(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId));
+ if (response.getStatus() != 200) {
+ return Optional.empty();
+ } else {
+ return Optional.of(response.readEntity(Pnf.class));
+ }
+ }
+
+ @Override
+ public void createPnf(String pnfId, Pnf pnf) {
+ new AAIResourcesClient().createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId),
+ Optional.of(pnf));
+ }
+
+ @Override
+ public void updatePnf(String pnfId, Pnf pnf) {
+ new AAIResourcesClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfId), pnf);
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAISingleTransactionClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAISingleTransactionClient.java
new file mode 100644
index 0000000000..8df505e979
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAISingleTransactionClient.java
@@ -0,0 +1,175 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.aaiclient.client.aai;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import javax.ws.rs.core.GenericType;
+import org.onap.so.client.RestClient;
+import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
+import org.onap.aaiclient.client.aai.entities.AAIError;
+import org.onap.aaiclient.client.aai.entities.singletransaction.OperationBodyRequest;
+import org.onap.aaiclient.client.aai.entities.singletransaction.OperationBodyResponse;
+import org.onap.aaiclient.client.aai.entities.singletransaction.SingleTransactionRequest;
+import org.onap.aaiclient.client.aai.entities.singletransaction.SingleTransactionResponse;
+import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryTransactionClient;
+import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Joiner;
+
+public class AAISingleTransactionClient extends
+ GraphInventoryTransactionClient<AAISingleTransactionClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIEdgeLabel> {
+
+ private final SingleTransactionRequest request;
+ private AAIResourcesClient resourcesClient;
+ private AAIClient aaiClient;
+
+ protected AAISingleTransactionClient(AAIResourcesClient resourcesClient, AAIClient aaiClient) {
+ super();
+ this.resourcesClient = resourcesClient;
+ this.aaiClient = aaiClient;
+ this.request = new SingleTransactionRequest();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.aaiclient.client.aai.GraphInventoryTransactionClient#execute()
+ */
+ @Override
+ public void execute() throws BulkProcessFailed {
+ try {
+ if (!this.request.getOperations().isEmpty()) {
+ RestClient client =
+ aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.SINGLE_TRANSACTION));
+ SingleTransactionResponse response = client.post(this.request, SingleTransactionResponse.class);
+ if (response != null) {
+ final Optional<String> errorMessage = this.locateErrorMessages(response);
+ if (errorMessage.isPresent()) {
+ throw new BulkProcessFailed(
+ "One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n"
+ + errorMessage.get());
+ }
+ } else {
+ throw new BulkProcessFailed(
+ "Transactions acccepted by A&AI, but there was no response. Unsure of result.");
+ }
+ }
+ } finally {
+ this.request.getOperations().clear();
+ this.actionCount = 0;
+ }
+ }
+
+ @Override
+ public void execute(boolean dryRun) throws BulkProcessFailed {
+ final ObjectMapper mapper = new ObjectMapper();
+ if (dryRun) {
+ try {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Would execute: {}", mapper.writeValueAsString(this.request));
+ }
+ } catch (JsonProcessingException e) {
+ logger.debug("Could not format request to JSON", e);
+ }
+ } else {
+ this.execute();
+ }
+ }
+
+ protected Optional<String> locateErrorMessages(SingleTransactionResponse response) {
+ final List<String> errorMessages = new ArrayList<>();
+ final ObjectMapper mapper = new ObjectMapper();
+
+ for (OperationBodyResponse body : response.getOperationResponses()) {
+ if (Optional.ofNullable(body.getResponseStatusCode()).orElse(400) > 300) {
+ AAIError error;
+ try {
+ error = mapper.readValue(mapper.writeValueAsString(body.getResponseBody()), AAIError.class);
+ } catch (IOException e) {
+ logger.error("could not parse error object from A&AI", e);
+ error = new AAIError();
+ }
+ AAIErrorFormatter formatter = new AAIErrorFormatter(error);
+ String outputMessage = formatter.getMessage();
+ errorMessages.add(outputMessage);
+ }
+ }
+
+ if (!errorMessages.isEmpty()) {
+ return Optional.of(Joiner.on("\n").join(errorMessages));
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ protected SingleTransactionRequest getRequest() {
+ return this.request;
+ }
+
+ @Override
+ protected void put(String uri, Object body) {
+ request.getOperations().add(new OperationBodyRequest().withAction("put").withUri(uri).withBody(body));
+ }
+
+ @Override
+ protected void delete(String uri) {
+ request.getOperations()
+ .add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(new Object()));
+ }
+
+ @Override
+ protected void delete(String uri, Object obj) {
+ request.getOperations().add(new OperationBodyRequest().withAction("delete").withUri(uri).withBody(obj));
+ }
+
+ @Override
+ protected void patch(String uri, Object body) {
+ request.getOperations().add(new OperationBodyRequest().withAction("patch").withUri(uri).withBody(body));
+ }
+
+ @Override
+ protected <T> Optional<T> get(GenericType<T> genericType, AAIBaseResourceUri<?, ?> clone) {
+ return resourcesClient.get(genericType, clone);
+ }
+
+ @Override
+ protected boolean exists(AAIBaseResourceUri<?, ?> uri) {
+ return resourcesClient.exists(uri);
+ }
+
+ @Override
+ protected String getGraphDBName() {
+ return aaiClient.getGraphDBName();
+ }
+
+ @Override
+ protected GraphInventoryPatchConverter getPatchConverter() {
+ return this.patchConverter;
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAITransactionalClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAITransactionalClient.java
new file mode 100644
index 0000000000..66fa503487
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAITransactionalClient.java
@@ -0,0 +1,228 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+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 javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.Response;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.so.client.RestClient;
+import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel;
+import org.onap.aaiclient.client.aai.entities.AAIError;
+import org.onap.aaiclient.client.aai.entities.bulkprocess.OperationBody;
+import org.onap.aaiclient.client.aai.entities.bulkprocess.Transaction;
+import org.onap.aaiclient.client.aai.entities.bulkprocess.Transactions;
+import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryTransactionClient;
+import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
+import org.onap.so.jsonpath.JsonPathUtil;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Joiner;
+
+public class AAITransactionalClient extends
+ GraphInventoryTransactionClient<AAITransactionalClient, AAIBaseResourceUri<?, ?>, AAIResourceUri, AAIEdgeLabel> {
+
+ private final Transactions transactions;
+ private Transaction currentTransaction;
+
+ private AAIResourcesClient resourcesClient;
+ private AAIClient aaiClient;
+
+ protected AAITransactionalClient(AAIResourcesClient resourcesClient, AAIClient aaiClient) {
+ super();
+ this.resourcesClient = resourcesClient;
+ this.aaiClient = aaiClient;
+ this.transactions = new Transactions();
+ startTransaction();
+ }
+
+ private void startTransaction() {
+ Transaction transaction = new Transaction();
+ transactions.getTransactions().add(transaction);
+ currentTransaction = transaction;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.aaiclient.client.aai.GraphInventoryTransactionalClient#beginNewTransaction()
+ */
+ public AAITransactionalClient beginNewTransaction() {
+ startTransaction();
+ return this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.onap.aaiclient.client.aai.GraphInventoryTransactionalClient#execute()
+ */
+ @Override
+ public void execute() throws BulkProcessFailed {
+ try {
+ if (!this.transactions.getTransactions().isEmpty()) {
+ RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.BULK_PROCESS));
+ Response response = client.put(this.transactions);
+ if (response.hasEntity()) {
+ final Optional<String> errorMessage = this.locateErrorMessages(response.readEntity(String.class));
+ if (errorMessage.isPresent()) {
+ throw new BulkProcessFailed(
+ "One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n"
+ + errorMessage.get());
+ }
+ } else {
+ throw new BulkProcessFailed(
+ "Transactions acccepted by A&AI, but there was no response. Unsure of result.");
+ }
+ }
+ } finally {
+ this.transactions.getTransactions().clear();
+ this.currentTransaction = null;
+ this.actionCount = 0;
+ }
+ }
+
+ @Override
+ public void execute(boolean dryRun) throws BulkProcessFailed {
+ final ObjectMapper mapper = new ObjectMapper();
+ if (dryRun) {
+ try {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Would execute: {}", mapper.writeValueAsString(this.transactions));
+ }
+ } catch (JsonProcessingException e) {
+ logger.debug("Could not format request to JSON", e);
+ }
+ } else {
+ this.execute();
+ }
+ }
+
+ protected Optional<String> locateErrorMessages(String response) {
+ final List<String> errorMessages = new ArrayList<>();
+ final List<String> results = JsonPathUtil.getInstance().locateResultList(response, "$..body");
+ final ObjectMapper mapper = new ObjectMapper();
+ if (!results.isEmpty()) {
+ List<Map<String, Object>> parsed = new ArrayList<>();
+ try {
+ for (String result : results) {
+ parsed.add(mapper.readValue(result, new TypeReference<Map<String, Object>>() {}));
+ }
+ } catch (IOException e) {
+ logger.error("could not map json", e);
+ }
+ for (Map<String, Object> map : parsed) {
+ for (Entry<String, Object> entry : map.entrySet()) {
+ if (!entry.getKey().matches("2\\d\\d")) {
+ AAIError error;
+ try {
+ error = mapper.readValue(entry.getValue().toString(), AAIError.class);
+ } catch (IOException e) {
+ logger.error("could not parse error object from A&AI", e);
+ error = new AAIError();
+ }
+ AAIErrorFormatter formatter = new AAIErrorFormatter(error);
+ String outputMessage = formatter.getMessage();
+ logger.error("part of a bulk action failed in A&AI: " + entry.getValue());
+ errorMessages.add(outputMessage);
+ }
+ }
+ }
+ }
+
+ if (!errorMessages.isEmpty()) {
+ return Optional.of(Joiner.on("\n").join(errorMessages));
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ private Relationship buildRelationship(AAIResourceUri uri) {
+ return buildRelationship(uri, Optional.empty());
+ }
+
+ private Relationship buildRelationship(AAIResourceUri uri, AAIEdgeLabel label) {
+ return buildRelationship(uri, Optional.of(label));
+ }
+
+ private Relationship buildRelationship(AAIResourceUri uri, Optional<AAIEdgeLabel> label) {
+ final Relationship result = new Relationship();
+ result.setRelatedLink(uri.build().toString());
+ if (label.isPresent()) {
+ result.setRelationshipLabel(label.toString());
+ }
+ return result;
+ }
+
+ protected Transactions getTransactions() {
+ return this.transactions;
+ }
+
+ @Override
+ protected void put(String uri, Object body) {
+ currentTransaction.getPut().add(new OperationBody().withUri(uri).withBody(body));
+ }
+
+ @Override
+ protected void delete(String uri) {
+ currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(null));
+ }
+
+ @Override
+ protected void delete(String uri, Object obj) {
+ currentTransaction.getDelete().add(new OperationBody().withUri(uri).withBody(obj));
+ }
+
+ @Override
+ protected void patch(String uri, Object body) {
+ currentTransaction.getPatch().add(new OperationBody().withUri(uri).withBody(body));
+ }
+
+ @Override
+ protected <T> Optional<T> get(GenericType<T> genericType, AAIBaseResourceUri<?, ?> clone) {
+ return resourcesClient.get(genericType, clone);
+ }
+
+ @Override
+ protected boolean exists(AAIBaseResourceUri<?, ?> uri) {
+ return resourcesClient.exists(uri);
+ }
+
+ @Override
+ protected String getGraphDBName() {
+ return aaiClient.getGraphDBName();
+ }
+
+ @Override
+ protected GraphInventoryPatchConverter getPatchConverter() {
+ return this.patchConverter;
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdator.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdator.java
new file mode 100644
index 0000000000..66f9a0e05f
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdator.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+public interface AAIUpdator {
+
+ void updateVnfToLocked(String vnfName) throws Exception;
+
+ void updateVnfToUnLocked(String vnfName) throws Exception;
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdatorImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdatorImpl.java
new file mode 100644
index 0000000000..2bcb1a872a
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIUpdatorImpl.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class AAIUpdatorImpl implements AAIUpdator {
+
+ @Autowired
+ protected AAIRestClientI client;
+
+ public AAIRestClientI getClient() {
+ return client;
+ }
+
+
+ public void setClient(AAIRestClientI client) {
+ this.client = client;
+ }
+
+ @Override
+ public void updateVnfToLocked(String vnfId) throws Exception {
+ client.updateMaintenceFlagVnfId(vnfId, true);
+ }
+
+ @Override
+ public void updateVnfToUnLocked(String vnfId) throws Exception {
+ client.updateMaintenceFlagVnfId(vnfId, false);
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidator.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidator.java
new file mode 100644
index 0000000000..b84579ef83
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidator.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import java.io.IOException;
+
+public interface AAIValidator {
+
+ boolean isPhysicalServerLocked(String hostName) throws IOException;
+
+ boolean isVNFLocked(String vnfId);
+
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidatorImpl.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidatorImpl.java
new file mode 100644
index 0000000000..3861b034e8
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIValidatorImpl.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import java.io.IOException;
+import java.util.List;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Pserver;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class AAIValidatorImpl implements AAIValidator {
+
+
+ @Autowired
+ protected AAIRestClientI client;
+
+ public AAIRestClientI getClient() {
+ return client;
+ }
+
+
+ public void setClient(AAIRestClientI client) {
+ this.client = client;
+ }
+
+ @Override
+ public boolean isPhysicalServerLocked(String vnfId) throws IOException {
+ List<Pserver> pservers;
+ boolean isLocked = false;
+ pservers = client.getPhysicalServerByVnfId(vnfId);
+ if (pservers != null) {
+ for (Pserver pserver : pservers) {
+ if (pserver.isInMaint()) {
+ isLocked = true;
+ return isLocked;
+ }
+ }
+ }
+ return isLocked;
+ }
+
+ @Override
+ public boolean isVNFLocked(String vnfId) {
+ boolean isLocked = false;
+ GenericVnf genericVnf = client.getVnfByName(vnfId);
+ if (genericVnf.isInMaint())
+ isLocked = true;
+
+ return isLocked;
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java
new file mode 100644
index 0000000000..0ddbb8fae5
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIVersion.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai;
+
+import org.onap.aaiclient.client.graphinventory.GraphInventoryVersion;
+
+public enum AAIVersion implements GraphInventoryVersion {
+ V10("V10"),
+ V11("V11"),
+ V12("V12"),
+ V13("v13"),
+ V14("v14"),
+ V15("v15"),
+ V16("v16"),
+ V17("v17"),
+ V18("v18"),
+ V19("v19");
+
+ public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1];
+ private final String value;
+
+ private AAIVersion(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return this.value;
+ }
+}
+
+
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEdgeLabel.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEdgeLabel.java
new file mode 100644
index 0000000000..fdef5773ef
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEdgeLabel.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.aaiclient.client.aai.entities;
+
+import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryEdgeLabel;
+
+public enum AAIEdgeLabel implements GraphInventoryEdgeLabel {
+
+ BELONGS_TO("org.onap.relationships.inventory.BelongsTo"),
+ USES("org.onap.relationships.inventory.Uses"),
+ COMPOSED_OF("org.onap.relationships.inventory.ComposedOf");
+
+ private final String label;
+
+ private AAIEdgeLabel(String label) {
+ this.label = label;
+ }
+
+
+ @Override
+ public String toString() {
+ return this.label;
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntity.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntity.java
new file mode 100644
index 0000000000..bac3462dc3
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntity.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities;
+
+public class AAIEntity {
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntityObject.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntityObject.java
new file mode 100644
index 0000000000..92790e23be
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIEntityObject.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities;
+
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+
+public interface AAIEntityObject {
+
+ public AAIResourceUri getUri();
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIError.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIError.java
new file mode 100644
index 0000000000..51c87d07dd
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIError.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.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({"requestError"})
+public class AAIError {
+
+ @JsonProperty("requestError")
+ private RequestError requestError;
+
+ @JsonProperty("requestError")
+ public RequestError getRequestError() {
+ return requestError;
+ }
+
+ @JsonProperty("requestError")
+ public void setRequestError(RequestError requestError) {
+ this.requestError = requestError;
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapper.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapper.java
new file mode 100644
index 0000000000..baa95fbc28
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/AAIResultWrapper.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities;
+
+import java.io.Serializable;
+import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryResultWrapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AAIResultWrapper extends GraphInventoryResultWrapper<Relationships> implements Serializable {
+
+ private static final long serialVersionUID = 5895841925807816737L;
+ private final static transient Logger logger = LoggerFactory.getLogger(AAIResultWrapper.class);
+
+ public AAIResultWrapper(String json) {
+ super(json, logger);
+ }
+
+ public AAIResultWrapper(Object aaiObject) {
+ super(aaiObject, logger);
+ }
+
+ @Override
+ protected Relationships createRelationships(String json) {
+ return new Relationships(json);
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Configuration.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Configuration.java
new file mode 100644
index 0000000000..335558f9c1
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Configuration.java
@@ -0,0 +1,153 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.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({"configuration-id", "configuration-type", "configuration-sub-type", "model-invariant-id",
+ "model-version-id", "orchestration-status", "operational-status", "configuration-selflink",
+ "model-customization-id"})
+public class Configuration {
+
+ @JsonProperty("configuration-id")
+ private String configurationId;
+ @JsonProperty("configuration-name")
+ private String configurationName;
+ @JsonProperty("configuration-type")
+ private String configurationType;
+ @JsonProperty("configuration-sub-type")
+ private String configurationSubType;
+ @JsonProperty("model-invariant-id")
+ private String modelInvariantId;
+ @JsonProperty("model-version-id")
+ private String modelVersionId;
+ @JsonProperty("orchestration-status")
+ private String orchestrationStatus;
+ @JsonProperty("operational-status")
+ private String operationalStatus;
+ @JsonProperty("configuration-selflink")
+ private String configurationSelflink;
+ @JsonProperty("model-customization-id")
+ private String modelCustomizationId;
+
+ @JsonProperty("configuration-id")
+ public String getConfigurationId() {
+ return configurationId;
+ }
+
+ @JsonProperty("configuration-id")
+ public void setConfigurationId(String configurationId) {
+ this.configurationId = configurationId;
+ }
+
+ @JsonProperty("configuration-name")
+ public String getConfigurationName() {
+ return configurationName;
+ }
+
+ @JsonProperty("configuration-name")
+ public void setConfigurationName(String configurationName) {
+ this.configurationName = configurationName;
+ }
+
+ @JsonProperty("configuration-type")
+ public String getConfigurationType() {
+ return configurationType;
+ }
+
+ @JsonProperty("configuration-type")
+ public void setConfigurationType(String configurationType) {
+ this.configurationType = configurationType;
+ }
+
+ @JsonProperty("configuration-sub-type")
+ public String getConfigurationSubType() {
+ return configurationSubType;
+ }
+
+ @JsonProperty("configuration-sub-type")
+ public void setConfigurationSubType(String configurationSubType) {
+ this.configurationSubType = configurationSubType;
+ }
+
+ @JsonProperty("model-invariant-id")
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ @JsonProperty("model-invariant-id")
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ @JsonProperty("model-version-id")
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ @JsonProperty("model-version-id")
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ @JsonProperty("orchestration-status")
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ @JsonProperty("orchestration-status")
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ @JsonProperty("operational-status")
+ public String getOperationalStatus() {
+ return operationalStatus;
+ }
+
+ @JsonProperty("operational-status")
+ public void setOperationalStatus(String operationalStatus) {
+ this.operationalStatus = operationalStatus;
+ }
+
+ @JsonProperty("model-customization-id")
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ @JsonProperty("model-customization-id")
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ @JsonProperty("configuration-selflink")
+ public String getConfigurationSelflink() {
+ return configurationSelflink;
+ }
+
+ @JsonProperty("configuration-selflink")
+ public void setConfigurationSelflink(String configurationSelflink) {
+ this.configurationSelflink = configurationSelflink;
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/CustomQuery.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/CustomQuery.java
new file mode 100644
index 0000000000..7363ba7796
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/CustomQuery.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities;
+
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class CustomQuery {
+
+ private List<String> start;
+ private String query;
+ private String gremlin;
+
+ public CustomQuery(List<AAIResourceUri> start) {
+ this.setStart(start);
+ }
+
+ public CustomQuery(List<AAIResourceUri> start, String query) {
+ this.setStart(start);
+ this.query = "query/" + query;
+ }
+
+ public CustomQuery(String gremlin) throws UnsupportedEncodingException {
+ this.gremlin = gremlin;
+ }
+
+ public String getGremlin() {
+ return gremlin;
+ }
+
+ public void setGremlin(String gremlin) {
+ this.gremlin = gremlin;
+ }
+
+ public List<String> getStart() {
+ return start;
+ }
+
+ public void setStart(List<AAIResourceUri> start) {
+ this.start = this.mapUris(start);
+ }
+
+ public String getQuery() {
+ return query;
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+
+ private List<String> mapUris(List<AAIResourceUri> uris) {
+ final List<String> result = new ArrayList<>();
+ uris.stream().map(item -> item.build().toString()).forEach(result::add);
+ return result;
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/QueryStep.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/QueryStep.java
new file mode 100644
index 0000000000..cbca20f37b
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/QueryStep.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.aaiclient.client.aai.entities;
+
+@FunctionalInterface
+public interface QueryStep {
+
+
+ public String build();
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Relationships.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Relationships.java
new file mode 100644
index 0000000000..fb205310fc
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Relationships.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities;
+
+import java.util.List;
+import javax.ws.rs.core.UriBuilder;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
+import org.onap.aaiclient.client.graphinventory.entities.GraphInventoryRelationships;
+
+public class Relationships extends GraphInventoryRelationships<AAIResultWrapper, AAIResourceUri, AAIObjectType> {
+
+ public Relationships(String json) {
+ super(json);
+ }
+
+ @Deprecated
+ /**
+ * Use getRelatedUris instead
+ *
+ * @return
+ */
+ public List<AAIResourceUri> getRelatedAAIUris() {
+ return this.getRelatedUris();
+ }
+
+ @Deprecated
+ /**
+ * Use getRelatedUris instead
+ *
+ * @return
+ */
+ public List<AAIResourceUri> getRelatedAAIUris(GraphInventoryObjectName type) {
+ return this.getRelatedUris(type);
+ }
+
+
+ protected AAIResultWrapper get(AAIResourceUri uri) {
+ return new AAIResourcesClient().get(uri);
+
+ }
+
+ @Override
+ protected AAIResourceUri createUri(AAIObjectType type, String relatedLink) {
+
+ return AAIUriFactory.createResourceFromExistingURI(type, UriBuilder.fromPath(relatedLink).build());
+ }
+
+ @Override
+ protected AAIObjectType fromTypeName(String name) {
+ return AAIObjectType.fromTypeName(name);
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/RequestError.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/RequestError.java
new file mode 100644
index 0000000000..3caabf52f4
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/RequestError.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.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({"serviceException"})
+public class RequestError {
+
+ @JsonProperty("serviceException")
+ private ServiceException serviceException;
+
+ @JsonProperty("serviceException")
+ public ServiceException getServiceException() {
+ return serviceException;
+ }
+
+ @JsonProperty("serviceException")
+ public void setServiceException(ServiceException serviceException) {
+ this.serviceException = serviceException;
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Results.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Results.java
new file mode 100644
index 0000000000..57312176c2
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/Results.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"results"})
+public class Results<T> {
+ @JsonProperty("results")
+ protected List<T> results;
+
+ @JsonProperty("results")
+ public List<T> getResult() {
+ if (results == null) {
+ results = new ArrayList<>();
+ }
+ return this.results;
+ }
+
+ @JsonProperty("results")
+ public void setResult(List<T> results) {
+ this.results = results;
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/ServiceException.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/ServiceException.java
new file mode 100644
index 0000000000..81dbbed652
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/ServiceException.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"messageId", "text", "variables"})
+public class ServiceException {
+
+ @JsonProperty("messageId")
+ private String messageId;
+ @JsonProperty("text")
+ private String text;
+ @JsonProperty("variables")
+ private List<String> variables = new ArrayList<>();
+
+ @JsonProperty("messageId")
+ public String getMessageId() {
+ return messageId;
+ }
+
+ @JsonProperty("messageId")
+ public void setMessageId(String messageId) {
+ this.messageId = messageId;
+ }
+
+ @JsonProperty("text")
+ public String getText() {
+ return text;
+ }
+
+ @JsonProperty("text")
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ @JsonProperty("variables")
+ public List<String> getVariables() {
+ return variables;
+ }
+
+ @JsonProperty("variables")
+ public void setVariables(List<String> variables) {
+ this.variables = variables;
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBody.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBody.java
new file mode 100644
index 0000000000..e886425696
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBody.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities.bulkprocess;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"uri", "body"})
+public class OperationBody {
+
+ @JsonProperty("uri")
+ private String uri;
+ @JsonProperty("body")
+ @JsonSerialize(using = OperationBodySerializer.class)
+ private Object body;
+
+ @JsonProperty("uri")
+ public String getUri() {
+ return uri;
+ }
+
+ @JsonProperty("uri")
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public OperationBody withUri(String uri) {
+ this.uri = uri;
+ return this;
+ }
+
+ @JsonProperty("body")
+ public Object getBody() {
+ return body;
+ }
+
+ @JsonProperty("body")
+ public void setBody(Object body) {
+ this.body = body;
+ }
+
+ public OperationBody withBody(Object body) {
+ this.body = body;
+ return this;
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBodySerializer.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBodySerializer.java
new file mode 100644
index 0000000000..11cd6e1ea4
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/OperationBodySerializer.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.aaiclient.client.aai.entities.bulkprocess;
+
+import java.io.IOException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+public class OperationBodySerializer extends StdSerializer<Object> {
+
+ private static final long serialVersionUID = 5367385969270400106L;
+
+ public OperationBodySerializer() {
+ this(null);
+ }
+
+ public OperationBodySerializer(Class<Object> t) {
+ super(t);
+ }
+
+ @Override
+ public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers)
+ throws IOException, JsonProcessingException {
+
+ if (value instanceof String) {
+ gen.writeRawValue((String) value);
+ } else {
+ gen.writeObject(value);
+ }
+
+ }
+
+}
+
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transaction.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transaction.java
new file mode 100644
index 0000000000..2c32c1b0ca
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transaction.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities.bulkprocess;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"patch", "patch", "delete"})
+public class Transaction {
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("put")
+ private List<OperationBody> put = new ArrayList<>();
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("patch")
+ private List<OperationBody> patch = new ArrayList<>();
+
+ @JsonInclude(JsonInclude.Include.NON_EMPTY)
+ @JsonProperty("delete")
+ private List<OperationBody> delete = new ArrayList<>();
+
+ @JsonProperty("put")
+ public List<OperationBody> getPut() {
+ return put;
+ }
+
+ @JsonProperty("put")
+ public void setPut(List<OperationBody> put) {
+ this.put = put;
+ }
+
+ public Transaction withPut(List<OperationBody> put) {
+ this.put = put;
+ return this;
+ }
+
+ @JsonProperty("patch")
+ public List<OperationBody> getPatch() {
+ return patch;
+ }
+
+ @JsonProperty("patch")
+ public void setPatch(List<OperationBody> patch) {
+ this.patch = patch;
+ }
+
+ public Transaction withPatch(List<OperationBody> patch) {
+ this.patch = patch;
+ return this;
+ }
+
+ @JsonProperty("delete")
+ public List<OperationBody> getDelete() {
+ return delete;
+ }
+
+ @JsonProperty("delete")
+ public void setDelete(List<OperationBody> delete) {
+ this.delete = delete;
+ }
+
+ public Transaction withDelete(List<OperationBody> delete) {
+ this.delete = delete;
+ return this;
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transactions.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transactions.java
new file mode 100644
index 0000000000..7d31085b71
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/bulkprocess/Transactions.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities.bulkprocess;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"transactions"})
+public class Transactions {
+
+ @JsonProperty("transactions")
+ private List<Transaction> transactions = new ArrayList<>();
+
+ @JsonProperty("transactions")
+ public List<Transaction> getTransactions() {
+ return transactions;
+ }
+
+ @JsonProperty("transactions")
+ public void setTransactions(List<Transaction> transactions) {
+ this.transactions = transactions;
+ }
+
+ public Transactions withTransactions(List<Transaction> transactions) {
+ this.transactions = transactions;
+ return this;
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequest.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequest.java
new file mode 100644
index 0000000000..25aff9fb4a
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities.singletransaction;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"action", "uri", "body"})
+public class OperationBodyRequest {
+
+ @JsonProperty("action")
+ private String action;
+ @JsonProperty("uri")
+ private String uri;
+ @JsonProperty("body")
+ @JsonSerialize(using = OperationBodyRequestSerializer.class)
+ private Object body;
+
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public OperationBodyRequest withAction(String action) {
+ this.action = action;
+ return this;
+ }
+
+ @JsonProperty("uri")
+ public String getUri() {
+ return uri;
+ }
+
+ @JsonProperty("uri")
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public OperationBodyRequest withUri(String uri) {
+ this.uri = uri;
+ return this;
+ }
+
+ @JsonProperty("body")
+ public Object getBody() {
+ return body;
+ }
+
+ @JsonProperty("body")
+ public void setBody(Object body) {
+ this.body = body;
+ }
+
+ public OperationBodyRequest withBody(Object body) {
+ this.body = body;
+ return this;
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java
new file mode 100644
index 0000000000..5a8a2b6f73
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyRequestSerializer.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.aaiclient.client.aai.entities.singletransaction;
+
+import java.io.IOException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+public class OperationBodyRequestSerializer extends StdSerializer<Object> {
+
+ private static final long serialVersionUID = 5367385969270400106L;
+
+ public OperationBodyRequestSerializer() {
+ this(null);
+ }
+
+ public OperationBodyRequestSerializer(Class<Object> t) {
+ super(t);
+ }
+
+ @Override
+ public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers)
+ throws IOException, JsonProcessingException {
+
+ if (value instanceof String) {
+ gen.writeRawValue((String) value);
+ } else {
+ gen.writeObject(value);
+ }
+
+ }
+
+}
+
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyResponse.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyResponse.java
new file mode 100644
index 0000000000..165806fdfa
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/OperationBodyResponse.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.aaiclient.client.aai.entities.singletransaction;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonPropertyOrder({"action", "uri", "response-status-code", "response-body"})
+public class OperationBodyResponse {
+
+ @JsonProperty("action")
+ public String action;
+ @JsonProperty("uri")
+ public String uri;
+ @JsonProperty("response-status-code")
+ public Integer responseStatusCode;
+ @JsonProperty("response-body")
+ public Object responseBody;
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ @JsonProperty("response-status-code")
+ public Integer getResponseStatusCode() {
+ return responseStatusCode;
+ }
+
+ @JsonProperty("response-status-code")
+ public void setResponseStatusCode(Integer responseStatusCode) {
+ this.responseStatusCode = responseStatusCode;
+ }
+
+ @JsonProperty("response-body")
+ public Object getResponseBody() {
+ return responseBody;
+ }
+
+ @JsonProperty("response-body")
+ public void getResponseBody(Object responseBody) {
+ this.responseBody = responseBody;
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionRequest.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionRequest.java
new file mode 100644
index 0000000000..c279c18dd7
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionRequest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.aaiclient.client.aai.entities.singletransaction;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class SingleTransactionRequest {
+
+ @JsonProperty("operations")
+ public List<OperationBodyRequest> operations;
+
+ public List<OperationBodyRequest> getOperations() {
+
+ if (operations == null) {
+ operations = new ArrayList<>();
+ }
+
+ return operations;
+ }
+
+ public void setOperations(List<OperationBodyRequest> operations) {
+ this.operations = operations;
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionResponse.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionResponse.java
new file mode 100644
index 0000000000..ac4eb2c82f
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/singletransaction/SingleTransactionResponse.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.aaiclient.client.aai.entities.singletransaction;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class SingleTransactionResponse {
+
+ @JsonProperty("operation-responses")
+ public List<OperationBodyResponse> operationResponses;
+
+ @JsonProperty("operation-responses")
+ public List<OperationBodyResponse> getOperationResponses() {
+ if (operationResponses == null) {
+ operationResponses = new ArrayList<>();
+ }
+ return operationResponses;
+ }
+
+ @JsonProperty("operation-responses")
+ public void setOperationResponses(List<OperationBodyResponse> operationResponses) {
+ this.operationResponses = operationResponses;
+ }
+
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIBaseResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIBaseResourceUri.java
new file mode 100644
index 0000000000..e933ffd339
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIBaseResourceUri.java
@@ -0,0 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities.uri;
+
+import org.onap.aaiclient.client.aai.AAIObjectBase;
+import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryResourceUri;
+
+public interface AAIBaseResourceUri<T extends AAIBaseResourceUri<?, ?>, OT extends AAIObjectBase>
+ extends AAIUri<T, OT>, GraphInventoryResourceUri<T, OT> {
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralResourceUri.java
new file mode 100644
index 0000000000..0d41e1df02
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIPluralResourceUri.java
@@ -0,0 +1,9 @@
+package org.onap.aaiclient.client.aai.entities.uri;
+
+import org.onap.aaiclient.client.aai.AAIObjectPlurals;
+import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri;
+
+public interface AAIPluralResourceUri extends AAIBaseResourceUri<AAIPluralResourceUri, AAIObjectPlurals>,
+ GraphInventoryPluralResourceUri<AAIPluralResourceUri, AAIObjectPlurals> {
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java
new file mode 100644
index 0000000000..3d01258f71
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIResourceUri.java
@@ -0,0 +1,10 @@
+package org.onap.aaiclient.client.aai.entities.uri;
+
+import org.onap.aaiclient.client.aai.AAIObjectPlurals;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri;
+
+public interface AAIResourceUri extends AAIBaseResourceUri<AAIResourceUri, AAIObjectType>,
+ GraphInventorySingleResourceUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals> {
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimplePluralUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimplePluralUri.java
new file mode 100644
index 0000000000..67ce0962dc
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimplePluralUri.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.aaiclient.client.aai.entities.uri;
+
+import javax.ws.rs.core.UriBuilder;
+import org.onap.aaiclient.client.aai.AAIObjectPlurals;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.graphinventory.entities.uri.SimplePluralUri;
+
+public class AAISimplePluralUri
+ extends SimplePluralUri<AAIPluralResourceUri, AAIResourceUri, AAIObjectPlurals, AAIObjectType>
+ implements AAIPluralResourceUri {
+
+ private static final long serialVersionUID = -6397024057188453229L;
+
+ protected AAISimplePluralUri(AAIObjectPlurals type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
+ }
+
+ protected AAISimplePluralUri(AAIObjectPlurals type) {
+ super(type);
+ }
+
+ protected AAISimplePluralUri(AAIObjectPlurals type, Object... values) {
+ super(type, values);
+ }
+
+ protected AAISimplePluralUri(AAIObjectPlurals type, AAIResourceUri uri) {
+ super(type, uri);
+ }
+
+ protected AAISimplePluralUri(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+ super(parentUri, childType);
+ }
+
+ protected AAISimplePluralUri(AAISimplePluralUri copy) {
+ super(copy);
+ }
+
+ @Override
+ public AAISimplePluralUri clone() {
+ return new AAISimplePluralUri(this);
+ }
+
+ @Override
+ public AAIObjectPlurals getObjectType() {
+ return this.pluralType;
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java
new file mode 100644
index 0000000000..40184b028b
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAISimpleUri.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.aaiclient.client.aai.entities.uri;
+
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
+import org.onap.aaiclient.client.aai.AAIObjectPlurals;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.graphinventory.entities.uri.SimpleUri;
+
+public class AAISimpleUri extends SimpleUri<AAIResourceUri, AAIPluralResourceUri, AAIObjectType, AAIObjectPlurals>
+ implements AAIResourceUri {
+
+ private static final long serialVersionUID = -6397024057188453229L;
+
+ protected AAISimpleUri(AAIObjectType type, Object... values) {
+ super(type, values);
+
+ }
+
+ protected AAISimpleUri(AAIObjectType type, URI uri) {
+ super(type, uri);
+ }
+
+ protected AAISimpleUri(AAIObjectType type, UriBuilder builder, Object... values) {
+ super(type, builder, values);
+ }
+
+ protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) {
+ super(parentUri, childType, childValues);
+ }
+
+ // copy constructor
+ protected AAISimpleUri(AAISimpleUri copy) {
+ super(copy);
+ }
+
+ @Override
+ public AAISimpleUri clone() {
+ return new AAISimpleUri(this);
+ }
+
+ @Override
+ public AAISimpleUri relatedTo(AAIObjectType type, String... values) {
+ this.internalURI = internalURI.path(relatedTo);
+ return new AAISimpleUri(this, type, values);
+ }
+
+ @Override
+ public AAISimplePluralUri relatedTo(AAIObjectPlurals plural) {
+ this.internalURI.path(relatedTo);
+ return new AAISimplePluralUri(this, plural);
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUri.java
new file mode 100644
index 0000000000..662a1ab37b
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUri.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities.uri;
+
+import java.util.regex.Pattern;
+import org.onap.aaiclient.client.aai.AAIObjectBase;
+import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri;
+
+public interface AAIUri<T extends AAIUri<?, ?>, OP extends AAIObjectBase> extends GraphInventoryUri<T, OP> {
+
+ public default Pattern getPrefixPattern() {
+ return Pattern.compile("/aai/v\\d+");
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java
new file mode 100644
index 0000000000..31b55958d6
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities.uri;
+
+import java.net.URI;
+import org.onap.aaiclient.client.aai.AAIObjectPlurals;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+
+
+public class AAIUriFactory {
+
+ /**
+ * values are filled into the URI template specified in {@link AAIObjectType} in order <br>
+ * There are two special lookups performed on certain types when a single value is specified: <br>
+ * Service Instance and AllottedResources <br>
+ * These can be retrieved without all their required keys but an HTTP call is required to do so
+ *
+ * @param type
+ * @param values
+ * @return
+ */
+ public static AAIResourceUri createResourceUri(AAIObjectType type, Object... values) {
+ if (AAIObjectType.SERVICE_INSTANCE.equals(type)) {
+ return new ServiceInstanceUri(values);
+ } else if (AAIObjectType.ALLOTTED_RESOURCE.equals(type)) {
+ return new AllottedResourceLookupUri(values);
+ } else {
+ return new AAISimpleUri(type, values);
+ }
+ }
+
+ public static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) {
+ return new NodesSingleUri(type, values);
+
+ }
+
+ public static NodesPluralUri createNodesUri(AAIObjectPlurals type) {
+ return new NodesPluralUri(type);
+
+ }
+
+ /**
+ * This method should only be used to wrap a URI retrieved from A&AI contained within an object response
+ *
+ * @param type
+ * @param uri
+ * @return
+ */
+ public static AAISimpleUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
+ return new AAISimpleUri(type, uri);
+ }
+
+
+ /**
+ * creates an AAIResourceUri from a parentUri
+ *
+ * @param parentUri
+ * @param childType
+ * @param childValues
+ * @return
+ */
+ public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType,
+ Object... childValues) {
+
+ return new AAISimpleUri(parentUri, childType, childValues);
+ }
+
+ public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+
+ return new AAISimplePluralUri(parentUri, childType);
+ }
+
+ /**
+ * Creates a uri for a plural type e.g. /cloud-infrastructure/pservers
+ *
+ * @param type
+ * @return
+ */
+ public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type) {
+
+ return new AAISimplePluralUri(type);
+
+ }
+
+ /**
+ * Creates a uri for a plural type with values e.g. /cloud-infrastructure/pservers
+ *
+ * @param type
+ * @return
+ */
+ public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type, Object... values) {
+
+ return new AAISimplePluralUri(type, values);
+
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java
new file mode 100644
index 0000000000..7f51835580
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AllottedResourceLookupUri.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities.uri;
+
+import java.net.URI;
+import java.util.Optional;
+import javax.ws.rs.core.UriBuilder;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+
+public class AllottedResourceLookupUri extends HttpLookupUri {
+
+ private static final long serialVersionUID = -9212594383876793188L;
+
+ protected AllottedResourceLookupUri(Object... values) {
+ super(AAIObjectType.ALLOTTED_RESOURCE, values);
+ }
+
+ protected AllottedResourceLookupUri(UriBuilder builder, Optional<String> cachedValue, Object... values) {
+ super(AAIObjectType.ALLOTTED_RESOURCE, builder, cachedValue, values);
+ }
+
+ @Override
+ public AllottedResourceLookupUri clone() {
+ return new AllottedResourceLookupUri(this.internalURI.clone(), this.getCachedValue(), values);
+ }
+
+ public AAIResourcesClient getResourcesClient() {
+ return new AAIResourcesClient();
+ }
+
+ @Override
+ public URI buildNoNetwork() {
+ return super.build(new String[] {"NONE", "NONE", "NONE", (String) this.values[0]});
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java
new file mode 100644
index 0000000000..c39eb50dc2
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/HttpLookupUri.java
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities.uri;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.net.URI;
+import java.util.Map;
+import java.util.Optional;
+import javax.ws.rs.BadRequestException;
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.UriBuilder;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.Results;
+import org.onap.aaiclient.client.graphinventory.Format;
+import org.onap.aaiclient.client.graphinventory.entities.Pathed;
+import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri;
+import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPayloadException;
+import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException;
+import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriNotFoundException;
+import org.onap.aaiclient.client.graphinventory.exceptions.IncorrectNumberOfUriKeys;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri {
+
+ private transient Optional<String> cachedValue = Optional.empty();
+ private final AAIObjectType aaiType;
+
+ protected HttpLookupUri(AAIObjectType type, Object... values) {
+ super(type, values);
+ this.aaiType = type;
+ }
+
+ protected HttpLookupUri(AAIObjectType type, UriBuilder builder, Optional<String> cachedValue, Object... values) {
+ super(type, builder, values);
+ this.cachedValue = cachedValue;
+ this.aaiType = type;
+ }
+
+ protected String getObjectById(Object id)
+ throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
+ if (!this.getCachedValue().isPresent()) {
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(aaiType, id).format(Format.PATHED);
+ String resultJson;
+ try {
+ resultJson = this.getResourcesClient().get(serviceInstanceUri, NotFoundException.class).getJson();
+ } catch (BadRequestException e) {
+ throw new GraphInventoryUriNotFoundException(
+ aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build());
+
+ }
+ try {
+ cachedValue = extractRelatedLink(resultJson);
+ if (!cachedValue.isPresent()) {
+ throw new GraphInventoryUriNotFoundException(
+ aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build());
+ }
+ } catch (IOException e) {
+ throw new GraphInventoryPayloadException("could not map payload: " + resultJson, e);
+ }
+ }
+ return cachedValue.get();
+ }
+
+ protected Optional<String> extractRelatedLink(String jsonString) throws IOException {
+ Optional<String> result;
+ ObjectMapper mapper = new ObjectMapper();
+
+ Results<Pathed> results = mapper.readValue(jsonString, new TypeReference<Results<Pathed>>() {});
+ if (results.getResult().size() == 1) {
+ 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+", ""));
+ } else if (results.getResult().isEmpty()) {
+ result = Optional.empty();
+ } else {
+ throw new IllegalStateException("more than one result returned");
+ }
+
+ return result;
+ }
+
+ protected Optional<String> getCachedValue() {
+ return this.cachedValue;
+ }
+
+ @Override
+ public URI build() {
+ try {
+ if (this.values.length == 1) {
+ String uri = getObjectById(this.values[0]);
+ Map<String, String> map = super.getURIKeys(uri);
+ this.values = map.values().toArray(values);
+ return super.build(values);
+ }
+ } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
+ throw new GraphInventoryUriComputationException(e);
+ }
+ return super.build();
+ }
+
+ @Override
+ public URI locateAndBuild() {
+ try {
+ if (this.values.length == 1) {
+ String uri = getObjectById(this.values[0]);
+ Map<String, String> map = super.getURIKeys(uri);
+ this.values = map.values().toArray(values);
+ return super.build(values);
+ }
+ } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
+ throw new GraphInventoryUriComputationException(e);
+ }
+ return super.build();
+ }
+
+ @Override
+ public abstract HttpLookupUri clone();
+
+ @Override
+ public void validateValuesSize(String template, Object... values) {
+ try {
+ super.validateValuesSize(template, values);
+ } catch (IncorrectNumberOfUriKeys e) {
+ if (values.length == 1) {
+ // Special case where we perform an http look up
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ public AAIResourcesClient getResourcesClient() {
+ return new AAIResourcesClient();
+ }
+
+ private void writeObject(ObjectOutputStream oos) throws IOException {
+
+ oos.writeUTF(this.cachedValue.orElse(""));
+ }
+
+ private void readObject(ObjectInputStream ois) throws IOException {
+
+ String value = ois.readUTF();
+ if ("".equals(value)) {
+ this.cachedValue = Optional.empty();
+ } else {
+ this.cachedValue = Optional.ofNullable(value);
+ }
+
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesPluralUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesPluralUri.java
new file mode 100644
index 0000000000..80032fe9fd
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesPluralUri.java
@@ -0,0 +1,19 @@
+package org.onap.aaiclient.client.aai.entities.uri;
+
+import javax.ws.rs.core.UriBuilder;
+import org.onap.aaiclient.client.aai.AAIObjectPlurals;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase;
+
+public class NodesPluralUri extends AAISimplePluralUri implements NodesUri {
+
+ private static final long serialVersionUID = -6743170679667245998L;
+
+ protected NodesPluralUri(AAIObjectPlurals type) {
+ super(type);
+ }
+
+ @Override
+ public String getTemplate(GraphInventoryObjectBase type) {
+ return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
+ }
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesSingleUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesSingleUri.java
new file mode 100644
index 0000000000..8ec4df5848
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesSingleUri.java
@@ -0,0 +1,21 @@
+package org.onap.aaiclient.client.aai.entities.uri;
+
+import javax.ws.rs.core.UriBuilder;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectBase;
+
+public class NodesSingleUri extends AAISimpleUri implements NodesUri {
+
+ private static final long serialVersionUID = 2721165364903444248L;
+
+ protected NodesSingleUri(AAIObjectType type, Object... values) {
+ super(type, values);
+ }
+
+
+ @Override
+ public String getTemplate(GraphInventoryObjectBase type) {
+ return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate();
+ }
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesUri.java
new file mode 100644
index 0000000000..03f1a62462
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/NodesUri.java
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities.uri;
+
+public interface NodesUri {
+
+
+}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java
new file mode 100644
index 0000000000..96eaac5815
--- /dev/null
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/ServiceInstanceUri.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.onap.aaiclient.client.aai.entities.uri;
+
+import java.net.URI;
+import java.util.Optional;
+import javax.ws.rs.core.UriBuilder;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+
+public class ServiceInstanceUri extends HttpLookupUri {
+
+ private static final long serialVersionUID = 2248914170527514548L;
+
+ protected ServiceInstanceUri(Object... values) {
+ super(AAIObjectType.SERVICE_INSTANCE, values);
+ }
+
+ protected ServiceInstanceUri(UriBuilder builder, Optional<String> cachedValue, Object... values) {
+ super(AAIObjectType.SERVICE_INSTANCE, builder, cachedValue, values);
+ }
+
+ @Override
+ public ServiceInstanceUri clone() {
+ return new ServiceInstanceUri(this.internalURI.clone(), this.getCachedValue(), values);
+ }
+
+ public AAIResourcesClient getResourcesClient() {
+ return new AAIResourcesClient();
+ }
+
+ @Override
+ public URI buildNoNetwork() {
+ return super.build(new String[] {"NONE", "NONE", (String) this.values[0]});
+ }
+}