diff options
author | Rich Tabedzki <richard.tabedzki@att.com> | 2017-04-05 13:15:15 +0000 |
---|---|---|
committer | Rich Tabedzki <richard.tabedzki@att.com> | 2017-04-05 13:15:52 +0000 |
commit | f2f129f56c057854517394cc5680b02418fece7d (patch) | |
tree | 43632d50bff51aa214713357b313a875e3e6d5c5 /aai-service/provider/src/main/java/org/openecomp/sdnc | |
parent | c11f9ffaa0d9f43371f6f85a20cd1f09c6595dfb (diff) |
[SDNC-5] summary
Synchronized source code with 17.07 after cleaning up deprecated code
Change-Id: Ieabd58d25bb405ad15ad255e1cf40797e91d937f
Signed-off-by: Rich Tabedzki <richard.tabedzki@att.com>
Diffstat (limited to 'aai-service/provider/src/main/java/org/openecomp/sdnc')
32 files changed, 466 insertions, 1332 deletions
diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIClient.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIClient.java index a57393c..05c4185 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIClient.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIClient.java @@ -35,17 +35,7 @@ import org.openecomp.sdnc.sli.aai.update.Update; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.AvailabilityZone; -import org.openecomp.aai.inventory.v8.GenericVnf; -import org.openecomp.aai.inventory.v8.L3Network; -import org.openecomp.aai.inventory.v8.PInterface; -import org.openecomp.aai.inventory.v8.PhysicalLink; -import org.openecomp.aai.inventory.v8.Pserver; -import org.openecomp.aai.inventory.v8.SearchResults; -import org.openecomp.aai.inventory.v8.Service; -import org.openecomp.aai.inventory.v8.ServiceInstance; -import org.openecomp.aai.inventory.v8.Tenant; -import org.openecomp.aai.inventory.v8.Vserver; +import org.openecomp.aai.inventory.v10.*; public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin { diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIDeclarations.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIDeclarations.java index f2f83c3..1157fb2 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIDeclarations.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIDeclarations.java @@ -28,6 +28,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; +import java.net.URLDecoder; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -57,23 +58,7 @@ import org.openecomp.sdnc.sli.aai.query.NamedQueryData; import org.openecomp.sdnc.sli.aai.query.QueryParameters; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.GenericVnf; -import org.openecomp.aai.inventory.v8.InventoryResponseItem; -import org.openecomp.aai.inventory.v8.InventoryResponseItems; -import org.openecomp.aai.inventory.v8.L3Network; -import org.openecomp.aai.inventory.v8.LogicalLink; -import org.openecomp.aai.inventory.v8.Metadata; -import org.openecomp.aai.inventory.v8.Metadatum; -import org.openecomp.aai.inventory.v8.Pnf; -import org.openecomp.aai.inventory.v8.Relationship; -import org.openecomp.aai.inventory.v8.RelationshipData; -import org.openecomp.aai.inventory.v8.RelationshipList; -import org.openecomp.aai.inventory.v8.ResultData; -import org.openecomp.aai.inventory.v8.SearchResults; -import org.openecomp.aai.inventory.v8.ServiceInstance; -import org.openecomp.aai.inventory.v8.Vlan; -import org.openecomp.aai.inventory.v8.Vlans; -import org.openecomp.aai.inventory.v8.Vserver; +import org.openecomp.aai.inventory.v10.*; public abstract class AAIDeclarations implements AAIClient { @@ -1535,20 +1520,20 @@ public abstract class AAIDeclarations implements AAIClient { if(relatedLink != null) { relationship.setRelatedLink(relatedLink); } else { - List<RelationshipData> relData = relationship.getRelationshipData(); + List<RelationshipData> relData = relationship.getRelationshipData(); - while(true) { - String searchRelationshipKey = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-key"; - String searchRelationshipValue = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-value"; - if(!params.containsKey(searchRelationshipKey)) - break; + while(true) { + String searchRelationshipKey = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-key"; + String searchRelationshipValue = "relationship-list.relationship[" + i + "].relationship-data[" + j + "].relationship-value"; + if(!params.containsKey(searchRelationshipKey)) + break; - RelationshipData relDatum = new RelationshipData(); - relDatum.setRelationshipKey(params.get(searchRelationshipKey)); - relDatum.setRelationshipValue(params.get(searchRelationshipValue)); - relData.add(relDatum); - j++; - } + RelationshipData relDatum = new RelationshipData(); + relDatum.setRelationshipKey(params.get(searchRelationshipKey)); + relDatum.setRelationshipValue(params.get(searchRelationshipValue)); + relData.add(relDatum); + j++; + } } @@ -1807,6 +1792,9 @@ public abstract class AAIDeclarations implements AAIClient { relatedTo = relatedTo.replaceAll("_", "-"); String relatedLink = nameValues.get("relationship.related_link"); + if(relatedLink != null) { + relatedLink = URLDecoder.decode(relatedLink, "UTF-8"); + } List<Relationship> relationships = relationshipList.getRelationship(); List<Relationship> relationshipsToDelete = new LinkedList<Relationship>(); @@ -1814,14 +1802,20 @@ public abstract class AAIDeclarations implements AAIClient { for(Relationship relationship : relationships) { if(relatedTo.equals(relationship.getRelatedTo())) { if(relatedLink != null) { - if(relationship.getRelatedLink() == null || !relationship.getRelatedLink().endsWith(relatedLink)) { - continue; + if(relationship.getRelatedLink() != null ) { + String localRelatedLink = relationship.getRelatedLink(); + localRelatedLink = URLDecoder.decode(localRelatedLink, "UTF-8"); + if(localRelatedLink.endsWith(relatedLink)) { + getLogger().debug(String.format("Found relationship of '%s' to keyword '%s'", relationship.getRelatedTo(), relatedTo)); + relationshipsToDelete.add(relationship); } } + } else { getLogger().debug(String.format("Found relationship of '%s' to keyword '%s'", relationship.getRelatedTo(), relatedTo)); relationshipsToDelete.add(relationship); } } + } if(relationshipsToDelete == null || relationshipsToDelete.isEmpty()) { getLogger().info(String.format("Relationship has not been found for %s", key)); return QueryStatus.NOT_FOUND; diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIRequest.java index 30d2168..6247e2d 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIRequest.java @@ -55,7 +55,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.GenericVnf; +import org.openecomp.aai.inventory.v10.*; public abstract class AAIRequest { protected static final Logger LOG = LoggerFactory.getLogger(AAIRequest.class); @@ -355,7 +355,7 @@ public abstract class AAIRequest { return false; } - public static ObjectMapper getObjectMapper() { + ObjectMapper getObjectMapper() { return AAIService.getObjectMapper(); } diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIService.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIService.java index 8feba08..9dadd00 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIService.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIService.java @@ -96,7 +96,7 @@ import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector; import com.sun.jersey.api.client.config.DefaultClientConfig; import com.sun.jersey.client.urlconnection.HTTPSProperties; -import org.openecomp.aai.inventory.v8.*; +import org.openecomp.aai.inventory.v10.*; public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicResource { @@ -2160,10 +2160,10 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe Tenant response = null; try { - AAIRequest request = new TenantRequest(); - request.addRequestProperty(TenantRequest.TENANT_ID, tenant_id); - request.addRequestProperty(CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER, cloudOwner); - request.addRequestProperty(CloudRegionRequest.CLOUD_REGION_CLOUD_REGION_ID, cloudRegionId); + AAIRequest request = AAIRequest.getRequestFromResource("tenant"); + request.addRequestProperty("tenant.tenant-id", tenant_id); + request.addRequestProperty("cloud-region.cloud-owner", cloudOwner); + request.addRequestProperty("cloud-region.cloud-region-id", cloudRegionId); String rv = executor.get(request); if(rv != null) { @@ -2185,10 +2185,10 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe Tenant response = null; try { - AAIRequest request = new TenantRequest(); - request.addRequestProperty(TenantRequest.TENANT_NAME, tenant_name); - request.addRequestProperty(CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER, cloudOwner); - request.addRequestProperty(CloudRegionRequest.CLOUD_REGION_CLOUD_REGION_ID, cloudRegionId); + AAIRequest request = AAIRequest.getRequestFromResource("tenant"); + request.addRequestProperty("tenant.tenant-name", tenant_name); + request.addRequestProperty("cloud-region.cloud-owner", cloudOwner); + request.addRequestProperty("cloud-region.cloud-region-id", cloudRegionId); Object rv = executor.query(request, Tenant.class); if(rv == null) return (Tenant)null; @@ -2210,10 +2210,10 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe Boolean response = null; try { - AAIRequest request = new TenantRequest(); - request.addRequestProperty(TenantRequest.TENANT_ID, tenant_id); - request.addRequestProperty(CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER, cloudOwner); - request.addRequestProperty(CloudRegionRequest.CLOUD_REGION_CLOUD_REGION_ID, cloudRegionId); + AAIRequest request = AAIRequest.getRequestFromResource("tenant"); + request.addRequestProperty("tenant.tenant-id", tenant_id); + request.addRequestProperty("cloud-region.cloud-owner", cloudOwner); + request.addRequestProperty("cloud-region.cloud-region-id", cloudRegionId); request.setRequestObject(tenannt); response = executor.post(request); } catch(AAIServiceException aaiexc) { @@ -2513,7 +2513,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe break; default: - if(key.contains(String.format("%s.", resource))) { + if(!key.contains(String.format("%s.", resource))) { key = rewriteKey(resource, key, ctx); } } @@ -2558,7 +2558,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe break; default: - if(key.contains(String.format("%s.", resource))) { + if(!key.contains(String.format("%s.", resource))) { key = rewriteKey(resource, key, ctx); } } @@ -2580,7 +2580,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe break; default: - if(key.contains(String.format("%s.", resource))) { + if(!key.contains(String.format("%s.", resource))) { key = rewriteKey(resource, key, ctx); } } diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceActivator.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceActivator.java index 261a0c7..b00748b 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceActivator.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIServiceActivator.java @@ -55,6 +55,8 @@ public class AAIServiceActivator implements BundleActivator { @Override public void start(BundleContext ctx) throws Exception { + System.setProperty("aaiclient.runtime", "OSGI"); + String sdnConfigDirectory = System.getenv(SDNC_CONFIG_DIR); // check SDNC CONFIG DIR system property @@ -210,8 +212,17 @@ public class AAIServiceActivator implements BundleActivator { for(ServiceRegistration registration : localRegistrationSet) { if (registration != null) { + try { + AAIService aaiService = (AAIService)ctx.getService(registration.getReference()); registration.unregister(); registrationSet.remove(registration); + if(aaiService != null) { + aaiService.cleanUp(); + } + } catch(Exception exc) { + if(LOG.isDebugEnabled()) + LOG.debug(exc.getMessage()); + } } } } diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/CloudRegionRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/CloudRegionRequest.java index 9897fbf..eed22f7 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/CloudRegionRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/CloudRegionRequest.java @@ -24,21 +24,24 @@ package org.openecomp.sdnc.sli.aai; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; +import java.util.HashMap; +import java.util.Map; import java.util.Properties; import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Joiner; -import org.openecomp.aai.inventory.v8.CloudRegion; +import org.openecomp.aai.inventory.v10.CloudRegion; public class CloudRegionRequest extends AAIRequest { public static final String CLOUD_REGION_PATH = "org.openecomp.sdnc.sli.aai.path.cloud.region"; - + private final String cloud_region_path; - + public static final String CLOUD_REGION_CLOUD_OWNER = "cloud-region.cloud-owner"; public static final String CLOUD_REGION_CLOUD_REGION_ID = "cloud-region.cloud-region-id"; @@ -51,7 +54,7 @@ public class CloudRegionRequest extends AAIRequest { public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return this.getRequestUrl(method, null); } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { @@ -59,13 +62,25 @@ public class CloudRegionRequest extends AAIRequest { request_url = processPathData(request_url, requestProperties); + Map<String, String> query = new HashMap<String, String>(); + if(requestProperties.containsKey(DEPTH)) { + query.put(DEPTH, requestProperties.getProperty(DEPTH)); + } + if(resourceVersion != null) { - request_url = request_url +"?resource-version="+resourceVersion; +// request_url = request_url +"?resource-version="+resourceVersion; + query.put(RESOURCE_VERSION, resourceVersion); + } + + if(!query.isEmpty()) { + Joiner.MapJoiner mapJoiner = Joiner.on("&").withKeyValueSeparator("="); + String queryString = mapJoiner.join(query); + request_url = String.format("%s?%s", request_url, queryString); } URL http_req_url = new URL(request_url); aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); - + return http_req_url; } @@ -86,10 +101,11 @@ public class CloudRegionRequest extends AAIRequest { @Override public String[] getArgsList() { - String[] args = + String[] args = { CLOUD_REGION_CLOUD_OWNER, - CLOUD_REGION_CLOUD_REGION_ID + CLOUD_REGION_CLOUD_REGION_ID, + DEPTH }; return args; @@ -99,13 +115,13 @@ public class CloudRegionRequest extends AAIRequest { public Class<? extends AAIDatum> getModelClass() { return CloudRegion.class; } - + public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { if(!requestProperties.containsKey(CLOUD_REGION_CLOUD_OWNER) || !requestProperties.containsKey(CLOUD_REGION_CLOUD_REGION_ID)) { aaiService.logKeyError(String.format("%s,%s", CLOUD_REGION_CLOUD_OWNER, CLOUD_REGION_CLOUD_REGION_ID)); } - + String encoded_vnf = encodeQuery(requestProperties.getProperty(CLOUD_REGION_CLOUD_OWNER)); request_url = request_url.replace("{cloud-owner}", encoded_vnf) ; @@ -114,7 +130,7 @@ public class CloudRegionRequest extends AAIRequest { aaiService.LOGwriteDateTrace("cloud-owner", requestProperties.getProperty(CLOUD_REGION_CLOUD_OWNER)); aaiService.LOGwriteDateTrace("cloud-region-id", requestProperties.getProperty(CLOUD_REGION_CLOUD_REGION_ID)); - + return request_url; } } diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericQueryRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericQueryRequest.java index 417202e..a420a06 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericQueryRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericQueryRequest.java @@ -31,14 +31,14 @@ import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.ResultData; +import org.openecomp.aai.inventory.v10.ResultData; public class GenericQueryRequest extends AAIRequest { public static final String GENERIC_SEARCH_PATH = "org.openecomp.sdnc.sli.aai.query.generic"; - + private final String generic_search_path; - + public static final String START_NODE_TYPE = "start-node-type"; public static final String IDENTIFIER = "identifier"; public static final String VALUE = "value"; @@ -48,7 +48,7 @@ public class GenericQueryRequest extends AAIRequest { generic_search_path = configProperties.getProperty(GENERIC_SEARCH_PATH); } - + // @Override // public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { // @@ -57,15 +57,15 @@ public class GenericQueryRequest extends AAIRequest { // // String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); // request_url = request_url.replace("{vnf-id}", encoded_vnf) ; -// +// // 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; // } @@ -82,12 +82,12 @@ public class GenericQueryRequest extends AAIRequest { 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 { + public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return getRequestUrl(method, null); } @@ -127,19 +127,19 @@ public class GenericQueryRequest extends AAIRequest { String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{identifier}", encoded_vnf) ; aaiService.LOGwriteDateTrace("identifier", requestProperties.getProperty(key)); - + key = VALUE; encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{value}", encoded_vnf) ; aaiService.LOGwriteDateTrace("value", requestProperties.getProperty(key)); - + key = START_NODE_TYPE; encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{start-node-type}", encoded_vnf) ; aaiService.LOGwriteDateTrace("start-node-type", requestProperties.getProperty(key)); - + return request_url; } } diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericRequest.java index 41ee9f3..54a5afc 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericRequest.java @@ -37,8 +37,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Joiner; -import org.openecomp.aai.inventory.v8.L3Network; -import org.openecomp.aai.inventory.v8.L3Networks; +import org.openecomp.aai.inventory.v10.L3Network; +import org.openecomp.aai.inventory.v10.L3Networks; public class GenericRequest extends AAIRequest { diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericVnfRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericVnfRequest.java index 235cecf..5d181f3 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericVnfRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericVnfRequest.java @@ -31,17 +31,17 @@ import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.GenericVnf; +import org.openecomp.aai.inventory.v10.GenericVnf; public class GenericVnfRequest extends AAIRequest { // tenant (1602) public static final String GENERIC_VNF_PATH = "org.openecomp.sdnc.sli.aai.path.generic.vnf"; public static final String GENERIC_VNF_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.generic.vnf.query"; - + private final String generic_vnf_path; private final String generic_vnf_query_path; - + public static final String GENERIC_VNF_ID = "generic_vnf.vnf_id"; public static final String VNF_ID = "vnf_id"; @@ -51,7 +51,7 @@ public class GenericVnfRequest extends AAIRequest { generic_vnf_query_path = configProperties.getProperty(GENERIC_VNF_QUERY_PATH); } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { @@ -60,11 +60,11 @@ public class GenericVnfRequest extends AAIRequest { if(requestProperties.containsKey(GENERIC_VNF_ID)) { key = GENERIC_VNF_ID; } - + if(!requestProperties.containsKey(key)) { aaiService.logKeyError(String.format("%s,%s", VNF_ID, GENERIC_VNF_ID)); } - + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{vnf-id}", encoded_vnf) ; if(resourceVersion != null) { @@ -74,31 +74,31 @@ public class GenericVnfRequest extends AAIRequest { aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); aaiService.LOGwriteDateTrace("vnf-id", requestProperties.getProperty(key)); - + return http_req_url; } - + @Override public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { String request_url = target_uri+generic_vnf_path; - + String key = VNF_ID; if(requestProperties.containsKey(GENERIC_VNF_ID)) { key = GENERIC_VNF_ID; } - + if(!requestProperties.containsKey(key)) { aaiService.logKeyError(String.format("%s,%s", VNF_ID, GENERIC_VNF_ID)); } - + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{vnf-id}", encoded_vnf) ; URL http_req_url = new URL(request_url); aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); aaiService.LOGwriteDateTrace("vnf-id", requestProperties.getProperty(key)); - + return http_req_url; } diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv4AddressListRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv4AddressListRequest.java index d9b2a91..364940a 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv4AddressListRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv4AddressListRequest.java @@ -31,7 +31,7 @@ import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.L3InterfaceIpv4AddressList; +import org.openecomp.aai.inventory.v10.L3InterfaceIpv4AddressList; public class L3InterfaceIpv4AddressListRequest extends AAIRequest { @@ -63,13 +63,14 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { public static final String L3_INTERFACE_IPV4_ADDRESS_LIST_PATH = "org.openecomp.sdnc.sli.aai.path.l3.interface.ipv4.address.list"; public static final String VLAN_L3_INTERFACE_IPV4_ADDRESS_LIST_PATH = "org.openecomp.sdnc.sli.aai.path.vlan.l3.interface.ipv4.address.list"; - + private final String l3_interface_ipv4_address_list_path; private final String vlan_l3_interface_ipv4_address_list_path; - + public static final String L3_INTERFACE_IPV4_ADDRESS = "l3-interface-ipv4-address"; public static final String LIST_L3_INTERFACE_IPV4_ADDRESS = "l3-interface-ipv4-address-list.l3-interface-ipv4-address"; - + public static final String VLAN_INTERFACE = "vlan-interface"; + public static final String VLAN_VLAN_INTERFACE = "vlan.vlan-interface"; public L3InterfaceIpv4AddressListRequest() { l3_interface_ipv4_address_list_path = configProperties.getProperty(L3_INTERFACE_IPV4_ADDRESS_LIST_PATH); @@ -80,20 +81,20 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return this.getRequestUrl(method, null); } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { String request_url = target_uri+l3_interface_ipv4_address_list_path; - - if(requestProperties.containsKey(VLanRequest.VLAN_INTERFACE) || requestProperties.containsKey(VLanRequest.VLAN_VLAN_INTERFACE)){ + + if(requestProperties.containsKey(VLAN_INTERFACE) || requestProperties.containsKey(VLAN_VLAN_INTERFACE)){ request_url = target_uri+vlan_l3_interface_ipv4_address_list_path; - request_url = VLanRequest.processPathData(request_url, requestProperties); + request_url = processVLanRequestPathData(request_url, requestProperties); } request_url = processPathData(request_url, requestProperties); request_url = LInterfaceRequest.processPathData(request_url, requestProperties); - request_url = GenericVnfRequest.processPathData(request_url, requestProperties); +// request_url = GenericVnfRequest.processPathData(request_url, requestProperties); if(resourceVersion != null) { request_url = request_url +"?resource-version="+resourceVersion; @@ -101,10 +102,27 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { URL http_req_url = new URL(request_url); aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); - + return http_req_url; } + public static String processVLanRequestPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { + String key = null; + + if(requestProperties.containsKey(VLAN_VLAN_INTERFACE)) { + key = VLAN_VLAN_INTERFACE; + } else if(requestProperties.containsKey(VLAN_INTERFACE)) { + key = VLAN_INTERFACE; + } else { + aaiService.logKeyError(String.format("%s,%s", VLAN_INTERFACE, VLAN_VLAN_INTERFACE)); + } + + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); + + request_url = request_url.replace("{vlan-interface}", encoded_vnf) ; + aaiService.LOGwriteDateTrace("vlan-interface", requestProperties.getProperty(key)); + return request_url; + } @Override public String toJSONString() { @@ -122,16 +140,15 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { @Override public String[] getArgsList() { - String[] args = + String[] args = { L3_INTERFACE_IPV4_ADDRESS, LIST_L3_INTERFACE_IPV4_ADDRESS, - VLanRequest.VLAN_INTERFACE, - VLanRequest.VLAN_VLAN_INTERFACE, - LInterfaceRequest.INTERFACE_NAME, + VLAN_INTERFACE, + VLAN_VLAN_INTERFACE, + LInterfaceRequest.INTERFACE_NAME, LInterfaceRequest.LINTERFACE_INTERFACE_NAME, - GenericVnfRequest.GENERIC_VNF_ID, - GenericVnfRequest.VNF_ID + "generic-vnf.vnf-id" }; return args; @@ -141,7 +158,7 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { public Class<? extends AAIDatum> getModelClass() { return L3InterfaceIpv4AddressList.class; } - + public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { String key = L3_INTERFACE_IPV4_ADDRESS; if(requestProperties.containsKey(LIST_L3_INTERFACE_IPV4_ADDRESS)) { @@ -151,29 +168,29 @@ public class L3InterfaceIpv4AddressListRequest extends AAIRequest { if(!requestProperties.containsKey(key)) { aaiService.logKeyError(String.format("%s,%s", L3_INTERFACE_IPV4_ADDRESS, LIST_L3_INTERFACE_IPV4_ADDRESS)); } - + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{l3-interface-ipv4-address}", encoded_vnf) ; - + aaiService.LOGwriteDateTrace("l3-interface-ipv4-address", requestProperties.getProperty(key)); return request_url; } - + /* * (non-Javadoc) * @see org.openecomp.sdnc.sli.aai.PathConfigurator#configurePath(java.lang.String) */ // @Override // public void processRequestPathValues(Map<String, String> nameValues) { -// String[] paths = +// String[] paths = // { // "/aai/v7/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}", // "/aai/v7/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}", // "/aai/v7/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}", // "/aai/v7/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}" // }; -// +// // List<String>keys = new LinkedList<String>(); // keys.addAll(nameValues.keySet()); // for(String key : keys) { diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv6AddressListRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv6AddressListRequest.java index da57abf..aa6b098 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv6AddressListRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/L3InterfaceIpv6AddressListRequest.java @@ -31,7 +31,7 @@ import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.L3InterfaceIpv6AddressList; +import org.openecomp.aai.inventory.v10.L3InterfaceIpv6AddressList; public class L3InterfaceIpv6AddressListRequest extends AAIRequest { @@ -60,16 +60,17 @@ public class L3InterfaceIpv6AddressListRequest extends AAIRequest { * aaiv7:inventory/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address} * aaiv7:inventory/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address} */ - + public static final String L3_INTERFACE_IPV6_ADDRESS_LIST_PATH = "org.openecomp.sdnc.sli.aai.path.l3.interface.ipv6.address.list"; public static final String VLAN_L3_INTERFACE_IPV6_ADDRESS_LIST_PATH = "org.openecomp.sdnc.sli.aai.path.vlan.l3.interface.ipv6.address.list"; - + private final String l3_interface_ipv6_address_list_path; private final String vlan_l3_interface_ipv6_address_list_path; - + public static final String L3_INTERFACE_IPV6_ADDRESS = "l3-interface-ipv6-address"; public static final String LIST_L3_INTERFACE_IPV6_ADDRESS = "l3-interface-ipv6-address-list.l3-interface-ipv6-address"; - + public static final String VLAN_INTERFACE = "vlan-interface"; + public static final String VLAN_VLAN_INTERFACE = "vlan.vlan-interface"; public L3InterfaceIpv6AddressListRequest() { l3_interface_ipv6_address_list_path = configProperties.getProperty(L3_INTERFACE_IPV6_ADDRESS_LIST_PATH); @@ -80,20 +81,20 @@ public class L3InterfaceIpv6AddressListRequest extends AAIRequest { public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return this.getRequestUrl(method, null); } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { String request_url = target_uri+l3_interface_ipv6_address_list_path; - if(requestProperties.containsKey(VLanRequest.VLAN_INTERFACE) || requestProperties.containsKey(VLanRequest.VLAN_VLAN_INTERFACE)){ + if(requestProperties.containsKey(VLAN_INTERFACE) || requestProperties.containsKey(VLAN_VLAN_INTERFACE)){ request_url = target_uri+vlan_l3_interface_ipv6_address_list_path; - request_url = VLanRequest.processPathData(request_url, requestProperties); + request_url = processVLanRequestPathData(request_url, requestProperties); } request_url = processPathData(request_url, requestProperties); request_url = LInterfaceRequest.processPathData(request_url, requestProperties); - request_url = GenericVnfRequest.processPathData(request_url, requestProperties); +// request_url = GenericVnfRequest.processPathData(request_url, requestProperties); if(resourceVersion != null) { request_url = request_url +"?resource-version="+resourceVersion; @@ -101,10 +102,27 @@ public class L3InterfaceIpv6AddressListRequest extends AAIRequest { URL http_req_url = new URL(request_url); aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); - + return http_req_url; } + public static String processVLanRequestPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { + String key = null; + + if(requestProperties.containsKey(VLAN_VLAN_INTERFACE)) { + key = VLAN_VLAN_INTERFACE; + } else if(requestProperties.containsKey(VLAN_INTERFACE)) { + key = VLAN_INTERFACE; + } else { + aaiService.logKeyError(String.format("%s,%s", VLAN_INTERFACE, VLAN_VLAN_INTERFACE)); + } + + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); + + request_url = request_url.replace("{vlan-interface}", encoded_vnf) ; + aaiService.LOGwriteDateTrace("vlan-interface", requestProperties.getProperty(key)); + return request_url; + } @Override public String toJSONString() { @@ -122,16 +140,15 @@ public class L3InterfaceIpv6AddressListRequest extends AAIRequest { @Override public String[] getArgsList() { - String[] args = + String[] args = { L3_INTERFACE_IPV6_ADDRESS, LIST_L3_INTERFACE_IPV6_ADDRESS, - VLanRequest.VLAN_INTERFACE, - VLanRequest.VLAN_VLAN_INTERFACE, - LInterfaceRequest.INTERFACE_NAME, + VLAN_INTERFACE, + VLAN_VLAN_INTERFACE, + LInterfaceRequest.INTERFACE_NAME, LInterfaceRequest.LINTERFACE_INTERFACE_NAME, - GenericVnfRequest.GENERIC_VNF_ID, - GenericVnfRequest.VNF_ID + "generic-vnf.vnf-id" }; @@ -142,21 +159,21 @@ public class L3InterfaceIpv6AddressListRequest extends AAIRequest { public Class<? extends AAIDatum> getModelClass() { return L3InterfaceIpv6AddressList.class; } - + public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { String key = L3_INTERFACE_IPV6_ADDRESS; if(requestProperties.containsKey(LIST_L3_INTERFACE_IPV6_ADDRESS)) { key = LIST_L3_INTERFACE_IPV6_ADDRESS; } - + if(!requestProperties.containsKey(key)) { aaiService.logKeyError(String.format("%s,%s", L3_INTERFACE_IPV6_ADDRESS, LIST_L3_INTERFACE_IPV6_ADDRESS)); } - + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{l3-interface-ipv6-address}", encoded_vnf) ; - + aaiService.LOGwriteDateTrace("l3-interface-ipv6-address", requestProperties.getProperty(key)); return request_url; } diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LInterfaceRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LInterfaceRequest.java index 7ba0155..c9a818d 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LInterfaceRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LInterfaceRequest.java @@ -31,17 +31,17 @@ import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.LInterface; +import org.openecomp.aai.inventory.v10.LInterface; public class LInterfaceRequest extends AAIRequest { // tenant (1602) public static final String LAGINTERFACE_LINTERFACE_PATH = "org.openecomp.sdnc.sli.aai.path.lag.interface.l.interface"; public static final String LAGINTERFACE_LINTERFACE_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.lag.interface.l.interface.query"; - + public static final String P_INTERFACE_LINTERFACE_PATH = "org.openecomp.sdnc.sli.aai.path.p.interface.l.interface"; public static final String P_INTERFACE_LINTERFACE_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.p.interface.l.interface.query"; - + public static final String LAGINTERFACE_LINTERFACE_PNF_PATH = "org.openecomp.sdnc.sli.aai.path.lag.interface.l.interface.pnf"; public static final String P_INTERFACE_LINTERFACE_PNF_PATH = "org.openecomp.sdnc.sli.aai.path.p.interface.l.interface.pnf"; @@ -49,23 +49,24 @@ public class LInterfaceRequest extends AAIRequest { private final String laginterface_linterface_query_path; private final String p_interface_linterface_path; private final String p_interface_linterface_query_path; - + private final String laginterface_linterface_pnf_path; private final String p_interface_linterface_pnf_path; - + public static final String INTERFACE_NAME = "interface-name"; public static final String LINTERFACE_INTERFACE_NAME = "l-interface.interface-name"; public static final String LAG_INTERFACE_INTERFACE_NAME = "lag-interface.interface-name"; public static final String P_INTERFACE_INTERFACE_NAME = "p-interface.interface-name"; + public static final String PNF_PNF_NAME = "pnf.pnf-name"; public static final String ROUTER_NAME = "router-name"; public static final String HOSTNAME = "hostname"; - - + + public static enum TYPE { L2_BRIDGE_BGF, L2_BRIDGE_SBG}; - + private final TYPE type; - + public LInterfaceRequest(TYPE type) { this.type = type; @@ -79,23 +80,23 @@ public class LInterfaceRequest extends AAIRequest { p_interface_linterface_pnf_path = configProperties.getProperty(P_INTERFACE_LINTERFACE_PNF_PATH); } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - String request_url = null; + String request_url = null; String encoded_vnf = null; String hostname = null; String pnfname = null; String interfaceName = null; if(type == TYPE.L2_BRIDGE_SBG) { - if(requestProperties.containsKey(PnfRequest.PNF_PNF_NAME)) { + if(requestProperties.containsKey(PNF_PNF_NAME)) { request_url = target_uri + laginterface_linterface_pnf_path; } else { request_url = target_uri + laginterface_linterface_path; } - + if(requestProperties.containsKey(ROUTER_NAME)) { hostname = requestProperties.getProperty(ROUTER_NAME); encoded_vnf = encodeQuery(hostname); @@ -108,8 +109,8 @@ public class LInterfaceRequest extends AAIRequest { request_url = request_url.replace("{hostname}", encoded_vnf); } - if(requestProperties.containsKey(PnfRequest.PNF_PNF_NAME)) { - pnfname = requestProperties.getProperty(PnfRequest.PNF_PNF_NAME); + if(requestProperties.containsKey(PNF_PNF_NAME)) { + pnfname = requestProperties.getProperty(PNF_PNF_NAME); encoded_vnf = encodeQuery(pnfname); request_url = request_url.replace("{pnf-name}", encoded_vnf); } @@ -117,7 +118,7 @@ public class LInterfaceRequest extends AAIRequest { encoded_vnf = encodeQuery(requestProperties.getProperty(LAG_INTERFACE_INTERFACE_NAME)); request_url = request_url.replace("{lag-interface.interface-name}", encoded_vnf) ; - + interfaceName = requestProperties.getProperty(INTERFACE_NAME); if(interfaceName == null || interfaceName.isEmpty()) { interfaceName = requestProperties.getProperty(LINTERFACE_INTERFACE_NAME); @@ -127,35 +128,35 @@ public class LInterfaceRequest extends AAIRequest { } if(type == TYPE.L2_BRIDGE_BGF) { - if(requestProperties.containsKey(PnfRequest.PNF_PNF_NAME)) { + if(requestProperties.containsKey(PNF_PNF_NAME)) { request_url = target_uri + p_interface_linterface_pnf_path; } else { request_url = target_uri + p_interface_linterface_path; } - + if(requestProperties.containsKey(ROUTER_NAME)) { hostname = requestProperties.getProperty(ROUTER_NAME); encoded_vnf = encodeQuery(hostname); request_url = request_url.replace("{hostname}", encoded_vnf); - } - + } + if(requestProperties.containsKey(HOSTNAME)) { hostname = requestProperties.getProperty(HOSTNAME); encoded_vnf = encodeQuery(hostname); request_url = request_url.replace("{hostname}", encoded_vnf); } - - if(requestProperties.containsKey(PnfRequest.PNF_PNF_NAME)) { - pnfname = requestProperties.getProperty(PnfRequest.PNF_PNF_NAME); + + if(requestProperties.containsKey(PNF_PNF_NAME)) { + pnfname = requestProperties.getProperty(PNF_PNF_NAME); encoded_vnf = encodeQuery(pnfname); request_url = request_url.replace("{pnf-name}", encoded_vnf); } - + encoded_vnf = encodeQuery(requestProperties.getProperty(P_INTERFACE_INTERFACE_NAME)); request_url = request_url.replace("{p-interface.interface-name}", encoded_vnf) ; - - + + interfaceName = requestProperties.getProperty(INTERFACE_NAME); if(interfaceName == null || interfaceName.isEmpty()) { interfaceName = requestProperties.getProperty(LINTERFACE_INTERFACE_NAME); @@ -185,7 +186,7 @@ public class LInterfaceRequest extends AAIRequest { return http_req_url; } - + @Override public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return this.getRequestUrl(method, null); @@ -211,27 +212,27 @@ public class LInterfaceRequest extends AAIRequest { public String[] getArgsList() { String[] args = {}; if(type == TYPE.L2_BRIDGE_SBG) { - String[] tmpArray = {INTERFACE_NAME, LINTERFACE_INTERFACE_NAME, LAG_INTERFACE_INTERFACE_NAME, HOSTNAME, ROUTER_NAME, PnfRequest.PNF_PNF_NAME}; + String[] tmpArray = {INTERFACE_NAME, LINTERFACE_INTERFACE_NAME, LAG_INTERFACE_INTERFACE_NAME, HOSTNAME, ROUTER_NAME, PNF_PNF_NAME}; args = tmpArray; } if(type == TYPE.L2_BRIDGE_BGF) { - String[] tmpArray = {INTERFACE_NAME, LINTERFACE_INTERFACE_NAME, P_INTERFACE_INTERFACE_NAME, HOSTNAME, ROUTER_NAME, PnfRequest.PNF_PNF_NAME}; + String[] tmpArray = {INTERFACE_NAME, LINTERFACE_INTERFACE_NAME, P_INTERFACE_INTERFACE_NAME, HOSTNAME, ROUTER_NAME, PNF_PNF_NAME}; args = tmpArray; } return args; } - + @Override public Class<? extends AAIDatum> getModelClass() { return LInterface.class; } - + @Override public String getPrimaryResourceName(String resource) { return "l-interface"; } - + public static final String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { String interfaceName = requestProperties.getProperty(INTERFACE_NAME); if(interfaceName == null || interfaceName.isEmpty()) { diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LagInterfacePnfRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LagInterfacePnfRequest.java index 15b72f1..f4b08e7 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LagInterfacePnfRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/LagInterfacePnfRequest.java @@ -24,6 +24,7 @@ package org.openecomp.sdnc.sli.aai; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; +import java.util.Properties; import org.apache.commons.lang.ArrayUtils; import org.openecomp.sdnc.sli.aai.data.AAIDatum; @@ -32,23 +33,26 @@ import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.LagInterface; +import org.openecomp.aai.inventory.v10.LagInterface; public class LagInterfacePnfRequest extends AAIRequest { // tenant (1602) public static final String LAG_INTERFACE_PATH = "org.openecomp.sdnc.sli.aai.path.pserver.pinterface"; public static final String LAG_INTERFACE_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.pserver.pinterface.query"; - + public static final String PNF_PATH = "org.openecomp.sdnc.sli.aai.path.pnf"; + private final String lag_interface_path; private final String lag_interface_query_path; - + public static final String INTERFACE_NAME = "interface-name"; public static final String LAG_INTERFACE_INTERFACE_NAME = "lag-interface.interface-name"; + public static final String PNF_NAME = "pnf-name"; + public static final String PNF_PNF_NAME = "pnf.pnf-name"; public LagInterfacePnfRequest() { - lag_interface_path = configProperties.getProperty(PnfRequest.PNF_PATH) + "/lag-interfaces/lag-interface/{interface-name}"; + lag_interface_path = configProperties.getProperty(PNF_PATH) + "/lag-interfaces/lag-interface/{interface-name}"; lag_interface_query_path = configProperties.getProperty(LAG_INTERFACE_QUERY_PATH); LoggerFactory.getLogger(LagInterfacePnfRequest.class).debug("org.openecomp.sdnc.sli.aai.path.pserver.pinterface=\t" + lag_interface_path); LoggerFactory.getLogger(LagInterfacePnfRequest.class).debug("org.openecomp.sdnc.sli.aai.path.pserver.pinterface.query=\t" + lag_interface_query_path); @@ -57,26 +61,26 @@ public class LagInterfacePnfRequest extends AAIRequest { } } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { String request_url = target_uri + lag_interface_path; String encoded_vnf = null; - + String interfaceName = null; if(requestProperties.containsKey(INTERFACE_NAME)) { interfaceName = requestProperties.getProperty(INTERFACE_NAME); - } else + } else if(requestProperties.containsKey(LAG_INTERFACE_INTERFACE_NAME)) { interfaceName = requestProperties.getProperty(LAG_INTERFACE_INTERFACE_NAME); } encoded_vnf = encodeQuery(interfaceName); request_url = request_url.replace("{interface-name}", encoded_vnf) ; - - request_url = PnfRequest.processPathData(request_url,requestProperties); + + request_url = processPnfRequestPathData(request_url,requestProperties); if(resourceVersion != null) { request_url = request_url +"?resource-version="+resourceVersion; @@ -85,10 +89,27 @@ public class LagInterfacePnfRequest extends AAIRequest { aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); aaiService.LOGwriteDateTrace("interface-name", interfaceName); - + return http_req_url; } - + + public static String processPnfRequestPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { + + String key = PNF_NAME; + if(requestProperties.containsKey(PNF_PNF_NAME)) { + key = PNF_PNF_NAME; + } + + if(!requestProperties.containsKey(key)) { + aaiService.logKeyError(String.format("%s,%s", PNF_NAME, PNF_PNF_NAME)); + } + + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); + request_url = request_url.replace("{pnf-name}", encoded_vnf) ; + + return request_url; + } + @Override public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return this.getRequestUrl(method, null); @@ -111,14 +132,11 @@ public class LagInterfacePnfRequest extends AAIRequest { @Override public String[] getArgsList() { - String[] args = {INTERFACE_NAME, LAG_INTERFACE_INTERFACE_NAME}; - String[] tmpArgs = new PnfRequest().getArgsList(); - - args = (String[]) ArrayUtils.addAll(args, tmpArgs); - + String[] args = {INTERFACE_NAME, LAG_INTERFACE_INTERFACE_NAME, PNF_PNF_NAME}; + return args; } - + @Override public Class<? extends AAIDatum> getModelClass() { return LagInterface.class; diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/NamedQueryRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/NamedQueryRequest.java index 6271b1d..46421b6 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/NamedQueryRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/NamedQueryRequest.java @@ -24,26 +24,32 @@ package org.openecomp.sdnc.sli.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.openecomp.sdnc.sli.aai.data.AAIDatum; +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; -import org.openecomp.aai.inventory.v8.InventoryResponseItems; +import org.openecomp.aai.inventory.v10.InventoryResponseItems; public class NamedQueryRequest extends AAIRequest { public static final String NAMED_SEARCH_PATH = "org.openecomp.sdnc.sli.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"; @@ -65,19 +71,23 @@ public class NamedQueryRequest extends AAIRequest { 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 { + public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return getRequestUrl(method, null); } @Override public String toJSONString() { - ObjectMapper mapper = new ObjectMapper(); + 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)); @@ -86,6 +96,54 @@ public class NamedQueryRequest extends AAIRequest { 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<String>(); + 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<String>(); + 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); + } + } + } + } + } + } + json_text = node.toString(); + if(json_text == null) json_text = mapper.writeValueAsString(tenant); } catch (JsonProcessingException exc) { handleException(this, exc); @@ -113,7 +171,7 @@ public class NamedQueryRequest extends AAIRequest { 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) ; @@ -121,7 +179,7 @@ public class NamedQueryRequest extends AAIRequest { } key = PREFIX; - + if(requestProperties.containsKey(key)) { encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{prefix}", encoded_vnf) ; diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/NodesQueryRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/NodesQueryRequest.java index d9bee38..a50d3f7 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/NodesQueryRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/NodesQueryRequest.java @@ -31,14 +31,14 @@ import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.SearchResults; +import org.openecomp.aai.inventory.v10.SearchResults; public class NodesQueryRequest extends AAIRequest { public static final String NODES_SEARCH_PATH = "org.openecomp.sdnc.sli.aai.query.nodes"; - + private final String nodes_search_path; - + public static final String NODE_TYPE = "node-type"; public static final String ENTITY_IDENTIFIER = "entity-identifier"; public static final String ENTITY_VALUE = "entity-value"; @@ -48,7 +48,7 @@ public class NodesQueryRequest extends AAIRequest { nodes_search_path = configProperties.getProperty(NODES_SEARCH_PATH); } - + // @Override // public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { // @@ -57,15 +57,15 @@ public class NodesQueryRequest extends AAIRequest { // // String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); // request_url = request_url.replace("{vnf-id}", encoded_vnf) ; -// +// // 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; // } @@ -82,12 +82,12 @@ public class NodesQueryRequest extends AAIRequest { 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 { + public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return getRequestUrl(method, null); } @@ -127,19 +127,19 @@ public class NodesQueryRequest extends AAIRequest { String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{entity-identifier}", encoded_vnf) ; aaiService.LOGwriteDateTrace("entity-identifier", requestProperties.getProperty(key)); - + key = ENTITY_VALUE; encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{entity-name}", encoded_vnf) ; aaiService.LOGwriteDateTrace("entity-name", requestProperties.getProperty(key)); - + key = NODE_TYPE; encoded_vnf = encodeQuery(requestProperties.getProperty(key)); request_url = request_url.replace("{node-type}", encoded_vnf) ; aaiService.LOGwriteDateTrace("node-type", requestProperties.getProperty(key)); - + return request_url; } } diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PInterfacePnfRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PInterfacePnfRequest.java index 637a0e4..c158d34 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PInterfacePnfRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PInterfacePnfRequest.java @@ -24,6 +24,7 @@ package org.openecomp.sdnc.sli.aai; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; +import java.util.Properties; import org.apache.commons.lang.ArrayUtils; import org.openecomp.sdnc.sli.aai.data.AAIDatum; @@ -32,23 +33,26 @@ import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.PInterface; +import org.openecomp.aai.inventory.v10.PInterface; public class PInterfacePnfRequest extends AAIRequest { // tenant (1602) public static final String PINTERFACE_PATH = "org.openecomp.sdnc.sli.aai.path.pserver.pinterface"; public static final String PINTERFACE_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.pserver.pinterface.query"; - + public static final String PNF_PATH = "org.openecomp.sdnc.sli.aai.path.pnf"; + private final String pinterface_path; private final String pinterface_query_path; - + public static final String INTERFACE_NAME = "interface-name"; public static final String PINTERFACE_INTERFACE_NAME = "p-interface.interface-name"; + public static final String PNF_NAME = "pnf-name"; + public static final String PNF_PNF_NAME = "pnf.pnf-name"; public PInterfacePnfRequest() { - pinterface_path = configProperties.getProperty(PnfRequest.PNF_PATH) + "/p-interfaces/p-interface/{interface-name}"; + pinterface_path = configProperties.getProperty(PNF_PATH) + "/p-interfaces/p-interface/{interface-name}"; pinterface_query_path = configProperties.getProperty(PINTERFACE_QUERY_PATH); LoggerFactory.getLogger(PInterfacePnfRequest.class).debug("org.openecomp.sdnc.sli.aai.path.pserver.pinterface=\t" + pinterface_path); LoggerFactory.getLogger(PInterfacePnfRequest.class).debug("org.openecomp.sdnc.sli.aai.path.pserver.pinterface.query=\t" + pinterface_query_path); @@ -57,26 +61,26 @@ public class PInterfacePnfRequest extends AAIRequest { } } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { String request_url = target_uri + pinterface_path; String encoded_vnf = null; - + String interfaceName = null; if(requestProperties.containsKey(INTERFACE_NAME)) { interfaceName = requestProperties.getProperty(INTERFACE_NAME); - } else + } else if(requestProperties.containsKey(PINTERFACE_INTERFACE_NAME)) { interfaceName = requestProperties.getProperty(PINTERFACE_INTERFACE_NAME); } encoded_vnf = encodeQuery(interfaceName); request_url = request_url.replace("{interface-name}", encoded_vnf) ; - - request_url = PnfRequest.processPathData(request_url,requestProperties); + + request_url = processPnfRequestPathData(request_url,requestProperties); if(resourceVersion != null) { request_url = request_url +"?resource-version="+resourceVersion; @@ -85,10 +89,27 @@ public class PInterfacePnfRequest extends AAIRequest { aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); aaiService.LOGwriteDateTrace("interface-name", interfaceName); - + return http_req_url; } - + + public static String processPnfRequestPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { + + String key = PNF_NAME; + if(requestProperties.containsKey(PNF_PNF_NAME)) { + key = PNF_PNF_NAME; + } + + if(!requestProperties.containsKey(key)) { + aaiService.logKeyError(String.format("%s,%s", PNF_NAME, PNF_PNF_NAME)); + } + + String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); + request_url = request_url.replace("{pnf-name}", encoded_vnf) ; + + return request_url; + } + @Override public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return this.getRequestUrl(method, null); @@ -111,14 +132,11 @@ public class PInterfacePnfRequest extends AAIRequest { @Override public String[] getArgsList() { - String[] args = {INTERFACE_NAME, PINTERFACE_INTERFACE_NAME}; - String[] tmpArgs = new PnfRequest().getArgsList(); - - args = (String[]) ArrayUtils.addAll(args, tmpArgs); - + String[] args = {INTERFACE_NAME, PINTERFACE_INTERFACE_NAME, PNF_NAME, PNF_PNF_NAME}; + return args; } - + @Override public Class<? extends AAIDatum> getModelClass() { return PInterface.class; diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PInterfaceRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PInterfaceRequest.java index f56d586..cc2208b 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PInterfaceRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PInterfaceRequest.java @@ -31,17 +31,17 @@ import org.slf4j.LoggerFactory; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.PInterface; +import org.openecomp.aai.inventory.v10.PInterface; public class PInterfaceRequest extends AAIRequest { // tenant (1602) public static final String PINTERFACE_PATH = "org.openecomp.sdnc.sli.aai.path.pserver.pinterface"; public static final String PINTERFACE_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.pserver.pinterface.query"; - + private final String pinterface_path; private final String pinterface_query_path; - + public static final String HOSTNAME = "hostname"; public static final String PSERVER_HOSTNAME = "pserver.hostname"; public static final String INTERFACE_NAME = "interface-name"; @@ -58,13 +58,13 @@ public class PInterfaceRequest extends AAIRequest { } } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { String request_url = target_uri + pinterface_path; String encoded_vnf = null; - + String hostname = null; String interfaceName = null; @@ -74,7 +74,7 @@ public class PInterfaceRequest extends AAIRequest { if(requestProperties.containsKey(PSERVER_HOSTNAME)) { hostname = requestProperties.getProperty(PSERVER_HOSTNAME); } - + if(requestProperties.containsKey(INTERFACE_NAME)) { interfaceName = requestProperties.getProperty(INTERFACE_NAME); } @@ -96,10 +96,10 @@ public class PInterfaceRequest extends AAIRequest { aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); aaiService.LOGwriteDateTrace("hostname", hostname); aaiService.LOGwriteDateTrace("interface-name", hostname); - + return http_req_url; } - + @Override public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return this.getRequestUrl(method, null); @@ -125,7 +125,7 @@ public class PInterfaceRequest extends AAIRequest { String[] args = {HOSTNAME, PSERVER_HOSTNAME, INTERFACE_NAME, PINTERFACE_INTERFACE_NAME}; return args; } - + @Override public Class<? extends AAIDatum> getModelClass() { return PInterface.class; diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PServerRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PServerRequest.java deleted file mode 100644 index d78254b..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PServerRequest.java +++ /dev/null @@ -1,116 +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.openecomp.sdnc.sli.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.openecomp.aai.inventory.v8.Pserver; - -public class PServerRequest extends AAIRequest { - - // tenant (1602) - public static final String PSERVER_PATH = "org.openecomp.sdnc.sli.aai.path.pserver"; - public static final String PSERVER_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.pserver.query"; - - private final String pserver_path; - private final String pserver_query_path; - - public static final String HOSTNAME = "hostname"; - public static final String PSERVER_HOSTNAME = "pserver.hostname"; - - - public PServerRequest() { - pserver_path = configProperties.getProperty(PSERVER_PATH); - pserver_query_path = configProperties.getProperty(PSERVER_QUERY_PATH); - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = target_uri + pserver_path; - String encoded_vnf = null; - - String hostname = null; - if(requestProperties.containsKey(HOSTNAME)) { - hostname = requestProperties.getProperty(HOSTNAME); - encoded_vnf = encodeQuery(hostname); - request_url = request_url.replace("{hostname}", encoded_vnf) ; - - } else if(requestProperties.containsKey(PSERVER_HOSTNAME)) { - hostname = requestProperties.getProperty(PSERVER_HOSTNAME); - encoded_vnf = encodeQuery(hostname); - request_url = request_url.replace("{hostname}", encoded_vnf) ; - - } else { - LOG.error("Required key "+PSERVER_HOSTNAME+" is misssing."); - } - - 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()); - aaiService.LOGwriteDateTrace("hostname", hostname); - - return http_req_url; - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { - return this.getRequestUrl(method, null); - } - - - @Override - public String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - Pserver vnfc = (Pserver)requestDatum; - String json_text = null; - try { - json_text = mapper.writeValueAsString(vnfc); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - @Override - public String[] getArgsList() { - String[] args = {HOSTNAME, PSERVER_HOSTNAME}; - return args; - } - - @Override - public Class<? extends AAIDatum> getModelClass() { - return Pserver.class; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PhysicalLinkRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PhysicalLinkRequest.java index 7aa0f1b..b494471 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PhysicalLinkRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PhysicalLinkRequest.java @@ -30,17 +30,17 @@ import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.PhysicalLink; +import org.openecomp.aai.inventory.v10.PhysicalLink; public class PhysicalLinkRequest extends AAIRequest { // physical link public static final String PHYSICAL_LINK_PATH = "org.openecomp.sdnc.sli.aai.path.physical.link"; public static final String PHYSICAL_LINK_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.physical.link.query"; - + private final String physical_link_path; private final String physical_link_query_path; - + public static final String LINK_NAME = "link-name"; public static final String PHYSICAL_LINK_NAME = "physical-link.link-name"; @@ -54,12 +54,12 @@ public class PhysicalLinkRequest extends AAIRequest { public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return this.getRequestUrl(method, null); } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { String request_url = target_uri+physical_link_path; - + String linkName = null; if(requestProperties.containsKey(LINK_NAME)) { linkName = requestProperties.getProperty(LINK_NAME); @@ -69,7 +69,7 @@ public class PhysicalLinkRequest extends AAIRequest { linkName = requestProperties.getProperty(PHYSICAL_LINK_NAME); } - + String encoded_vnf = encodeQuery(linkName); request_url = request_url.replace("{link-name}", encoded_vnf) ; @@ -80,7 +80,7 @@ public class PhysicalLinkRequest extends AAIRequest { aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); aaiService.LOGwriteDateTrace("link-name", linkName); - + return http_req_url; } diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PnfRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PnfRequest.java deleted file mode 100644 index 83988f9..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PnfRequest.java +++ /dev/null @@ -1,117 +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.openecomp.sdnc.sli.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Properties; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.openecomp.aai.inventory.v8.Pnf; - -public class PnfRequest extends AAIRequest { - - // pnf - public static final String PNF_PATH = "org.openecomp.sdnc.sli.aai.path.pnf"; - - - private final String pnf_path; - - - public static final String PNF_NAME = "pnf-name"; - public static final String PNF_PNF_NAME = "pnf.pnf-name"; - - - public PnfRequest() { - pnf_path = configProperties.getProperty(PNF_PATH); - - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { - return this.getRequestUrl(method, null); - } - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = target_uri+pnf_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; - } - - public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { - - String key = PNF_NAME; - if(requestProperties.containsKey(PNF_PNF_NAME)) { - key = PNF_PNF_NAME; - } - - if(!requestProperties.containsKey(key)) { - aaiService.logKeyError(String.format("%s,%s", PNF_NAME, PNF_PNF_NAME)); - } - - String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - request_url = request_url.replace("{pnf-name}", encoded_vnf) ; - - return request_url; - } - - @Override - public String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - Pnf pnf = (Pnf)requestDatum; - String json_text = null; - try { - json_text = mapper.writeValueAsString(pnf); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - @Override - public String[] getArgsList() { - String[] args = {PNF_NAME, PNF_PNF_NAME}; - - return args; - } - - @Override - public Class<? extends AAIDatum> getModelClass() { - return Pnf.class; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/RelationshipRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/RelationshipRequest.java index b964ecb..d0d0e88 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/RelationshipRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/RelationshipRequest.java @@ -30,17 +30,17 @@ import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.RelationshipList; +import org.openecomp.aai.inventory.v10.RelationshipList; public class RelationshipRequest extends AAIRequest { // tenant (1602) public static final String RELATIONSHIP_LIST_PATH = "org.openecomp.sdnc.sli.aai.path.relationship.list"; public static final String RELATIONSHIP_LIST_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.relationship.list.query"; - + private final String relationship_path; private final String relationship_query_path; - + public static final String RELATED_TO = "related-to"; public static final String RELATIONSHIP_KEY = "relationship-key"; @@ -49,23 +49,23 @@ public class RelationshipRequest extends AAIRequest { relationship_query_path = configProperties.getProperty(RELATIONSHIP_LIST_QUERY_PATH); } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { AAIRequest masterRequest = (AAIRequest)requestProperties.get(MASTER_REQUEST); URL masterURL = masterRequest.getRequestUrl(method, null); - + String request_url = masterURL.toString(); request_url = request_url + relationship_path; - + if(request_url.contains("//")) { request_url = request_url.replaceAll("//", "/"); } if(requestProperties.containsKey(RELATED_TO)) { String encoded_vnf = encodeQuery(requestProperties.getProperty(RELATED_TO)); - request_url = request_url.replace("{related-to}", encoded_vnf) ; + request_url = request_url.replace("{related-to}", encoded_vnf) ; } // if(resourceVersion != null) { @@ -75,10 +75,10 @@ public class RelationshipRequest extends AAIRequest { aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); aaiService.LOGwriteDateTrace("related-to", requestProperties.getProperty(RELATED_TO)); - + return http_req_url; } - + @Override public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { @@ -89,7 +89,7 @@ public class RelationshipRequest extends AAIRequest { aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); aaiService.LOGwriteDateTrace("tenant_name", requestProperties.getProperty(RELATIONSHIP_KEY)); - + return http_req_url; } @@ -120,7 +120,7 @@ public class RelationshipRequest extends AAIRequest { public Class<? extends AAIDatum> getModelClass() { return RelationshipList.class; } - + public boolean isDeleteDataRequired() { return true; } diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/SelfLinkRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/SelfLinkRequest.java index 0f0059a..90bbcb4 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/SelfLinkRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/SelfLinkRequest.java @@ -29,6 +29,7 @@ import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Joiner; public class SelfLinkRequest extends AAIRequest { @@ -47,6 +48,17 @@ public class SelfLinkRequest extends AAIRequest { String request_url = null; request_url = requestProperties.getProperty(SELFLINK); + + String query = null; + + if(request_url.contains("?")) { + query = request_url.substring(request_url.indexOf("?")); + Joiner.MapJoiner mapJoiner = Joiner.on(",").withKeyValueSeparator("="); +// String queryString = mapJoiner.join(query); + } else { + request_url = request_url + "?depth=1"; + } + URL http_req_url = new URL(request_url); aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/ServiceRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/ServiceRequest.java deleted file mode 100644 index 7266fd0..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/ServiceRequest.java +++ /dev/null @@ -1,109 +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.openecomp.sdnc.sli.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.openecomp.aai.inventory.v8.Service; - -public class ServiceRequest extends AAIRequest { - - // tenant (1602) - public static final String SERVICE_PATH = "org.openecomp.sdnc.sli.aai.path.service"; - public static final String SERVICE_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.service.query"; - - private final String service_path; - private final String service_query_path; - - public static final String SERVICE_ID = "service.service-id"; - - - - public ServiceRequest() { - service_path = configProperties.getProperty(SERVICE_PATH); - service_query_path = configProperties.getProperty(SERVICE_QUERY_PATH); - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = target_uri + service_path; - String encoded_vnf = null; - - String serviceId = null; - if(requestProperties.containsKey(SERVICE_ID)) { - serviceId = requestProperties.getProperty(SERVICE_ID); - } - - encoded_vnf = encodeQuery(serviceId); - request_url = request_url.replace("{service-id}", encoded_vnf) ; - - 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()); - aaiService.LOGwriteDateTrace("service-id", serviceId); - - return http_req_url; - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { - return this.getRequestUrl(method, null); - } - - - @Override - public String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - Service vnfc = (Service)requestDatum; - String json_text = null; - try { - json_text = mapper.writeValueAsString(vnfc); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - @Override - public String[] getArgsList() { - String[] args = {SERVICE_ID}; - return args; - } - - @Override - public Class<? extends AAIDatum> getModelClass() { - return Service.class; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/SubInterfaceRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/SubInterfaceRequest.java index 8c97b3e..fa04349 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/SubInterfaceRequest.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/SubInterfaceRequest.java @@ -31,29 +31,29 @@ import org.openecomp.sdnc.sli.aai.data.AAIDatum; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.openecomp.aai.inventory.v8.LInterface; +import org.openecomp.aai.inventory.v10.LInterface; public class SubInterfaceRequest extends AAIRequest { // tenant (1602) public static final String PNF_LAGINTERFACE_SUBINTERFACE_PATH = "org.openecomp.sdnc.sli.aai.path.pnf.lag.interface.subinterface"; public static final String PNF_LAGINTERFACE_SUBINTERFACE_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.pnf.lag.interface.subinterface.query"; - + public static final String PNF_P_INTERFACE_SUBINTERFACE_PATH = "org.openecomp.sdnc.sli.aai.path.pnf.p.interface.l.interface"; public static final String PNF_P_INTERFACE_SUBINTERFACE_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.pnf.p.interface.l.interface.query"; - + private final String pnf_laginterface_subinterface_path; private final String pnf_laginterface_subinterface_query_path; private final String pnf_p_interface_subinterface_path; private final String pnf_p_interface_subinterface_query_path; - + public static final String SUBINTERFACE_INTERFACE_NAME = "l-interface.interface-name"; public static final String LAG_INTERFACE_INTERFACE_NAME = "lag-interface.interface-name"; - + public static final String PNF_PNF_NAME = "pnf.pnf-name"; public static enum TYPE { L2_BRIDGE_BGF, L2_BRIDGE_SBG}; - + private final TYPE type; - + public SubInterfaceRequest(TYPE type) { this.type = type; @@ -64,11 +64,11 @@ public class SubInterfaceRequest extends AAIRequest { pnf_p_interface_subinterface_query_path = configProperties.getProperty(PNF_P_INTERFACE_SUBINTERFACE_QUERY_PATH); } - + @Override public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - String request_url = null; + String request_url = null; String encoded_vnf = null; String pnfname = null; @@ -77,8 +77,8 @@ public class SubInterfaceRequest extends AAIRequest { if(type == TYPE.L2_BRIDGE_SBG) { request_url = target_uri + pnf_laginterface_subinterface_path; - if(requestProperties.containsKey(PnfRequest.PNF_PNF_NAME)) { - pnfname = requestProperties.getProperty(PnfRequest.PNF_PNF_NAME); + if(requestProperties.containsKey(PNF_PNF_NAME)) { + pnfname = requestProperties.getProperty(PNF_PNF_NAME); encoded_vnf = encodeQuery(pnfname); request_url = request_url.replace("{pnf-name}", encoded_vnf); } @@ -86,7 +86,7 @@ public class SubInterfaceRequest extends AAIRequest { encoded_vnf = encodeQuery(requestProperties.getProperty(LAG_INTERFACE_INTERFACE_NAME)); request_url = request_url.replace("{lag-interface.interface-name}", encoded_vnf) ; - + interfaceName = requestProperties.getProperty(SUBINTERFACE_INTERFACE_NAME); encoded_vnf = encodeQuery(interfaceName); request_url = request_url.replace("{interface-name}", encoded_vnf) ; @@ -94,17 +94,17 @@ public class SubInterfaceRequest extends AAIRequest { } if(type == TYPE.L2_BRIDGE_BGF) { request_url = target_uri + pnf_p_interface_subinterface_path; - - if(requestProperties.containsKey(PnfRequest.PNF_PNF_NAME)) { - pnfname = requestProperties.getProperty(PnfRequest.PNF_PNF_NAME); + + if(requestProperties.containsKey(PNF_PNF_NAME)) { + pnfname = requestProperties.getProperty(PNF_PNF_NAME); encoded_vnf = encodeQuery(pnfname); request_url = request_url.replace("{pnf-name}", encoded_vnf); } - + encoded_vnf = encodeQuery(requestProperties.getProperty(PInterfaceRequest.PINTERFACE_INTERFACE_NAME)); request_url = request_url.replace("{p-interface.interface-name}", encoded_vnf) ; - - + + interfaceName = requestProperties.getProperty(SUBINTERFACE_INTERFACE_NAME); encoded_vnf = encodeQuery(interfaceName); request_url = request_url.replace("{interface-name}", encoded_vnf) ; @@ -130,7 +130,7 @@ public class SubInterfaceRequest extends AAIRequest { return http_req_url; } - + @Override public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { return this.getRequestUrl(method, null); @@ -156,27 +156,27 @@ public class SubInterfaceRequest extends AAIRequest { public String[] getArgsList() { String[] args = {}; if(type == TYPE.L2_BRIDGE_SBG) { - String[] tmpArray = {SUBINTERFACE_INTERFACE_NAME, LAG_INTERFACE_INTERFACE_NAME, PnfRequest.PNF_PNF_NAME}; + String[] tmpArray = {SUBINTERFACE_INTERFACE_NAME, LAG_INTERFACE_INTERFACE_NAME, PNF_PNF_NAME}; args = tmpArray; } if(type == TYPE.L2_BRIDGE_BGF) { - String[] tmpArray = {SUBINTERFACE_INTERFACE_NAME, PInterfaceRequest.PINTERFACE_INTERFACE_NAME, PnfRequest.PNF_PNF_NAME}; + String[] tmpArray = {SUBINTERFACE_INTERFACE_NAME, PInterfaceRequest.PINTERFACE_INTERFACE_NAME, PNF_PNF_NAME}; args = tmpArray; } return args; } - + @Override public Class<? extends AAIDatum> getModelClass() { return LInterface.class; } - + @Override public String getPrimaryResourceName(String resource) { return "sub-interface"; } - + public static final String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { String interfaceName = requestProperties.getProperty(SUBINTERFACE_INTERFACE_NAME); request_url = request_url.replace("{interface-name}", encodeQuery(interfaceName)) ; diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/SubnetRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/SubnetRequest.java deleted file mode 100644 index 05d93e8..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/SubnetRequest.java +++ /dev/null @@ -1,116 +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.openecomp.sdnc.sli.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.openecomp.aai.inventory.v8.Subnet; - -public class SubnetRequest extends AAIRequest { - - public static final String SUBNET_PATH = "org.openecomp.sdnc.sli.aai.path.subnet"; - public static final String SUBNET_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.subnet.query"; - - private final String subnet_path; - private final String subnet_query_path; - - public static final String SUBNET_ID = "subnet.subnet-id"; - public static final String NETWORK_ID = "l3-network.network-id"; - - - public SubnetRequest() { - subnet_path = configProperties.getProperty(SUBNET_PATH); - subnet_query_path = configProperties.getProperty(SUBNET_QUERY_PATH); - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = target_uri+subnet_path; - - String encoded_vnf = null; - if(requestProperties.getProperty(SUBNET_ID) != null) { - encoded_vnf = encodeQuery(requestProperties.getProperty(SUBNET_ID)); - request_url = request_url.replace("{subnet-id}", encoded_vnf) ; - } - - if(requestProperties.getProperty(NETWORK_ID) != null) { - encoded_vnf = encodeQuery(requestProperties.getProperty(NETWORK_ID)); - request_url = request_url.replace("{network-id}", encoded_vnf) ; - - } - - 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()); - aaiService.LOGwriteDateTrace(SUBNET_ID, requestProperties.getProperty(SUBNET_ID)); - aaiService.LOGwriteDateTrace(NETWORK_ID, requestProperties.getProperty(NETWORK_ID)); - - return http_req_url; - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { - return this.getRequestUrl(method, null); - } - - - @Override - public String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - Subnet vnfc = (Subnet)requestDatum; - String json_text = null; - try { - json_text = mapper.writeValueAsString(vnfc); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - @Override - public String[] getArgsList() { - String[] args = {SUBNET_ID, NETWORK_ID}; - return args; - } - - @Override - public Class<? extends AAIDatum> getModelClass() { - return Subnet.class; - } - - public String getPrimaryResourceName(String resource) { - return "subnet"; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/TenantRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/TenantRequest.java deleted file mode 100644 index 2a4e1a1..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/TenantRequest.java +++ /dev/null @@ -1,145 +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.openecomp.sdnc.sli.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Properties; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.openecomp.aai.inventory.v8.Tenant; - -public class TenantRequest extends AAIRequest { - - // tenant (1602) - public static final String TENANT_PATH = "org.openecomp.sdnc.sli.aai.path.tenant"; - public static final String TENANT_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.tenant.query"; - - private final String tenant_path; - private final String tenant_query_path; - - public static final String TENANT_ID = "tenant_id"; - public static final String TENANT_NAME = "tenant_name"; - public static final String TENANT_TENANT_ID = "tenant.tenant_id"; - public static final String TENANT_TENANT_NAME = "tenant.tenant_name"; - - public TenantRequest() { - tenant_path = configProperties.getProperty(TENANT_PATH); - tenant_query_path = configProperties.getProperty(TENANT_QUERY_PATH); - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - if(requestProperties.getProperty(TENANT_ID) == null && requestProperties.getProperty(TENANT_NAME) != null) { - return getRequestQueryUrl(method); - } - - String request_url = target_uri+tenant_path; -// String encoded_vnf = encodeQuery(requestProperties.getProperty(TENANT_ID)); -// request_url = request_url.replace("{tenant-id}", encoded_vnf) ; - - request_url = TenantRequest.processPathData(request_url, requestProperties); - if(requestProperties.containsKey(CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER)) { - request_url = CloudRegionRequest.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 { - - String request_url = target_uri+tenant_query_path; - String encoded_vnf = encodeQuery(requestProperties.getProperty(TENANT_NAME)); - request_url = request_url.replace("{tenant-name}", encoded_vnf) ; - - if(requestProperties.containsKey(CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER)) { - request_url = CloudRegionRequest.processPathData(request_url, requestProperties); - } - - URL http_req_url = new URL(request_url); - - aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); - aaiService.LOGwriteDateTrace("tenant_name", requestProperties.getProperty(TENANT_NAME)); - - return http_req_url; - } - - - @Override - public String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - Tenant tenant = (Tenant)requestDatum; - String json_text = null; - try { - json_text = mapper.writeValueAsString(tenant); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - - @Override - public String[] getArgsList() { - String[] args = {TENANT_ID, TENANT_NAME, TENANT_TENANT_ID, TENANT_TENANT_NAME, CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER, CloudRegionRequest.CLOUD_REGION_CLOUD_REGION_ID }; - return args; - } - - - @Override - public Class<? extends AAIDatum> getModelClass() { - return Tenant.class; - } - - public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { - String key = TENANT_ID; - if(requestProperties.containsKey(TENANT_TENANT_ID)) { - key = TENANT_TENANT_ID; - } - - if(!requestProperties.containsKey(key)) { - aaiService.logKeyError(String.format("%s,%s", TENANT_ID, TENANT_TENANT_ID)); - } - - String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - request_url = request_url.replace("{tenant-id}", encoded_vnf) ; - - aaiService.LOGwriteDateTrace("tenant-id", requestProperties.getProperty(key)); - return request_url; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/VLanRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/VLanRequest.java deleted file mode 100644 index 2a775f4..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/VLanRequest.java +++ /dev/null @@ -1,137 +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.openecomp.sdnc.sli.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Properties; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.openecomp.aai.inventory.v8.Vlan; - -public class VLanRequest extends AAIRequest { - - public static final String VLAN_PATH = "org.openecomp.sdnc.sli.aai.path.vlan"; - public static final String GENERIC_VNF_VLAN_PATH ="org.openecomp.sdnc.sli.aai.path.generic.vnf.vlan"; - - private final String vlan_path; - - public static final String VLAN_INTERFACE = "vlan-interface"; - public static final String VLAN_VLAN_INTERFACE = "vlan.vlan-interface"; - - - public VLanRequest() { - vlan_path = configProperties.getProperty(VLAN_PATH); - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { - return this.getRequestUrl(method, null); - } - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = target_uri+vlan_path; - - String key = VLAN_INTERFACE; - if(requestProperties.containsKey(VLAN_VLAN_INTERFACE)) { - key = VLAN_VLAN_INTERFACE; - } - - if(!requestProperties.containsKey(key)) { - aaiService.logKeyError(String.format("%s,%s", VLAN_INTERFACE, VLAN_VLAN_INTERFACE)); - } - String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - - request_url = request_url.replace("{vlan-interface}", encoded_vnf) ; - aaiService.LOGwriteDateTrace("vlan-interface", requestProperties.getProperty(key)); - - 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 String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - Vlan vnfc = (Vlan)requestDatum; - String json_text = null; - try { - json_text = mapper.writeValueAsString(vnfc); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - @Override - public String[] getArgsList() { - String[] args = - { - VLAN_INTERFACE, - VLAN_VLAN_INTERFACE, - LInterfaceRequest.INTERFACE_NAME, - LInterfaceRequest.LINTERFACE_INTERFACE_NAME, - GenericVnfRequest.GENERIC_VNF_ID, - GenericVnfRequest.VNF_ID, - CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER, - CloudRegionRequest.CLOUD_REGION_CLOUD_REGION_ID - }; - - return args; - } - - @Override - public Class<? extends AAIDatum> getModelClass() { - return Vlan.class; - } - - public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException { - String key = VLAN_INTERFACE; - if(requestProperties.containsKey(VLAN_VLAN_INTERFACE)) { - key = VLAN_VLAN_INTERFACE; - } - - if(!requestProperties.containsKey(key)) { - aaiService.logKeyError(String.format("%s,%s", VLAN_INTERFACE, VLAN_VLAN_INTERFACE)); - } - - String encoded_vnf = encodeQuery(requestProperties.getProperty(key)); - - request_url = request_url.replace("{vlan-interface}", encoded_vnf) ; - aaiService.LOGwriteDateTrace("vlan-interface", requestProperties.getProperty(key)); - return request_url; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/VServerVLanRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/VServerVLanRequest.java deleted file mode 100644 index f653d71..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/VServerVLanRequest.java +++ /dev/null @@ -1,147 +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.openecomp.sdnc.sli.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.openecomp.aai.inventory.v8.Vlan; - -public class VServerVLanRequest extends AAIRequest { - - // tenant (1602) - public static final String VLAN_PATH = "org.openecomp.sdnc.sli.aai.path.vlan"; - public static final String VLAN_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.vlan.query"; - - private final String vlan_path; - private final String vlan_query_path; - - public static final String TENANT_ID = "tenant.tenant_id"; - public static final String VSERVER_ID = "vserver.vserver_id"; - public static final String INTERFACE_NAME = "l-interface.interface-name"; - public static final String VLAN_INTERFACE = "vlan.vlan-interface"; - - public VServerVLanRequest() { - vlan_path = configProperties.getProperty(VLAN_PATH); - vlan_query_path = configProperties.getProperty(VLAN_QUERY_PATH); - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = target_uri+vlan_path; - String encoded_vnf = encodeQuery(requestProperties.getProperty(TENANT_ID)); - request_url = request_url.replace("{tenant-id}", encoded_vnf) ; - - encoded_vnf = encodeQuery(requestProperties.getProperty(VSERVER_ID)); - request_url = request_url.replace("{vserver-id}", encoded_vnf) ; - - encoded_vnf = encodeQuery(requestProperties.getProperty(INTERFACE_NAME)); - request_url = request_url.replace("{interface-name}", encoded_vnf) ; - - encoded_vnf = encodeQuery(requestProperties.getProperty(VLAN_INTERFACE)); - request_url = request_url.replace("{vlan-interface}", encoded_vnf) ; - - if(requestProperties.containsKey(CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER)) { - request_url = CloudRegionRequest.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()); - aaiService.LOGwriteDateTrace("tenant-id", requestProperties.getProperty(TENANT_ID)); - aaiService.LOGwriteDateTrace("vserver-id", requestProperties.getProperty(VSERVER_ID)); - aaiService.LOGwriteDateTrace("interface-name", requestProperties.getProperty(INTERFACE_NAME)); - aaiService.LOGwriteDateTrace("vlan-interface", requestProperties.getProperty(VLAN_INTERFACE)); - - return http_req_url; - } - - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = target_uri+vlan_path; - String encoded_vnf = encodeQuery(requestProperties.getProperty(TENANT_ID)); - request_url = request_url.replace("{tenant-id}", encoded_vnf) ; - - encoded_vnf = encodeQuery(requestProperties.getProperty(VSERVER_ID)); - request_url = request_url.replace("{vserver-id}", encoded_vnf) ; - - encoded_vnf = encodeQuery(requestProperties.getProperty(INTERFACE_NAME)); - request_url = request_url.replace("{interface-name}", encoded_vnf) ; - - encoded_vnf = encodeQuery(requestProperties.getProperty(VLAN_INTERFACE)); - request_url = request_url.replace("{vlan-interface}", encoded_vnf) ; - - if(requestProperties.containsKey(CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER)) { - request_url = CloudRegionRequest.processPathData(request_url, requestProperties); - } - - URL http_req_url = new URL(request_url); - - aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); - aaiService.LOGwriteDateTrace("tenant-id", requestProperties.getProperty(TENANT_ID)); - aaiService.LOGwriteDateTrace("vserver-id", requestProperties.getProperty(VSERVER_ID)); - aaiService.LOGwriteDateTrace("interface-name", requestProperties.getProperty(INTERFACE_NAME)); - aaiService.LOGwriteDateTrace("vlan-interface", requestProperties.getProperty(VLAN_INTERFACE)); - - return http_req_url; - } - - - @Override - public String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - Vlan tenant = (Vlan)requestDatum; - String json_text = null; - try { - json_text = mapper.writeValueAsString(tenant); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - - @Override - public String[] getArgsList() { - String[] args = {TENANT_ID, VSERVER_ID, INTERFACE_NAME, VLAN_INTERFACE, CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER, CloudRegionRequest.CLOUD_REGION_CLOUD_REGION_ID}; - return args; - } - - - @Override - public Class<? extends AAIDatum> getModelClass() { - return Vlan.class; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/VserverRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/VserverRequest.java deleted file mode 100644 index 757034c..0000000 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/VserverRequest.java +++ /dev/null @@ -1,156 +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.openecomp.sdnc.sli.aai; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Arrays; - -import org.openecomp.sdnc.sli.aai.data.AAIDatum; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.openecomp.aai.inventory.v8.Vserver; - -public class VserverRequest extends AAIRequest { - - public static final String VSERVER_PATH = "org.openecomp.sdnc.sli.aai.path.vserver"; - public static final String VSERVER_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.vserver.query"; - - private final String vserver_path; - private final String vserver_query_path; - - public static final String VSERVER_ID = "vserver_id"; - public static final String VSERVER_VSERVER_ID = "vserver.vserver_id"; - - public static final String TENANT_ID = "tenant_id"; - public static final String TENANT_TENANT_ID = "tenant.tenant_id"; - - - public static final String VSERVER_NAME = "vserver_name"; - - public VserverRequest() { - vserver_path = configProperties.getProperty(VSERVER_PATH); - vserver_query_path = configProperties.getProperty(VSERVER_QUERY_PATH); - } - - - @Override - public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException { - - String request_url = target_uri+vserver_path; - LOG.debug(Arrays.toString(requestProperties.entrySet().toArray())); - - String encoded_vnf = null; - if(requestProperties.containsKey(VSERVER_ID)) { - encoded_vnf = encodeQuery(requestProperties.getProperty(VSERVER_ID)); - request_url = request_url.replace("{vserver-id}", encoded_vnf) ; - aaiService.LOGwriteDateTrace(VSERVER_ID, requestProperties.getProperty(VSERVER_ID)); - } - else if(requestProperties.containsKey(VSERVER_VSERVER_ID)) { - encoded_vnf = encodeQuery(requestProperties.getProperty(VSERVER_VSERVER_ID)); - request_url = request_url.replace("{vserver-id}", encoded_vnf) ; - aaiService.LOGwriteDateTrace(VSERVER_ID, requestProperties.getProperty(VSERVER_VSERVER_ID)); - } - - - if(requestProperties.containsKey(TENANT_ID)) { - encoded_vnf = encodeQuery(requestProperties.getProperty(TENANT_ID)); - request_url = request_url.replace("{tenant-id}", encoded_vnf) ; - aaiService.LOGwriteDateTrace(TENANT_ID, requestProperties.getProperty(TENANT_ID)); - } - else if(requestProperties.containsKey(TENANT_TENANT_ID)) { - encoded_vnf = encodeQuery(requestProperties.getProperty(TENANT_TENANT_ID)); - request_url = request_url.replace("{tenant-id}", encoded_vnf) ; - aaiService.LOGwriteDateTrace(TENANT_ID, requestProperties.getProperty(TENANT_TENANT_ID)); - } - - if(requestProperties.containsKey(CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER)) { - request_url = CloudRegionRequest.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 this.getRequestUrl(method, null); - } - - - @Override - public String toJSONString() { - ObjectMapper mapper = getObjectMapper(); - Vserver vnfc = (Vserver)requestDatum; - String json_text = null; - try { - json_text = mapper.writeValueAsString(vnfc); - } catch (JsonProcessingException exc) { - handleException(this, exc); - return null; - } - return json_text; - } - - @Override - public String[] getArgsList() { - String[] args = {VSERVER_ID, VSERVER_VSERVER_ID, VSERVER_NAME, TENANT_ID, TENANT_TENANT_ID, CloudRegionRequest.CLOUD_REGION_CLOUD_OWNER, CloudRegionRequest.CLOUD_REGION_CLOUD_REGION_ID}; - return args; - } - - @Override - public Class<? extends AAIDatum> getModelClass() { - return Vserver.class; - } - - @Override - public String formatKey(String argument) { - switch(argument) { - case "tenant-id": - return "tenant.tenant-id"; - case "vserver-id": - return "vserver.vserver-id"; - case "vserver-name": - return "vserver.vserver-name"; -// case "cloud-region-id": -// return "cloud-region.cloud-region-id"; -// case "cloud-owner": -// return "cloud-region.cloud-owner"; - default: - return argument; - } - } - - public String getPrimaryResourceName(String resource) { - return "vserver"; - } -} diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/SubInterface.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/SubInterface.java index 03f638a..872c5f8 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/SubInterface.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/SubInterface.java @@ -31,8 +31,8 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import org.openecomp.aai.inventory.v8.RelationshipList; -import org.openecomp.aai.inventory.v8.Vlans; +import org.openecomp.aai.inventory.v10.RelationshipList; +import org.openecomp.aai.inventory.v10.Vlans; @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/InstanceFilter.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/InstanceFilter.java index 5e2eb78..26c6157 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/InstanceFilter.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/InstanceFilter.java @@ -33,14 +33,15 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import org.openecomp.aai.inventory.v8.LogicalLink; -import org.openecomp.aai.inventory.v8.Pnf; +import org.openecomp.aai.inventory.v10.*; @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @JsonPropertyOrder({ "logical-link", - "pnf" + "pnf", + "l3-network", + "service-instance" }) public class InstanceFilter { @@ -48,11 +49,16 @@ public class InstanceFilter { private LogicalLink logicalLink; @JsonProperty("pnf") private Pnf pnf; + @JsonProperty("l3-network") + private L3Network l3Network; + @JsonProperty("service-instance") + private ServiceInstance serviceInstance; + @JsonIgnore private Map<String, Object> additionalProperties = new HashMap<String, Object>(); /** - * + * * @return * The logicalLink */ @@ -62,7 +68,7 @@ public class InstanceFilter { } /** - * + * * @param logicalLink * The logical-link */ @@ -72,7 +78,7 @@ public class InstanceFilter { } /** - * + * * @return * The pnf */ @@ -82,7 +88,7 @@ public class InstanceFilter { } /** - * + * * @param pnf * The pnf */ @@ -91,6 +97,16 @@ public class InstanceFilter { this.pnf = pnf; } + @JsonProperty("l3-network") + public L3Network getL3Network() { + return l3Network; + } + + @JsonProperty("l3-network") + public void setL3Network(L3Network l3Network) { + this.l3Network = l3Network; + } + @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; @@ -101,4 +117,14 @@ public class InstanceFilter { this.additionalProperties.put(name, value); } + @JsonProperty("service-instance") + public ServiceInstance getServiceInstance() { + return serviceInstance; + } + + @JsonProperty("service-instance") + public void setServiceInstance(ServiceInstance serviceInstance) { + this.serviceInstance = serviceInstance; + } + } diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQueryData.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQueryData.java index f136198..6d09a2d 100644 --- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQueryData.java +++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/NamedQueryData.java @@ -26,7 +26,6 @@ import java.util.Map; import javax.annotation.Generated; import org.openecomp.sdnc.sli.aai.data.AAIDatum; - import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; |