diff options
Diffstat (limited to 'aai-service')
15 files changed, 2 insertions, 905 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java index 3fa95495..11f4f653 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java @@ -55,11 +55,6 @@ import javax.xml.bind.annotation.XmlType; 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.InstanceFilter; -import org.onap.ccsdk.sli.adaptors.aai.query.InstanceFilters; -import org.onap.ccsdk.sli.adaptors.aai.query.NamedQuery; -import org.onap.ccsdk.sli.adaptors.aai.query.NamedQueryData; -import org.onap.ccsdk.sli.adaptors.aai.query.QueryParameters; import org.onap.ccsdk.sli.adaptors.aai.query.Result; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicException; @@ -136,9 +131,6 @@ public abstract class AAIDeclarations implements AAIClient { //Service public static final String SERVICE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.service"; - // P-Interfaces - public static final String P_INTERFACE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterface"; - // site-pair-sets public static final String SITE_PAIR_SET_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.site.pair.set"; @@ -151,7 +143,7 @@ public abstract class AAIDeclarations implements AAIClient { protected abstract Logger getLogger(); public abstract AAIExecutorInterface getExecutor(); - + private static final String RELATIONSHIP_DATA= "Retrofitting relationship data: "; @@ -797,8 +789,6 @@ public abstract class AAIDeclarations implements AAIClient { if(!tmpParams.isEmpty()) { params.putAll(tmpParams); } - if("named-query".equals(resource)) - request.setRequestObject(extractNamedQueryDataFromQueryPrefix(nameValues, params)); } String rv = getExecutor().get(request); @@ -860,14 +850,6 @@ public abstract class AAIDeclarations implements AAIClient { } } - if("named-query".equals(resource)) { - InventoryResponseItems rd = InventoryResponseItems.class.cast(response); - List<InventoryResponseItem> iRIlist = rd.getInventoryResponseItem(); - if(iRIlist == null || iRIlist.isEmpty()) { - return QueryStatus.NOT_FOUND; - } - } - if("nodes-query".equals(resource)) { SearchResults rd = SearchResults.class.cast(response); List<ResultData> rdList = rd.getResultData(); @@ -2016,114 +1998,6 @@ public abstract class AAIDeclarations implements AAIClient { return prefixMap; } - /** - */ - protected NamedQueryData extractNamedQueryDataFromQueryPrefix(HashMap<String, String> nameValues, Map<String, String> parms) { - if(parms.isEmpty()) { - return null; - } - - NamedQueryData data = new NamedQueryData(); - - // query parameters - if(data.getQueryParameters() == null) { - data.setQueryParameters(new QueryParameters()); - } - String namedQueryUuid = nameValues.get("named-query-uuid".replaceAll("-", "_")); - if(namedQueryUuid == null) { - namedQueryUuid = parms.get("query-parameters.named-query.named-query-uuid"); - } - NamedQuery namedQuery = new NamedQuery(); - namedQuery.setNamedQueryUuid(namedQueryUuid); - data.getQueryParameters().setNamedQuery(namedQuery); - - // instance filters - if(data.getInstanceFilters() == null) { - data.setInstanceFilters(new InstanceFilters()); - } - - - String quantity = parms.get("instance-filters.instance-filter_length"); - if(quantity != null && StringUtils.isNumeric(quantity)) { - int max = Integer.parseInt(quantity); - for(int i = 0; i < max; i++) { - String keyPattern = String.format("instance-filters.instance-filter[%d].", i); - Set<String> keys = parms.keySet(); - for(String key: keys) { - if(key.startsWith(keyPattern)){ - String value = parms.get(key); - String remainder = key.substring(keyPattern.length()); - String[] split = remainder.split("\\."); - getLogger().debug(String.format("%s", remainder)); - if("logical-link".equals(split[0])) { - InstanceFilter insf = null; - if(data.getInstanceFilters().getInstanceFilter().isEmpty()) { - insf = new InstanceFilter(); - data.getInstanceFilters().getInstanceFilter().add(insf); - } else { - insf = data.getInstanceFilters().getInstanceFilter().get(0); - } - LogicalLink logicalLink = insf.getLogicalLink(); - if(logicalLink == null) { - logicalLink = new LogicalLink(); - insf.setLogicalLink(logicalLink); - } - - switch(split[1]) { - case "link-name": - logicalLink.setLinkName(value); - break; - case "link-type": - logicalLink.setLinkType(value); - break; - case "operational-state": - logicalLink.setOperationalStatus(value); - break; - } - - } else if("pnf".equals(split[0])) { - Pnf pnf = new Pnf(); - pnf.setPnfName(value); - - InstanceFilter insf = new InstanceFilter(); - insf.setPnf(pnf); - data.getInstanceFilters().getInstanceFilter().add(insf); - - } else if("service-instance".equals(split[0])) { - ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setServiceInstanceId(value); - - InstanceFilter insf = new InstanceFilter(); - insf.setServiceInstance(serviceInstance); - data.getInstanceFilters().getInstanceFilter().add(insf); - - } else if("l3-network".equals(split[0])) { - L3Network l3Network = new L3Network(); - if("network-role".equals(split[1])) { - l3Network.setNetworkRole(value); - } - - InstanceFilter insf = new InstanceFilter(); - insf.setL3Network(l3Network); - data.getInstanceFilters().getInstanceFilter().add(insf); - } else if("generic-vnf".equals(split[0])) { - GenericVnf vnf = new GenericVnf(); - if("vnf-id".equals(split[1])) { - vnf.setVnfId(value); - } - - InstanceFilter insf = new InstanceFilter(); - insf.setGenericVnf(vnf); - data.getInstanceFilters().getInstanceFilter().add(insf); - } - } - } - } - } - - return data; - } - public abstract <T> T getResource(String key, Class<T> type) throws AAIServiceException ; protected abstract boolean deleteList(URL url, String caller) throws AAIServiceException; } diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java index 04312fd7..0edd09df 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java @@ -117,8 +117,6 @@ public abstract class AAIRequest { switch(resoource){ case "generic-query": return new GenericQueryRequest(); - case "named-query": - return new NamedQueryRequest(); case "nodes-query": return new NodesQueryRequest(); case "custom-query": diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java index 2411d292..d315f64b 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java @@ -219,8 +219,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe svc_inst_query_path = props.getProperty(SVC_INST_QRY_PATH); props.getProperty(PARAM_SERVICE_TYPE, "service-type"); - props.getProperty(P_INTERFACE_PATH); - props.getProperty(VNF_IMAGE_QUERY_PATH); ubb_notify_path = props.getProperty(UBB_NOTIFY_PATH); @@ -1358,7 +1356,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe case "custom-query": case "formatted-query": case "generic-query": - case "named-query": case "nodes-query": case "linterface": case "l2-bridge-sbg": @@ -1387,7 +1384,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe case "custom-query": case "formatted-query": case "generic-query": - case "named-query": case "nodes-query": case "linterface": case "l2-bridge-sbg": @@ -1416,7 +1412,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe case "custom-query": case "formatted-query": case "generic-query": - case "named-query": case "nodes-query": case "linterface": case "l2-bridge-sbg": @@ -1445,7 +1440,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe case "custom-query": case "formatted-query": case "generic-query": - case "named-query": case "nodes-query": case "linterface": case "l2-bridge-sbg": diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java index 3bd6ac49..e773da52 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java @@ -330,7 +330,6 @@ public class AAIServiceUtils { case "custom-query": case "formatted-query": case "generic-query": - case "named-query": case "nodes-query": case "linterface": case "l2-bridge-sbg": @@ -365,7 +364,6 @@ public class AAIServiceUtils { case "custom-query": case "formatted-query": case "generic-query": - case "named-query": case "nodes-query": case "linterface": case "l2-bridge-sbg": diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java deleted file mode 100755 index d6df6286..00000000 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java +++ /dev/null @@ -1,215 +0,0 @@ -/*- - * ============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.v14.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 = targetUri+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/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQuery.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQuery.java deleted file mode 100644 index 170fa78a..00000000 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQuery.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============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.HashMap; -import java.util.Map; -import javax.annotation.Generated; -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) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "named-query-uuid" -}) -public class NamedQuery { - - @JsonProperty("named-query-uuid") - private String namedQueryUuid; - @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); - - /** - * - * @return - * The namedQueryUuid - */ - @JsonProperty("named-query-uuid") - public String getNamedQueryUuid() { - return namedQueryUuid; - } - - /** - * - * @param namedQueryUuid - * The named-query-uuid - */ - @JsonProperty("named-query-uuid") - public void setNamedQueryUuid(String namedQueryUuid) { - this.namedQueryUuid = namedQueryUuid; - } - - @JsonAnyGetter - public Map<String, Object> getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryData.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryData.java deleted file mode 100644 index f7170246..00000000 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryData.java +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ============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.HashMap; -import java.util.Map; -import javax.annotation.Generated; - -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; - -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) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "query-parameters", - "instance-filters" -}) -public class NamedQueryData implements AAIDatum { - - @JsonProperty("query-parameters") - private QueryParameters queryParameters; - @JsonProperty("instance-filters") - private InstanceFilters instanceFilters; - @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); - - /** - * - * @return - * The queryParameters - */ - @JsonProperty("query-parameters") - public QueryParameters getQueryParameters() { - return queryParameters; - } - - /** - * - * @param queryParameters - * The query-parameters - */ - @JsonProperty("query-parameters") - public void setQueryParameters(QueryParameters queryParameters) { - this.queryParameters = queryParameters; - } - - /** - * - * @return - * The instanceFilters - */ - @JsonProperty("instance-filters") - public InstanceFilters getInstanceFilters() { - return instanceFilters; - } - - /** - * - * @param instanceFilters - * The instance-filters - */ - @JsonProperty("instance-filters") - public void setInstanceFilters(InstanceFilters instanceFilters) { - this.instanceFilters = instanceFilters; - } - - @JsonAnyGetter - public Map<String, Object> getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/QueryParameters.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/QueryParameters.java deleted file mode 100644 index ba37900a..00000000 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/QueryParameters.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============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.HashMap; -import java.util.Map; -import javax.annotation.Generated; -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) -@Generated("org.jsonschema2pojo") -@JsonPropertyOrder({ - "named-query" -}) -public class QueryParameters { - - @JsonProperty("named-query") - private NamedQuery namedQuery; - @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); - - /** - * - * @return - * The namedQuery - */ - @JsonProperty("named-query") - public NamedQuery getNamedQuery() { - return namedQuery; - } - - /** - * - * @param namedQuery - * The named-query - */ - @JsonProperty("named-query") - public void setNamedQuery(NamedQuery namedQuery) { - this.namedQuery = namedQuery; - } - - @JsonAnyGetter - public Map<String, Object> getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } - -} diff --git a/aai-service/provider/src/main/resources/aaiclient.properties b/aai-service/provider/src/main/resources/aaiclient.properties index d23078d8..51a37772 100755 --- a/aai-service/provider/src/main/resources/aaiclient.properties +++ b/aai-service/provider/src/main/resources/aaiclient.properties @@ -49,9 +49,6 @@ org.onap.ccsdk.sli.adaptors.aai.path.query=/aai/v14/search/sdn-zone-query org.onap.ccsdk.sli.adaptors.aai.query.nodes=/aai/v14/search/nodes-query?search-node-type={node-type}&filter={entity-identifier}:EQUALS:{entity-name} org.onap.ccsdk.sli.adaptors.aai.query.generic=/aai/v14/search/generic-query?key={identifier}:{value}&start-node-type={start-node-type}&include=complex&depth=3 -# named query -org.onap.ccsdk.sli.adaptors.aai.query.named=/aai/search/named-query - #update org.onap.ccsdk.sli.adaptors.aai.update=/aai/v14/actions/update @@ -60,13 +57,7 @@ org.onap.ccsdk.sli.adaptors.aai.path.notify=/aai/v14/actions/notify org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn=<%= @ubbUri %>/restconf/config/L3SDN-API:services/layer3-service-list/{service-instance-id} org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn=<%= @ubbUri %>/restconf/config/L3AVPN-EVC-API:services/service-list/{service-instance-id}/service-data/avpn-logicalchannel-information -# P-Interfaces -org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterfaces=/aai/v14/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces -org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterface=/aai/v14/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name} - # VNF IMAGES -org.onap.ccsdk.sli.adaptors.aai.path.vnf.images=/aai/v14/service-design-and-creation/vnf-images -org.onap.ccsdk.sli.adaptors.aai.path.vnf.image=/aai/v14/service-design-and-creation/vnf-images/vnf-image/{att-uuid} org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v14/service-design-and-creation/vnf-images/vnf-image?application={application_model}&application-vendor={application_vendor} # service instance diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AutoGeneratedRegressionTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AutoGeneratedRegressionTest.java index 9e26a26c..f39542ad 100755 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AutoGeneratedRegressionTest.java +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/AutoGeneratedRegressionTest.java @@ -60,7 +60,6 @@ import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; -import org.onap.ccsdk.sli.adaptors.aai.query.NamedQueryData; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; import org.onap.aai.inventory.v14.GenericVnf; @@ -724,38 +723,7 @@ public class AutoGeneratedRegressionTest { } } - @Test - public void R1702NamedQueryRequest() - { - LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); - try - { - SvcLogicContext ctx = new SvcLogicContext(); - URL resource = this.getClass().getResource("/json/nquery2.json"); - - LOG.info("Resource is " + resource.getFile()); - File requestFile = new File(resource.getFile()); - if(!requestFile.exists()) { - fail("Test file does not exist"); - } - ObjectMapper mapper = AAIService.getObjectMapper(); - NamedQueryData request = mapper.readValue(requestFile, NamedQueryData.class); - Map<String, Object> map = mapper.convertValue(request, Map.class); - - ctx.setAttribute("namedQueryData.instance-filters.instance-filter[0].l3-network.network-role", "example-network-role-val-432223"); - ctx.setAttribute("namedQueryData.instance-filters.instance-filter_length", "1"); - QueryStatus resp = client.query("named-query", false, null, "named-query-uuid = '4f448e43-339f-4c1c-85f6-896c444e25ca' AND prefix = 'namedQueryData' ", "zdzich", null, ctx); - - LOG.info("AAIResponse: " + resp.toString()); - } - catch (Throwable e) - { - assert(true); - } - } - - - static class MySchemaOutputResolver extends SchemaOutputResolver { + static class MySchemaOutputResolver extends SchemaOutputResolver { public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { File file = new File(suggestedFileName); diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequestTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequestTest.java deleted file mode 100644 index c28a1ed0..00000000 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequestTest.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.onap.ccsdk.sli.adaptors.aai; - -import static org.junit.Assert.*; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class NamedQueryRequestTest { - - private static final Logger LOG = LoggerFactory.getLogger(NamedQueryRequestTest.class); - - private static NamedQueryRequest request; - - @BeforeClass - public static void setUp() throws Exception { - - request = new NamedQueryRequest(); - LOG.info("\nEchoRequestTest.setUp\n"); - } - - @AfterClass - public static void tearDown() throws Exception { - request = null; - LOG.info("----------------------- EchoRequestTest.tearDown -----------------------"); - } - - @Test - public void runGetRequestUrlTest() { - LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); - - URL url; - try { - url = request.getRequestUrl("GET", null); - assertNotNull(url); - } catch (UnsupportedEncodingException | MalformedURLException exc) { - LOG.error("Failed test", exc); - } - - } - - @Test - public void runToJSONStringTest() { - LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); - - try { - String json = request.toJSONString(); - assertNotNull(json); - } catch (Exception exc) { - LOG.error("Failed test", exc); - } - - } - - @Test - public void runGetArgsListTest() { - LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); - - try { - String[] args = request.getArgsList(); - assertNotNull(args); - } catch (Exception exc) { - LOG.error("Failed test", exc); - } - - } - - @Test - public void runGetModelTest() { - LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); - - try { - Class<? extends AAIDatum> clazz = request.getModelClass(); - assertNotNull(clazz); - } catch (Exception exc) { - LOG.error("Failed test", exc); - } - - } -} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryDataTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryDataTest.java deleted file mode 100644 index 9f01e84a..00000000 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryDataTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.onap.ccsdk.sli.adaptors.aai.query; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class NamedQueryDataTest { - - NamedQueryData _nqdInstance; - protected QueryParameters _queryParameters; - protected InstanceFilters _instanceFilters; - protected Map<String, Object> _additionalProperties; - - @Before - public void setUp() throws Exception { - _nqdInstance = new NamedQueryData(); - _queryParameters = mock(QueryParameters.class); - _instanceFilters = mock(InstanceFilters.class); - _additionalProperties = new HashMap<String, Object>() {{ - put("prop1", "propvalue1"); - put("prop2", "propvalue2"); - }}; - } - - @After - public void tearDown() throws Exception { - _nqdInstance = null; - _queryParameters = null; - _instanceFilters = null; - _additionalProperties = null; - } - - @Test - public void testSetQueryParameters() { - _nqdInstance.setQueryParameters(_queryParameters); - assertEquals(_nqdInstance.getQueryParameters(), _queryParameters); - } - - @Test - public void testSetInstanceFilters() { - _nqdInstance.setInstanceFilters(_instanceFilters); - assertEquals(_nqdInstance.getInstanceFilters(), _instanceFilters); - } - - @Test - public void testSetAdditionalProperty() { - _nqdInstance.setAdditionalProperty("prop1", "propvalue1"); - _nqdInstance.setAdditionalProperty("prop2", "propvalue2"); - assertEquals(_nqdInstance.getAdditionalProperties(), _additionalProperties); - } - -} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryTest.java deleted file mode 100644 index 02a239a2..00000000 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/NamedQueryTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.onap.ccsdk.sli.adaptors.aai.query; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class NamedQueryTest { - - NamedQuery _nqInstance; - protected String _namedQueryUuid; - protected Map<String, Object> _additionalProperties; - - @Before - public void setUp() throws Exception { - _nqInstance = new NamedQuery(); - _namedQueryUuid = "uuid"; - _additionalProperties = new HashMap<String, Object>() {{ - put("prop1", "propvalue1"); - put("prop2", "propvalue2"); - }}; - } - - @After - public void tearDown() throws Exception { - _nqInstance = null; - _namedQueryUuid = null; - _additionalProperties = null; - } - - @Test - public void testSetNamedQueryUuid() { - _nqInstance.setNamedQueryUuid(_namedQueryUuid); - assertEquals(_nqInstance.getNamedQueryUuid(), _namedQueryUuid); - } - - @Test - public void testSetAdditionalProperty() { - _nqInstance.setAdditionalProperty("prop1", "propvalue1"); - _nqInstance.setAdditionalProperty("prop2", "propvalue2"); - assertEquals(_nqInstance.getAdditionalProperties(), _additionalProperties); - } - -} diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/QueryParametersTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/QueryParametersTest.java deleted file mode 100644 index d9a57890..00000000 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/query/QueryParametersTest.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.onap.ccsdk.sli.adaptors.aai.query; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.onap.ccsdk.sli.adaptors.aai.data.ErrorResponse; -import org.onap.ccsdk.sli.adaptors.aai.data.RequestError; - -public class QueryParametersTest { - - QueryParameters _qpInstance; - protected NamedQuery _namedQuery; - protected Map<String, Object> _additionalProperties; - - @Before - public void setUp() throws Exception { - _qpInstance = new QueryParameters(); - _namedQuery = mock(NamedQuery.class); - _additionalProperties = new HashMap<String, Object>() {{ - put("prop1", "propvalue1"); - put("prop2", "propvalue2"); - }}; - } - - @After - public void tearDown() throws Exception { - _qpInstance = null; - _namedQuery = null; - _additionalProperties = null; - } - - @Test - public void testSetNamedQuery() { - _qpInstance.setNamedQuery(_namedQuery); - assertEquals(_qpInstance.getNamedQuery(), _namedQuery); - } - - @Test - public void testSetAdditionalProperty() { - _qpInstance.setAdditionalProperty("prop1", "propvalue1"); - _qpInstance.setAdditionalProperty("prop2", "propvalue2"); - assertEquals(_qpInstance.getAdditionalProperties(), _additionalProperties); - } - -} diff --git a/aai-service/provider/src/test/resources/aaiclient.properties b/aai-service/provider/src/test/resources/aaiclient.properties index d23078d8..e994d66f 100755 --- a/aai-service/provider/src/test/resources/aaiclient.properties +++ b/aai-service/provider/src/test/resources/aaiclient.properties @@ -49,9 +49,6 @@ org.onap.ccsdk.sli.adaptors.aai.path.query=/aai/v14/search/sdn-zone-query org.onap.ccsdk.sli.adaptors.aai.query.nodes=/aai/v14/search/nodes-query?search-node-type={node-type}&filter={entity-identifier}:EQUALS:{entity-name} org.onap.ccsdk.sli.adaptors.aai.query.generic=/aai/v14/search/generic-query?key={identifier}:{value}&start-node-type={start-node-type}&include=complex&depth=3 -# named query -org.onap.ccsdk.sli.adaptors.aai.query.named=/aai/search/named-query - #update org.onap.ccsdk.sli.adaptors.aai.update=/aai/v14/actions/update @@ -65,8 +62,6 @@ org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterfaces=/aai/v14/cloud-infrastr org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterface=/aai/v14/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name} # VNF IMAGES -org.onap.ccsdk.sli.adaptors.aai.path.vnf.images=/aai/v14/service-design-and-creation/vnf-images -org.onap.ccsdk.sli.adaptors.aai.path.vnf.image=/aai/v14/service-design-and-creation/vnf-images/vnf-image/{att-uuid} org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v14/service-design-and-creation/vnf-images/vnf-image?application={application_model}&application-vendor={application_vendor} # service instance |