summaryrefslogtreecommitdiffstats
path: root/adaptors/aai-service/provider/src/main/java
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-10-29 15:04:35 -0400
committerDan Timoney <dtimoney@att.com>2021-10-29 15:04:41 -0400
commit1267516ac4ce6402a0d175328563d5557fd59c96 (patch)
tree0ed5d136977ea47f531412fd02941d627e35f03e /adaptors/aai-service/provider/src/main/java
parent9bdc825f7b9c1689aae71fcb01bf08aa6bcba995 (diff)
Sync local changes to support GRA microservice
Sync changes made downstream to support GRA microservice Issue-ID: CCSDK-3504 Signed-off-by: Dan Timoney <dtimoney@att.com> Change-Id: I854b5437c4a60023bd161e3625e08ff6e0771945
Diffstat (limited to 'adaptors/aai-service/provider/src/main/java')
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java3
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java144
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java102
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterface.java3
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java51
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java54
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java62
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/BulkUpdateRequest.java129
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java2
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/DslNaradQueryRequest.java132
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/DslQueryRequest.java127
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequest.java2
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java2
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java215
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java2
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequest.java2
-rwxr-xr-xadaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequest.java2
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/data/AAIAbstractDatum.java47
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/data/RelatedNode.java142
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/DslNaradQueryRequestData.java65
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/DslQueryRequestData.java65
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestData.java77
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestItem.java88
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestItemBody.java57
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateResponseData.java65
-rw-r--r--adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateResponseItem.java108
26 files changed, 1664 insertions, 84 deletions
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java
index 7fd2dfe76..a3361523b 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java
@@ -88,4 +88,7 @@ public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin {
boolean delete(AAIRequest request, String resourceVersion) throws AAIServiceException;
boolean update(AAIRequest request, String resourceVersion) throws AAIServiceException;
+ // Bulk subnet update
+ String bulkSubnetUpdate(BulkUpdateRequest request) throws AAIServiceException;
+
}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java
index 446ec4b6a..d3f79db8d 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java
@@ -36,6 +36,7 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
+import java.net.URISyntaxException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.KeyManagementException;
@@ -57,6 +58,7 @@ import org.onap.ccsdk.sli.adaptors.aai.data.ErrorResponse;
import org.onap.ccsdk.sli.adaptors.aai.data.RequestError;
import org.onap.ccsdk.sli.adaptors.aai.data.ResourceVersion;
import org.onap.ccsdk.sli.adaptors.aai.data.ServiceException;
+import org.onap.ccsdk.sli.adaptors.aai.update.BulkUpdateResponseData;
import org.onap.ccsdk.sli.core.sli.MetricLogger;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.slf4j.Logger;
@@ -64,6 +66,8 @@ import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.EnglishReasonPhraseCatalog;
/**
@@ -228,18 +232,20 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
if(request.getRequestObject() != null) {
requestUrl = request.getRequestUrl(HttpMethod.POST, null);
requestUrl = appendDepth(requestUrl, request);
+ LOG.info(String.format("%s : %s", HttpMethod.GET, requestUrl.toString()));
con = getConfiguredConnection(requestUrl, HttpMethod.POST);
String json_text = request.toJSONString();
LOGwriteDateTrace("data", json_text);
- logMetricRequest("POST "+requestUrl.getPath(), json_text, requestUrl.getPath());
+ logMetricRequest("POST "+requestUrl.toString(), json_text, requestUrl.toString());
OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream());
osw.write(json_text);
osw.flush();
} else {
requestUrl = request.getRequestUrl(HttpMethod.GET, null);
requestUrl = appendDepth(requestUrl, request);
+ LOG.info(String.format("%s : %s", HttpMethod.GET, requestUrl.toString()));
con = getConfiguredConnection(requestUrl, HttpMethod.GET);
- logMetricRequest("GET "+requestUrl.getPath(), "", requestUrl.getPath());
+ logMetricRequest("GET "+requestUrl.toString(), "", requestUrl.toString());
}
// Check for errors
@@ -374,15 +380,17 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
URL requestUrl = request.getRequestUrl(HttpMethod.PUT, resourceVersion);
HttpURLConnection con = getConfiguredConnection(requestUrl, HttpMethod.PUT);
- ObjectMapper mapper = AAIService.getObjectMapper();
String jsonText = request.toJSONString();
-
LOGwriteDateTrace("data", jsonText);
- logMetricRequest("PUT "+requestUrl.getPath(), jsonText, requestUrl.getPath());
- OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream());
- osw.write(jsonText);
- osw.flush();
+ if(jsonText!=null) {
+ OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream());
+ osw.write(jsonText);
+ osw.flush();
+ osw.close();
+ }
+ logMetricRequest("PUT "+requestUrl.toString(), jsonText, requestUrl.toString());
+
// Check for errors
int responseCode = con.getResponseCode();
@@ -405,6 +413,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
logMetricResponse(responseCode, responseMessage);
// Process the response
+ ObjectMapper mapper = AAIService.getObjectMapper();
BufferedReader reader;
String line = null;
reader = new BufferedReader( new InputStreamReader( inputStream ) );
@@ -688,6 +697,92 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
}
}
+ /**
+ * Returns an String that contains JSON data returned from the AAI Server.
+ * <p>
+ * This method always returns immediately, whether or not the
+ * data exists.
+ *
+ * @param request an instance of AAIRequiest representing
+ * the request made by DirectedGraph node.
+ * @return the JSON based representation of data instance requested.
+ * @see String
+ */
+ @Override
+ public String bulkUpdate(BulkUpdateRequest request) throws AAIServiceException {
+ InputStream inputStream = null;
+
+ try {
+ URL requestUrl = request.getRequestUrl(HttpMethod.POST, null);
+ HttpURLConnection con = getConfiguredConnection(requestUrl, HttpMethod.POST);
+ String jsonText = request.toJSONString();
+ LOGwriteDateTrace("data", jsonText);
+
+ if(jsonText!=null) {
+ OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream());
+ osw.write(jsonText);
+ osw.flush();
+ osw.close();
+ }
+ logMetricRequest("POST "+requestUrl.toString(), jsonText, requestUrl.toString());
+
+
+ // Check for errors
+ int responseCode = con.getResponseCode();
+ if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
+ inputStream = con.getInputStream();
+ } else {
+ inputStream = con.getErrorStream();
+ }
+ String responseMessage = null;
+ try {
+ responseMessage = con.getResponseMessage();
+ } catch(Exception exc) {
+ responseMessage = EnglishReasonPhraseCatalog.INSTANCE.getReason(responseCode,null);
+ } finally {
+ if(responseMessage == null)
+ responseMessage = NOT_PROVIDED;
+ }
+
+ LOG.info(HTTP_URL_CONNECTION_RESULT, responseCode, responseMessage);
+ logMetricResponse(responseCode, responseMessage);
+
+ // Process the response
+ ObjectMapper mapper = AAIService.getObjectMapper();
+ BufferedReader reader;
+ String line = null;
+ reader = new BufferedReader( new InputStreamReader( inputStream ) );
+ mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+
+ if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
+ StringBuilder stringBuilder = new StringBuilder();
+
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, responseMessage, (stringBuilder.length() > 0) ? stringBuilder.toString() : "{no-data}");
+ return stringBuilder.toString();
+ } else {
+ ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
+ LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse));
+
+ throw new AAIServiceException(responseCode, errorresponse);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("AAIRequestExecutor.post", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ try {
+ if(inputStream != null)
+ inputStream.close();
+ } catch (Exception exc) {
+ LOG.warn("AAIRequestExecutor.post", exc);
+ }
+ }
+ }
+
/**
*
* @param httpReqUrl
@@ -712,6 +807,7 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
"PATCH".equalsIgnoreCase(method) ? "application/merge-patch+json" : "application/json");
con.setRequestProperty("X-FromAppId", applicationId);
con.setRequestProperty("X-TransactionId", TransactionIdTracker.getNextTransactionId());
+ con.setRequestProperty("X-DslApiVersion", "V2");
String mlId = ml.getRequestID();
if (mlId != null && !mlId.isEmpty()) {
LOG.debug(String.format("MetricLogger requestId = %s", mlId));
@@ -732,20 +828,28 @@ public class AAIClientRESTExecutor implements AAIExecutorInterface {
return con;
}
- private URL appendDepth(URL requestUrl, AAIRequest request) throws MalformedURLException {
-
- String depth = request.requestProperties.getProperty("depth", "1");
- String path = requestUrl.toString();
- if(path.contains("?depth=") || path.contains("&depth=")) {
- return requestUrl;
- } else {
- if(path.contains("?")) {
- path = String.format("%s&depth=%s", path, depth);
- } else {
- path = String.format("%s?depth=%s", path, depth);
+ private URL appendDepth(URL requestUrl, AAIRequest request) throws MalformedURLException, URISyntaxException {
+ final String NODES_ONLY = "nodes-only";
+ URIBuilder builder = new URIBuilder(requestUrl.toURI());
+ // PROCESS nodes-only option
+ if (request.requestProperties.containsKey(NODES_ONLY)) {
+ if(request.requestProperties.containsKey(NODES_ONLY)) {
+ String nodesOnly = request.requestProperties.getProperty(NODES_ONLY);
+ if(nodesOnly != null && !nodesOnly.isEmpty()) {
+ builder.setParameter(NODES_ONLY, nodesOnly);
+ }
+ }
+ // do not add depth by default with nodes-only
+ if(!request.requestProperties.containsKey("depth")) {
+ return builder.build().toURL();
}
- return new URL(path);
}
+
+ String depth = request.requestProperties.getProperty("depth", "1");
+
+ builder.setParameter("depth", depth);
+
+ return builder.build().toURL();
}
public void logMetricRequest(String targetServiceName, String msg, String path){
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
index aca1e6b81..46303dddf 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
@@ -43,9 +43,11 @@ import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -58,12 +60,18 @@ import org.apache.commons.lang.StringUtils;
import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
import org.onap.ccsdk.sli.adaptors.aai.query.FormattedQueryResultList;
import org.onap.ccsdk.sli.adaptors.aai.query.Result;
+import org.onap.ccsdk.sli.adaptors.aai.update.BulkUpdateRequestItemBody;
import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.aai.inventory.v24.GenericVnf;
import org.onap.aai.inventory.v24.Image;
+import org.onap.aai.inventory.v24.InventoryResponseItem;
+import org.onap.aai.inventory.v24.InventoryResponseItems;
+import org.onap.aai.inventory.v24.L3Network;
+import org.onap.aai.inventory.v24.LogicalLink;
import org.onap.aai.inventory.v24.Metadata;
import org.onap.aai.inventory.v24.Metadatum;
+import org.onap.aai.inventory.v24.Pnf;
import org.onap.aai.inventory.v24.RelatedToProperty;
import org.onap.aai.inventory.v24.Relationship;
import org.onap.aai.inventory.v24.RelationshipData;
@@ -71,6 +79,7 @@ import org.onap.aai.inventory.v24.RelationshipList;
import org.onap.aai.inventory.v24.ResultData;
import org.onap.aai.inventory.v24.SearchResults;
import org.onap.aai.inventory.v24.ServiceInstance;
+import org.onap.aai.inventory.v24.Subnet;
import org.onap.aai.inventory.v24.Vlan;
import org.onap.aai.inventory.v24.Vlans;
import org.onap.aai.inventory.v24.Vserver;
@@ -99,6 +108,7 @@ public abstract class AAIDeclarations implements AAIClient {
public static final String READ_TIMEOUT = "read.timeout";
public static final String TARGET_URI = "org.onap.ccsdk.sli.adaptors.aai.uri";
+ public static final String TARGET_NARAD_URI = "org.onap.ccsdk.sli.adaptors.narad.uri";
public static final String AAI_VERSION = "org.onap.ccsdk.sli.adaptors.aai.version";
@@ -134,6 +144,9 @@ public abstract class AAIDeclarations implements AAIClient {
// node query (1602)
public static final String QUERY_NODES_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.nodes";
+ // aai-specific proxy
+ public static final String HTTP_PROXY = "org.onap.ccsdk.sli.adaptors.aai.http.proxy";
+
private static final String VERSION_PATTERN = "/v$/";
private static final String AAI_SERVICE_EXCEPTION = "AAI Service Exception";
@@ -465,6 +478,18 @@ public abstract class AAIDeclarations implements AAIClient {
// params.remove("prefix");
}
}
+ if(params.containsKey("dsl")) {
+ Set<Entry<String, String>> entryset = params.entrySet();
+ Iterator<Entry<String, String>> it = entryset.iterator();
+ while(it.hasNext()) {
+ Entry<String, String> entry = it.next();
+ if("dsl".equals(entry.getKey())) {
+ String resolvedValue = entry.getValue();
+ resolvedValue = AAIServiceUtils.processDslRequestData(resolvedValue, ctx);
+ entry.setValue(resolvedValue);
+ }
+ }
+ }
// params passed
getLogger().debug("parms = "+ Arrays.toString(params.entrySet().toArray()));
@@ -569,8 +594,54 @@ public abstract class AAIDeclarations implements AAIClient {
getLogger().debug("parms = "+ Arrays.toString(params.entrySet().toArray()));
AAIRequest request = AAIRequest.createRequest(resource, nameValues);
+
+ // Special handling for bulk-subnet
+ if ("bulk-subnet".equals(resource)) {
+ BulkUpdateRequest bulkUpdateRequest = (BulkUpdateRequest) request;
+ String networkPath;
+ try {
+ networkPath = request.getRequestPath("l3-network").replace("{network-id}", nameValues.get("l3_network.network_id"));
+ } catch (MalformedURLException e) {
+ throw new SvcLogicException("Caught exception creating path to l3-network", e);
+ }
+ if (!params.containsKey("subnets")) {
+ throw new SvcLogicException("Missing mandatory parameter subnets for update to bulk-subnet resource");
+ }
+
+ if (!params.containsKey("orchestration-status")) {
+ throw new SvcLogicException("Missing mandatory parameter orchestration-status for update to bulk-subnet resource");
+ }
+ String subnetListVar = params.get("subnets");
+ String subnetLengthStr = ctx.getAttribute(subnetListVar+".subnet_length");
+ if ((subnetLengthStr == null) || (subnetLengthStr.length() == 0)) {
+ throw new SvcLogicException("subnet list length variable "+subnetListVar+"_length is unset");
+ }
+
+ String orchestrationStatus = params.get("orchestration-status");
+
+ BulkUpdateRequestItemBody subnet = new BulkUpdateRequestItemBody();
+ subnet.setOrchestrationStatus(orchestrationStatus);
+
+ int subnetLength = Integer.parseInt(subnetLengthStr);
+ for (int i = 0 ; i < subnetLength ; i++) {
+ String subnetId = ctx.getAttribute(subnetListVar+".subnet["+i+"].subnet-id");
+ String subnetPath = networkPath+"/subnets/subnet/"+subnetId+"?depth=1";
+ bulkUpdateRequest.addUpdate("patch", subnetPath, subnet);
+ }
+
+ try {
+ getExecutor().bulkUpdate(bulkUpdateRequest);
+ } catch (AAIServiceException e) {
+ throw new SvcLogicException("Cannot execute bulk update", e);
+ }
+ return QueryStatus.SUCCESS;
+ }
+
+ // Handling for non-bulk transactions
request = new UpdateRequest(request, params);
+
+
String[] arguments = request.getArgsList();
for(String name : arguments) {
String modifiedKey = name.replaceAll("-", "_");
@@ -1126,7 +1197,7 @@ public abstract class AAIDeclarations implements AAIClient {
newValues.add(tmpValue);
}
if(!newValues.isEmpty()) {
- Method setter = findSetterFor(resourceClass, value);
+ Method setter = findSetterFor(resourceClass, value);
if(setter != null) {
Object o = setter.invoke(instance, newValues);
} else {
@@ -1141,7 +1212,7 @@ public abstract class AAIDeclarations implements AAIClient {
getLogger().warn(AAI_SERVICE_EXCEPTION, nsme);
}
}
- }
+ }
}
set.remove(id);
} else {
@@ -1494,20 +1565,19 @@ public abstract class AAIDeclarations implements AAIClient {
}
private Method findSetterFor(Class<? extends AAIDatum> resourceClass, String value) {
- try {
- String setterName = "set"+StringUtils.capitalize(value);
- for (Method method : resourceClass.getDeclaredMethods()) {
- int modifiers = method.getModifiers();
- if (Modifier.isPublic(modifiers) && setterName.contentEquals(method.getName())) {
- return method;
- }
- }
- } catch(Exception exc) {
- getLogger().warn("findSetterFor()", exc);
- }
- return null;
- }
-
+ try {
+ String setterName = "set"+StringUtils.capitalize(value);
+ for (Method method : resourceClass.getDeclaredMethods()) {
+ int modifiers = method.getModifiers();
+ if (Modifier.isPublic(modifiers) && setterName.contentEquals(method.getName())) {
+ return method;
+ }
+ }
+ } catch(Exception exc) {
+ getLogger().warn("findSetterFor()", exc);
+ }
+ return null;
+ }
private QueryStatus newModelProcessRelationshipList(Object instance, Map<String, String> params, String prefix, SvcLogicContext ctx) throws Exception {
Class resourceClass = instance.getClass();
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterface.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterface.java
index d02f14a95..129ce118b 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterface.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterface.java
@@ -24,10 +24,13 @@
*/
package org.onap.ccsdk.sli.adaptors.aai;
+import org.onap.ccsdk.sli.adaptors.aai.update.BulkUpdateResponseData;
+
public interface AAIExecutorInterface {
public String get(AAIRequest request) throws AAIServiceException;
public String post(AAIRequest request) throws AAIServiceException;
public Boolean delete(AAIRequest request, String resourceVersion) throws AAIServiceException;
public Object query(AAIRequest request, Class clas) throws AAIServiceException;
public Boolean patch(AAIRequest request, String resourceVersion) throws AAIServiceException;
+ public String bulkUpdate(BulkUpdateRequest request) throws AAIServiceException;
}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
index e9fa9e67e..239342d95 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
@@ -53,10 +53,6 @@ import java.util.TreeSet;
import org.apache.commons.lang.StringUtils;
import org.onap.aai.inventory.v24.GenericVnf;
import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
-import org.onap.ccsdk.sli.core.utils.common.EnvProperties;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,6 +65,7 @@ public abstract class AAIRequest {
protected static final Logger LOG = LoggerFactory.getLogger(AAIRequest.class);
protected static final String TARGET_URI = "org.onap.ccsdk.sli.adaptors.aai.uri";
+ protected static final String TARGET_NARAD_URI = "org.onap.ccsdk.sli.adaptors.narad.uri";
protected static final String MASTER_REQUEST = "master-request";
@@ -77,7 +74,8 @@ public abstract class AAIRequest {
public static final String DEPTH = "depth";
protected static Properties configProperties;
- protected final String targetUri;
+ private final String targetUri;
+ protected final String targetNaradUri;
protected static AAIService aaiService;
protected AAIDatum requestDatum;
@@ -116,6 +114,8 @@ public abstract class AAIRequest {
}
switch(resoource){
+ case "bulk-subnet":
+ return new BulkUpdateRequest();
case "generic-query":
return new GenericQueryRequest();
case "nodes-query":
@@ -123,6 +123,10 @@ public abstract class AAIRequest {
case "custom-query":
case "formatted-query":
return new CustomQueryRequest();
+ case "dsl-query":
+ return new DslQueryRequest();
+ case "dsl-narad-query":
+ return new DslNaradQueryRequest();
case "echo":
case "test":
return new EchoRequest();
@@ -163,39 +167,15 @@ public abstract class AAIRequest {
AAIRequest.configProperties = props;
AAIRequest.aaiService = aaiService;
- InputStream in = null;
-
try
{
- LOG.info("Loading aai-path.properties via OSGi");
URL url = null;
- Bundle bundle = FrameworkUtil.getBundle(AAIService.class);
- if(bundle != null) {
- BundleContext ctx = bundle.getBundleContext();
- if(ctx == null)
- return;
-
- url = ctx.getBundle().getResource(AAIService.PATH_PROPERTIES);
- } else {
url = aaiService.getClass().getResource("/aai-path.properties");
- }
-
- in = url.openStream();
- }
- catch (NoClassDefFoundError|Exception e) {
- LOG.info("Loading aai-path.properties from jar");
- in = AAIRequest.class.getResourceAsStream("/aai-path.properties");
-
- }
-
- if (in == null) {
- return;
- }
- try {
+ InputStream in = url.openStream();
Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8);
- Properties properties = new EnvProperties();
+ Properties properties = new Properties();
properties.load(reader);
LOG.info("loaded " + properties.size());
@@ -219,7 +199,7 @@ public abstract class AAIRequest {
bs.set(bitIndex);
}
String path = properties.getProperty(key);
- LOG.trace(String.format("bitset %s\t\t%s", bs.toString(), path));
+ LOG.info(String.format("bitset %s\t\t%s", bs.toString(), path));
bitsetPaths.put(bs, path);
}
LOG.info("loaded " + resourceNames.toString());
@@ -232,6 +212,13 @@ public abstract class AAIRequest {
public AAIRequest() {
targetUri = configProperties.getProperty(TARGET_URI);
+ String tmpNarad = targetUri;
+ if(configProperties.containsKey(TARGET_NARAD_URI)) {
+ tmpNarad = configProperties.getProperty(TARGET_NARAD_URI);
+ if(tmpNarad == null || tmpNarad.length() == 0)
+ tmpNarad = targetUri;
+ }
+ targetNaradUri = tmpNarad;
}
public void addRequestProperty(String key, String value) {
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
index 0039aa0fe..ddd87e111 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
@@ -38,7 +38,9 @@ import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.HttpURLConnection;
+import java.net.InetSocketAddress;
import java.net.MalformedURLException;
+import java.net.Proxy;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
@@ -73,6 +75,11 @@ import javax.xml.bind.annotation.XmlElement;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
+import org.onap.aai.inventory.v24.GenericVnf;
+import org.onap.aai.inventory.v24.PhysicalLink;
+import org.onap.aai.inventory.v24.ResultData;
+import org.onap.aai.inventory.v24.SearchResults;
+import org.onap.aai.inventory.v24.Vserver;
import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
import org.onap.ccsdk.sli.adaptors.aai.data.ErrorResponse;
import org.onap.ccsdk.sli.adaptors.aai.data.notify.NotifyEvent;
@@ -82,11 +89,6 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.SvcLogicResource;
import org.onap.ccsdk.sli.core.utils.common.EnvProperties;
-import org.onap.aai.inventory.v24.GenericVnf;
-import org.onap.aai.inventory.v24.PhysicalLink;
-import org.onap.aai.inventory.v24.ResultData;
-import org.onap.aai.inventory.v24.SearchResults;
-import org.onap.aai.inventory.v24.Vserver;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -134,6 +136,10 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
private String userName;
private String userPassword;
+ // proxy
+ private String proxyHost;
+ private int proxyPort;
+
// runtime
private final boolean runtimeOSGI;
@@ -231,6 +237,16 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
queryNodesPath = props.getProperty(QUERY_NODES_PATH);
+ String httpProxy = props.getProperty(HTTP_PROXY, "none");
+ if (!httpProxy.isEmpty() && !"none".equalsIgnoreCase(httpProxy)) {
+ String proxyParts[] = httpProxy.split(":");
+ proxyHost = proxyParts[0];
+ proxyPort = (proxyParts.length > 1) && (proxyParts[1] != null) && (!proxyParts[1].isEmpty()) ? Integer.parseInt(proxyParts[1]) : -1;
+ } else {
+ proxyHost = null;
+ proxyPort = -1;
+ }
+
String iche = props.getProperty(CERTIFICATE_HOST_ERROR);
boolean host_error = false;
if(iche != null && !iche.isEmpty()) {
@@ -348,8 +364,13 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
* @throws Exception
*/
protected HttpURLConnection getConfiguredConnection(URL http_req_url, String method) throws Exception {
- HttpURLConnection con = (HttpURLConnection) http_req_url.openConnection();
-
+ HttpURLConnection con;
+ if (proxyPort > -1) {
+ Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
+ con = (HttpURLConnection) http_req_url.openConnection(proxy);
+ } else {
+ con = (HttpURLConnection) http_req_url.openConnection();
+ }
// Set up the connection properties
con.setRequestProperty( "Connection", "close" );
con.setDoInput(true);
@@ -362,6 +383,8 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
con.setRequestProperty( "Content-Type", "PATCH".equalsIgnoreCase(method) ? "application/merge-patch+json" : "application/json" );
con.setRequestProperty("X-FromAppId", applicationId);
con.setRequestProperty("X-TransactionId",TransactionIdTracker.getNextTransactionId());
+ con.setRequestProperty("X-DslApiVersion", "V2");
+
String mlId = ml.getRequestID();
if(mlId != null && !mlId.isEmpty()) {
LOG.debug(String.format("MetricLogger requestId = %s", mlId));
@@ -1049,7 +1072,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
String data_type = datum.getResourceType();
String resourceLink = datum.getResourceLink();
if(!resourceLink.isEmpty() && !resourceLink.toLowerCase().startsWith("http")) {
- resourceLink = (new EchoRequest()).targetUri + resourceLink;
+ resourceLink = (new EchoRequest()).getTargetUri() + resourceLink;
}
entity = new URL(resourceLink);
}
@@ -1355,6 +1378,8 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
switch(normResource){
case "custom-query":
+ case "dsl-query":
+ case "dsl-narad-query":
case "formatted-query":
case "generic-query":
case "nodes-query":
@@ -1383,6 +1408,8 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
switch(normResource){
case "custom-query":
+ case "dsl-query":
+ case "dsl-narad-query":
case "formatted-query":
case "generic-query":
case "nodes-query":
@@ -1411,6 +1438,8 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
switch(normResource){
case "custom-query":
+ case "dsl-query":
+ case "dsl-narad-query":
case "formatted-query":
case "generic-query":
case "nodes-query":
@@ -1438,7 +1467,10 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
String normResource = resource.split(":")[0];
switch(normResource){
+ case "bulk-subnet":
case "custom-query":
+ case "dsl-query":
+ case "dsl-narad-query":
case "formatted-query":
case "generic-query":
case "nodes-query":
@@ -1545,4 +1577,10 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
return executor.delete(request, resourceVersion);
}
+ @Override
+ public String bulkSubnetUpdate(BulkUpdateRequest request) throws AAIServiceException {
+
+ return executor.bulkUpdate(request);
+ }
+
}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java
index 3c8668aee..c86e78b53 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java
@@ -39,6 +39,8 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.xml.bind.annotation.XmlType;
@@ -198,6 +200,10 @@ public class AAIServiceUtils {
if (term.startsWith("$") && (ctx != null)) {
// Resolve any index variables.
+ if(resolveCtxVariable(term.substring(1), ctx) == null) {
+ LOG.warn(String.format("The variable %s resolved to a null", term));
+ return "ERROR_NULL_VALUE";
+ }
term = ("'" + resolveCtxVariable(term.substring(1), ctx) + "'");
if (term.contains(VERSION_PATTERN) && (ctx != null)) {
return term.replace(VERSION_PATTERN, AAIRequest.getSupportedAAIVersion());
@@ -327,7 +333,10 @@ public class AAIServiceUtils {
public static boolean isValidFormat(String resource, Map<String, String> nameValues) {
switch(resource){
- case "custom-query":
+ case "bulk-subnet":
+ case "custom-query":
+ case "dsl-query":
+ case "dsl-narad-query":
case "formatted-query":
case "generic-query":
case "nodes-query":
@@ -345,12 +354,19 @@ public class AAIServiceUtils {
Set<String> keys = nameValues.keySet();
for(String key : keys) {
if(!key.contains(".")) {
- if("depth".equals(key) || "related-to".equals(key) || "related_to".equals(key) || "related-link".equals(key) || "related_link".equals(key) || "selflink".equals(key) || "resource_path".equals(key))
+ if("depth".equals(key) || "nodes-only".equals(key) || "nodes_only".equals(key) || "related-to".equals(key) || "related_to".equals(key) || "related-link".equals(key) || "related_link".equals(key) || "selflink".equals(key) || "resource_path".equals(key))
continue;
else {
getLogger().warn(String.format("key '%s' is incompatible with resource type '%s'", key, resource));
+ getLogger().warn("The valid format is {resource-type}.{primary-key} = ...");
+// return false;
}
}
+
+ if(nameValues.get(key) == null || "ERROR_NULL_VALUE".equalsIgnoreCase(nameValues.get(key))) {
+ LOG.warn(String.format("The value is null/unresolved for key of %s. Processing aborted.", key));
+ return false;
+ }
}
return true;
}
@@ -361,7 +377,10 @@ public class AAIServiceUtils {
}
switch(resource){
+ case "bulk-subnet":
case "custom-query":
+ case "dsl-query":
+ case "dsl-narad-query":
case "formatted-query":
case "generic-query":
case "nodes-query":
@@ -391,4 +410,43 @@ public class AAIServiceUtils {
}
return tags.contains(resource);
}
+
+ public static String processDslRequestData(final String value, SvcLogicContext ctx) {
+ String subjectToChange = value;
+
+ Pattern p = Pattern.compile("\\$([a-zA-Z\\d-\\.]*)");
+ Matcher m = p.matcher(value);
+
+ boolean secondPass = false;
+
+ while (m.find()) {
+ final String reference = m.group();
+ String resolved = resolveTerm(reference, ctx);
+ final String indexedReference = String.format("[%s]", reference);
+ if (subjectToChange.contains(indexedReference) && resolved.startsWith("'") && resolved.endsWith("'")) {
+ resolved = resolved.substring(1, resolved.length() - 1);
+ }
+ if(resolved != null && !resolved.isEmpty() && !"ERROR_NULL_VALUE".equalsIgnoreCase(resolved)) {
+ LOG.info("{} - {}", reference, resolved);
+ subjectToChange = subjectToChange.replace(reference, resolved);
+ } else {
+ LOG.info("{} - {} enabling second pass", reference, resolved);
+ secondPass = true;
+ }
+ }
+
+ if(secondPass) {
+ p = Pattern.compile("\\$([\\[\\]\\.a-zA-Z\\d-]*)");
+ m = p.matcher(subjectToChange);
+ while (m.find()) {
+ final String reference = m.group();
+ String resolved = resolveTerm(reference, ctx);
+ LOG.info("{} - {}", reference, resolved);
+ if(resolved != null && !resolved.isEmpty() && !"ERROR_NULL_VALUE".equalsIgnoreCase(resolved))
+ subjectToChange = subjectToChange.replace(reference, resolved);
+ }
+ }
+
+ return subjectToChange;
+ }
}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/BulkUpdateRequest.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/BulkUpdateRequest.java
new file mode 100644
index 000000000..a513fc11a
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/BulkUpdateRequest.java
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2021 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=========================================================
+ */
+/**
+ * @author Dan Timoney
+ *
+ */
+package org.onap.ccsdk.sli.adaptors.aai;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
+
+import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
+import org.onap.ccsdk.sli.adaptors.aai.update.BulkUpdateRequestData;
+import org.onap.ccsdk.sli.adaptors.aai.update.BulkUpdateRequestItemBody;
+import org.onap.ccsdk.sli.adaptors.aai.update.BulkUpdateResponseData;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+public class BulkUpdateRequest extends AAIRequest {
+
+ private final String generic_search_path;
+
+ public static final String FORMAT = "format";
+
+ public BulkUpdateRequest() {
+ generic_search_path = "/aai/v24/bulk/single-transaction";
+ setRequestObject(new BulkUpdateRequestData());
+ }
+
+
+ @Override
+ public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
+
+ String requestUrl = getTargetUri()+generic_search_path;
+
+ String formatQuery = requestProperties.getProperty(FORMAT);
+
+ if(formatQuery != null) {
+ requestUrl = requestUrl +"?format="+formatQuery;
+ }
+ URL httpReqUrl = new URL(requestUrl);
+
+ aaiService.LOGwriteFirstTrace(method, httpReqUrl.toString());
+
+ return httpReqUrl;
+ }
+
+ @Override
+ public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException {
+ return getRequestUrl(method, null);
+ }
+
+
+ @Override
+ public String toJSONString() {
+ ObjectMapper mapper = getObjectMapper();
+ BulkUpdateRequestData bulkUpdateRequest = (BulkUpdateRequestData)requestDatum;
+ String jsonText = null;
+ try {
+ jsonText = mapper.writeValueAsString(bulkUpdateRequest);
+ } catch (JsonProcessingException exc) {
+ handleException(this, exc);
+ return null;
+ }
+ return jsonText;
+ }
+
+
+ @Override
+ public String[] getArgsList() {
+ String[] args = {FORMAT};
+ return args;
+ }
+
+
+ @Override
+ public Class<? extends AAIDatum> getModelClass() {
+ return BulkUpdateRequestData.class;
+ }
+
+
+ public static String processPathData(String requestUrl, Properties requestProperties) throws UnsupportedEncodingException {
+ return requestUrl;
+ }
+
+ @Override
+ public AAIDatum jsonStringToObject(String jsonData) throws IOException {
+ if(jsonData == null) {
+ return null;
+ }
+
+ AAIDatum response = null;
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(jsonData, BulkUpdateResponseData.class);
+ return response;
+ }
+
+ protected boolean expectsDataFromPUTRequest() {
+ return true;
+ }
+
+ public void addUpdate(String action, String uri, BulkUpdateRequestItemBody body) {
+ ((BulkUpdateRequestData) requestDatum).addRequestItem(action, uri, body);
+ }
+
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java
index a99e6d5ef..6384ba5da 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java
@@ -59,7 +59,7 @@ public class CustomQueryRequest extends AAIRequest {
@Override
public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
- String requestUrl = targetUri+generic_search_path;
+ String requestUrl = getTargetUri()+generic_search_path;
requestUrl = processPathData(requestUrl, requestProperties);
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/DslNaradQueryRequest.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/DslNaradQueryRequest.java
new file mode 100644
index 000000000..c869bdbf8
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/DslNaradQueryRequest.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2019 IBM.
+ * ================================================================================
+ * 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=========================================================
+ */
+/**
+ * @author Rich Tabedzki
+ *
+ */
+package org.onap.ccsdk.sli.adaptors.aai;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
+
+import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
+import org.onap.ccsdk.sli.adaptors.aai.query.DslNaradQueryRequestData;
+import org.onap.ccsdk.sli.adaptors.aai.query.FormattedQueryResultList;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+public class DslNaradQueryRequest extends AAIRequest {
+
+ private final String generic_search_path;
+
+ public static final String FORMAT = "format";
+
+
+ public DslNaradQueryRequest() {
+ generic_search_path = "/narad/v24/dsl";
+ }
+
+
+ @Override
+ public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
+
+ String requestUrl = getTargetUri()+generic_search_path;
+
+ requestUrl = processPathData(requestUrl, requestProperties);
+
+ String formatQuery = requestProperties.getProperty(FORMAT);
+
+ if(formatQuery != null) {
+ requestUrl = requestUrl +"?format="+formatQuery;
+ }
+ URL httpReqUrl = new URL(requestUrl);
+
+ aaiService.LOGwriteFirstTrace(method, httpReqUrl.toString());
+
+ return httpReqUrl;
+ }
+
+ @Override
+ public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException {
+ return getRequestUrl(method, null);
+ }
+
+
+ @Override
+ public String toJSONString() {
+ ObjectMapper mapper = getObjectMapper();
+ DslNaradQueryRequestData tenant = (DslNaradQueryRequestData)requestDatum;
+ String jsonText = null;
+ try {
+ jsonText = mapper.writeValueAsString(tenant);
+ } catch (JsonProcessingException exc) {
+ handleException(this, exc);
+ return null;
+ }
+ return jsonText;
+ }
+
+
+ @Override
+ public String[] getArgsList() {
+ String[] args = {FORMAT};
+ return args;
+ }
+
+
+ @Override
+ public Class<? extends AAIDatum> getModelClass() {
+ return DslNaradQueryRequestData.class;
+ }
+
+
+ public static String processPathData(String requestUrl, Properties requestProperties) throws UnsupportedEncodingException {
+ return requestUrl;
+ }
+
+ @Override
+ public AAIDatum jsonStringToObject(String jsonData) throws IOException {
+ if(jsonData == null) {
+ return null;
+ }
+
+ AAIDatum response = null;
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(jsonData, FormattedQueryResultList.class);
+ return response;
+ }
+
+ protected boolean expectsDataFromPUTRequest() {
+ return true;
+ }
+
+ public String getTargetUri() {
+ return targetNaradUri;
+ }
+
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/DslQueryRequest.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/DslQueryRequest.java
new file mode 100644
index 000000000..97a295afb
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/DslQueryRequest.java
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (C) 2019 IBM.
+ * ================================================================================
+ * 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=========================================================
+ */
+/**
+ * @author Rich Tabedzki
+ *
+ */
+package org.onap.ccsdk.sli.adaptors.aai;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Properties;
+
+import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
+import org.onap.ccsdk.sli.adaptors.aai.query.DslQueryRequestData;
+import org.onap.ccsdk.sli.adaptors.aai.query.FormattedQueryResultList;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+
+public class DslQueryRequest extends AAIRequest {
+
+ private final String generic_search_path;
+
+ public static final String FORMAT = "format";
+
+
+ public DslQueryRequest() {
+ generic_search_path = "/aai/v24/dsl";
+ }
+
+
+ @Override
+ public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
+
+ String requestUrl = getTargetUri()+generic_search_path;
+
+ requestUrl = processPathData(requestUrl, requestProperties);
+
+ String formatQuery = requestProperties.getProperty(FORMAT);
+
+ if(formatQuery != null) {
+ requestUrl = requestUrl +"?format="+formatQuery;
+ }
+ URL httpReqUrl = new URL(requestUrl);
+
+ aaiService.LOGwriteFirstTrace(method, httpReqUrl.toString());
+
+ return httpReqUrl;
+ }
+
+ @Override
+ public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException {
+ return getRequestUrl(method, null);
+ }
+
+
+ @Override
+ public String toJSONString() {
+ ObjectMapper mapper = getObjectMapper();
+ DslQueryRequestData tenant = (DslQueryRequestData)requestDatum;
+ String jsonText = null;
+ try {
+ jsonText = mapper.writeValueAsString(tenant);
+ } catch (JsonProcessingException exc) {
+ handleException(this, exc);
+ return null;
+ }
+ return jsonText;
+ }
+
+
+ @Override
+ public String[] getArgsList() {
+ String[] args = {FORMAT};
+ return args;
+ }
+
+
+ @Override
+ public Class<? extends AAIDatum> getModelClass() {
+ return DslQueryRequestData.class;
+ }
+
+
+ public static String processPathData(String requestUrl, Properties requestProperties) throws UnsupportedEncodingException {
+ return requestUrl;
+ }
+
+ @Override
+ public AAIDatum jsonStringToObject(String jsonData) throws IOException {
+ if(jsonData == null) {
+ return null;
+ }
+
+ AAIDatum response = null;
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(jsonData, FormattedQueryResultList.class);
+ return response;
+ }
+
+ protected boolean expectsDataFromPUTRequest() {
+ return true;
+ }
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequest.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequest.java
index 8e6af0100..5d3741a37 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequest.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequest.java
@@ -49,7 +49,7 @@ public class EchoRequest extends AAIRequest {
@Override
public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
- String requestUrl = targetUri+echoPath;
+ String requestUrl = getTargetUri()+echoPath;
if(resourceVersion != null) {
requestUrl = requestUrl +"?resource-version="+resourceVersion;
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java
index 857edacf3..42be4cdad 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java
@@ -55,7 +55,7 @@ public class GenericQueryRequest extends AAIRequest {
@Override
public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
- String request_url = targetUri+generic_search_path;
+ String request_url = getTargetUri()+generic_search_path;
request_url = processPathData(request_url, requestProperties);
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java
new file mode 100755
index 000000000..93b3cbbac
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java
@@ -0,0 +1,215 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
+ * 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=========================================================
+ */
+/**
+ * @author Rich Tabedzki
+ *
+ */
+package org.onap.ccsdk.sli.adaptors.aai;
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
+import org.onap.aai.inventory.v24.InventoryResponseItems;
+
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.AnnotationIntrospector;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.databind.type.TypeFactory;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
+
+public class NamedQueryRequest extends AAIRequest {
+
+ public static final String NAMED_SEARCH_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.named";
+
+ private final String named_search_path;
+
+ public static final String NAMED_QUERY_UUID = "named-query-uuid";
+ public static final String PREFIX = "prefix";
+
+
+ public NamedQueryRequest() {
+ named_search_path = configProperties.getProperty(NAMED_SEARCH_PATH);
+ }
+
+ @Override
+ public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
+
+ String request_url = getTargetUri()+named_search_path;
+
+ request_url = processPathData(request_url, requestProperties);
+
+ if(resourceVersion != null) {
+ request_url = request_url +"?resource-version="+resourceVersion;
+ }
+ URL http_req_url = new URL(request_url);
+
+ aaiService.LOGwriteFirstTrace(method, http_req_url.toString());
+
+ return http_req_url;
+ }
+
+ @Override
+ public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException {
+ return getRequestUrl(method, null);
+ }
+
+
+ @Override
+ public String toJSONString() {
+ ObjectMapper mapper = AAIService.getObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ mapper.setSerializationInclusion(Include.NON_EMPTY);
+ mapper.setSerializationInclusion(Include.NON_DEFAULT);
+
+ AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
+ AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
+ mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(introspector, secondary));
+ mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+
+ AAIDatum tenant = (AAIDatum)requestDatum;
+ String json_text = null;
+ try {
+ ObjectNode node = mapper.valueToTree(tenant);
+ Iterator<JsonNode> it = node.elements();
+ while(it.hasNext()){
+ JsonNode jn = it.next();
+ JsonNode child = jn.get("instance-filter");
+ if(child != null) {
+ child = child.get(0);
+ if(child.has("l3-network")) {
+ JsonNode innerChild = child.get("l3-network");
+ if(innerChild != null) {
+ if(innerChild instanceof ObjectNode) {
+ ObjectNode on = ObjectNode.class.cast(innerChild);
+ List<String> namesToDelete = new ArrayList<>();
+ Iterator<String> names = on.fieldNames();
+ while(names.hasNext()) {
+ String name = names.next();
+ if(name != null && name.startsWith("is-")) {
+ namesToDelete.add(name);
+ }
+ }
+ for(String nameToDelete : namesToDelete) {
+ on.remove(nameToDelete);
+ }
+ }
+ }
+ } else if(child.has("pnf")) {
+ JsonNode innerChild = child.get("pnf");
+ if(innerChild != null) {
+ if(innerChild instanceof ObjectNode) {
+ ObjectNode on = ObjectNode.class.cast(innerChild);
+ List<String> namesToDelete = new ArrayList<>();
+ Iterator<String> names = on.fieldNames();
+ while(names.hasNext()) {
+ String name = names.next();
+ if(name != null && name.startsWith("in-maint")) {
+ namesToDelete.add(name);
+ }
+ }
+ for(String nameToDelete : namesToDelete) {
+ on.remove(nameToDelete);
+ }
+ }
+ }
+ } else if(child.has("generic-vnf")) {
+ JsonNode innerChild = child.get("generic-vnf");
+ if(innerChild != null) {
+ if(innerChild instanceof ObjectNode) {
+ ObjectNode on = ObjectNode.class.cast(innerChild);
+ List<String> namesToDelete = new ArrayList<>();
+ Iterator<String> names = on.fieldNames();
+ while(names.hasNext()) {
+ String name = names.next();
+ if(name != null && name.startsWith("is-")) {
+ namesToDelete.add(name);
+ } else if(name != null && name.startsWith("in-maint")) {
+ namesToDelete.add(name);
+ }
+ }
+ for(String nameToDelete : namesToDelete) {
+ on.remove(nameToDelete);
+ }
+ }
+ }
+ }
+ }
+ }
+ json_text = node.toString();
+ if(json_text == null)
+ json_text = mapper.writeValueAsString(tenant);
+ } catch (JsonProcessingException exc) {
+ handleException(this, exc);
+ return null;
+ }
+ return json_text;
+ }
+
+
+ @Override
+ public String[] getArgsList() {
+ String[] args = {NAMED_QUERY_UUID, PREFIX};
+ return args;
+ }
+
+
+ @Override
+ public Class<? extends AAIDatum> getModelClass() {
+ return InventoryResponseItems.class;
+ }
+
+
+ public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException {
+
+
+ String encoded_vnf ;
+ String key = NAMED_QUERY_UUID;
+
+ if(requestProperties.containsKey(key)) {
+ encoded_vnf = encodeQuery(requestProperties.getProperty(key));
+ request_url = request_url.replace("{named-query-uuid}", encoded_vnf) ;
+ aaiService.LOGwriteDateTrace(NAMED_QUERY_UUID, requestProperties.getProperty(key));
+ }
+
+ key = PREFIX;
+
+ if(requestProperties.containsKey(key)) {
+ encoded_vnf = encodeQuery(requestProperties.getProperty(key));
+ request_url = request_url.replace("{prefix}", encoded_vnf) ;
+ aaiService.LOGwriteDateTrace(PREFIX, requestProperties.getProperty(key));
+ }
+
+ return request_url;
+ }
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java
index 6db9434e4..b589bdb56 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java
@@ -56,7 +56,7 @@ public class NodesQueryRequest extends AAIRequest {
@Override
public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
- String request_url = targetUri+nodes_search_path;
+ String request_url = getTargetUri()+nodes_search_path;
request_url = processPathData(request_url, requestProperties);
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequest.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequest.java
index 68aff1f95..307c0d539 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequest.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequest.java
@@ -47,7 +47,7 @@ public class PathRequest extends AAIRequest {
@Override
public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
- String request_url = targetUri + "{resource-path}";
+ String request_url = getTargetUri() + "{resource-path}";
String encoded_vnf = requestProperties.getProperty(RESOURCE_PATH);
request_url = request_url.replace("{resource-path}", encoded_vnf) ;
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequest.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequest.java
index 0094b45fd..4869c2367 100755
--- a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequest.java
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequest.java
@@ -55,7 +55,7 @@ public class SelfLinkRequest extends AAIRequest {
try {
URI uri = new URI(request_url);
if(uri.getHost() == null) {
- request_url = targetUri + request_url;
+ request_url = getTargetUri() + request_url;
}
} catch(Exception exc) {
LOG.error("SelfLinkRequest.getRequestUrl", exc);
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/data/AAIAbstractDatum.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/data/AAIAbstractDatum.java
new file mode 100644
index 000000000..62eab016c
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/data/AAIAbstractDatum.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * 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.ccsdk.sli.adaptors.aai.data;
+
+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({
+ "related-nodes"
+})
+public class AAIAbstractDatum implements AAIDatum {
+ @JsonProperty("related-nodes")
+ private List<RelatedNode> relatedNodes = null;
+
+ @JsonProperty("related-nodes")
+ public List<RelatedNode> getRelatedNodes() {
+ return relatedNodes;
+ }
+
+ @JsonProperty("related-nodes")
+ public void setRelatedNodes(List<RelatedNode> relatedNodes) {
+ this.relatedNodes = relatedNodes;
+ }
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/data/RelatedNode.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/data/RelatedNode.java
new file mode 100644
index 000000000..c7517eae5
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/data/RelatedNode.java
@@ -0,0 +1,142 @@
+package org.onap.ccsdk.sli.adaptors.aai.data;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.aai.inventory.v24.CloudRegion;
+import org.onap.aai.inventory.v24.Configuration;
+import org.onap.aai.inventory.v24.InstanceGroup;
+import org.onap.aai.inventory.v24.L3InterfaceIpv4AddressList;
+import org.onap.aai.inventory.v24.L3InterfaceIpv6AddressList;
+import org.onap.aai.inventory.v24.LInterface;
+import org.onap.aai.inventory.v24.LagInterface;
+import org.onap.aai.inventory.v24.LogicalLink;
+import org.onap.aai.inventory.v24.PInterface;
+import org.onap.aai.inventory.v24.Pnf;
+import org.onap.aai.inventory.v24.ServiceInstance;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "cloud-region",
+ "configuration",
+ "instance-group",
+ "l-interface",
+ "lag-interface",
+ "logical-link",
+ "p-interface",
+ "pnf",
+ "l3-interface-ipv6-address-list",
+ "l3-interface-ipv6-address-list",
+ "service-instance"
+})
+public class RelatedNode implements AAIDatum {
+ @JsonProperty("cloud-region")
+ private CloudRegion cloudRegion;
+ @JsonProperty("configuration")
+ private Configuration configuration;
+ @JsonProperty("instance-group")
+ private InstanceGroup instanceGroup;
+ @JsonProperty("l-interface")
+ protected LInterface lInterface;
+ @JsonProperty("logical-link")
+ protected LogicalLink logicalLink;
+ @JsonProperty("lag-interface")
+ protected LagInterface lagInterface;
+ @JsonProperty("l3-interface-ipv4-address-list")
+ protected L3InterfaceIpv4AddressList l3InterfaceIpv4AddressList;
+ @JsonProperty("l3-interface-ipv6-address-list")
+ protected L3InterfaceIpv6AddressList l3InterfaceIpv6AddressList;
+ @JsonProperty("p-interface")
+ protected PInterface pInterface;
+ @JsonProperty("pnf")
+ protected Pnf pnf;
+ @JsonProperty("service-instance")
+ private ServiceInstance serviceInstance;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @JsonProperty("service-instance")
+ public ServiceInstance getServiceInstance() {
+ return serviceInstance;
+ }
+
+ @JsonProperty("service-instance")
+ public void setServiceInstance(ServiceInstance serviceInstance) {
+ this.serviceInstance = serviceInstance;
+ }
+
+ @JsonProperty("cloud-region")
+ public CloudRegion getCloudRegion() {
+ return cloudRegion;
+ }
+
+ @JsonProperty("cloud-region")
+ public void setCloudRegion(CloudRegion cloudRegion) {
+ this.cloudRegion = cloudRegion;
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+ @JsonProperty("configuration")
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+ @JsonProperty("configuration")
+ public void setConfiguration(Configuration configuration) {
+ this.configuration = configuration;
+ }
+ @JsonProperty("l-interface")
+ public LInterface getlInterface() {
+ return lInterface;
+ }
+ @JsonProperty("l-interface")
+ public void setlInterface(LInterface lInterface) {
+ this.lInterface = lInterface;
+ }
+ @JsonProperty("pnf")
+ public Pnf getPnf() {
+ return pnf;
+ }
+ @JsonProperty("pnf")
+ public void setPnf(Pnf pnf) {
+ this.pnf = pnf;
+ }
+ @JsonProperty("l3-interface-ipv4-address-list")
+ public L3InterfaceIpv4AddressList getL3InterfaceIpv4AddressList() {
+ return l3InterfaceIpv4AddressList;
+ }
+ @JsonProperty("l3-interface-ipv4-address-list")
+ public void setL3InterfaceIpv4AddressList(L3InterfaceIpv4AddressList l3InterfaceIpv4AddressList) {
+ this.l3InterfaceIpv4AddressList = l3InterfaceIpv4AddressList;
+ }
+ @JsonProperty("l3-interface-ipv6-address-list")
+ public L3InterfaceIpv6AddressList getL3InterfaceIpv6AddressList() {
+ return l3InterfaceIpv6AddressList;
+ }
+ @JsonProperty("l3-interface-ipv6-address-list")
+ public void setL3InterfaceIpv6AddressList(L3InterfaceIpv6AddressList l3InterfaceIpv6AddressList) {
+ this.l3InterfaceIpv6AddressList = l3InterfaceIpv6AddressList;
+ }
+ @JsonProperty("instance-group")
+ public InstanceGroup getInstanceGroup() {
+ return instanceGroup;
+ }
+ @JsonProperty("instance-group")
+ public void setInstanceGroup(InstanceGroup instanceGroup) {
+ this.instanceGroup = instanceGroup;
+ }
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/DslNaradQueryRequestData.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/DslNaradQueryRequestData.java
new file mode 100644
index 000000000..65b81d6fd
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/DslNaradQueryRequestData.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * 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.ccsdk.sli.adaptors.aai.query;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "dsl"
+})
+@XmlRootElement(name = "dsl-request")
+public class DslNaradQueryRequestData implements AAIDatum {
+
+ @JsonProperty("dsl")
+ private String dsl;
+
+ @JsonProperty("dsl")
+ public String getDsl() {
+ return dsl;
+ }
+
+ @JsonProperty("dsl")
+ public void setDsl(String dsl) {
+ this.dsl = dsl;
+ }
+
+ @Override
+ public String toString()
+ {
+ return " [dsl = "+dsl+"]";
+ }
+
+ public String getResourceVersion() {
+ return null;
+ }
+
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/DslQueryRequestData.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/DslQueryRequestData.java
new file mode 100644
index 000000000..5f51f2195
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/DslQueryRequestData.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * 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.ccsdk.sli.adaptors.aai.query;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "dsl"
+})
+@XmlRootElement(name = "dsl-request")
+public class DslQueryRequestData implements AAIDatum {
+
+ @JsonProperty("dsl")
+ private String dsl;
+
+ @JsonProperty("dsl")
+ public String getDsl() {
+ return dsl;
+ }
+
+ @JsonProperty("dsl")
+ public void setDsl(String dsl) {
+ this.dsl = dsl;
+ }
+
+ @Override
+ public String toString()
+ {
+ return " [dsl = "+dsl+"]";
+ }
+
+ public String getResourceVersion() {
+ return null;
+ }
+
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestData.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestData.java
new file mode 100644
index 000000000..5ec0dc978
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestData.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2021 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.ccsdk.sli.adaptors.aai.update;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "operations"
+})
+@XmlRootElement(name = "input")
+public class BulkUpdateRequestData implements AAIDatum {
+
+ @JsonProperty("operations")
+ private List<BulkUpdateRequestItem> operations = null;
+
+ public BulkUpdateRequestData() {
+ operations = new ArrayList<>();
+ }
+
+ @JsonProperty("operations")
+ public List<BulkUpdateRequestItem> getOperations() {
+ return operations;
+ }
+
+ @JsonProperty("operations")
+ public void setOperations(List<BulkUpdateRequestItem> operations) {
+ this.operations = operations;
+ }
+
+ @Override
+ public String toString()
+ {
+ return " [operations = "+operations+"]";
+ }
+
+ public void addRequestItem(String action, String uri, BulkUpdateRequestItemBody body) {
+ BulkUpdateRequestItem requestItem = new BulkUpdateRequestItem();
+
+ requestItem.setAction(action);
+ requestItem.setUri(uri);
+ requestItem.setBody(body);
+
+ operations.add(requestItem);
+ }
+
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestItem.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestItem.java
new file mode 100644
index 000000000..e01578351
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestItem.java
@@ -0,0 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2021 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.ccsdk.sli.adaptors.aai.update;
+
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "action",
+ "uri",
+ "body"
+})
+@XmlRootElement(name = "operation")
+public class BulkUpdateRequestItem {
+
+ @JsonProperty("action")
+ String action;
+
+ @JsonProperty("uri")
+ String uri;
+
+ @JsonProperty("body")
+ BulkUpdateRequestItemBody body;
+
+ @JsonProperty("action")
+ public String getAction() {
+ return action;
+ }
+
+ @JsonProperty("action")
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ @JsonProperty("uri")
+ public String getUri() {
+ return uri;
+ }
+
+ @JsonProperty("uri")
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ @JsonProperty("body")
+ public BulkUpdateRequestItemBody getBody() {
+ return body;
+ }
+
+ @JsonProperty("body")
+ public void setBody(BulkUpdateRequestItemBody body) {
+ this.body = body;
+ }
+
+
+ @Override
+ public String toString()
+ {
+ return " [action = "+action+",uri = "+uri+",body = "+body+"]";
+ }
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestItemBody.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestItemBody.java
new file mode 100644
index 000000000..2b225a108
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateRequestItemBody.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2021 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.ccsdk.sli.adaptors.aai.update;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "orchestration-status"
+})
+
+@XmlRootElement(name = "body")
+public class BulkUpdateRequestItemBody {
+
+ @JsonProperty("orchestration-status")
+ String orchestrationStatus;
+
+ @JsonProperty("orchestration-status")
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ @JsonProperty("orchestration-status")
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ @Override
+ public String toString()
+ {
+ return " [orchestration-status = "+orchestrationStatus+"]";
+ }
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateResponseData.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateResponseData.java
new file mode 100644
index 000000000..28cf2fba2
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateResponseData.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2021 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.ccsdk.sli.adaptors.aai.update;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "operation-responses"
+})
+@XmlRootElement(name = "input")
+public class BulkUpdateResponseData implements AAIDatum {
+
+ @JsonProperty("operation-responses")
+ private List<BulkUpdateResponseItem> operationResponses;
+
+ @JsonProperty("operation-responses")
+ public List<BulkUpdateResponseItem> getOperationResponses() {
+ return operationResponses;
+ }
+
+ @JsonProperty("operation-responses")
+ public void setOperations(List<BulkUpdateResponseItem> operationResponses) {
+ this.operationResponses = operationResponses;
+ }
+
+ @Override
+ public String toString()
+ {
+ return " [operation-responses = "+operationResponses+"]";
+ }
+
+ public String getResourceVersion() {
+ return null;
+ }
+
+}
diff --git a/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateResponseItem.java b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateResponseItem.java
new file mode 100644
index 000000000..3fed097e0
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/update/BulkUpdateResponseItem.java
@@ -0,0 +1,108 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2021 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.ccsdk.sli.adaptors.aai.update;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "action",
+ "uri",
+ "response-status-code",
+ "response-body"
+})
+@XmlRootElement(name = "response")
+public class BulkUpdateResponseItem implements AAIDatum {
+
+ @JsonProperty("action")
+ String action;
+
+ @JsonProperty("uri")
+ String uri;
+
+ @JsonProperty("response-status-code")
+ String responseStatusCode;
+
+ @JsonProperty("response-body")
+ String responseBody;
+
+ @JsonProperty("action")
+ public String getAction() {
+ return action;
+ }
+
+ @JsonProperty("action")
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ @JsonProperty("uri")
+ public String getUri() {
+ return uri;
+ }
+
+ @JsonProperty("uri")
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ @JsonProperty("response-status-code")
+ public String getResponseStatusCode() {
+ return responseStatusCode;
+ }
+
+ @JsonProperty("response-status-code")
+ public void setResponseStatusCode(String responseStatusCode) {
+ this.responseStatusCode = responseStatusCode;
+ }
+
+ @JsonProperty("response-body")
+ public String getResponseBody() {
+ return responseBody;
+ }
+
+ @JsonProperty("response-body")
+ public void setResponseBody(String responseBody) {
+ this.responseBody = responseBody;
+ }
+
+
+ @Override
+ public String toString()
+ {
+ return " [action = "+action+",uri = "+uri+",response-status-code = "+responseStatusCode+",response-body = "+responseBody+"]";
+ }
+
+ public String getResourceVersion() {
+ return null;
+ }
+
+}