diff options
author | Dan Timoney <dtimoney@att.com> | 2017-04-21 16:14:18 -0400 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2017-04-21 16:14:18 -0400 |
commit | 328d71305e529887d78bec5d028d54feaea737c1 (patch) | |
tree | 9c571511c9c7f402a84cac82cc41cee9f4e091cc /aai-service/provider/src/main/java | |
parent | ec0f99bdd24468c1f662d6fcf6e2ca29b678da73 (diff) |
[SDNC-5] Rebase SDN-C adaptors
Apply latest bug fixes, enhancements and port to OpenDaylight Boron.
Change-Id: Ia7d29986eb12f98edbf075dae3cc9343af6791b6
Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'aai-service/provider/src/main/java')
13 files changed, 948 insertions, 90 deletions
diff --git a/aai-service/provider/src/main/java/META-INF/sun-jaxb.episode b/aai-service/provider/src/main/java/META-INF/sun-jaxb.episode index ee1594e..f14c7d4 100755 --- a/aai-service/provider/src/main/java/META-INF/sun-jaxb.episode +++ b/aai-service/provider/src/main/java/META-INF/sun-jaxb.episode @@ -5,7 +5,7 @@ This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> Any modifications to this file will be lost upon recompilation of the source schema. -Generated on: 2017.04.05 at 11:36:07 AM GMT +Generated on: 2017.02.21 at 07:59:51 PM EST --> <bindings xmlns:tns="http://org.openecomp.aai.inventory/v8" if-exists="true" scd="x-schema::tns"> 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 05c4185..602fdb5 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 @@ -39,12 +39,26 @@ import org.openecomp.aai.inventory.v10.*; public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin { + // Availability Zone + public SdnZoneResponse requestSdnZoneQuery(String service_type, String vnf_type, String physical_location) throws AAIServiceException; + + // VCE + public boolean postNetworkVceData(String vnf_id, Vce request) throws AAIServiceException; + public Vce requestNetworkVceData(String vnf_id) throws AAIServiceException; + public boolean deleteNetworkVceData(String vnf_id, String resourceVersion) throws AAIServiceException; + // Service Inteface public ServiceInstance requestServiceInterfaceData(String svc_instance_id) throws AAIServiceException; public ServiceInstance requestServiceInterfaceData(String customer_id, String service_type, String svc_instance_id) throws AAIServiceException; public boolean postServiceInterfaceData(String customer_id, String service_type, String svc_instance_id, ServiceInstance request) throws AAIServiceException; public SearchResults requestServiceInstanceURL(String svc_instance_id) throws AAIServiceException; + // VPE +// public Vpes requestNetworkVpeList() throws AAIServiceException; + public Vpe requestNetworkVpeData(String vnf_id) throws AAIServiceException; + public boolean postNetworkVpeData(String vnf_id, Vpe request) throws AAIServiceException; + public boolean deleteNetworkVpeData(String vnf_id, String resourceVersion) throws AAIServiceException; + // VServers public Vserver requestVServerData(String tenant_id, String vserver_id, String cloudOwner, String cloudRegionId) throws AAIServiceException; public boolean postVServerData(String tenantId, String vserverId, String cloudOwner, String cloudRegionId, Vserver request) throws AAIServiceException; @@ -57,14 +71,41 @@ public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin { public String getVServerIdFromVserverUrl(URL url, String tennantId); public Vserver requestVServerDataByURL(URL url) throws AAIServiceException; + // VPLS-PE + public VplsPe requestNetworkVplsPeData(String equipment_name) throws AAIServiceException; + public boolean postNetworkVplsPeData(String vnf_id, VplsPe request) throws AAIServiceException; + public boolean deleteNetworkVplsPeData(String vnf_id, String resourceVersion) throws AAIServiceException; + + + // Complexes + public Complex requestNetworkComplexData(String vnf_id) throws AAIServiceException; + public boolean postNetworkComplexData(String vnf_id, Complex request) throws AAIServiceException; + public boolean deleteNetworkComplexData(String vnf_id, String resourceVersion) throws AAIServiceException; + + // CTag Pool + public CtagPool requestCtagPoolData(String physical_location_id, String target_pe, String availability_zone_name) throws AAIServiceException; + // --------------------------------- 1507 --------------------------- // Data Change public VServer dataChangeRequestVServerData(URL url) throws AAIServiceException; + public CtagPool dataChangeRequestCtagPoolData(URL url) throws AAIServiceException; + + public VplsPe dataChangeRequestVplsPeData(URL url) throws AAIServiceException; + + public Vpe dataChangeRequestVpeData(URL url) throws AAIServiceException; + + public DvsSwitch dataChangeRequestDvsSwitchData(URL url) throws AAIServiceException; + public Pserver dataChangeRequestPServerData(URL url) throws AAIServiceException; + //OAM-Network: + public OamNetwork dataChangeRequestOAMNetworkData(URL url) throws AAIServiceException; //Availability-Zone: public AvailabilityZone dataChangeRequestAvailabilityZoneData(URL url) throws AAIServiceException; + //Complex: + public Complex dataChangeRequestComplexData(URL url) throws AAIServiceException; + /* DELETE */ public boolean dataChangeDeleteVServerData(URL url) throws AAIServiceException; @@ -89,6 +130,11 @@ public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin { public boolean postGenericVnfData(String vnf_id, GenericVnf request) throws AAIServiceException; public boolean deleteGenericVnfData(String vnf_id, String resourceVersion) throws AAIServiceException; + // DvsSwitch + public DvsSwitch requestDvsSwitchData(String vnf_id) throws AAIServiceException; + public boolean postDvsSwitchData(String vnf_id, DvsSwitch request) throws AAIServiceException; + public boolean deleteDvsSwitchData(String vnf_id, String resourceVersion) throws AAIServiceException; + // PInterface public PInterface requestPInterfaceData(String hostname, String interfaceName) throws AAIServiceException; public boolean postPInterfaceData(String hostname, String interfaceName, PInterface request) throws AAIServiceException; @@ -99,15 +145,36 @@ public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin { public boolean postPhysicalLinkData(String vnf_id, PhysicalLink request) throws AAIServiceException; public boolean deletePhysicalLinkData(String vnf_id, String resourceVersion) throws AAIServiceException; + // PServers + public Pserver requestPServerData(String hostname) throws AAIServiceException; + public boolean postPServerData(String hostname, Pserver server) throws AAIServiceException; + public boolean deletePServerData(String hostname, String resourceVersion) throws AAIServiceException; + // L3Networks public L3Network requestL3NetworkData(String networkId) throws AAIServiceException; public L3Network requestL3NetworkQueryByName(String networkId) throws AAIServiceException; public boolean postL3NetworkData(String networkId, L3Network request) throws AAIServiceException; public boolean deleteL3NetworkData(String networkId, String resourceVersion) throws AAIServiceException; + // Vpn Bindings + public VpnBinding requestVpnBindingData(String vpnId) throws AAIServiceException; +// public boolean postVpnBindingData(String vpnId, VpnBinding request) throws AAIServiceException; + public boolean deleteVpnBindingData(String vpnId, String resourceVersion) throws AAIServiceException; + + //VnfImage + public VnfImage requestVnfImageData(String vpnId) throws AAIServiceException; + public VnfImage requestVnfImageDataByVendorModel(String vendor, String model) throws AAIServiceException; + public VnfImage requestVnfImageDataByVendorModelVersion(String vendor, String model, String version) throws AAIServiceException; + // UBB Notify public boolean sendNotify(NotifyEvent event, String serviceInstanceId, String pathCode) throws AAIServiceException; + // 1512 + // Site Pair Site + public SitePairSet requestSitePairSetData(String sitePairSetId) throws AAIServiceException; + public boolean postSitePairSetData(String sitePairSetId, SitePairSet request) throws AAIServiceException; + public boolean deleteSitePairSetData(String sitePairSetId, String resourceVersion) throws AAIServiceException; + // Services public Service requestServiceData(String serviceId) throws AAIServiceException; public boolean postServiceData(String serviceId, Service request) throws AAIServiceException; @@ -116,12 +183,15 @@ public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin { // Node Query - 1602 public SearchResults requestNodeQuery(String type, String entityIdentifier, String entityName) throws AAIServiceException; public String requestDataByURL(URL url) throws AAIServiceException; +// public Object requestDataInstanceNodeQuery(String type, String vnf_name) throws AAIServiceException; public GenericVnf requestGenericVnfeNodeQuery(String vnf_name) throws AAIServiceException; // // tenant public Tenant requestTenantData(String tenant_id, String cloudOwner, String cloudRegionId) throws AAIServiceException; public Tenant requestTenantDataByName(String tenant_name, String cloudOwner, String cloudRegionId) throws AAIServiceException; public boolean postTenantData(String tenant_id, String cloudOwner, String cloudRegionId, Tenant request) throws AAIServiceException; +// public boolean deleteGenericVnfData(String vnf_id, String resourceVersion) throws AAIServiceException; + public QueryStatus backup(Map<String, String> params, SvcLogicContext ctx) throws SvcLogicException; public QueryStatus restore(Map<String, String> params, SvcLogicContext ctx) throws SvcLogicException; 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 1157fb2..8798556 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 @@ -275,8 +275,8 @@ public abstract class AAIDeclarations implements AAIClient { } tenantId = getTenantIdFromVserverUrl(vserverUrl); - String cloudOwner = nameValues.get("cloud_region.cloud_owner"); - String cloudRegionId = nameValues.get("cloud_region.cloud_region_id"); + String cloudOwner = getCloudOwnerFromVserverUrl(vserverUrl); + String cloudRegionId = getCloudRegionFromVserverUrl(vserverUrl); Vserver vserver = null; try { @@ -306,10 +306,7 @@ public abstract class AAIDeclarations implements AAIClient { attributes.put("cloud-region-id", cloudRegionId); } } else if (vserverId != null && tenantId != null) { - String cloudOwner = nameValues.get("cloud_region.cloud_owner"); - String cloudRegionId = nameValues.get("cloud_region.cloud_region_id"); - - Vserver vserver = this.requestVServerData(tenantId, vserverId, cloudOwner, cloudRegionId); + Vserver vserver = this.requestVServerData(tenantId, vserverId, "att-aic", "AAIAIC25"); if(vserver == null) { return QueryStatus.NOT_FOUND; } 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 9dadd00..fe3317d 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 @@ -383,6 +383,68 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe return con; } + /* (non-Javadoc) + * @see org.openecomp.sdnc.sli.resource.aic.AnAIClient#requestSdnZoneQuery(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public SdnZoneResponse requestSdnZoneQuery(String service_type, String vnf_type, String physical_location) throws AAIServiceException { + SdnZoneResponse response = null; + InputStream inputStream = null; + + try { + URL http_req_url = getRequestURL(service_type, vnf_type, physical_location); + + HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET); + + LOGwriteFirstTrace(HttpMethod.GET, http_req_url.toString()); + LOGwriteDateTrace("service_type", service_type); + LOGwriteDateTrace("vnf_type", vnf_type); + LOGwriteDateTrace("physical_location", physical_location); + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + + // Process the response + LOG.debug("HttpURLConnection result:" + responseCode); + if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); + BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); + + ObjectMapper mapper = getObjectMapper(); + + if (responseCode == HttpURLConnection.HTTP_OK) { + response = mapper.readValue(reader, SdnZoneResponse.class); + LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response)); + } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { + LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); + return response; + } else { + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); + throw new AAIServiceException(responseCode, errorresponse); + } + + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestServiceInterfaceData", exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + + } + } + } + return response; + } + @Override public GenericVnf requestGenericVnfData(String vnf_id) throws AAIServiceException { GenericVnf response = null; @@ -441,6 +503,73 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe return response; } + /* (non-Javadoc) + * @see org.openecomp.sdnc.sli.resource.aic.AnAIClient#requestSdnZoneQuery(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public Vce requestNetworkVceData(String vnf_id) throws AAIServiceException { + Vce response = null; + try { + AAIRequest request = AAIRequest.getRequestFromResource("vce"); + request.addRequestProperty("vce.vnf-id", vnf_id); + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, Vce.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc); + throw new AAIServiceException(exc); + } + + return response; + } + + + /* (non-Javadoc) + * @see org.openecomp.sdnc.sli.resource.aic.AnAIClient#requestSdnZoneQuery(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public boolean deleteNetworkVceData(String vnf_id, String resourceVersion) throws AAIServiceException { + boolean response = false; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("vce"); + request.addRequestProperty("vce.vnf-id", vnf_id); + response = executor.delete(request, resourceVersion); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("deleteNetworkVceData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + /* (non-Javadoc) + * @see org.openecomp.sdnc.sli.resource.aic.AnAIClient#postNetworkVceData(java.lang.String, org.openecomp.sdnc.sli.resource.aic.aai.VCERequest) + */ + @Override + public boolean postNetworkVceData(String vnf_id, Vce data) throws AAIServiceException { + boolean response = false; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("vce"); + request.addRequestProperty("vce.vnf-id", vnf_id); + request.setRequestObject(data); + response = executor.post(request); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestGenericVnfData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override public SearchResults requestServiceInstanceURL(String svc_instance_id) throws AAIServiceException { SearchResults response = null; @@ -708,7 +837,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe { String encrypted_url = selection; String apnpattern = - "/aai/v2/business/customers/customer/(.+)/service-subscriptions/service-subscription/(.+)/service-instances/service-instance/(.+)/"; + "/aai/v10/business/customers/customer/(.+)/service-subscriptions/service-subscription/(.+)/service-instances/service-instance/(.+)/"; Pattern pattern = Pattern.compile(apnpattern); try { @@ -735,6 +864,188 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe return encrypted_url; } + @Override + public Vpe requestNetworkVpeData(String vnf_id) throws AAIServiceException { + Vpe response = null; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("vpe"); + request.addRequestProperty("vpe.vnf-id", vnf_id); + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, Vpe.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public boolean postNetworkVpeData(String vnf_id, Vpe data) throws AAIServiceException { + boolean response = false; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("vpe"); + request.addRequestProperty("vpe.vnf-id", vnf_id); + request.setRequestObject(data); + response = executor.post(request); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc); + throw new AAIServiceException(exc); + } + + return response; + } + + @Override + public boolean deleteNetworkVpeData(String vnf_id, String resourceVersion) throws AAIServiceException { + boolean response = false; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("vpe"); + request.addRequestProperty("vpe.vnf-id", vnf_id); + response = executor.delete(request, resourceVersion); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public VplsPe requestNetworkVplsPeData(String equipment_name)throws AAIServiceException { + VplsPe response = null; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("vpls-pe"); + request.addRequestProperty("vpls-pe.equipment-name", equipment_name); + + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, VplsPe.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public boolean postNetworkVplsPeData(String equipment_name, VplsPe data) throws AAIServiceException { + boolean response = false; + try { + AAIRequest request = AAIRequest.getRequestFromResource("vpls-pe"); + request.addRequestProperty("vpls-pe.equipment-name", equipment_name); + request.setRequestObject(data); + response = executor.post(request); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestGenericVnfData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public boolean deleteNetworkVplsPeData(String vnf_id, String resourceVersion) throws AAIServiceException { + boolean response = false; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("vpls-pe"); + request.addRequestProperty("vpls-pe.equipment-name", vnf_id); + response = executor.delete(request, resourceVersion); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("deleteNetworkVplsPeData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public Complex requestNetworkComplexData(String pLocId) throws AAIServiceException { + Complex response = null; + InputStream inputStream = null; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("complex"); + request.addRequestProperty("complex.physical-location-id", pLocId); + + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, Complex.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestNetworkComplexData", exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + + } + } + } + return response; + } + + @Override + public boolean postNetworkComplexData(String vnf_id, Complex data) throws AAIServiceException { + boolean response = false; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("complex"); + request.addRequestProperty("complex.physical-location-id", vnf_id); + request.setRequestObject(data); + response = executor.post(request); + + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("postNetworkComplexData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public boolean deleteNetworkComplexData(String pLocId, String resourceVersion) throws AAIServiceException { + boolean response = false; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("complex"); + request.addRequestProperty("complex.physical-location-id", pLocId); + + response = executor.delete(request, resourceVersion); + + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("deleteNetworkComplexData", exc); + throw new AAIServiceException(exc); + } + return response; + } + /* * (non-Javadoc) * @see org.openecomp.sdnct.sli.aai.AAIClient#requestVServersData(java.lang.String, java.lang.String) @@ -862,6 +1173,101 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe } + /* + * (non-Javadoc) + * @see org.openecomp.sdnc.sli.aai.AAIClient#requestCtagPoolData(String) + */ + @Override + public CtagPool requestCtagPoolData(String physical_location_id, String target_pe, String availability_zone_name) throws AAIServiceException { + CtagPool response = null; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("ctag-pool"); + + request.addRequestProperty("ctag-pool.target-pe", target_pe); + request.addRequestProperty("ctag-pool.availability-zone-name", availability_zone_name); + request.addRequestProperty("complex.physical-location-id", physical_location_id); + + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, CtagPool.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestNetworkVceData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + //==================== DvsSwitch ====================== + @Override + public DvsSwitch requestDvsSwitchData(String vnf_id) throws AAIServiceException { + DvsSwitch response = null; + InputStream inputStream = null; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("dvs-switch"); + request.addRequestProperty("dvs-switch.switch-name", vnf_id); + + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, DvsSwitch.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestDvsSwitchData", exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + + } + } + } + return response; + } + + @Override + public boolean postDvsSwitchData(String switch_name, DvsSwitch data) throws AAIServiceException { + boolean response = false; + try { + AAIRequest request = AAIRequest.getRequestFromResource("dvs-switch"); + request.addRequestProperty("dvs-switch.switch-name", switch_name); + request.setRequestObject(data); + response = executor.post(request); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public boolean deleteDvsSwitchData(String vnf_id, String resourceVersion) throws AAIServiceException { + boolean response = false; + InputStream inputStream = null; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("dvs-switch"); + request.addRequestProperty("dvs-switch.switch-name", vnf_id); + response = executor.delete(request, resourceVersion); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("deleteDvsSwitchData", exc); + throw new AAIServiceException(exc); + } + return response; + } //================== End of DvsSwitch ================= //==================== PhysicalLink ====================== @Override @@ -1033,6 +1439,116 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe } return response; } + //================== End of PInterface ================= + //==================== SitePairSet ====================== + @Override + public SitePairSet requestSitePairSetData(String sitePairSetId) throws AAIServiceException { + SitePairSet response = null; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("site-pair-set"); + request.addRequestProperty("site-pair-set.site-pair-set-id", sitePairSetId); + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, SitePairSet.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public boolean postSitePairSetData(String linkName, SitePairSet request) throws AAIServiceException { + InputStream inputStream = null; + + try { + + ObjectMapper mapper = getObjectMapper(); + String json_text = mapper.writeValueAsString(request); + + SSLSocketFactory sockFact = CTX.getSocketFactory(); + + String request_url = target_uri+site_pair_set_path; + String encoded_vnf = encodeQuery(linkName); + request_url = request_url.replace("{site-pair-set-id}", encoded_vnf) ; + URL http_req_url = new URL(request_url); + + HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.PUT); + + OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream()); + osw.write(json_text); + osw.flush(); + osw.close(); + + + LOGwriteFirstTrace("PUT", request_url); + LOGwriteDateTrace("link-name", linkName); + LOGwriteDateTrace("SitePairSet", json_text); + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + + // Process the response + BufferedReader reader; + String line = null; + reader = new BufferedReader( new InputStreamReader( inputStream ) ); + + if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) { + StringBuilder stringBuilder = new StringBuilder(); + + while( ( line = reader.readLine() ) != null ) { + stringBuilder.append( line ); + } + LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder != null) ? stringBuilder.toString() : "{no-data}"); + return true; + } else { + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); + + throw new AAIServiceException(responseCode, errorresponse); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("postSitePairSetData", exc); + throw new AAIServiceException(exc); + } finally { + try { + if(inputStream != null) + inputStream.close(); + } catch (Exception exc) { + + } + } + } + + @Override + public boolean deleteSitePairSetData(String linkName, String resourceVersion) throws AAIServiceException { + boolean response = false; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("site-pair-set"); + request.addRequestProperty("site-pair-set.site-pair-set-id", linkName); + response = executor.delete(request, resourceVersion); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("deleteSitePairSetData", exc); + throw new AAIServiceException(exc); + } + + return response; + } //================== End of SitePairSet ================= //==================== Service ====================== @Override @@ -1172,6 +1688,56 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe } @Override + public CtagPool dataChangeRequestCtagPoolData(URL url) throws AAIServiceException { + + if(url == null) { + throw new NullPointerException(); + } + + return this.getResource(url.toString(), CtagPool.class); + } + + @Override + public VplsPe dataChangeRequestVplsPeData(URL url) throws AAIServiceException { + + if(url == null) { + throw new NullPointerException(); + } + + return this.getResource(url.toString(), VplsPe.class); + } + + @Override + public Vpe dataChangeRequestVpeData(URL url) throws AAIServiceException { + + if(url == null) { + throw new NullPointerException(); + } + + return this.getResource(url.toString(), Vpe.class); + } + + @Override + public DvsSwitch dataChangeRequestDvsSwitchData(URL url) throws AAIServiceException { + + if(url == null) { + throw new NullPointerException(); + } + + return this.getResource(url.toString(), DvsSwitch.class); + } + + @Override + public OamNetwork dataChangeRequestOAMNetworkData(URL url) throws AAIServiceException { + + if(url == null) { + throw new NullPointerException(); + } + + return this.getResource(url.toString(), OamNetwork.class); + } + + @Override public AvailabilityZone dataChangeRequestAvailabilityZoneData(URL url) throws AAIServiceException { if(url == null) { @@ -1181,6 +1747,16 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe return this.getResource(url.toString(), AvailabilityZone.class); } + @Override + public Complex dataChangeRequestComplexData(URL url) throws AAIServiceException { + + if(url == null) { + throw new NullPointerException(); + } + + return this.getResource(url.toString(), Complex.class); + } + /* DELETE */ public boolean dataChangeDeleteVServerData(URL url) throws AAIServiceException { @@ -1360,6 +1936,66 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe } @Override + public Pserver requestPServerData(String hostname) throws AAIServiceException { + Pserver response = null; + InputStream inputStream = null; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("pserver"); + request.addRequestProperty("pserver.hostname", hostname); + + + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, Pserver.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestPServerData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public boolean postPServerData(String hostname, Pserver data) throws AAIServiceException { + boolean response = false; + try { + AAIRequest request = AAIRequest.getRequestFromResource("pserver"); + request.addRequestProperty("pserver.hostname", hostname); + request.setRequestObject(data); + response = executor.post(request); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public boolean deletePServerData(String hostname, String resourceVersion) throws AAIServiceException { + boolean response = false; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("pserver"); + request.addRequestProperty("pserver.hostname", hostname); + response = executor.delete(request, resourceVersion); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("deletePServerData", exc); + throw new AAIServiceException(exc); + } + + return response; + } + + + @Override public L3Network requestL3NetworkData(String networkId) throws AAIServiceException { L3Network response = null; InputStream inputStream = null; @@ -1450,6 +2086,157 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe } + @Override + public VpnBinding requestVpnBindingData(String vpnId) throws AAIServiceException { + VpnBinding response = null; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("vpn-binding"); + request.addRequestProperty("vpn-binding.vpn-id", vpnId); + + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, VpnBinding.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestVpnBindingData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public boolean deleteVpnBindingData(String vpnId, String resourceVersion) throws AAIServiceException { + boolean response = false; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("vpn-binding"); + request.addRequestProperty("vpn-binding.vpn-id", vpnId); + response = executor.delete(request, resourceVersion); + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("deleteVpnBindingData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + + @Override + public VnfImage requestVnfImageData(String att_uuid) throws AAIServiceException { + VnfImage response = null; + + try { + AAIRequest request = AAIRequest.getRequestFromResource("vnf-image"); + request.addRequestProperty("vnf-image.att-uuid", att_uuid); + + String rv = executor.get(request); + if(rv != null) { + ObjectMapper mapper = getObjectMapper(); + response = mapper.readValue(rv, VnfImage.class); + } + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestVnfImageData", exc); + throw new AAIServiceException(exc); + } + return response; + } + + @Override + public VnfImage requestVnfImageDataByVendorModel(String vendor, String model) throws AAIServiceException { + return requestVnfImageDataByVendorModelVersion(vendor, model, null); + } + + @Override + public VnfImage requestVnfImageDataByVendorModelVersion(String vendor, String model, String version) throws AAIServiceException + { + List<VnfImage> responseList = new ArrayList<VnfImage>(); + VnfImage response = null; + InputStream inputStream = null; + + try { + String request_url = target_uri+vnf_image_query_path + (version==null? "": "&application-version={application_version}"); + request_url = request_url.replace("{application_vendor}", encodeQuery(vendor)) ; + request_url = request_url.replace("{application_model}", encodeQuery(model)) ; + if(version != null) { + request_url = request_url.replace("{application_version}", encodeQuery(version)) ; + } + URL http_req_url = new URL(request_url); + + HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET); + + LOGwriteFirstTrace(HttpMethod.GET, http_req_url.toString()); + LOGwriteDateTrace("application_vendor", vendor); + LOGwriteDateTrace("application_model", model); + if(version != null) { + LOGwriteDateTrace("application_version", version); + } + + // Check for errors + int responseCode = con.getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_OK) { + inputStream = con.getInputStream(); + } else { + inputStream = con.getErrorStream(); + } + + // Process the response + LOG.debug("HttpURLConnection result:" + responseCode); + if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); + BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) ); + + ObjectMapper mapper = getObjectMapper(); + + if (responseCode == HttpURLConnection.HTTP_OK) { +// StringBuilder stringBuilder = new StringBuilder("\n"); +// String line = null; +// while( ( line = reader.readLine() ) != null ) { +// stringBuilder.append("\n").append( line ); +// } +// LOG.info(stringBuilder.toString()); + response = mapper.readValue(reader, VnfImage.class); + String original_buffer = mapper.writeValueAsString(response); + LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", original_buffer); + if(response.getApplicationVendor() == null /*&& response.getAdditionalProperties() != null && !response.getAdditionalProperties().isEmpty()*/){ + LOG.warn("A List of multiple VNF-IMAGE entries has been returned"); + VnfImages listOfObjects = mapper.readValue(original_buffer, VnfImages.class); + if(!listOfObjects.getVnfImage().isEmpty()) { + response = listOfObjects.getVnfImage().get(0); + } + } + } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) { + LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist."); + return response; + } else { + ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class); + LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse)); + throw new AAIServiceException(responseCode, errorresponse); + } + + } catch(AAIServiceException aaiexc) { + throw aaiexc; + } catch (Exception exc) { + LOG.warn("requestVnfImageData", exc); + throw new AAIServiceException(exc); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch(Exception exc) { + + } + } + } + return response; + } + + public boolean sendNotify(NotifyEvent event, String serviceInstanceId, String pathCode) throws AAIServiceException { InputStream inputStream = null; @@ -2589,6 +3376,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe } private String rewriteKey(String resource, String key, SvcLogicContext ctx) { + LOG.info("AAI Deprecation - the format of request key is no longer supported. Please rewrite this key : " + key); Class<? extends AAIDatum> clazz = null; try { 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 eed22f7..89c876d 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 @@ -39,9 +39,9 @@ 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"; @@ -54,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 { @@ -80,7 +80,7 @@ public class CloudRegionRequest extends AAIRequest { URL http_req_url = new URL(request_url); aaiService.LOGwriteFirstTrace(method, http_req_url.toString()); - + return http_req_url; } @@ -101,7 +101,7 @@ public class CloudRegionRequest extends AAIRequest { @Override public String[] getArgsList() { - String[] args = + String[] args = { CLOUD_REGION_CLOUD_OWNER, CLOUD_REGION_CLOUD_REGION_ID, @@ -115,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) ; @@ -130,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 a420a06..bb7ebd8 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 @@ -36,9 +36,9 @@ 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/GenericVnfRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/GenericVnfRequest.java index 5d181f3..a8d7381 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 @@ -38,10 +38,10 @@ 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/NodesQueryRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/NodesQueryRequest.java index a50d3f7..d6e2305 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 @@ -36,9 +36,9 @@ 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/PInterfaceRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PInterfaceRequest.java index cc2208b..8a59a85 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 @@ -38,10 +38,10 @@ 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/PhysicalLinkRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/PhysicalLinkRequest.java index b494471..e5d22cd 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 @@ -37,10 +37,10 @@ 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/RelationshipRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/RelationshipRequest.java index d0d0e88..cbf2953 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 @@ -37,10 +37,10 @@ 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/data/SubInterface.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/data/SubInterface.java index 872c5f8..d9d0eb8 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 @@ -59,7 +59,7 @@ public class SubInterface implements AAIDatum { private Map<String, Object> additionalProperties = new HashMap<String, Object>(); /** - * + * * @return * The interfaceName */ @@ -69,7 +69,7 @@ public class SubInterface implements AAIDatum { } /** - * + * * @param interfaceName * The interface-name */ @@ -79,7 +79,7 @@ public class SubInterface implements AAIDatum { } /** - * + * * @return * The interfaceRole */ @@ -89,7 +89,7 @@ public class SubInterface implements AAIDatum { } /** - * + * * @param interfaceRole * The interface-role */ @@ -99,7 +99,7 @@ public class SubInterface implements AAIDatum { } /** - * + * * @return * The resourceVersion */ @@ -109,7 +109,7 @@ public class SubInterface implements AAIDatum { } /** - * + * * @param resourceVersion * The resource-version */ @@ -119,7 +119,7 @@ public class SubInterface implements AAIDatum { } /** - * + * * @return * The vlans */ @@ -129,7 +129,7 @@ public class SubInterface implements AAIDatum { } /** - * + * * @param vlans * The vlans */ @@ -139,7 +139,7 @@ public class SubInterface implements AAIDatum { } /** - * + * * @return * The relationshipList */ @@ -149,7 +149,7 @@ public class SubInterface implements AAIDatum { } /** - * + * * @param relationshipList * The relationshipList */ 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 26c6157..dde605f 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,7 +33,10 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import org.openecomp.aai.inventory.v10.*; +import org.openecomp.aai.inventory.v10.L3Network; +import org.openecomp.aai.inventory.v10.Pnf; +import org.openecomp.aai.inventory.v10.LogicalLink; +import org.openecomp.aai.inventory.v10.ServiceInstance; @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @@ -58,7 +61,7 @@ public class InstanceFilter { private Map<String, Object> additionalProperties = new HashMap<String, Object>(); /** - * + * * @return * The logicalLink */ @@ -68,7 +71,7 @@ public class InstanceFilter { } /** - * + * * @param logicalLink * The logical-link */ @@ -78,7 +81,7 @@ public class InstanceFilter { } /** - * + * * @return * The pnf */ @@ -88,7 +91,7 @@ public class InstanceFilter { } /** - * + * * @param pnf * The pnf */ |