summaryrefslogtreecommitdiffstats
path: root/aai-service/provider/src
diff options
context:
space:
mode:
Diffstat (limited to 'aai-service/provider/src')
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java247
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java3692
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java798
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java5277
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java19
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java631
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java491
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java276
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/FormattedQueryResultList.java17
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFilter.java112
-rwxr-xr-xaai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Result.java217
-rw-r--r--aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Results.java84
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/main/resources/aai-path.properties424
-rwxr-xr-xaai-service/provider/src/main/resources/aai_schema_v11.xsd166
-rwxr-xr-x[-rw-r--r--]aai-service/provider/src/test/resources/aaiclient.properties156
15 files changed, 6546 insertions, 6061 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java
index 604b236e6..37daa0732 100644..100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java
@@ -3,14 +3,14 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * 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.
@@ -41,163 +41,160 @@ import com.fasterxml.jackson.databind.JsonMappingException;
public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin {
- // 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;
+ // VCE
+ public boolean postNetworkVceData(String vnfId, Vce request) throws AAIServiceException;
+ public Vce requestNetworkVceData(String vnfId) throws AAIServiceException;
+ public boolean deleteNetworkVceData(String vnfId, String resourceVersion) throws AAIServiceException;
- // Service Inteface
- 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;
+ // Service Inteface
+ public ServiceInstance requestServiceInterfaceData(String customerId, String serviceType, String svc_instanceId) throws AAIServiceException;
+ public boolean postServiceInterfaceData(String customerId, String serviceType, String svcInstanceId, ServiceInstance request) throws AAIServiceException;
+ public SearchResults requestServiceInstanceURL(String svcInstanceId) 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 tenantId, String vserverId, String cloudOwner, String cloudRegionId) throws AAIServiceException;
+ public boolean postVServerData(String tenantId, String vserverId, String cloudOwner, String cloudRegionId, Vserver request) throws AAIServiceException;
+ public boolean deleteVServerData(String tenantId, String vserverId, String cloudOwner, String cloudRegionId, 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;
- public boolean deleteVServerData(String tenant_id, String vserver_id, String cloudOwner, String cloudRegionId, String resourceVersion) throws AAIServiceException;
+ public URL requestVserverURLNodeQuery(String vserver_name) throws AAIServiceException;
+ public String getTenantIdFromVserverUrl(URL url);
+ public String getCloudOwnerFromVserverUrl(URL url);
+ public String getCloudRegionFromVserverUrl(URL url);
+ public String getVServerIdFromVserverUrl(URL url, String tennantId);
+ public Vserver requestVServerDataByURL(URL url) throws AAIServiceException;
- public URL requestVserverURLNodeQuery(String vserver_name) throws AAIServiceException;
- public String getTenantIdFromVserverUrl(URL url);
- public String getCloudOwnerFromVserverUrl(URL url);
- public String getCloudRegionFromVserverUrl(URL url);
- 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;
+ // VPLS-PE
+ public VplsPe requestNetworkVplsPeData(String equipmentName) throws AAIServiceException;
+ public boolean postNetworkVplsPeData(String vnfId, VplsPe request) throws AAIServiceException;
+ public boolean deleteNetworkVplsPeData(String vnfId, 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;
+ public Complex requestNetworkComplexData(String vnfId) throws AAIServiceException;
+ public boolean postNetworkComplexData(String vnfId, Complex request) throws AAIServiceException;
+ public boolean deleteNetworkComplexData(String vnfId, String resourceVersion) throws AAIServiceException;
- // CTag Pool
- public CtagPool requestCtagPoolData(String physical_location_id, String target_pe, String availability_zone_name) throws AAIServiceException;
+ // CTag Pool
+ public CtagPool requestCtagPoolData(String physicalLocationId, String targetPe, String availabilityZoneName) throws AAIServiceException;
// --------------------------------- 1507 ---------------------------
- // Data Change
- public VServer dataChangeRequestVServerData(URL url) throws AAIServiceException;
+ // Data Change
+ public VServer dataChangeRequestVServerData(URL url) throws AAIServiceException;
+
+ public CtagPool dataChangeRequestCtagPoolData(URL url) throws AAIServiceException;
+
+ public VplsPe dataChangeRequestVplsPeData(URL url) throws AAIServiceException;
- public CtagPool dataChangeRequestCtagPoolData(URL url) throws AAIServiceException;
-
- public VplsPe dataChangeRequestVplsPeData(URL url) throws AAIServiceException;
+ public DvsSwitch dataChangeRequestDvsSwitchData(URL url) throws AAIServiceException;
- public Vpe dataChangeRequestVpeData(URL url) throws AAIServiceException;
+ public Pserver dataChangeRequestPServerData(URL url) throws AAIServiceException;
- public DvsSwitch dataChangeRequestDvsSwitchData(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;
- 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;
+ public boolean dataChangeDeleteCtagPoolData(URL url) throws AAIServiceException;
- /* DELETE */
- public boolean dataChangeDeleteVServerData(URL url) throws AAIServiceException;
+ public boolean dataChangeDeleteVplsPeData(URL url) throws AAIServiceException;
- public boolean dataChangeDeleteCtagPoolData(URL url) throws AAIServiceException;
+ public boolean dataChangeDeleteVpeData(URL url) throws AAIServiceException;
- public boolean dataChangeDeleteVplsPeData(URL url) throws AAIServiceException;
+ public boolean dataChangeDeleteDvsSwitchData(URL url) throws AAIServiceException;
+ //OAM-Network:
+ public boolean dataChangeDeleteOAMNetworkData(URL url) throws AAIServiceException;
+ //Availability-Zone:
+ public boolean dataChangeDeleteAvailabilityZoneData(URL url) throws AAIServiceException;
+ //Complex:
+ public boolean dataChangeDeleteComplexData(URL url) throws AAIServiceException;
- public boolean dataChangeDeleteVpeData(URL url) throws AAIServiceException;
+ // ----------------- Release 1510 ----------------------
+ // // GenericVNF
+ public GenericVnf requestGenericVnfData(String vnfId) throws AAIServiceException;
+ public boolean postGenericVnfData(String vnfId, GenericVnf request) throws AAIServiceException;
+ public boolean deleteGenericVnfData(String vnfId, String resourceVersion) throws AAIServiceException;
- public boolean dataChangeDeleteDvsSwitchData(URL url) throws AAIServiceException;
- //OAM-Network:
- public boolean dataChangeDeleteOAMNetworkData(URL url) throws AAIServiceException;
- //Availability-Zone:
- public boolean dataChangeDeleteAvailabilityZoneData(URL url) throws AAIServiceException;
- //Complex:
- public boolean dataChangeDeleteComplexData(URL url) throws AAIServiceException;
+ // DvsSwitch
+ public DvsSwitch requestDvsSwitchData(String vnfId) throws AAIServiceException;
+ public boolean postDvsSwitchData(String vnfId, DvsSwitch request) throws AAIServiceException;
+ public boolean deleteDvsSwitchData(String vnfId, String resourceVersion) throws AAIServiceException;
- // ----------------- Release 1510 ----------------------
- // // GenericVNF
- public GenericVnf requestGenericVnfData(String vnf_id) throws AAIServiceException;
- public boolean postGenericVnfData(String vnf_id, GenericVnf request) throws AAIServiceException;
- public boolean deleteGenericVnfData(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;
+ public boolean deletePInterfaceData(String hostname, String interfaceName, 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;
+ // Physical Link
+ public PhysicalLink requestPhysicalLinkData(String vnfId) throws AAIServiceException;
+ public boolean postPhysicalLinkData(String vnfId, PhysicalLink request) throws AAIServiceException;
+ public boolean deletePhysicalLinkData(String vnfId, 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;
- public boolean deletePInterfaceData(String hostname, String interfaceName, 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;
- // Physical Link
- public PhysicalLink requestPhysicalLinkData(String vnf_id) throws AAIServiceException;
- public boolean postPhysicalLinkData(String vnf_id, PhysicalLink request) throws AAIServiceException;
- public boolean deletePhysicalLinkData(String vnf_id, 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;
- // 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;
+ // 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;
- // 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;
+ //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;
- // 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;
+ // UBB Notify
+ public boolean sendNotify(NotifyEvent event, String serviceInstanceId, String pathCode) 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;
+ // 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;
- // UBB Notify
- public boolean sendNotify(NotifyEvent event, String serviceInstanceId, String pathCode) throws AAIServiceException;
+ // Services
+ public Service requestServiceData(String serviceId) throws AAIServiceException;
+ public boolean postServiceData(String serviceId, Service request) throws AAIServiceException;
+ public boolean deleteServiceData(String serviceId, String resourceVersion) 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;
+ // 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;
- // Services
- public Service requestServiceData(String serviceId) throws AAIServiceException;
- public boolean postServiceData(String serviceId, Service request) throws AAIServiceException;
- public boolean deleteServiceData(String serviceId, String resourceVersion) 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 vnfId, String resourceVersion) throws AAIServiceException;
- // 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;
+ public void logKeyError(String keys);
+
+ public QueryStatus processResponseData(String rv, String resource, AAIRequest request, String prefix, SvcLogicContext ctx, HashMap<String, String> nameValues, String modifier) throws JsonParseException, JsonMappingException, IOException, AAIServiceException ;
+ public String getPathTemplateForResource(String resoourceName, String join, SvcLogicContext ctx) throws MalformedURLException;
+ public boolean isDeprecatedFormat(String resource, HashMap<String, String> nameValues);
+
+ String query(AAIRequest request) throws AAIServiceException;
+ String save(AAIRequest request) throws AAIServiceException;
+ boolean delete(AAIRequest request, 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;
-
- public void logKeyError(String keys);
-
- public QueryStatus processResponseData(String rv, String resource, AAIRequest request, String prefix, SvcLogicContext ctx, HashMap<String, String> nameValues, String modifier) throws JsonParseException, JsonMappingException, IOException, AAIServiceException ;
- public String getPathTemplateForResource(String resoourceName, String join, SvcLogicContext ctx) throws MalformedURLException;
- public boolean isDeprecatedFormat(String resource, HashMap<String, String> nameValues);
}
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
index 61df17083..04a0c593a 100644..100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
@@ -3,7 +3,7 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,7 +73,7 @@ import org.onap.ccsdk.sli.adaptors.aai.query.InstanceFilters;
import org.onap.ccsdk.sli.adaptors.aai.query.NamedQuery;
import org.onap.ccsdk.sli.adaptors.aai.query.NamedQueryData;
import org.onap.ccsdk.sli.adaptors.aai.query.QueryParameters;
-import org.onap.ccsdk.sli.adaptors.aai.query.Results;
+import org.onap.ccsdk.sli.adaptors.aai.query.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -84,1852 +84,1876 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public abstract class AAIDeclarations implements AAIClient {
- public static final String TRUSTSTORE_PATH = "org.onap.ccsdk.sli.adaptors.aai.ssl.trust";
- public static final String TRUSTSTORE_PSSWD = "org.onap.ccsdk.sli.adaptors.aai.ssl.trust.psswd";
- public static final String KEYSTORE_PATH = "org.onap.ccsdk.sli.adaptors.aai.ssl.key";
- public static final String KEYSTORE_PSSWD = "org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd";
+ public static final String TRUSTSTORE_PATH = "org.onap.ccsdk.sli.adaptors.aai.ssl.trust";
+ public static final String TRUSTSTORE_PSSWD = "org.onap.ccsdk.sli.adaptors.aai.ssl.trust.psswd";
+ public static final String KEYSTORE_PATH = "org.onap.ccsdk.sli.adaptors.aai.ssl.key";
+ public static final String KEYSTORE_PSSWD = "org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd";
- public static final String APPLICATION_ID = "org.onap.ccsdk.sli.adaptors.aai.application";
+ public static final String APPLICATION_ID = "org.onap.ccsdk.sli.adaptors.aai.application";
- public static final String CLIENT_NAME = "org.onap.ccsdk.sli.adaptors.aai.client.name";
- public static final String CLIENT_PWWD = "org.onap.ccsdk.sli.adaptors.aai.client.psswd";
+ public static final String CLIENT_NAME = "org.onap.ccsdk.sli.adaptors.aai.client.name";
+ public static final String CLIENT_PWWD = "org.onap.ccsdk.sli.adaptors.aai.client.psswd";
- public static final String CONNECTION_TIMEOUT = "connection.timeout";
- public static final String READ_TIMEOUT = "read.timeout";
+ public static final String CONNECTION_TIMEOUT = "connection.timeout";
+ public static final String READ_TIMEOUT = "read.timeout";
- public static final String TARGET_URI = "org.onap.ccsdk.sli.adaptors.aai.uri";
+ public static final String TARGET_URI = "org.onap.ccsdk.sli.adaptors.aai.uri";
- // Availability zones query
- public static final String QUERY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.query";
+ // Availability zones query
+ public static final String QUERY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.query";
- // Update
- public static final String UPDATE_PATH = "org.onap.ccsdk.sli.adaptors.aai.update";
+ // Update
+ public static final String UPDATE_PATH = "org.onap.ccsdk.sli.adaptors.aai.update";
- // Service instance
- public static final String SVC_INSTANCE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.svcinst";
- public static final String SVC_INST_QRY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.svcinst.query";
+ // Service instance
+ public static final String SVC_INSTANCE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.svcinst";
+ public static final String SVC_INST_QRY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.svcinst.query";
- // VServer
- public static final String NETWORK_VSERVER_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.vserver";
+ // VServer
+ public static final String NETWORK_VSERVER_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.vserver";
- public static final String VNF_IMAGE_QUERY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query";
+ public static final String VNF_IMAGE_QUERY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query";
- public static final String PARAM_SERVICE_TYPE = "org.onap.ccsdk.sli.adaptors.aai.param.service.type";
- public static final String CERTIFICATE_HOST_ERROR = "org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore";
+ public static final String PARAM_SERVICE_TYPE = "org.onap.ccsdk.sli.adaptors.aai.param.service.type";
+ public static final String CERTIFICATE_HOST_ERROR = "org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore";
- // UBB Notify
- public static final String UBB_NOTIFY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.notify";
- public static final String SELFLINK_AVPN = "org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn";
- public static final String SELFLINK_FQDN = "org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn";
+ // UBB Notify
+ public static final String UBB_NOTIFY_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.notify";
+ public static final String SELFLINK_AVPN = "org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn";
+ public static final String SELFLINK_FQDN = "org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn";
- //Service
- public static final String SERVICE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.service";
+ //Service
+ public static final String SERVICE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.service";
- // P-Interfaces
- public static final String P_INTERFACE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterface";
+ // P-Interfaces
+ public static final String P_INTERFACE_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterface";
- // site-pair-sets
- public static final String SITE_PAIR_SET_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.site.pair.set";
+ // site-pair-sets
+ public static final String SITE_PAIR_SET_PATH = "org.onap.ccsdk.sli.adaptors.aai.path.site.pair.set";
- // node query (1602)
- public static final String QUERY_NODES_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.nodes";
-
-
- protected abstract Logger getLogger();
- public abstract AAIRequestExecutor getExecutor();
-
-
- @Override
- public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx)
- throws SvcLogicException {
-
- getLogger().debug("AAIService.query \tresource = "+resource);
-
- String vnfId;
- String vnfName = null;
- HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
- getLogger().debug("key = "+ nameValues.toString());
-
- if(!AAIServiceUtils.isValidFormat(resource, nameValues)) {
- ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource));
- return QueryStatus.FAILURE;
- }
-
- if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) {
- ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource));
- return QueryStatus.FAILURE;
- }
-
- // process data using new model
- boolean useNewModelProcessing = true;
- // process server query by name the old way
- if("vserver".equals(resource) || "vserver2".equals(resource)){
- if(nameValues.containsKey("vserver_name") || nameValues.containsKey("vserver-name") || nameValues.containsKey("vserver.vserver_name") || nameValues.containsKey("vserver.vserver-name"))
- useNewModelProcessing = false;
- }
- if("generic-vnf".equals(resource)){
- if(nameValues.containsKey("vnf_name") || nameValues.containsKey("vnf-name") || nameValues.containsKey("generic_vnf.vnf_name") || nameValues.containsKey("generic-vnf.vnf-name"))
- useNewModelProcessing = false;
- }
-
- // process data using new model
- if(useNewModelProcessing && AAIRequest.createRequest(resource, nameValues) != null) {
-
- try {
- return newModelQuery(resource, localOnly, select, key, prefix, orderBy, ctx);
- } catch (Exception exc) {
- getLogger().warn("Failed query - returning FAILURE", exc);
- return QueryStatus.FAILURE;
- }
- }
-
- ObjectMapper mapper = AAIService.getObjectMapper();
- Map<String,Object> attributes = new HashMap<>();
-
- String modifier = null;
-
- if(resource.contains(":")) {
- String[] tokens = resource.split(":");
- resource = tokens[0];
- if(tokens.length > 1) {
- modifier = tokens[1];
- }
- }
-
- resource = resource.toLowerCase().replace("-", "_");
-
- try {
-
- switch(resource) {
- case "generic_vnf":
- vnfId = nameValues.get("vnf_id");
- if(nameValues.containsKey("vnf_id"))
- vnfId = nameValues.get("vnf_id");
- else if(nameValues.containsKey("generic_vnf.vnf_name"))
- vnfId = nameValues.get("generic_vnf.vserver_name");
-
- if(nameValues.containsKey("vnf_name"))
- vnfName = nameValues.get("vnf_name");
- else if(nameValues.containsKey("generic_vnf.vnf_name"))
- vnfName = nameValues.get("generic_vnf.vnf_name");
-
- if(vnfId != null && !vnfId.isEmpty()) {
- // at this point of the project this part should not be executed
- vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", "");
- GenericVnf vnf = this.requestGenericVnfData(vnfId);
- if(vnf == null) {
- return QueryStatus.NOT_FOUND;
- }
-
- attributes = mapper.convertValue(vnf, attributes.getClass());
- } else if(vnfName != null && !vnfName.isEmpty()) {
- try {
- vnfName = vnfName.trim().replace("'", "").replace("$", "").replace("'", "");
- GenericVnf vnf = this.requestGenericVnfeNodeQuery(vnfName);
- if(vnf == null) {
- return QueryStatus.NOT_FOUND;
- }
- vnfId=vnf.getVnfId();
- nameValues.put("vnf_id", vnfId);
- attributes = mapper.convertValue(vnf, attributes.getClass());
- } catch (AAIServiceException exc) {
- int errorCode = exc.getReturnCode();
- switch(errorCode) {
- case 400:
- case 404:
- case 412:
- break;
- default:
- getLogger().warn("Caught exception trying to refresh generic VNF", exc);
- }
- ctx.setAttribute(prefix + ".error.message", exc.getMessage());
- if(errorCode >= 300) {
- ctx.setAttribute(prefix + ".error.http.response-code",
- Integer.toString(exc.getReturnCode()));
- }
- return QueryStatus.FAILURE;
- }
- } else {
- getLogger().warn("No arguments are available to process generic VNF");
- return QueryStatus.FAILURE;
- }
- break;
- case "vserver":
- case "vserver2":
- String vserverName = null;
- if(nameValues.containsKey("vserver_name"))
- vserverName = nameValues.get("vserver_name");
- else if(nameValues.containsKey("vserver.vserver_name"))
- vserverName = nameValues.get("vserver.vserver_name");
-
- String vserverId = null;
- if(nameValues.containsKey("vserver_id"))
- vserverId = nameValues.get("vserver_id");
- if(nameValues.containsKey("vserver.vserver_id"))
- vserverId = nameValues.get("vserver.vserver_id");
- String tenantId = nameValues.get("teannt_id");
-
- if(vserverName != null) vserverName = vserverName.trim().replace("'", "").replace("$", "").replace("'", "");
- if(vserverId != null) vserverId = vserverId.trim().replace("'", "").replace("$", "").replace("'", "");
- if(tenantId != null) tenantId = tenantId.trim().replace("'", "").replace("$", "").replace("'", "");
-
- if (vserverName != null) {
- URL vserverUrl = null;
- try {
- vserverUrl = this.requestVserverURLNodeQuery(vserverName);
- } catch (AAIServiceException aaiexc) {
- ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage());
- if (aaiexc.getReturnCode() >= 300) {
- ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode());
- }
-
- if (aaiexc.getReturnCode() == 404)
- return QueryStatus.NOT_FOUND;
- else
- return QueryStatus.FAILURE;
- }
- if (vserverUrl == null) {
- return QueryStatus.NOT_FOUND;
- }
-
- tenantId = getTenantIdFromVserverUrl(vserverUrl);
- String cloudOwner = getCloudOwnerFromVserverUrl(vserverUrl);
- String cloudRegionId = getCloudRegionFromVserverUrl(vserverUrl);
-
- Vserver vserver = null;
- try {
- vserver = this.requestVServerDataByURL(vserverUrl);
- } catch (AAIServiceException aaiexc) {
- ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage());
- if (aaiexc.getReturnCode() >= 300) {
- ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode());
- }
-
- if (aaiexc.getReturnCode() == 404)
- return QueryStatus.NOT_FOUND;
- else
- return QueryStatus.FAILURE;
- }
- if (vserver == null) {
- return QueryStatus.NOT_FOUND;
- }
- attributes = mapper.convertValue(vserver, attributes.getClass());
- if (!attributes.containsKey("tenant-id") && tenantId != null) {
- attributes.put("tenant-id", tenantId);
- }
- if (!attributes.containsKey("cloud-owner") && cloudOwner != null) {
- attributes.put("cloud-owner", cloudOwner);
- }
- if (!attributes.containsKey("cloud-region-id") && cloudRegionId != null) {
- attributes.put("cloud-region-id", cloudRegionId);
- }
- } else if (vserverId != null && tenantId != null) {
- Vserver vserver = this.requestVServerData(tenantId, vserverId, "att-aic", "AAIAIC25");
- if(vserver == null) {
- return QueryStatus.NOT_FOUND;
- }
- attributes = mapper.convertValue(vserver, attributes.getClass());
- if(!attributes.containsKey("tenant-id") && tenantId != null){
- attributes.put("tenant-id", tenantId);
- }
- } else {
- return QueryStatus.FAILURE;
- }
- break;
-
- default:
- return QueryStatus.FAILURE;
- }
-
- QueryStatus retval = QueryStatus.SUCCESS;
-
- if (attributes == null || attributes.isEmpty()) {
- retval = QueryStatus.NOT_FOUND;
- getLogger().debug("No data found");
- } else {
- if (ctx != null) {
- if (prefix != null) {
- ArrayList<String> keys = new ArrayList<>(attributes.keySet());
-
- int numCols = keys.size();
-
- for (int i = 0; i < numCols; i++) {
- String colValue;
- String colName = keys.get(i);
- Object object = attributes.get(colName);
-
- if(object != null && object instanceof String) {
- colValue = (String)object;
-
- if (prefix != null) {
- getLogger().debug("Setting "+prefix + "." + colName.replaceAll("_", "-")+" = "+ colValue);
- ctx.setAttribute(prefix + "." + colName.replaceAll("_", "-"), colValue);
- } else {
- getLogger().debug("Setting " + colValue.replaceAll("_", "-")+" = "+colValue);
- ctx.setAttribute(colValue.replaceAll("_", "-"), colValue);
- }
- } else if(object != null && object instanceof Map) {
- if(colName.equals(modifier) || "relationship-list".equals(colName)){
- String localNodifier = modifier;
- if(localNodifier == null)
- localNodifier = "relationship-list";
- Map<String, Object> properties = (Map<String, Object>)object;
- writeMap(properties, prefix+"."+localNodifier, ctx);
- }
- }
- }
- }
- }
- }
- getLogger().debug("Query - returning " + retval);
- return retval;
-
- } catch (Exception exc) {
- getLogger().warn("Failed query - returning FAILURE", exc);
- return QueryStatus.FAILURE;
- }
-
-// return QueryStatus.SUCCESS;
- }
-
-
- public void writeMap(Map<String, Object> properties, String prefix, SvcLogicContext ctx) {
- Set<String> mapKeys = properties.keySet();
-
- for(String mapKey : mapKeys) {
- Object entity = properties.get(mapKey);
- if(entity instanceof ArrayList) {
- writeList((ArrayList<?>)entity, prefix + "." + mapKey, ctx);
- } else
- if(entity instanceof String || entity instanceof Long || entity instanceof Integer || entity instanceof Boolean) {
- ctx.setAttribute(prefix + "." + mapKey, entity.toString());
- getLogger().debug(prefix + "." + mapKey + " : " + entity.toString());
- } else if(entity instanceof Map) {
- String localPrefix = prefix;
- if(mapKey != null) {
- localPrefix = String.format("%s.%s", prefix, mapKey);
- }
- writeMap( (Map<String, Object>)entity, localPrefix, ctx);
- }
- }
- }
-
- private void writeList(ArrayList<?> list, String prefix, SvcLogicContext ctx) {
- for(int i = 0; i < list.size(); i++ ) {
- Object entity = list.get(i);
- if(entity instanceof Map) {
- writeMap( (Map<String, Object>)entity, prefix + "[" + i + "]", ctx);
- } else
- if(entity instanceof String || entity instanceof Long || entity instanceof Integer || entity instanceof Boolean) {
- ctx.setAttribute(prefix, entity.toString());
- getLogger().debug(prefix + " : " + entity.toString());
- }
- }
-
- if(!list.isEmpty()) {
- ctx.setAttribute(prefix + "_length", Integer.toString(list.size()));
- getLogger().debug(prefix + "_length" + " : " + Integer.toString(list.size()));
- }
- }
-
- @Override
- public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map<String, String> params, String prefix, SvcLogicContext ctx)
- throws SvcLogicException {
-
- getLogger().debug("AAIService.save\tresource="+resource);
- HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
-
- if(!AAIServiceUtils.isValidFormat(resource, nameValues)) {
- ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource));
- return QueryStatus.FAILURE;
- }
-
- if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) {
- getLogger().warn("AAIService.save has unspecified resource");
- ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource));
- return QueryStatus.FAILURE;
- }
- // keys passed
- getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray()));
-
- // process params
- if(params.containsKey("prefix")) {
- Map<String, String> tmpParams = ctxGetBeginsWith(ctx, params.get("prefix"));
- if(!tmpParams.isEmpty()) {
- params.putAll(tmpParams);
-// params.remove("prefix");
- }
- }
- // params passed
- getLogger().debug("parms = "+ Arrays.toString(params.entrySet().toArray()));
-
- boolean useNewModelProcessing = true;
- // process server query by name the old way
- if("vserver".equals(resource) || "vserver2".equals(resource)){
- if(nameValues.containsKey("vserver-name")) {
- useNewModelProcessing = false;
- }
-
- if(!params.containsKey("vserver-selflink")) {
-
- AAIRequest request = AAIRequest.createRequest(resource, nameValues);
- URL path = null;
- try {
- request.processRequestPathValues(nameValues);
- path = request.getRequestUrl("GET", null);
- params.put("vserver-selflink", path.toString());
- } catch (UnsupportedEncodingException | MalformedURLException e) {
- // TODO : Fix this
- params.put("vserver-selflink", "/vserver");
- }
- }
- }
-
- // process data using new model
- if(useNewModelProcessing && AAIRequest.createRequest(resource, nameValues) != null) {
-
- try {
- if(!resource.contains(":")){
- return newModelSave(resource, force, key, params, prefix, ctx);
- } else {
- String[] tokens = resource.split(":");
- String localResource = tokens[0];
- String dependency = tokens[1];
-
- AAIDatum instance = newModelObjectRequest( localResource, nameValues, prefix, ctx);
- if(instance == null) {
- return QueryStatus.NOT_FOUND;
- }
-
- switch(dependency){
- case "relationship-list":
- newModelProcessRelationshipList(instance, params, prefix, ctx);
- break;
- }
- // create a method to update relationship-list
- AAIRequest request = AAIRequest.createRequest(localResource, nameValues);
- request.setRequestObject(instance);
- request.processRequestPathValues(nameValues);
-
- getExecutor().post(request);
- getLogger().debug("Save relationship list - returning SUCCESS");
- return QueryStatus.SUCCESS;
- }
- } catch (Exception exc) {
- ctx.setAttribute(prefix + ".error.message", exc.getMessage());
- if(exc instanceof AAIServiceException) {
- AAIServiceException aaiexc = (AAIServiceException)exc;
- if(aaiexc.getReturnCode() >= 300) {
- ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode());
- }
-
- if(aaiexc.getReturnCode() == 404) {
- return QueryStatus.NOT_FOUND;
- }
- }
- getLogger().warn("Failed save() - returning FAILURE", exc);
- return QueryStatus.FAILURE;
- }
- } else {
- String reSource = resource.toLowerCase().replace("-", "_");
- String vnfId;
-
- try {
- switch(reSource) {
- case "generic_vnf":
- case "generic-vnf":
- vnfId = nameValues.get("vnf_id");
- if(vnfId == null) {
- getLogger().debug("Save(generic-vnf) with no vnf-id specified. Returning FAILURE");
- return QueryStatus.FAILURE;
- }
- vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", "");
- GenericVnf vnf = this.requestGenericVnfData(vnfId);
- String status = params.get("prov-status");
- boolean updated = false;
- if(status != null && !status.isEmpty()) {
- vnf.setProvStatus(status);
- }
- if(updated) {
- this.postGenericVnfData(vnfId, vnf);
- }
- break;
- case "vpe":
- return update( resource, key, params, prefix, ctx) ;
-
- default:
- getLogger().debug("Save() executing default path - returning FAILURE");
- return QueryStatus.FAILURE;
- }
- } catch (Exception exc) {
- getLogger().warn("Failed save - returning FAILURE", exc);
- ctx.setAttribute(prefix + ".error.message", exc.getMessage());
- return QueryStatus.FAILURE;
- }
- }
-
- getLogger().debug("Save - returning SUCCESS");
- return QueryStatus.SUCCESS;
- }
-
- @Override
- public QueryStatus update(String resource, String key, Map<String, String> params, String prefix, SvcLogicContext ctx) throws SvcLogicException {
-
- resource = resource.toLowerCase();
- HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
- getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray()));
- if(!AAIServiceUtils.isValidFormat(resource, nameValues)) {
- ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource));
- return QueryStatus.FAILURE;
- }
-
- if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) {
- ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource));
- return QueryStatus.FAILURE;
- }
-
- getLogger().debug("parms = "+ Arrays.toString(params.entrySet().toArray()));
-
- AAIRequest request = AAIRequest.createRequest(resource, nameValues);
- request = new UpdateRequest(request, params);
-
- String[] arguments = request.getArgsList();
- for(String name : arguments) {
- String modifiedKey = name.replaceAll("-", "_");
- if(nameValues.containsKey(modifiedKey)) {
- String argValue = nameValues.get(modifiedKey);
- if(argValue != null) argValue = argValue.trim().replace("'", "").replace("$", "").replace("'", "");
- request.addRequestProperty(name, argValue);
- }
- }
-
- try {
- QueryStatus retval = QueryStatus.SUCCESS;
-
- retval = newModelQuery(resource, false, null, key, "tmpDelete", null, ctx);
-
- if(retval == null || retval != QueryStatus.SUCCESS) {
- return retval;
- }
-
- String resourceVersion = ctx.getAttribute("tmpDelete.resource-version");
- if(resourceVersion == null) {
- return QueryStatus.NOT_FOUND;
- }
- params.put("resource-version", resourceVersion);
-
- request.processRequestPathValues(nameValues);
- getExecutor().patch(request, resourceVersion);
- } catch(AAIServiceException aaiexc) {
- if(aaiexc.getReturnCode() == 404)
- return QueryStatus.NOT_FOUND;
- else
- return QueryStatus.FAILURE;
- } catch (Exception exc) {
- getLogger().warn("Failed update - returning FAILURE", exc);
- return QueryStatus.FAILURE;
- }
-
- getLogger().debug("Update - returning SUCCESS");
- return QueryStatus.SUCCESS;
- }
-
- @Override
- public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException {
- getLogger().debug("AAIService.delete\tresource="+resource);
- HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
- getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray()));
-
- if(!AAIServiceUtils.isValidFormat(resource, nameValues)) {
- ctx.setAttribute(String.format("%s.error.message", "aaiData"), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource));
- return QueryStatus.FAILURE;
- }
-
- if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) {
- ctx.setAttribute(String.format("%s.error.message", "tmpDelete"), String.format("Resource %s is not supported", resource));
- return QueryStatus.FAILURE;
- }
-
- if(AAIRequest.createRequest(resource, nameValues) != null) {
- if(resource.contains(":")) {
- return processDeleteRelationshipList(resource, key, ctx, nameValues);
- }
-
-
- try {
- QueryStatus retval = QueryStatus.SUCCESS;
-
- retval = newModelQuery(resource, false, null, key, "tmpDelete", null, ctx);
-
- if(retval == null || retval != QueryStatus.SUCCESS) {
- return retval;
- }
-
- String resourceVersion = ctx.getAttribute("tmpDelete.resource-version");
- if(resourceVersion == null) {
- return QueryStatus.NOT_FOUND;
- }
-
- try {
- AAIRequest request = AAIRequest.createRequest(resource, nameValues);
- if(request == null) {
- return QueryStatus.FAILURE;
- }
-
- request.processRequestPathValues(nameValues);
-
- if(getExecutor().delete(request, resourceVersion)) {
- return QueryStatus.SUCCESS;
- }
- } catch(AAIServiceException aaiexc) {
- if(aaiexc.getReturnCode() == 404)
- return QueryStatus.NOT_FOUND;
- else
- return QueryStatus.FAILURE;
-
- } catch (Exception exc) {
- getLogger().warn("requestGenericVnfData", exc);
- return QueryStatus.FAILURE;
- }
-
- } catch (Exception exc) {
- getLogger().warn("Failed delete - returning FAILURE", exc);
- return QueryStatus.FAILURE;
- }
- } else {
- String resoourceName = resource;
- String identifier = null;
-
- if(resoourceName.contains(":")) {
- String[] tokens = resoourceName.split(":");
- if(tokens != null && tokens.length > 0) {
- resoourceName = tokens[0];
- identifier = tokens[1];
- }
- }
- if("relationship-list".equals(identifier) || "relationshipList".equals(identifier)) {
-// RelationshipRequest relationshipRequest = new RelationshipRequest();
- if("generic-vnf".equals(resoourceName)){
- String vnfId = nameValues.get("vnf_id");
- String relatedTo = nameValues.get("related_to");
- vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", "");
- relatedTo = relatedTo.trim().replace("'", "").replace("$", "").replace("'", "");
-
- GenericVnf vnf;
- try {
- vnf = this.requestGenericVnfData(vnfId);
- if(vnf == null)
- return QueryStatus.NOT_FOUND;
- } catch (AAIServiceException exc) {
- getLogger().warn("Failed delete - returning NOT_FOUND", exc);
- return QueryStatus.NOT_FOUND;
- }
- boolean itemRemoved = false;
- RelationshipList relationshipList = vnf.getRelationshipList();
- List<Relationship> relationships = relationshipList.getRelationship();
- List<Relationship> iterableList = new LinkedList<Relationship>(relationships);
- for(Relationship relationship : iterableList) {
- if(relationship.getRelatedTo().equals(relatedTo)) {
- relationships.remove(relationship);
- itemRemoved = true;
- }
- }
-
- if(!itemRemoved)
- return QueryStatus.NOT_FOUND;
-
-// AAIRequest masterRequest = new GenericVnfRequest();
-// masterRequest.addRequestProperty(GenericVnfRequest.VNF_ID, vnfId);
-// relationshipRequest.addMasterRequest(masterRequest);
-// Map<String, String> attributes = objectToProperties(vnf);
-// try {
-// Boolean result = getExecutor().delete(relationshipRequest, attributes.get(AAIRequest.RESOURCE_VERSION));
-// } catch (AAIServiceException e) {
-// return QueryStatus.FAILURE;
-// }
-
- try {
- this.postGenericVnfData(vnf.getVnfId(), vnf);
- } catch (AAIServiceException exc) {
- if(exc.getReturnCode() == 404){
- return QueryStatus.NOT_FOUND;
- } else {
- getLogger().warn("Failed delete - returning FAILURE", exc);
- return QueryStatus.FAILURE;
- }
- }
- return QueryStatus.SUCCESS;
- }
- }
- }
- return QueryStatus.FAILURE;
- }
-
- @Override
- public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException {
- return query(resource, false, null, key, prefix, null, ctx);
- }
-
- @Override
- public QueryStatus isAvailable(String arg0, String arg1, String arg2, SvcLogicContext arg3)
- throws SvcLogicException {
- // TODO Auto-generated method stub
- throw new SvcLogicException("Method AAIService.isAvailable() has not been implemented yet");
- }
-
- @Override
- public QueryStatus notify(String resource, String action, String key, SvcLogicContext ctx) throws SvcLogicException {
- // TODO Auto-generated method stub
- throw new SvcLogicException("Method AAIService.notify() has not been implemented yet");
- }
-
-// @Override
- public QueryStatus newModelQuery(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx) {
-
- Object response = null;
- QueryStatus retval = QueryStatus.SUCCESS;
- String modifier = null;
-
- HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
- if(resource.contains(":")) {
- modifier = resource.split(":")[1];
- }
-
- try {
- AAIRequest request = AAIRequest.createRequest(resource, nameValues);
- if(request == null) {
- return QueryStatus.FAILURE;
- }
-
- Map<String, String> params = new HashMap<>();
-
- request.processRequestPathValues(nameValues);
- if(nameValues.containsKey("prefix")){
- Map<String, String> tmpParams = ctxGetBeginsWith(ctx, nameValues.get("prefix"));
- if(!tmpParams.isEmpty()) {
- params.putAll(tmpParams);
- }
- if("named-query".equals(resource))
- request.setRequestObject(extractNamedQueryDataFromQueryPrefix(nameValues, params));
- }
- String rv = getExecutor().get(request);
-
- retval = processResponseData(rv, resource, request, prefix, ctx, nameValues, modifier);
-
- } catch(AAIServiceException aaiexc) {
- int errorCode = aaiexc.getReturnCode();
- ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage());
- if(errorCode >= 300) {
- ctx.setAttribute(prefix + ".error.http.response-code", "" +
- Integer.toString(aaiexc.getReturnCode()));
- }
-
- if(aaiexc.getReturnCode() == 404)
- return QueryStatus.NOT_FOUND;
-
- return QueryStatus.FAILURE;
- } catch (Exception exc) {
- getLogger().warn("requestGenericVnfData", exc);
- ctx.setAttribute(prefix + ".error.message", exc.getMessage());
- return QueryStatus.FAILURE;
- }
-
- return retval;
- }
-
- public QueryStatus processResponseData(String rv, String resource, AAIRequest request, String prefix, SvcLogicContext ctx, HashMap<String, String> nameValues, String modifier) throws JsonParseException, JsonMappingException, IOException, AAIServiceException
- {
- Object response;
-
- if(rv == null) {
- return QueryStatus.NOT_FOUND;
- }
-
- response = request.jsonStringToObject(rv);
- if(response == null) {
- return QueryStatus.NOT_FOUND;
- }
-
- if("generic-query".equals(resource)) {
- SearchResults rd = SearchResults.class.cast(response);
- List<ResultData> rdList = rd.getResultData();
- if(rdList == null || rdList.isEmpty()) {
- return QueryStatus.NOT_FOUND;
- }
- ResultData rDatum = rdList.get(0);
- nameValues.put("selflink", rDatum.getResourceLink());
- AAIRequest req2 = AAIRequest.createRequest(rDatum.getResourceType(), nameValues);
- req2.processRequestPathValues(nameValues);
- rv = getExecutor().get(req2);
- if(rv == null) {
- return QueryStatus.NOT_FOUND;
- }
-
- response = req2.jsonStringToObject(rv);
- if(response == null) {
- return QueryStatus.NOT_FOUND;
- }
- }
-
- if("named-query".equals(resource)) {
- InventoryResponseItems rd = InventoryResponseItems.class.cast(response);
- List<InventoryResponseItem> iRIlist = rd.getInventoryResponseItem();
- if(iRIlist == null || iRIlist.isEmpty()) {
- return QueryStatus.NOT_FOUND;
- }
- }
-
- if("nodes-query".equals(resource)) {
- SearchResults rd = SearchResults.class.cast(response);
- List<ResultData> rdList = rd.getResultData();
- if(rdList == null || rdList.isEmpty()) {
- return QueryStatus.NOT_FOUND;
- }
- ResultData rDatum = rdList.get(0);
- response = rDatum;
- }
-
- if("formatted-query".equals(resource) || "custom-query".equals(resource)) {
- FormattedQueryResultList rd = FormattedQueryResultList.class.cast(response);
- List<Results> iRIlist = rd.getResults();
- if(iRIlist == null || iRIlist.isEmpty()) {
- return QueryStatus.NOT_FOUND;
- }
- }
-
- // process relationship list
- // this is a temporary soluton to address the realationship handling changes added in Release 17.07
- try {
- Class<?> clazz = response.getClass();
- Method getter = clazz.getMethod("getRelationshipList");
- Object obj = getter.invoke(response);
- if(obj != null && obj instanceof RelationshipList) {
- RelationshipList list = RelationshipList.class.cast(obj);
- AAIServiceUtils.populateRelationshipDataFromPath(list);
- }
- } catch(Exception exc) {
- getLogger().debug("Retrofiting relationship data: " + exc.getMessage());
- }
-
- String preFix;
- if(prefix == null || prefix.isEmpty()) {
- preFix = "";
- } else {
- preFix = prefix + ".";
- }
-
- Map<String,Object> props = objectToProperties(response);
- Set<String> keys = props.keySet();
- for(String theKey: keys) {
- if(getLogger().isTraceEnabled())
- getLogger().trace(theKey);
-
- Object value = props.get(theKey);
- if(value == null)
- continue;
- Object type = value.getClass();
- if(value instanceof String) {
- ctx.setAttribute(preFix + theKey, value.toString());
- continue;
- }
- if(value instanceof Boolean) {
- ctx.setAttribute(preFix + theKey, value.toString());
- continue;
- }
- if(value instanceof Integer) {
- ctx.setAttribute(preFix + theKey, value.toString());
- continue;
- }
- if(value instanceof Long) {
- ctx.setAttribute(preFix + theKey, value.toString());
- continue;
- }
-
- if(value instanceof ArrayList) {
- ArrayList<?> array = ArrayList.class.cast(value);
- for(int i = 0; i < array.size(); i++) {
- writeList(array, String.format("%s.%s", prefix, theKey), ctx);
- }
- continue;
- }
-
- if("relationship-list".equals(theKey)){
- Map<String, Object> relationshipList = (Map<String, Object>)value;
- // we are interested in seeing just the selected relationship
- if(theKey.equals(modifier)) {
- List<?> relationships = (List<?>)relationshipList.get("relationship");
- if(relationships != null && !relationships.isEmpty()) {
-
- List newRelationships = new LinkedList();
- newRelationships.addAll(relationships);
-
- for(Object obj : newRelationships){
- if(obj instanceof Map<?, ?>) {
- Map<?, ?> relProperties = (Map<?, ?>)obj;
- if(relProperties.containsKey("related-to")) {
- Object relPropsRelatedTo = relProperties.get("related-to");
-
- String relatedTo = nameValues.get("related_to");
- if(relatedTo != null) {
- relatedTo = relatedTo.trim().replace("'", "").replace("$", "").replace("'", "");
- if(!relatedTo.equals(relPropsRelatedTo)) {
- relationships.remove(relProperties);
- }
- continue;
- } else {
- continue;
- }
- }
- }
- }
- }
- }
- writeMap(relationshipList, String.format("%s.%s", prefix, theKey), ctx);
- continue;
- }
-
- if(value instanceof Map) {
- Map<String, Object> subnetsList = (Map<String, Object>)value;
- writeMap(subnetsList, String.format("%s.%s", prefix, theKey), ctx);
- continue;
- }
-
- }
- return QueryStatus.SUCCESS;
- }
-
-
- public QueryStatus newModelBackupRequest(String resource, Map<String, String> params, String prefix, SvcLogicContext ctx) {
-
- QueryStatus retval = QueryStatus.SUCCESS;
- HashMap<String, String> nameValues = new HashMap<>();
-
- try {
- AAIRequest request = AAIRequest.createRequest(resource, nameValues);
- if(request == null) {
- return QueryStatus.FAILURE;
- }
-
- boolean argsFound = false;
- String[] arguments = request.getArgsList();
- for(String name : arguments) {
- String tmpName = name.replaceAll("-", "_");
- String value = params.get(tmpName);
- if(value != null && !value.isEmpty()) {
- value = value.trim().replace("'", "").replace("$", "").replace("'", "");
- request.addRequestProperty(name, value);
- argsFound = true;
- }
- }
- if(!argsFound) {
- getLogger().warn("No arguments were found. Terminating backup request.");
- return QueryStatus.FAILURE;
- }
-
- String rv = getExecutor().get(request);
- ctx.setAttribute(prefix, rv);
- } catch(AAIServiceException aaiexc) {
- if(aaiexc.getReturnCode() == 404)
- return QueryStatus.NOT_FOUND;
-
- return QueryStatus.FAILURE;
- } catch (Exception exc) {
- getLogger().warn("newModelBackupRequest", exc);
- return QueryStatus.FAILURE;
- }
-
- return retval;
- }
-
- public AAIDatum newModelObjectRequest(String resource, Map<String, String> params, String prefix, SvcLogicContext ctx)
- throws AAIServiceException {
-
- AAIDatum response = null;
-
- try {
- AAIRequest request = AAIRequest.createRequest(resource, params);
- if(request == null) {
- return null;
- }
-
- request.processRequestPathValues(params);
- String rv = getExecutor().get(request);
- response = request.jsonStringToObject(rv);
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- getLogger().warn("newModelBackupRequest", exc);
- throw new AAIServiceException(exc);
- }
-
- return response;
- }
-
-
- @Override
- public QueryStatus release(String arg0, String arg1, SvcLogicContext arg2) throws SvcLogicException {
- // TODO Auto-generated method stub
- throw new SvcLogicException("Method AAIService.release() has not been implemented yet");
- }
-
- @Override
- public QueryStatus reserve(String arg0, String arg1, String arg2, String arg3, SvcLogicContext arg4)
- throws SvcLogicException {
- // TODO Auto-generated method stub
- throw new SvcLogicException("Method AAIService.reserve() has not been implemented yet");
- }
-
- private QueryStatus newModelSave(String resource, boolean force, String key, Map<String, String> params, String prefix, SvcLogicContext ctx) {
- getLogger().debug("Executing newModelSave for resource : " + resource);
- HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
-
- try {
- ArrayList<String> subResources = new ArrayList<>();
- Set<String> set = params.keySet();
- Map<String, Method> setters = new HashMap<>();
- Map<String, Method> getters = new HashMap<>();
-
- // 1. find class
- AAIRequest request = AAIRequest.createRequest(resource, nameValues);
- Class<? extends AAIDatum> resourceClass = request.getModelClass();
- getLogger().debug(resourceClass.getName());
- AAIDatum instance = resourceClass.newInstance();
-
- {
- Annotation[] annotations = resourceClass.getAnnotations();
- for(Annotation annotation : annotations) {
- Class<? extends Annotation> anotationType = annotation.annotationType();
- String annotationName = anotationType.getName();
-
- // 2. find string property setters and getters for the lists
- if("javax.xml.bind.annotation.XmlType".equals(annotationName)){
- XmlType order = (XmlType)annotation;
- String[] values = order.propOrder();
- for(String value : values) {
- String id = AAIServiceUtils.camelCaseToDashedString(value);
- Field field = resourceClass.getDeclaredField(value);
- Class<?> type = field.getType();
- Method setter = null;
- try {
- setter = resourceClass.getMethod("set"+StringUtils.capitalize(value), type);
- if(type.getName().startsWith("java.lang") || "boolean".equals(type.getName()) || "long".equals(type.getName())) {
- try {
- setter.setAccessible(true);
- Object arglist[] = new Object[1];
- arglist[0] = params.get(id);
-
- if(arglist[0] != null) {
- if(!type.getName().equals("java.lang.String")) {
-// getLogger().debug(String.format("Processing %s with parameter %s", types[0].getName(), value));
- if("boolean".equals(type.getName())) {
- arglist[0] = valueOf(Boolean.class, params.get(id));
- } else if("long".equals(type.getName())) {
- arglist[0] = valueOf(Long.class, params.get(id));
- } else {
- arglist[0] = valueOf(type, params.get(id));
- }
- }
- Object o = setter.invoke(instance, arglist);
- }
- set.remove(id);
-
- } catch (Exception x) {
- Throwable cause = x.getCause();
- getLogger().warn("Failed process for " + resourceClass.getName(), x);
- }
- } else if(type.getName().equals("java.util.List")) {
- List<String> newValues = new ArrayList<>();
- String length = id+"_length";
- if(!params.isEmpty() && params.containsKey(length)) {
- String tmp = params.get(length).toString();
- int count = Integer.parseInt(tmp);
- for(int i=0; i<count; i++) {
- String tmpValue = params.get(String.format("%s[%d]", id, i));
- newValues.add(tmpValue);
- }
- if(!newValues.isEmpty()) {
- Object o = setter.invoke(instance, newValues);
- }
- }
- set.remove(id);
- } else {
- setters.put(id, setter);
- }
- } catch(Exception exc) {
-
- }
-
- Method getter;
- try {
- getter = resourceClass.getMethod("get"+StringUtils.capitalize(value));
- if(!type.getName().equals("java.lang.String")) {
- getters.put(id, getter);
- }
- } catch(Exception exc) {
-
- }
-
- }
- subResources.addAll(Arrays.asList(values));
- }
- }
- }
-
- // remove getters that have matching setter
- for(String setKey : setters.keySet()) {
- if(getters.containsKey(setKey)) {
- getters.remove(setKey);
- }
- }
-
- Set<String> relationshipKeys = new TreeSet<>();
- Set<String> vlansKeys = new TreeSet<>();
- Set<String> metadataKeys = new TreeSet<>();
-
- for(String attribute : set) {
- String value = params.get(attribute);
- if(attribute.startsWith("relationship-list")) {
- relationshipKeys.add(attribute);
- } else if(attribute.startsWith("vlans")) {
- vlansKeys.add(attribute);
- } else if(attribute.startsWith("metadata")) {
- metadataKeys.add(attribute);
- }
- }
- // 3. find list property getters
- for(String attribute : set) {
- String value = params.get(attribute);
- Method method = getters.get(attribute);
- if(method != null) {
- try {
- method.setAccessible(true);
- Object arglist[] = new Object[0];
-// arglist[0] = value;
- Class<?>[] types = method.getParameterTypes();
- if(types.length == 0){
- Object o = method.invoke(instance, arglist);
- if(o instanceof ArrayList) {
- ArrayList<String> values = (ArrayList<String>)o;
-// getLogger().debug(String.format("Processing %s with parameter %s", types[0].getName(), value));
- value = value.replace("[", "").replace("]", "");
- List<String> items = Arrays.asList(value.split("\\s*,\\s*"));
- for(String s : items) {
- values.add(s.trim());
- }
- }
- }
- } catch (Exception x) {
- Throwable cause = x.getCause();
- getLogger().warn("Failed process for " + resourceClass.getName(), x);
- }
- }
- }
- // 4. Process Relationships
- // add relationship list
- if( (subResources.contains("relationship-list") || subResources.contains("relationshipList")) && !relationshipKeys.isEmpty()) {
- RelationshipList relationshipList = null;
- Object obj = null;
- Method getRelationshipListMethod = null;
- try {
- getRelationshipListMethod = resourceClass.getMethod("getRelationshipList");
- } catch(Exception exc) {
- getLogger().debug("Retrofiting relationship data: " + exc.getMessage());
- }
-
- if(getRelationshipListMethod != null){
- try {
- getRelationshipListMethod.setAccessible(true);
- obj = getRelationshipListMethod.invoke(instance);
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- }
- }
- if(obj != null && obj instanceof RelationshipList){
- relationshipList = (RelationshipList)obj;
- } else {
- relationshipList = new RelationshipList();
- Method setRelationshipListMethod = resourceClass.getMethod("setRelationshipList", RelationshipList.class);
- if(setRelationshipListMethod != null){
- try {
- setRelationshipListMethod.setAccessible(true);
- Object arglist[] = new Object[1];
- arglist[0] = relationshipList;
-
- obj = setRelationshipListMethod.invoke(instance, arglist);
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- }
- }
- }
-
- List<Relationship> relationships = relationshipList.getRelationship();
-
- int i = 0;
- while(true){
- String searchKey = "relationship-list.relationship[" + i + "].related-to";
- if(!params.containsKey(searchKey))
- break;
- int j = 0;
- String relatedTo = params.get(searchKey);
- String relatedLinkKey = "relationship-list.relationship[" + i + "].related-link";
- String relatedLink = null;
- if(params.containsKey(relatedLinkKey)) {
- relatedLink = params.get(relatedLinkKey);
- }
- Relationship relationship = new Relationship();
- relationships.add(relationship);
- relationship.setRelatedTo(relatedTo);
- if(relatedLink != null) {
- relationship.setRelatedLink(relatedLink);
- } else {
-// List<RelationshipData> relData = relationship.getRelationshipData();
- Map<String, String> relParams = new HashMap<String, String>();
-
- 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;
-
- relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue));
- j++;
- }
- AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams);
- for(Map.Entry<String,String> entry : relParams.entrySet()) {
- rlRequest.addRequestProperty(entry.getKey(), entry.getValue());
- }
- String path = rlRequest.updatePathDataValues(null);
- relationship.setRelatedLink(path);
- }
- i++;
- }
- }
-
- // 4. vlans
- if(subResources.contains("vlans") && !vlansKeys.isEmpty()) {
- Object obj = null;
- Vlans vlanList = null;
- Method getVLansMethod = resourceClass.getMethod("getVlans");
- if(getVLansMethod != null){
- try {
- getVLansMethod.setAccessible(true);
- obj = getVLansMethod.invoke(instance);
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- }
- }
- if(obj != null && obj instanceof Vlans){
- vlanList = (Vlans)obj;
- } else {
- vlanList = new Vlans();
- Method setVlansMethod = resourceClass.getMethod("setVlans", Vlans.class);
- if(setVlansMethod != null){
- try {
- setVlansMethod.setAccessible(true);
- Object arglist[] = new Object[1];
- arglist[0] = vlanList;
-
- obj = setVlansMethod.invoke(instance, arglist);
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- }
- }
- }
-
- int i = 0;
- while(true){
- String searchKey = "vlans.vlan[" + i + "].vlan-interface";
- if(!params.containsKey(searchKey))
- break;
-
- String vlanInterface = params.get("vlans.vlan[" + i + "].vlan-interface");
- String vlanIdInner = params.get("vlans.vlan[" + i + "].vlan-id-inner");
- String vlanIdOute = params.get("vlans.vlan[" + i + "].vlan-id-outer");
- String speedValue = params.get("vlans.vlan[" + i + "].speed-value");
- String speedUnits = params.get("vlans.vlan[" + i + "].speed-units");
-
- Vlan vlan = new Vlan();
- vlan.setVlanInterface(vlanInterface);
-
- if(vlanIdInner != null) {
- Long iVlanIdInner = Long.parseLong(vlanIdInner);
- vlan.setVlanIdInner(iVlanIdInner);
- }
-
- if(vlanIdOute != null) {
- Long iVlanIdOuter = Long.parseLong(vlanIdOute);
- vlan.setVlanIdOuter(iVlanIdOuter);
- }
-
- if(speedValue != null) {
- vlan.setSpeedValue(speedValue);
- vlan.setSpeedUnits(speedUnits);
- }
-
- vlanList.getVlan().add(vlan);
- i++;
- }
- }
-
- // 5. metadata
- if(subResources.contains("metadata") && !metadataKeys.isEmpty()) {
- Object obj = null;
- Metadata metadataList = null;
- Method getMetadataMethod = resourceClass.getMethod("getMetadata");
- if(getMetadataMethod != null){
- try {
- getMetadataMethod.setAccessible(true);
- obj = getMetadataMethod.invoke(instance);
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- }
- }
- if(obj != null && obj instanceof Metadata){
- metadataList = (Metadata)obj;
- } else {
- metadataList = new Metadata();
- Method setMetadataMethod = resourceClass.getMethod("setMetadata", Metadata.class);
- if(setMetadataMethod != null){
- try {
- setMetadataMethod.setAccessible(true);
- Object arglist[] = new Object[1];
- arglist[0] = metadataList;
-
- obj = setMetadataMethod.invoke(instance, arglist);
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- }
- }
- }
-
- if(metadataList.getMetadatum() == null) {
-// metadataList.setMetadatum(new ArrayList<Metadatum>());
- }
-
- // process data
- int i = 0;
- while(true){
- String metaKey = "metadata.metadatum[" + i + "].meta-key";
- if(!params.containsKey(metaKey))
- break;
-
- String metaValue = params.get("metadata.metadatum[" + i + "].meta-value");
-
- Metadatum vlan = new Metadatum();
- vlan.setMetaname(metaKey);
- vlan.setMetaval(metaValue);
-
- metadataList.getMetadatum().add(vlan);
- i++;
- }
-
- }
-
-
- // 6. Prepare AAI request
- String[] args = request.getArgsList();
- for(String arg : args) {
- String modifiedKey = arg.replaceAll("-", "_");
- if(nameValues.containsKey(modifiedKey)) {
- String argValue = nameValues.get(modifiedKey);
- if(argValue != null) argValue = argValue.trim().replace("'", "").replace("$", "").replace("'", "");
- request.addRequestProperty(arg, argValue);
- }
- }
-
- request.processRequestPathValues(nameValues);
- request.setRequestObject(instance);
- Object response = getExecutor().post(request);
- if(request.expectsDataFromPUTRequest()){
- if(response != null && response instanceof String) {
- String rv = response.toString();
- QueryStatus retval = processResponseData(rv, resource, request, prefix, ctx, nameValues, null);
- getLogger().debug("newModelSave - returning " + retval.toString());
- return retval;
- }
- }
-
- } catch(AAIServiceException exc){
- ctx.setAttribute(prefix + ".error.message", exc.getMessage());
- int returnCode = exc.getReturnCode();
- if(returnCode >= 300) {
- ctx.setAttribute(prefix + ".error.http.response-code", "" +
- Integer.toString(exc.getReturnCode()));
- }
-
- if(returnCode == 400 || returnCode == 412)
- return QueryStatus.FAILURE;
- else if(returnCode == 404)
- return QueryStatus.NOT_FOUND;
- else {
- getLogger().warn("Failed newModelSave - returning FAILURE", exc);
- return QueryStatus.FAILURE;
- }
- } catch(Exception exc){
- getLogger().warn("Failed newModelSave - returning FAILURE", exc);
- ctx.setAttribute(prefix + ".error.message", exc.getMessage());
- return QueryStatus.FAILURE;
- }
-
- getLogger().debug("newModelSave - returning SUCCESS");
- return QueryStatus.SUCCESS;
- }
-
- private QueryStatus newModelProcessRelationshipList(Object instance, Map<String, String> params, String prefix, SvcLogicContext ctx) throws Exception {
-
- Class resourceClass = instance.getClass();
-
- Set<String> relationshipKeys = new TreeSet<>();
-
- Set<String> set = params.keySet();
-
- for(String attribute : set) {
- String value = params.get(attribute);
-
- if(attribute.startsWith("relationship-list")) {
- relationshipKeys.add(attribute);
- }
- }
-
- // 3. Process Relationships
- // add relationship list
- if(!relationshipKeys.isEmpty()) {
- RelationshipList relationshipList;
- Object obj = null;
- Method getRelationshipListMethod = null;
- try {
- getRelationshipListMethod = resourceClass.getMethod("getRelationshipList");
- } catch(Exception exc) {
- getLogger().debug("Retrofiting relationship data: " + exc.getMessage());
- }
- if(getRelationshipListMethod != null){
- try {
- getRelationshipListMethod.setAccessible(true);
- obj = getRelationshipListMethod.invoke(instance);
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- }
- }
- if(obj != null && obj instanceof RelationshipList){
- relationshipList = (RelationshipList)obj;
- } else {
- relationshipList = new RelationshipList();
- Method setRelationshipListMethod = resourceClass.getMethod("setRelationshipList", RelationshipList.class);
- if(setRelationshipListMethod != null){
- try {
- setRelationshipListMethod.setAccessible(true);
- Object arglist[] = new Object[1];
- arglist[0] = relationshipList;
-
- obj = setRelationshipListMethod.invoke(instance, arglist);
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- }
- }
- }
-
- boolean createdNewRelationships = false;
- List<Relationship> relationships = relationshipList.getRelationship();
- if(relationships == null) {
- relationships = new ArrayList<Relationship>();
- createdNewRelationships = true;
- }
-
- int i = 0;
- while(true){
- String searchKey = "relationship-list.relationship[" + i + "].related-to";
- if(!params.containsKey(searchKey))
- break;
-
- int j = 0;
- String relatedTo = params.get(searchKey);
- String relatedLinkKey = "relationship-list.relationship[" + i + "].related-link";
- String relatedLink = null;
- if(params.containsKey(relatedLinkKey)) {
- relatedLink = params.get(relatedLinkKey);
- }
-
- Relationship relationship = new Relationship();
- relationships.add(relationship);
- relationship.setRelatedTo(relatedTo);
- if(relatedLink != null) {
- relationship.setRelatedLink(relatedLink);
- } else {
- Map<String, String> relParams = new HashMap<>();
-
- 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;
-
- relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue));
- j++;
- }
- AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams);
- for(String key : relParams.keySet()) {
- rlRequest.addRequestProperty(key, relParams.get(key));
- }
- String path = rlRequest.updatePathDataValues(null);
- relationship.setRelatedLink(path);
- }
-
- i++;
- }
- }
-
- return QueryStatus.SUCCESS;
- }
-
- private Relationship findRelationship(List<Relationship> relationships, String relatedTo) {
- if(relatedTo == null)
- return null;
-
- for(Relationship relationship : relationships) {
- if(relationship.getRelatedTo().equals(relatedTo)){
- return relationship;
- }
- }
- return null;
- }
-
-
- public QueryStatus backup(Map<String, String> params, SvcLogicContext ctx) throws SvcLogicException {
- String resource = params.get("resource").toLowerCase();
- String prefix = params.get("data-key");
-
- HashMap<String, String> nameValues = new HashMap<>();
- if(AAIRequest.createRequest(resource, nameValues) != null) {
-
- try {
- return newModelBackupRequest(resource, params, prefix, ctx);
- } catch (Exception exc) {
- getLogger().warn("Failed backup - returning FAILURE", exc);
- return QueryStatus.FAILURE;
- }
- }
-
- return QueryStatus.NOT_FOUND;
- }
-
- @Override
- public QueryStatus restore(Map<String, String> params, SvcLogicContext ctx) throws SvcLogicException {
-
- QueryStatus retval = QueryStatus.SUCCESS;
- String resource = params.get("resource").toLowerCase();
- String prefix = params.get("data-key");
-
- HashMap<String, String> nameValues = new HashMap<>();
- if(AAIRequest.createRequest(resource, nameValues) != null) {
-
- try {
- retval = newModelBackupRequest(resource, params, "tmpRestore", ctx);
- if(retval == QueryStatus.SUCCESS) {
- String current_json = ctx.getAttribute("tmpRestore");
- ctx. setAttribute("tmpRestore", null);
-
- String snapshot_json = ctx.getAttribute(prefix);
- }
- } catch (Exception exc) {
- getLogger().warn("Failed restore - returning FAILURE", exc);
- return QueryStatus.FAILURE;
- }
- }
-
- return QueryStatus.NOT_FOUND;
- }
-
- protected Map<String, Object> objectToProperties(Object object) {
- ObjectMapper mapper = AAIService.getObjectMapper();
- return mapper.convertValue(object, Map.class);
- }
-
- static <T> T valueOf(Class<T> klazz, String arg) {
- Exception cause = null;
- T ret = null;
- try {
- ret = klazz.cast(klazz.getDeclaredMethod("valueOf", String.class).invoke(null, arg));
- } catch (NoSuchMethodException exc) {
- LoggerFactory.getLogger(AAIService.class).warn("Wrong data type", exc);
- ret = klazz.cast(arg);
- } catch (IllegalAccessException e) {
- cause = e;
- } catch (InvocationTargetException e) {
- cause = e;
- }
- if (cause == null) {
- return ret;
- } else {
- throw new IllegalArgumentException(cause);
- }
- }
-
- private QueryStatus processDeleteRelationshipList(String resource, String key, SvcLogicContext ctx, HashMap<String, String> nameValues) {
- try {
- AAIRequest request = AAIRequest.createRequest(resource, nameValues);
- if(request == null) {
- return QueryStatus.FAILURE;
- }
-
- request.processRequestPathValues(nameValues);
- URL url = request.getRequestUrl("GET", null);
-
- Class resourceClass = request.getModelClass();
- Object instance = getResource(url.toString(), resourceClass);
- if(instance == null)
- return QueryStatus.NOT_FOUND;
-
- // get resource version
- String resourceVersion = null;
- Method getResourceVersionMethod = resourceClass.getMethod("getResourceVersion");
- if(getResourceVersionMethod != null){
- try {
- getResourceVersionMethod.setAccessible(true);
- Object object = getResourceVersionMethod.invoke(instance);
- if(object != null)
- resourceVersion = object.toString();
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- }
- }
-
- RelationshipList relationshipList = null;
- Object obj = null;
- Method getRelationshipListMethod = null;
- try {
- getRelationshipListMethod = resourceClass.getMethod("getRelationshipList");
- } catch(Exception exc) {
- getLogger().debug("Retrofiting relationship data: " + exc.getMessage());
- }
- if(getRelationshipListMethod != null){
- try {
- getRelationshipListMethod.setAccessible(true);
- obj = getRelationshipListMethod.invoke(instance);
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- }
- }
- if(obj != null && obj instanceof RelationshipList){
- relationshipList = (RelationshipList)obj;
- } else {
- getLogger().debug("No relationships found to process.");
- return QueryStatus.NOT_FOUND;
- }
-
- if(relationshipList.getRelationship() == null || relationshipList.getRelationship().isEmpty()) {
- return QueryStatus.NOT_FOUND;
- }
- String relatedTo = nameValues.get("related_to");
- if(relatedTo == null) {
- return QueryStatus.FAILURE;
- }
-
- 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>();
-
- for(Relationship relationship : relationships) {
- if(relatedTo.equals(relationship.getRelatedTo())) {
- if(relatedLink != null) {
- 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;
- }
-
- String path = url.toString();
- path = path + "/relationship-list/relationship";
- URL deleteUrl = new URL(path);
-
- ObjectMapper mapper = AAIService.getObjectMapper();
-
- boolean cumulativeResponse = true;
-
- for(Relationship targetRelationship : relationshipsToDelete) {
- String json_text = mapper.writeValueAsString(targetRelationship);
- boolean response = deleteRelationshipList(deleteUrl, json_text);
- if(!response)
- cumulativeResponse = response;
-
- }
-
- if(!cumulativeResponse)
- return QueryStatus.FAILURE;
-
- return QueryStatus.SUCCESS;
-
- } catch(Exception exc) {
- getLogger().warn("processDelete", exc);
- return QueryStatus.FAILURE;
- }
- }
-
- static final Map<String, String> ctxGetBeginsWith( SvcLogicContext ctx, String prefix ) {
- Map<String, String> tmpPrefixMap = new HashMap<>();
-
- if(prefix == null || prefix.isEmpty()){
- return tmpPrefixMap;
- }
-
- for( String key : ctx.getAttributeKeySet() ) {
- if( key.startsWith(prefix) ) {
- String tmpKey = key.substring(prefix.length() + 1);
- tmpPrefixMap.put( tmpKey, ctx.getAttribute(key));
- }
- }
-
- Map<String, String> prefixMap = new HashMap<>();
- Pattern p = Pattern.compile(".*\\[\\d\\]");
-
- SortedSet<String> keys = new TreeSet(tmpPrefixMap.keySet () );
- for(String key : keys) {
- Matcher m = p.matcher(key);
- if(m.matches()) {
- continue;
- } else if(key.endsWith("_length")) {
- String listKey = key.substring(0, key.indexOf("_length"));
- int max = Integer.parseInt(tmpPrefixMap.get(key));
-
- ArrayList<String> data = new ArrayList<>();
- for(int x = 0; x < max; x++){
- String tmpKey = String.format("%s[%d]", listKey, x);
- String tmpValue = tmpPrefixMap.get(tmpKey);
- if(tmpValue != null && !tmpValue.isEmpty()) {
- data.add(tmpValue);
- }
- }
- if(!data.isEmpty()) {
- prefixMap.put(listKey, data.toString());
- } else {
- prefixMap.put(key, tmpPrefixMap.get(key));
- }
- } else {
- prefixMap.put(key, tmpPrefixMap.get(key));
- }
- }
-
- return prefixMap;
- }
-
- /**
- */
- protected NamedQueryData extractNamedQueryDataFromQueryPrefix(HashMap<String, String> nameValues, Map<String, String> parms) {
- if(parms.isEmpty()) {
- return null;
- }
-
- NamedQueryData data = new NamedQueryData();
-
- // query parameters
- if(data.getQueryParameters() == null) {
- data.setQueryParameters(new QueryParameters());
- }
- String namedQueryUuid = nameValues.get("named-query-uuid".replaceAll("-", "_"));
- if(namedQueryUuid == null) {
- namedQueryUuid = parms.get("query-parameters.named-query.named-query-uuid");
- }
- NamedQuery namedQuery = new NamedQuery();
- namedQuery.setNamedQueryUuid(namedQueryUuid);
- data.getQueryParameters().setNamedQuery(namedQuery);
-
- // instance filters
- if(data.getInstanceFilters() == null) {
- data.setInstanceFilters(new InstanceFilters());
- }
-
-
- String quantity = parms.get("instance-filters.instance-filter_length");
- if(quantity != null && StringUtils.isNumeric(quantity)) {
- int max = Integer.parseInt(quantity);
- for(int i = 0; i < max; i++) {
- String keyPattern = String.format("instance-filters.instance-filter[%d].", i);
- Set<String> keys = parms.keySet();
- for(String key: keys) {
- if(key.startsWith(keyPattern)){
- String value = parms.get(key);
- String remainder = key.substring(keyPattern.length());
- String[] split = remainder.split("\\.");
- getLogger().debug(String.format("%s", remainder));
- if("logical-link".equals(split[0])) {
- InstanceFilter insf = null;
- if(data.getInstanceFilters().getInstanceFilter().isEmpty()) {
- insf = new InstanceFilter();
- data.getInstanceFilters().getInstanceFilter().add(insf);
- } else {
- insf = data.getInstanceFilters().getInstanceFilter().get(0);
- }
- LogicalLink logicalLink = insf.getLogicalLink();
- if(logicalLink == null) {
- logicalLink = new LogicalLink();
- insf.setLogicalLink(logicalLink);
- }
-
- switch(split[1]) {
- case "link-name":
- logicalLink.setLinkName(value);
- break;
- case "link-type":
- logicalLink.setLinkType(value);
- break;
- case "operational-state":
- logicalLink.setOperationalStatus(value);
- break;
- }
-
- } else if("pnf".equals(split[0])) {
- Pnf pnf = new Pnf();
- pnf.setPnfName(value);
-
- InstanceFilter insf = new InstanceFilter();
- insf.setPnf(pnf);
- data.getInstanceFilters().getInstanceFilter().add(insf);
-
- } else if("service-instance".equals(split[0])) {
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId(value);
-
- InstanceFilter insf = new InstanceFilter();
- insf.setServiceInstance(serviceInstance);
- data.getInstanceFilters().getInstanceFilter().add(insf);
-
- } else if("l3-network".equals(split[0])) {
- L3Network l3Network = new L3Network();
- if("network-role".equals(split[1])) {
- l3Network.setNetworkRole(value);
- }
-
- InstanceFilter insf = new InstanceFilter();
- insf.setL3Network(l3Network);
- data.getInstanceFilters().getInstanceFilter().add(insf);
- }
- }
- }
- }
- }
-
- return data;
- }
-
- public abstract <T> T getResource(String key, Class<T> type) throws AAIServiceException ;
- protected abstract boolean deleteRelationshipList(URL url, String caller) throws AAIServiceException;
+ // node query (1602)
+ public static final String QUERY_NODES_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.nodes";
+
+
+ protected abstract Logger getLogger();
+ public abstract AAIRequestExecutor getExecutor();
+
+
+ @Override
+ public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx)
+ throws SvcLogicException {
+
+ getLogger().debug("AAIService.query \tresource = "+resource);
+
+ String vnfId;
+ String vnfName = null;
+ HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
+ getLogger().debug("key = "+ nameValues.toString());
+
+ if(!AAIServiceUtils.isValidFormat(resource, nameValues)) {
+ ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource));
+ return QueryStatus.FAILURE;
+ }
+
+ if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) {
+ ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource));
+ return QueryStatus.FAILURE;
+ }
+
+ // process data using new model
+ boolean useNewModelProcessing = true;
+ // process server query by name the old way
+ if("vserver".equals(resource) || "vserver2".equals(resource)){
+ if(nameValues.containsKey("vserver_name") || nameValues.containsKey("vserver-name") || nameValues.containsKey("vserver.vserver_name") || nameValues.containsKey("vserver.vserver-name"))
+ useNewModelProcessing = false;
+ }
+ if("generic-vnf".equals(resource)){
+ if(nameValues.containsKey("vnf_name") || nameValues.containsKey("vnf-name") || nameValues.containsKey("generic_vnf.vnf_name") || nameValues.containsKey("generic-vnf.vnf-name"))
+ useNewModelProcessing = false;
+ }
+
+ // process data using new model
+ if(useNewModelProcessing && AAIRequest.createRequest(resource, nameValues) != null) {
+
+ try {
+ return newModelQuery(resource, localOnly, select, key, prefix, orderBy, ctx);
+ } catch (Exception exc) {
+ getLogger().warn("Failed query - returning FAILURE", exc);
+ return QueryStatus.FAILURE;
+ }
+ }
+
+ ObjectMapper mapper = AAIService.getObjectMapper();
+ Map<String,Object> attributes = new HashMap<>();
+
+ String modifier = null;
+
+ if(resource.contains(":")) {
+ String[] tokens = resource.split(":");
+ resource = tokens[0];
+ if(tokens.length > 1) {
+ modifier = tokens[1];
+ }
+ }
+
+ resource = resource.toLowerCase().replace("-", "_");
+
+ try {
+
+ switch(resource) {
+ case "generic_vnf":
+ vnfId = nameValues.get("vnf_id");
+ if(nameValues.containsKey("vnf_id"))
+ vnfId = nameValues.get("vnf_id");
+ else if(nameValues.containsKey("generic_vnf.vnf_name"))
+ vnfId = nameValues.get("generic_vnf.vserver_name");
+
+ if(nameValues.containsKey("vnf_name"))
+ vnfName = nameValues.get("vnf_name");
+ else if(nameValues.containsKey("generic_vnf.vnf_name"))
+ vnfName = nameValues.get("generic_vnf.vnf_name");
+
+ if(vnfId != null && !vnfId.isEmpty()) {
+ // at this point of the project this part should not be executed
+ vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", "");
+ GenericVnf vnf = this.requestGenericVnfData(vnfId);
+ if(vnf == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+
+ attributes = mapper.convertValue(vnf, attributes.getClass());
+ } else if(vnfName != null && !vnfName.isEmpty()) {
+ try {
+ vnfName = vnfName.trim().replace("'", "").replace("$", "").replace("'", "");
+ GenericVnf vnf = this.requestGenericVnfeNodeQuery(vnfName);
+ if(vnf == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+ vnfId=vnf.getVnfId();
+ nameValues.put("vnf_id", vnfId);
+ attributes = mapper.convertValue(vnf, attributes.getClass());
+ } catch (AAIServiceException exc) {
+ int errorCode = exc.getReturnCode();
+ switch(errorCode) {
+ case 400:
+ case 404:
+ case 412:
+ break;
+ default:
+ getLogger().warn("Caught exception trying to refresh generic VNF", exc);
+ }
+ ctx.setAttribute(prefix + ".error.message", exc.getMessage());
+ if(errorCode >= 300) {
+ ctx.setAttribute(prefix + ".error.http.response-code",
+ Integer.toString(exc.getReturnCode()));
+ }
+ return QueryStatus.FAILURE;
+ }
+ } else {
+ getLogger().warn("No arguments are available to process generic VNF");
+ return QueryStatus.FAILURE;
+ }
+ break;
+ case "vserver":
+ case "vserver2":
+ String vserverName = null;
+ if(nameValues.containsKey("vserver_name"))
+ vserverName = nameValues.get("vserver_name");
+ else if(nameValues.containsKey("vserver.vserver_name"))
+ vserverName = nameValues.get("vserver.vserver_name");
+
+ String vserverId = null;
+ if(nameValues.containsKey("vserver_id"))
+ vserverId = nameValues.get("vserver_id");
+ if(nameValues.containsKey("vserver.vserver_id"))
+ vserverId = nameValues.get("vserver.vserver_id");
+ String tenantId = nameValues.get("teannt_id");
+
+ if(vserverName != null) vserverName = vserverName.trim().replace("'", "").replace("$", "").replace("'", "");
+ if(vserverId != null) vserverId = vserverId.trim().replace("'", "").replace("$", "").replace("'", "");
+ if(tenantId != null) tenantId = tenantId.trim().replace("'", "").replace("$", "").replace("'", "");
+
+ if (vserverName != null) {
+ URL vserverUrl = null;
+ try {
+ vserverUrl = this.requestVserverURLNodeQuery(vserverName);
+ } catch (AAIServiceException aaiexc) {
+ ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage());
+ if (aaiexc.getReturnCode() >= 300) {
+ ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode());
+ }
+
+ if (aaiexc.getReturnCode() == 404)
+ return QueryStatus.NOT_FOUND;
+ else
+ return QueryStatus.FAILURE;
+ }
+ if (vserverUrl == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+
+ tenantId = getTenantIdFromVserverUrl(vserverUrl);
+ String cloudOwner = getCloudOwnerFromVserverUrl(vserverUrl);
+ String cloudRegionId = getCloudRegionFromVserverUrl(vserverUrl);
+
+ Vserver vserver = null;
+ try {
+ vserver = this.requestVServerDataByURL(vserverUrl);
+ } catch (AAIServiceException aaiexc) {
+ ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage());
+ if (aaiexc.getReturnCode() >= 300) {
+ ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode());
+ }
+
+ if (aaiexc.getReturnCode() == 404)
+ return QueryStatus.NOT_FOUND;
+ else
+ return QueryStatus.FAILURE;
+ }
+ if (vserver == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+ attributes = mapper.convertValue(vserver, attributes.getClass());
+ if (!attributes.containsKey("tenant-id") && tenantId != null) {
+ attributes.put("tenant-id", tenantId);
+ }
+ if (!attributes.containsKey("cloud-owner") && cloudOwner != null) {
+ attributes.put("cloud-owner", cloudOwner);
+ }
+ if (!attributes.containsKey("cloud-region-id") && cloudRegionId != null) {
+ attributes.put("cloud-region-id", cloudRegionId);
+ }
+ } else if (vserverId != null && tenantId != null) {
+ Vserver vserver = this.requestVServerData(tenantId, vserverId, "att-aic", "AAIAIC25");
+ if(vserver == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+ attributes = mapper.convertValue(vserver, attributes.getClass());
+ if(!attributes.containsKey("tenant-id") && tenantId != null){
+ attributes.put("tenant-id", tenantId);
+ }
+ } else {
+ return QueryStatus.FAILURE;
+ }
+ break;
+
+ default:
+ return QueryStatus.FAILURE;
+ }
+
+ QueryStatus retval = QueryStatus.SUCCESS;
+
+ if (attributes == null || attributes.isEmpty()) {
+ retval = QueryStatus.NOT_FOUND;
+ getLogger().debug("No data found");
+ } else {
+ if (ctx != null) {
+ if (prefix != null) {
+ ArrayList<String> keys = new ArrayList<>(attributes.keySet());
+
+ int numCols = keys.size();
+
+ for (int i = 0; i < numCols; i++) {
+ String colValue;
+ String colName = keys.get(i);
+ Object object = attributes.get(colName);
+
+ if(object != null && object instanceof String) {
+ colValue = (String)object;
+
+ if (prefix != null) {
+ getLogger().debug("Setting "+prefix + "." + colName.replaceAll("_", "-")+" = "+ colValue);
+ ctx.setAttribute(prefix + "." + colName.replaceAll("_", "-"), colValue);
+ } else {
+ getLogger().debug("Setting " + colValue.replaceAll("_", "-")+" = "+colValue);
+ ctx.setAttribute(colValue.replaceAll("_", "-"), colValue);
+ }
+ } else if(object != null && object instanceof Map) {
+ if(colName.equals(modifier) || "relationship-list".equals(colName)){
+ String localNodifier = modifier;
+ if(localNodifier == null)
+ localNodifier = "relationship-list";
+ Map<String, Object> properties = (Map<String, Object>)object;
+ writeMap(properties, prefix+"."+localNodifier, ctx);
+ }
+ }
+ }
+ }
+ }
+ }
+ getLogger().debug("Query - returning " + retval);
+ return retval;
+
+ } catch (Exception exc) {
+ getLogger().warn("Failed query - returning FAILURE", exc);
+ return QueryStatus.FAILURE;
+ }
+
+// return QueryStatus.SUCCESS;
+ }
+
+
+ public void writeMap(Map<String, Object> properties, String prefix, SvcLogicContext ctx) {
+ Set<String> mapKeys = properties.keySet();
+
+ for(String mapKey : mapKeys) {
+ Object entity = properties.get(mapKey);
+ if(entity instanceof ArrayList) {
+ writeList((ArrayList<?>)entity, prefix + "." + mapKey, ctx);
+ } else
+ if(entity instanceof String || entity instanceof Long || entity instanceof Integer || entity instanceof Boolean) {
+ ctx.setAttribute(prefix + "." + mapKey, entity.toString());
+ getLogger().debug(prefix + "." + mapKey + " : " + entity.toString());
+ } else if(entity instanceof Map) {
+ String localPrefix = prefix;
+ if(mapKey != null) {
+ localPrefix = String.format("%s.%s", prefix, mapKey);
+ }
+ writeMap( (Map<String, Object>)entity, localPrefix, ctx);
+ }
+ }
+ }
+
+ private void writeList(ArrayList<?> list, String prefix, SvcLogicContext ctx) {
+ for(int i = 0; i < list.size(); i++ ) {
+ Object entity = list.get(i);
+ if(entity instanceof Map) {
+ writeMap( (Map<String, Object>)entity, prefix + "[" + i + "]", ctx);
+ } else
+ if(entity instanceof String || entity instanceof Long || entity instanceof Integer || entity instanceof Boolean) {
+ ctx.setAttribute(prefix, entity.toString());
+ getLogger().debug(prefix + " : " + entity.toString());
+ }
+ }
+
+ if(!list.isEmpty()) {
+ ctx.setAttribute(prefix + "_length", Integer.toString(list.size()));
+ getLogger().debug(prefix + "_length" + " : " + Integer.toString(list.size()));
+ }
+ }
+
+ @Override
+ public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map<String, String> params, String prefix, SvcLogicContext ctx)
+ throws SvcLogicException {
+
+ getLogger().debug("AAIService.save\tresource="+resource);
+ HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
+
+ if(!AAIServiceUtils.isValidFormat(resource, nameValues)) {
+ ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource));
+ return QueryStatus.FAILURE;
+ }
+
+ if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) {
+ getLogger().warn("AAIService.save has unspecified resource");
+ ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource));
+ return QueryStatus.FAILURE;
+ }
+ // keys passed
+ getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray()));
+
+ // process params
+ if(params.containsKey("prefix")) {
+ Map<String, String> tmpParams = ctxGetBeginsWith(ctx, params.get("prefix"));
+ if(!tmpParams.isEmpty()) {
+ params.putAll(tmpParams);
+// params.remove("prefix");
+ }
+ }
+ // params passed
+ getLogger().debug("parms = "+ Arrays.toString(params.entrySet().toArray()));
+
+ boolean useNewModelProcessing = true;
+ // process server query by name the old way
+ if("vserver".equals(resource) || "vserver2".equals(resource)){
+ if(nameValues.containsKey("vserver-name")) {
+ useNewModelProcessing = false;
+ }
+
+ if(!params.containsKey("vserver-selflink")) {
+
+ AAIRequest request = AAIRequest.createRequest(resource, nameValues);
+ URL path = null;
+ try {
+ request.processRequestPathValues(nameValues);
+ path = request.getRequestUrl("GET", null);
+ params.put("vserver-selflink", path.toString());
+ } catch (UnsupportedEncodingException | MalformedURLException e) {
+ // TODO : Fix this
+ params.put("vserver-selflink", "/vserver");
+ }
+ }
+ }
+
+ // process data using new model
+ if(useNewModelProcessing && AAIRequest.createRequest(resource, nameValues) != null) {
+
+ try {
+ if(!resource.contains(":")){
+ return newModelSave(resource, force, key, params, prefix, ctx);
+ } else {
+ String[] tokens = resource.split(":");
+ String localResource = tokens[0];
+ String dependency = tokens[1];
+
+ AAIDatum instance = newModelObjectRequest( localResource, nameValues, prefix, ctx);
+ if(instance == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+
+ switch(dependency){
+ case "relationship-list":
+ newModelProcessRelationshipList(instance, params, prefix, ctx);
+ break;
+ }
+ // create a method to update relationship-list
+ AAIRequest request = AAIRequest.createRequest(localResource, nameValues);
+ request.setRequestObject(instance);
+ request.processRequestPathValues(nameValues);
+
+ getExecutor().post(request);
+ getLogger().debug("Save relationship list - returning SUCCESS");
+ return QueryStatus.SUCCESS;
+ }
+ } catch (Exception exc) {
+ ctx.setAttribute(prefix + ".error.message", exc.getMessage());
+ if(exc instanceof AAIServiceException) {
+ AAIServiceException aaiexc = (AAIServiceException)exc;
+ if(aaiexc.getReturnCode() >= 300) {
+ ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode());
+ }
+
+ if(aaiexc.getReturnCode() == 404) {
+ return QueryStatus.NOT_FOUND;
+ }
+ }
+ getLogger().warn("Failed save() - returning FAILURE", exc);
+ return QueryStatus.FAILURE;
+ }
+ } else {
+ String reSource = resource.toLowerCase().replace("-", "_");
+ String vnfId;
+
+ try {
+ switch(reSource) {
+ case "generic_vnf":
+ case "generic-vnf":
+ vnfId = nameValues.get("vnf_id");
+ if(vnfId == null) {
+ getLogger().debug("Save(generic-vnf) with no vnf-id specified. Returning FAILURE");
+ return QueryStatus.FAILURE;
+ }
+ vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", "");
+ GenericVnf vnf = this.requestGenericVnfData(vnfId);
+ String status = params.get("prov-status");
+ boolean updated = false;
+ if(status != null && !status.isEmpty()) {
+ vnf.setProvStatus(status);
+ }
+ if(updated) {
+ this.postGenericVnfData(vnfId, vnf);
+ }
+ break;
+ case "vpe":
+ return update( resource, key, params, prefix, ctx) ;
+
+ default:
+ getLogger().debug("Save() executing default path - returning FAILURE");
+ return QueryStatus.FAILURE;
+ }
+ } catch (Exception exc) {
+ getLogger().warn("Failed save - returning FAILURE", exc);
+ ctx.setAttribute(prefix + ".error.message", exc.getMessage());
+ return QueryStatus.FAILURE;
+ }
+ }
+
+ getLogger().debug("Save - returning SUCCESS");
+ return QueryStatus.SUCCESS;
+ }
+
+ @Override
+ public QueryStatus update(String resource, String key, Map<String, String> params, String prefix, SvcLogicContext ctx) throws SvcLogicException {
+
+ resource = resource.toLowerCase();
+ HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
+ getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray()));
+ if(!AAIServiceUtils.isValidFormat(resource, nameValues)) {
+ ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource));
+ return QueryStatus.FAILURE;
+ }
+
+ if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) {
+ ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not supported", resource));
+ return QueryStatus.FAILURE;
+ }
+
+ // check if request is for groups
+ if(!AAIServiceUtils.containsResource(resource, nameValues)) {
+ ctx.setAttribute(String.format("%s.error.message", prefix), String.format("Resource %s is not permitted in 'update' operation", resource));
+ return QueryStatus.FAILURE;
+ }
+
+ getLogger().debug("parms = "+ Arrays.toString(params.entrySet().toArray()));
+
+ AAIRequest request = AAIRequest.createRequest(resource, nameValues);
+ request = new UpdateRequest(request, params);
+
+ String[] arguments = request.getArgsList();
+ for(String name : arguments) {
+ String modifiedKey = name.replaceAll("-", "_");
+ if(nameValues.containsKey(modifiedKey)) {
+ String argValue = nameValues.get(modifiedKey);
+ if(argValue != null) argValue = argValue.trim().replace("'", "").replace("$", "").replace("'", "");
+ request.addRequestProperty(name, argValue);
+ }
+ }
+
+ try {
+ QueryStatus retval = QueryStatus.SUCCESS;
+
+ retval = newModelQuery(resource, false, null, key, "tmpDelete", null, ctx);
+
+ if(retval == null || retval != QueryStatus.SUCCESS) {
+ return retval;
+ }
+
+ String resourceVersion = ctx.getAttribute("tmpDelete.resource-version");
+ if(resourceVersion == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+ params.put("resource-version", resourceVersion);
+
+ request.processRequestPathValues(nameValues);
+ getExecutor().patch(request, resourceVersion);
+ } catch(AAIServiceException aaiexc) {
+ if(aaiexc.getReturnCode() == 404)
+ return QueryStatus.NOT_FOUND;
+ else
+ return QueryStatus.FAILURE;
+ } catch (Exception exc) {
+ getLogger().warn("Failed update - returning FAILURE", exc);
+ return QueryStatus.FAILURE;
+ }
+
+ getLogger().debug("Update - returning SUCCESS");
+ return QueryStatus.SUCCESS;
+ }
+
+ @Override
+ public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException {
+ getLogger().debug("AAIService.delete\tresource="+resource);
+ HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
+ getLogger().debug("key = "+ Arrays.toString(nameValues.entrySet().toArray()));
+
+ if(!AAIServiceUtils.isValidFormat(resource, nameValues)) {
+ ctx.setAttribute(String.format("%s.error.message", "aaiData"), String.format("Resource %s is not supported. Key string contains invaid identifiers", resource));
+ return QueryStatus.FAILURE;
+ }
+
+ if(resource == null || resource.isEmpty() || AAIRequest.createRequest(resource, nameValues) == null) {
+ ctx.setAttribute(String.format("%s.error.message", "tmpDelete"), String.format("Resource %s is not supported", resource));
+ return QueryStatus.FAILURE;
+ }
+
+ // check if request is for groups
+ if(!AAIServiceUtils.containsResource(resource, nameValues)) {
+ ctx.setAttribute(String.format("%s.error.message", "tmpDelete"), String.format("Resource %s is not permitted in 'delete' operation", resource));
+ return QueryStatus.FAILURE;
+ }
+
+ if(AAIRequest.createRequest(resource, nameValues) != null) {
+ if(resource.contains(":")) {
+ return processDeleteRelationshipList(resource, key, ctx, nameValues);
+ }
+
+
+ try {
+ QueryStatus retval = QueryStatus.SUCCESS;
+
+ retval = newModelQuery(resource, false, null, key, "tmpDelete", null, ctx);
+
+ if(retval == null || retval != QueryStatus.SUCCESS) {
+ return retval;
+ }
+
+ String resourceVersion = ctx.getAttribute("tmpDelete.resource-version");
+ if(resourceVersion == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+
+ try {
+ AAIRequest request = AAIRequest.createRequest(resource, nameValues);
+ if(request == null) {
+ return QueryStatus.FAILURE;
+ }
+
+ request.processRequestPathValues(nameValues);
+
+ if(getExecutor().delete(request, resourceVersion)) {
+ return QueryStatus.SUCCESS;
+ }
+ } catch(AAIServiceException aaiexc) {
+ if(aaiexc.getReturnCode() == 404)
+ return QueryStatus.NOT_FOUND;
+ else
+ return QueryStatus.FAILURE;
+
+ } catch (Exception exc) {
+ getLogger().warn("requestGenericVnfData", exc);
+ return QueryStatus.FAILURE;
+ }
+
+ } catch (Exception exc) {
+ getLogger().warn("Failed delete - returning FAILURE", exc);
+ return QueryStatus.FAILURE;
+ }
+ } else {
+ String resoourceName = resource;
+ String identifier = null;
+
+ if(resoourceName == null)
+ return QueryStatus.FAILURE;
+
+ if(resoourceName.contains(":")) {
+ String[] tokens = resoourceName.split(":");
+ if(tokens != null && tokens.length > 0) {
+ resoourceName = tokens[0];
+ identifier = tokens[1];
+ }
+ }
+ if("relationship-list".equals(identifier) || "relationshipList".equals(identifier)) {
+// RelationshipRequest relationshipRequest = new RelationshipRequest();
+ if("generic-vnf".equals(resoourceName)){
+ String vnfId = nameValues.get("vnf_id");
+ String relatedTo = nameValues.get("related_to");
+ vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", "");
+ relatedTo = relatedTo.trim().replace("'", "").replace("$", "").replace("'", "");
+
+ GenericVnf vnf;
+ try {
+ vnf = this.requestGenericVnfData(vnfId);
+ if(vnf == null)
+ return QueryStatus.NOT_FOUND;
+ } catch (AAIServiceException exc) {
+ getLogger().warn("Failed delete - returning NOT_FOUND", exc);
+ return QueryStatus.NOT_FOUND;
+ }
+ boolean itemRemoved = false;
+ RelationshipList relationshipList = vnf.getRelationshipList();
+ List<Relationship> relationships = relationshipList.getRelationship();
+ List<Relationship> iterableList = new LinkedList<Relationship>(relationships);
+ for(Relationship relationship : iterableList) {
+ if(relationship.getRelatedTo().equals(relatedTo)) {
+ relationships.remove(relationship);
+ itemRemoved = true;
+ }
+ }
+
+ if(!itemRemoved)
+ return QueryStatus.NOT_FOUND;
+
+// AAIRequest masterRequest = new GenericVnfRequest();
+// masterRequest.addRequestProperty(GenericVnfRequest.VNF_ID, vnfId);
+// relationshipRequest.addMasterRequest(masterRequest);
+// Map<String, String> attributes = objectToProperties(vnf);
+// try {
+// Boolean result = getExecutor().delete(relationshipRequest, attributes.get(AAIRequest.RESOURCE_VERSION));
+// } catch (AAIServiceException e) {
+// return QueryStatus.FAILURE;
+// }
+
+ try {
+ this.postGenericVnfData(vnf.getVnfId(), vnf);
+ } catch (AAIServiceException exc) {
+ if(exc.getReturnCode() == 404){
+ return QueryStatus.NOT_FOUND;
+ } else {
+ getLogger().warn("Failed delete - returning FAILURE", exc);
+ return QueryStatus.FAILURE;
+ }
+ }
+ return QueryStatus.SUCCESS;
+ }
+ }
+ }
+ return QueryStatus.FAILURE;
+ }
+
+ @Override
+ public QueryStatus exists(String resource, String key, String prefix, SvcLogicContext ctx) throws SvcLogicException {
+ return query(resource, false, null, key, prefix, null, ctx);
+ }
+
+ @Override
+ public QueryStatus isAvailable(String arg0, String arg1, String arg2, SvcLogicContext arg3)
+ throws SvcLogicException {
+ // TODO Auto-generated method stub
+ throw new SvcLogicException("Method AAIService.isAvailable() has not been implemented yet");
+ }
+
+ @Override
+ public QueryStatus notify(String resource, String action, String key, SvcLogicContext ctx) throws SvcLogicException {
+ // TODO Auto-generated method stub
+ throw new SvcLogicException("Method AAIService.notify() has not been implemented yet");
+ }
+
+// @Override
+ public QueryStatus newModelQuery(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx) {
+
+ Object response = null;
+ QueryStatus retval = QueryStatus.SUCCESS;
+ String modifier = null;
+
+ HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
+ if(resource.contains(":")) {
+ modifier = resource.split(":")[1];
+ }
+
+ try {
+ AAIRequest request = AAIRequest.createRequest(resource, nameValues);
+ if(request == null) {
+ return QueryStatus.FAILURE;
+ }
+
+ Map<String, String> params = new HashMap<>();
+
+ request.processRequestPathValues(nameValues);
+ if(nameValues.containsKey("prefix")){
+ Map<String, String> tmpParams = ctxGetBeginsWith(ctx, nameValues.get("prefix"));
+ if(!tmpParams.isEmpty()) {
+ params.putAll(tmpParams);
+ }
+ if("named-query".equals(resource))
+ request.setRequestObject(extractNamedQueryDataFromQueryPrefix(nameValues, params));
+ }
+ String rv = getExecutor().get(request);
+
+ retval = processResponseData(rv, resource, request, prefix, ctx, nameValues, modifier);
+
+ } catch(AAIServiceException aaiexc) {
+ int errorCode = aaiexc.getReturnCode();
+ ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage());
+ if(errorCode >= 300) {
+ ctx.setAttribute(prefix + ".error.http.response-code",
+ Integer.toString(aaiexc.getReturnCode()));
+ }
+
+ if(aaiexc.getReturnCode() == 404)
+ return QueryStatus.NOT_FOUND;
+
+ return QueryStatus.FAILURE;
+ } catch (Exception exc) {
+ getLogger().warn("requestGenericVnfData", exc);
+ ctx.setAttribute(prefix + ".error.message", exc.getMessage());
+ return QueryStatus.FAILURE;
+ }
+
+ return retval;
+ }
+
+ public QueryStatus processResponseData(String rv, String resource, AAIRequest request, String prefix, SvcLogicContext ctx, HashMap<String, String> nameValues, String modifier) throws JsonParseException, JsonMappingException, IOException, AAIServiceException
+ {
+ Object response;
+
+ if(rv == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+
+ response = request.jsonStringToObject(rv);
+ if(response == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+
+ if("generic-query".equals(resource)) {
+ SearchResults rd = SearchResults.class.cast(response);
+ List<ResultData> rdList = rd.getResultData();
+ if(rdList == null || rdList.isEmpty()) {
+ return QueryStatus.NOT_FOUND;
+ }
+ ResultData rDatum = rdList.get(0);
+ nameValues.put("selflink", rDatum.getResourceLink());
+ AAIRequest req2 = AAIRequest.createRequest(rDatum.getResourceType(), nameValues);
+ req2.processRequestPathValues(nameValues);
+ rv = getExecutor().get(req2);
+ if(rv == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+
+ response = req2.jsonStringToObject(rv);
+ if(response == null) {
+ return QueryStatus.NOT_FOUND;
+ }
+ }
+
+ if("named-query".equals(resource)) {
+ InventoryResponseItems rd = InventoryResponseItems.class.cast(response);
+ List<InventoryResponseItem> iRIlist = rd.getInventoryResponseItem();
+ if(iRIlist == null || iRIlist.isEmpty()) {
+ return QueryStatus.NOT_FOUND;
+ }
+ }
+
+ if("nodes-query".equals(resource)) {
+ SearchResults rd = SearchResults.class.cast(response);
+ List<ResultData> rdList = rd.getResultData();
+ if(rdList == null || rdList.isEmpty()) {
+ return QueryStatus.NOT_FOUND;
+ }
+ ResultData rDatum = rdList.get(0);
+ response = rDatum;
+ }
+
+ if("formatted-query".equals(resource) || "custom-query".equals(resource)) {
+ FormattedQueryResultList rd = FormattedQueryResultList.class.cast(response);
+ List<Result> iRIlist = rd.getResults();
+ if(iRIlist == null || iRIlist.isEmpty()) {
+ return QueryStatus.NOT_FOUND;
+ }
+ }
+
+ // process relationship list
+ // this is a temporary soluton to address the realationship handling changes added in Release 17.07
+ try {
+ Class<?> clazz = response.getClass();
+ Method getter = clazz.getMethod("getRelationshipList");
+ Object obj = getter.invoke(response);
+ if(obj != null && obj instanceof RelationshipList) {
+ RelationshipList list = RelationshipList.class.cast(obj);
+ AAIServiceUtils.populateRelationshipDataFromPath(list);
+ }
+ } catch(Exception exc) {
+ getLogger().debug("Retrofiting relationship data: " + exc.getMessage());
+ }
+
+ String preFix;
+ if(prefix == null || prefix.isEmpty()) {
+ preFix = "";
+ } else {
+ preFix = prefix + ".";
+ }
+
+ Map<String,Object> props = objectToProperties(response);
+ Set<String> keys = props.keySet();
+ for(String theKey: keys) {
+ if(getLogger().isTraceEnabled())
+ getLogger().trace(theKey);
+
+ Object value = props.get(theKey);
+ if(value == null)
+ continue;
+ Object type = value.getClass();
+ if(value instanceof String) {
+ ctx.setAttribute(preFix + theKey, value.toString());
+ continue;
+ }
+ if(value instanceof Boolean) {
+ ctx.setAttribute(preFix + theKey, value.toString());
+ continue;
+ }
+ if(value instanceof Integer) {
+ ctx.setAttribute(preFix + theKey, value.toString());
+ continue;
+ }
+ if(value instanceof Long) {
+ ctx.setAttribute(preFix + theKey, value.toString());
+ continue;
+ }
+
+ if(value instanceof ArrayList) {
+ ArrayList<?> array = ArrayList.class.cast(value);
+ for(int i = 0; i < array.size(); i++) {
+ writeList(array, String.format("%s.%s", prefix, theKey), ctx);
+ }
+ continue;
+ }
+
+ if("relationship-list".equals(theKey)){
+ Map<String, Object> relationshipList = (Map<String, Object>)value;
+ // we are interested in seeing just the selected relationship
+ if(theKey.equals(modifier)) {
+ List<?> relationships = (List<?>)relationshipList.get("relationship");
+ if(relationships != null && !relationships.isEmpty()) {
+
+ List newRelationships = new LinkedList();
+ newRelationships.addAll(relationships);
+
+ for(Object obj : newRelationships){
+ if(obj instanceof Map<?, ?>) {
+ Map<?, ?> relProperties = (Map<?, ?>)obj;
+ if(relProperties.containsKey("related-to")) {
+ Object relPropsRelatedTo = relProperties.get("related-to");
+
+ String relatedTo = nameValues.get("related_to");
+ if(relatedTo != null) {
+ relatedTo = relatedTo.trim().replace("'", "").replace("$", "").replace("'", "");
+ if(!relatedTo.equals(relPropsRelatedTo)) {
+ relationships.remove(relProperties);
+ }
+ continue;
+ } else {
+ continue;
+ }
+ }
+ }
+ }
+ }
+ }
+ writeMap(relationshipList, String.format("%s.%s", prefix, theKey), ctx);
+ continue;
+ }
+
+ if(value instanceof Map) {
+ Map<String, Object> subnetsList = (Map<String, Object>)value;
+ writeMap(subnetsList, String.format("%s.%s", prefix, theKey), ctx);
+ continue;
+ }
+
+ }
+ return QueryStatus.SUCCESS;
+ }
+
+
+ public QueryStatus newModelBackupRequest(String resource, Map<String, String> params, String prefix, SvcLogicContext ctx) {
+
+ QueryStatus retval = QueryStatus.SUCCESS;
+ HashMap<String, String> nameValues = new HashMap<>();
+
+ try {
+ AAIRequest request = AAIRequest.createRequest(resource, nameValues);
+ if(request == null) {
+ return QueryStatus.FAILURE;
+ }
+
+ boolean argsFound = false;
+ String[] arguments = request.getArgsList();
+ for(String name : arguments) {
+ String tmpName = name.replaceAll("-", "_");
+ String value = params.get(tmpName);
+ if(value != null && !value.isEmpty()) {
+ value = value.trim().replace("'", "").replace("$", "").replace("'", "");
+ request.addRequestProperty(name, value);
+ argsFound = true;
+ }
+ }
+ if(!argsFound) {
+ getLogger().warn("No arguments were found. Terminating backup request.");
+ return QueryStatus.FAILURE;
+ }
+
+ String rv = getExecutor().get(request);
+ ctx.setAttribute(prefix, rv);
+ } catch(AAIServiceException aaiexc) {
+ if(aaiexc.getReturnCode() == 404)
+ return QueryStatus.NOT_FOUND;
+
+ return QueryStatus.FAILURE;
+ } catch (Exception exc) {
+ getLogger().warn("newModelBackupRequest", exc);
+ return QueryStatus.FAILURE;
+ }
+
+ return retval;
+ }
+
+ public AAIDatum newModelObjectRequest(String resource, Map<String, String> params, String prefix, SvcLogicContext ctx)
+ throws AAIServiceException {
+
+ AAIDatum response = null;
+
+ try {
+ AAIRequest request = AAIRequest.createRequest(resource, params);
+ if(request == null) {
+ return null;
+ }
+
+ request.processRequestPathValues(params);
+ String rv = getExecutor().get(request);
+ response = request.jsonStringToObject(rv);
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ getLogger().warn("newModelBackupRequest", exc);
+ throw new AAIServiceException(exc);
+ }
+
+ return response;
+ }
+
+
+ @Override
+ public QueryStatus release(String arg0, String arg1, SvcLogicContext arg2) throws SvcLogicException {
+ // TODO Auto-generated method stub
+ throw new SvcLogicException("Method AAIService.release() has not been implemented yet");
+ }
+
+ @Override
+ public QueryStatus reserve(String arg0, String arg1, String arg2, String arg3, SvcLogicContext arg4)
+ throws SvcLogicException {
+ // TODO Auto-generated method stub
+ throw new SvcLogicException("Method AAIService.reserve() has not been implemented yet");
+ }
+
+ private QueryStatus newModelSave(String resource, boolean force, String key, Map<String, String> params, String prefix, SvcLogicContext ctx) {
+ getLogger().debug("Executing newModelSave for resource : " + resource);
+ HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
+
+ try {
+ ArrayList<String> subResources = new ArrayList<>();
+ Set<String> set = params.keySet();
+ Map<String, Method> setters = new HashMap<>();
+ Map<String, Method> getters = new HashMap<>();
+
+ // 1. find class
+ AAIRequest request = AAIRequest.createRequest(resource, nameValues);
+ Class<? extends AAIDatum> resourceClass = request.getModelClass();
+ getLogger().debug(resourceClass.getName());
+ AAIDatum instance = resourceClass.newInstance();
+
+ {
+ Annotation[] annotations = resourceClass.getAnnotations();
+ for(Annotation annotation : annotations) {
+ Class<? extends Annotation> anotationType = annotation.annotationType();
+ String annotationName = anotationType.getName();
+
+ // 2. find string property setters and getters for the lists
+ if("javax.xml.bind.annotation.XmlType".equals(annotationName)){
+ XmlType order = (XmlType)annotation;
+ String[] values = order.propOrder();
+ for(String value : values) {
+ String id = AAIServiceUtils.camelCaseToDashedString(value);
+ Field field = resourceClass.getDeclaredField(value);
+ Class<?> type = field.getType();
+ Method setter = null;
+ try {
+ setter = resourceClass.getMethod("set"+StringUtils.capitalize(value), type);
+ if(type.getName().startsWith("java.lang") || "boolean".equals(type.getName()) || "long".equals(type.getName())) {
+ try {
+ setter.setAccessible(true);
+ Object arglist[] = new Object[1];
+ arglist[0] = params.get(id);
+
+ if(arglist[0] != null) {
+ if(!type.getName().equals("java.lang.String")) {
+// getLogger().debug(String.format("Processing %s with parameter %s", types[0].getName(), value));
+ if("boolean".equals(type.getName())) {
+ arglist[0] = valueOf(Boolean.class, params.get(id));
+ } else if("long".equals(type.getName())) {
+ arglist[0] = valueOf(Long.class, params.get(id));
+ } else {
+ arglist[0] = valueOf(type, params.get(id));
+ }
+ }
+ Object o = setter.invoke(instance, arglist);
+ }
+ set.remove(id);
+
+ } catch (Exception x) {
+ Throwable cause = x.getCause();
+ getLogger().warn("Failed process for " + resourceClass.getName(), x);
+ }
+ } else if(type.getName().equals("java.util.List")) {
+ List<String> newValues = new ArrayList<>();
+ String length = id+"_length";
+ if(!params.isEmpty() && params.containsKey(length)) {
+ String tmp = params.get(length).toString();
+ int count = Integer.parseInt(tmp);
+ for(int i=0; i<count; i++) {
+ String tmpValue = params.get(String.format("%s[%d]", id, i));
+ newValues.add(tmpValue);
+ }
+ if(!newValues.isEmpty()) {
+ Object o = setter.invoke(instance, newValues);
+ }
+ }
+ set.remove(id);
+ } else {
+ setters.put(id, setter);
+ }
+ } catch(Exception exc) {
+
+ }
+
+ Method getter;
+ try {
+ getter = resourceClass.getMethod("get"+StringUtils.capitalize(value));
+ if(!type.getName().equals("java.lang.String")) {
+ getters.put(id, getter);
+ }
+ } catch(Exception exc) {
+
+ }
+
+ }
+ subResources.addAll(Arrays.asList(values));
+ }
+ }
+ }
+
+ // remove getters that have matching setter
+ for(String setKey : setters.keySet()) {
+ if(getters.containsKey(setKey)) {
+ getters.remove(setKey);
+ }
+ }
+
+ Set<String> relationshipKeys = new TreeSet<>();
+ Set<String> vlansKeys = new TreeSet<>();
+ Set<String> metadataKeys = new TreeSet<>();
+
+ for(String attribute : set) {
+ String value = params.get(attribute);
+ if(attribute.startsWith("relationship-list")) {
+ relationshipKeys.add(attribute);
+ } else if(attribute.startsWith("vlans")) {
+ vlansKeys.add(attribute);
+ } else if(attribute.startsWith("metadata")) {
+ metadataKeys.add(attribute);
+ }
+ }
+ // 3. find list property getters
+ for(String attribute : set) {
+ String value = params.get(attribute);
+ Method method = getters.get(attribute);
+ if(method != null) {
+ try {
+ method.setAccessible(true);
+ Object arglist[] = new Object[0];
+// arglist[0] = value;
+ Class<?>[] types = method.getParameterTypes();
+ if(types.length == 0){
+ Object o = method.invoke(instance, arglist);
+ if(o instanceof ArrayList) {
+ ArrayList<String> values = (ArrayList<String>)o;
+// getLogger().debug(String.format("Processing %s with parameter %s", types[0].getName(), value));
+ value = value.replace("[", "").replace("]", "");
+ List<String> items = Arrays.asList(value.split("\\s*,\\s*"));
+ for(String s : items) {
+ values.add(s.trim());
+ }
+ }
+ }
+ } catch (Exception x) {
+ Throwable cause = x.getCause();
+ getLogger().warn("Failed process for " + resourceClass.getName(), x);
+ }
+ }
+ }
+ // 4. Process Relationships
+ // add relationship list
+ if( (subResources.contains("relationship-list") || subResources.contains("relationshipList")) && !relationshipKeys.isEmpty()) {
+ RelationshipList relationshipList = null;
+ Object obj = null;
+ Method getRelationshipListMethod = null;
+ try {
+ getRelationshipListMethod = resourceClass.getMethod("getRelationshipList");
+ } catch(Exception exc) {
+ getLogger().debug("Retrofiting relationship data: " + exc.getMessage());
+ }
+
+ if(getRelationshipListMethod != null){
+ try {
+ getRelationshipListMethod.setAccessible(true);
+ obj = getRelationshipListMethod.invoke(instance);
+ } catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
+ }
+ }
+ if(obj != null && obj instanceof RelationshipList){
+ relationshipList = (RelationshipList)obj;
+ } else {
+ relationshipList = new RelationshipList();
+ Method setRelationshipListMethod = resourceClass.getMethod("setRelationshipList", RelationshipList.class);
+ if(setRelationshipListMethod != null){
+ try {
+ setRelationshipListMethod.setAccessible(true);
+ Object arglist[] = new Object[1];
+ arglist[0] = relationshipList;
+
+ obj = setRelationshipListMethod.invoke(instance, arglist);
+ } catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
+ }
+ }
+ }
+
+ List<Relationship> relationships = relationshipList.getRelationship();
+
+ int i = 0;
+ while(true){
+ String searchKey = "relationship-list.relationship[" + i + "].related-to";
+ if(!params.containsKey(searchKey))
+ break;
+ int j = 0;
+ String relatedTo = params.get(searchKey);
+ String relatedLinkKey = "relationship-list.relationship[" + i + "].related-link";
+ String relatedLink = null;
+ if(params.containsKey(relatedLinkKey)) {
+ relatedLink = params.get(relatedLinkKey);
+ }
+ Relationship relationship = new Relationship();
+ relationships.add(relationship);
+ relationship.setRelatedTo(relatedTo);
+ if(relatedLink != null) {
+ relationship.setRelatedLink(relatedLink);
+ } else {
+// List<RelationshipData> relData = relationship.getRelationshipData();
+ Map<String, String> relParams = new HashMap<String, String>();
+
+ 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;
+
+ relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue));
+ j++;
+ }
+ AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams);
+ for(Map.Entry<String,String> entry : relParams.entrySet()) {
+ rlRequest.addRequestProperty(entry.getKey(), entry.getValue());
+ }
+ String path = rlRequest.updatePathDataValues(null);
+ relationship.setRelatedLink(path);
+ }
+ i++;
+ }
+ }
+
+ // 4. vlans
+ if(subResources.contains("vlans") && !vlansKeys.isEmpty()) {
+ Object obj = null;
+ Vlans vlanList = null;
+ Method getVLansMethod = resourceClass.getMethod("getVlans");
+ if(getVLansMethod != null){
+ try {
+ getVLansMethod.setAccessible(true);
+ obj = getVLansMethod.invoke(instance);
+ } catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
+ }
+ }
+ if(obj != null && obj instanceof Vlans){
+ vlanList = (Vlans)obj;
+ } else {
+ vlanList = new Vlans();
+ Method setVlansMethod = resourceClass.getMethod("setVlans", Vlans.class);
+ if(setVlansMethod != null){
+ try {
+ setVlansMethod.setAccessible(true);
+ Object arglist[] = new Object[1];
+ arglist[0] = vlanList;
+
+ obj = setVlansMethod.invoke(instance, arglist);
+ } catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
+ }
+ }
+ }
+
+ int i = 0;
+ while(true){
+ String searchKey = "vlans.vlan[" + i + "].vlan-interface";
+ if(!params.containsKey(searchKey))
+ break;
+
+ String vlanInterface = params.get("vlans.vlan[" + i + "].vlan-interface");
+ String vlanIdInner = params.get("vlans.vlan[" + i + "].vlan-id-inner");
+ String vlanIdOute = params.get("vlans.vlan[" + i + "].vlan-id-outer");
+ String speedValue = params.get("vlans.vlan[" + i + "].speed-value");
+ String speedUnits = params.get("vlans.vlan[" + i + "].speed-units");
+
+ Vlan vlan = new Vlan();
+ vlan.setVlanInterface(vlanInterface);
+
+ if(vlanIdInner != null) {
+ Long iVlanIdInner = Long.parseLong(vlanIdInner);
+ vlan.setVlanIdInner(iVlanIdInner);
+ }
+
+ if(vlanIdOute != null) {
+ Long iVlanIdOuter = Long.parseLong(vlanIdOute);
+ vlan.setVlanIdOuter(iVlanIdOuter);
+ }
+
+ if(speedValue != null) {
+ vlan.setSpeedValue(speedValue);
+ vlan.setSpeedUnits(speedUnits);
+ }
+
+ vlanList.getVlan().add(vlan);
+ i++;
+ }
+ }
+
+ // 5. metadata
+ if(subResources.contains("metadata") && !metadataKeys.isEmpty()) {
+ Object obj = null;
+ Metadata metadataList = null;
+ Method getMetadataMethod = resourceClass.getMethod("getMetadata");
+ if(getMetadataMethod != null){
+ try {
+ getMetadataMethod.setAccessible(true);
+ obj = getMetadataMethod.invoke(instance);
+ } catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
+ }
+ }
+ if(obj != null && obj instanceof Metadata){
+ metadataList = (Metadata)obj;
+ } else {
+ metadataList = new Metadata();
+ Method setMetadataMethod = resourceClass.getMethod("setMetadata", Metadata.class);
+ if(setMetadataMethod != null){
+ try {
+ setMetadataMethod.setAccessible(true);
+ Object arglist[] = new Object[1];
+ arglist[0] = metadataList;
+
+ obj = setMetadataMethod.invoke(instance, arglist);
+ } catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
+ }
+ }
+ }
+
+ if(metadataList.getMetadatum() == null) {
+// metadataList.setMetadatum(new ArrayList<Metadatum>());
+ }
+
+ // process data
+ int i = 0;
+ while(true){
+ String metaKey = "metadata.metadatum[" + i + "].meta-key";
+ if(!params.containsKey(metaKey))
+ break;
+
+ String metaValue = params.get("metadata.metadatum[" + i + "].meta-value");
+
+ Metadatum vlan = new Metadatum();
+ vlan.setMetaname(metaKey);
+ vlan.setMetaval(metaValue);
+
+ metadataList.getMetadatum().add(vlan);
+ i++;
+ }
+
+ }
+
+
+ // 6. Prepare AAI request
+ String[] args = request.getArgsList();
+ for(String arg : args) {
+ String modifiedKey = arg.replaceAll("-", "_");
+ if(nameValues.containsKey(modifiedKey)) {
+ String argValue = nameValues.get(modifiedKey);
+ if(argValue != null) argValue = argValue.trim().replace("'", "").replace("$", "").replace("'", "");
+ request.addRequestProperty(arg, argValue);
+ }
+ }
+
+ request.processRequestPathValues(nameValues);
+ request.setRequestObject(instance);
+ Object response = getExecutor().post(request);
+ if(request.expectsDataFromPUTRequest()){
+ if(response != null && response instanceof String) {
+ String rv = response.toString();
+ QueryStatus retval = processResponseData(rv, resource, request, prefix, ctx, nameValues, null);
+ getLogger().debug("newModelSave - returning " + retval.toString());
+ return retval;
+ }
+ }
+
+ } catch(AAIServiceException exc){
+ ctx.setAttribute(prefix + ".error.message", exc.getMessage());
+ int returnCode = exc.getReturnCode();
+ if(returnCode >= 300) {
+ ctx.setAttribute(prefix + ".error.http.response-code",
+ Integer.toString(exc.getReturnCode()));
+ }
+
+ if(returnCode == 400 || returnCode == 412)
+ return QueryStatus.FAILURE;
+ else if(returnCode == 404)
+ return QueryStatus.NOT_FOUND;
+ else {
+ getLogger().warn("Failed newModelSave - returning FAILURE", exc);
+ return QueryStatus.FAILURE;
+ }
+ } catch(Exception exc){
+ getLogger().warn("Failed newModelSave - returning FAILURE", exc);
+ ctx.setAttribute(prefix + ".error.message", exc.getMessage());
+ return QueryStatus.FAILURE;
+ }
+
+ getLogger().debug("newModelSave - returning SUCCESS");
+ return QueryStatus.SUCCESS;
+ }
+
+ private QueryStatus newModelProcessRelationshipList(Object instance, Map<String, String> params, String prefix, SvcLogicContext ctx) throws Exception {
+
+ Class resourceClass = instance.getClass();
+
+ Set<String> relationshipKeys = new TreeSet<>();
+
+ Set<String> set = params.keySet();
+
+ for(String attribute : set) {
+ String value = params.get(attribute);
+
+ if(attribute.startsWith("relationship-list")) {
+ relationshipKeys.add(attribute);
+ }
+ }
+
+ // 3. Process Relationships
+ // add relationship list
+ if(!relationshipKeys.isEmpty()) {
+ RelationshipList relationshipList;
+ Object obj = null;
+ Method getRelationshipListMethod = null;
+ try {
+ getRelationshipListMethod = resourceClass.getMethod("getRelationshipList");
+ } catch(Exception exc) {
+ getLogger().debug("Retrofiting relationship data: " + exc.getMessage());
+ }
+ if(getRelationshipListMethod != null){
+ try {
+ getRelationshipListMethod.setAccessible(true);
+ obj = getRelationshipListMethod.invoke(instance);
+ } catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
+ }
+ }
+ if(obj != null && obj instanceof RelationshipList){
+ relationshipList = (RelationshipList)obj;
+ } else {
+ relationshipList = new RelationshipList();
+ Method setRelationshipListMethod = resourceClass.getMethod("setRelationshipList", RelationshipList.class);
+ if(setRelationshipListMethod != null){
+ try {
+ setRelationshipListMethod.setAccessible(true);
+ Object arglist[] = new Object[1];
+ arglist[0] = relationshipList;
+
+ obj = setRelationshipListMethod.invoke(instance, arglist);
+ } catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
+ }
+ }
+ }
+
+ boolean createdNewRelationships = false;
+ List<Relationship> relationships = relationshipList.getRelationship();
+ if(relationships == null) {
+ relationships = new ArrayList<Relationship>();
+ createdNewRelationships = true;
+ }
+
+ int i = 0;
+ while(true){
+ String searchKey = "relationship-list.relationship[" + i + "].related-to";
+ if(!params.containsKey(searchKey))
+ break;
+
+ int j = 0;
+ String relatedTo = params.get(searchKey);
+ String relatedLinkKey = "relationship-list.relationship[" + i + "].related-link";
+ String relatedLink = null;
+ if(params.containsKey(relatedLinkKey)) {
+ relatedLink = params.get(relatedLinkKey);
+ }
+
+ Relationship relationship = new Relationship();
+ relationships.add(relationship);
+ relationship.setRelatedTo(relatedTo);
+ if(relatedLink != null) {
+ relationship.setRelatedLink(relatedLink);
+ } else {
+ Map<String, String> relParams = new HashMap<>();
+
+ 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;
+
+ relParams.put(params.get(searchRelationshipKey), params.get(searchRelationshipValue));
+ j++;
+ }
+ AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams);
+ for(String key : relParams.keySet()) {
+ rlRequest.addRequestProperty(key, relParams.get(key));
+ }
+ String path = rlRequest.updatePathDataValues(null);
+ relationship.setRelatedLink(path);
+ }
+
+ i++;
+ }
+ }
+
+ return QueryStatus.SUCCESS;
+ }
+
+ private Relationship findRelationship(List<Relationship> relationships, String relatedTo) {
+ if(relatedTo == null)
+ return null;
+
+ for(Relationship relationship : relationships) {
+ if(relationship.getRelatedTo().equals(relatedTo)){
+ return relationship;
+ }
+ }
+ return null;
+ }
+
+
+ public QueryStatus backup(Map<String, String> params, SvcLogicContext ctx) throws SvcLogicException {
+ String resource = params.get("resource").toLowerCase();
+ String prefix = params.get("data-key");
+
+ HashMap<String, String> nameValues = new HashMap<>();
+ if(AAIRequest.createRequest(resource, nameValues) != null) {
+
+ try {
+ return newModelBackupRequest(resource, params, prefix, ctx);
+ } catch (Exception exc) {
+ getLogger().warn("Failed backup - returning FAILURE", exc);
+ return QueryStatus.FAILURE;
+ }
+ }
+
+ return QueryStatus.NOT_FOUND;
+ }
+
+ @Override
+ public QueryStatus restore(Map<String, String> params, SvcLogicContext ctx) throws SvcLogicException {
+
+ QueryStatus retval = QueryStatus.SUCCESS;
+ String resource = params.get("resource").toLowerCase();
+ String prefix = params.get("data-key");
+
+ HashMap<String, String> nameValues = new HashMap<>();
+ if(AAIRequest.createRequest(resource, nameValues) != null) {
+
+ try {
+ retval = newModelBackupRequest(resource, params, "tmpRestore", ctx);
+ if(retval == QueryStatus.SUCCESS) {
+ String current_json = ctx.getAttribute("tmpRestore");
+ ctx. setAttribute("tmpRestore", null);
+
+ String snapshot_json = ctx.getAttribute(prefix);
+ }
+ } catch (Exception exc) {
+ getLogger().warn("Failed restore - returning FAILURE", exc);
+ return QueryStatus.FAILURE;
+ }
+ }
+
+ return QueryStatus.NOT_FOUND;
+ }
+
+ protected Map<String, Object> objectToProperties(Object object) {
+ ObjectMapper mapper = AAIService.getObjectMapper();
+ return mapper.convertValue(object, Map.class);
+ }
+
+ static <T> T valueOf(Class<T> klazz, String arg) {
+ Exception cause = null;
+ T ret = null;
+ try {
+ ret = klazz.cast(klazz.getDeclaredMethod("valueOf", String.class).invoke(null, arg));
+ } catch (NoSuchMethodException exc) {
+ LoggerFactory.getLogger(AAIService.class).warn("Wrong data type", exc);
+ ret = klazz.cast(arg);
+ } catch (IllegalAccessException e) {
+ cause = e;
+ } catch (InvocationTargetException e) {
+ cause = e;
+ }
+ if (cause == null) {
+ return ret;
+ } else {
+ throw new IllegalArgumentException(cause);
+ }
+ }
+
+ private QueryStatus processDeleteRelationshipList(String resource, String key, SvcLogicContext ctx, HashMap<String, String> nameValues) {
+ try {
+ AAIRequest request = AAIRequest.createRequest(resource, nameValues);
+ if(request == null) {
+ return QueryStatus.FAILURE;
+ }
+
+ request.processRequestPathValues(nameValues);
+ URL url = request.getRequestUrl("GET", null);
+
+ Class resourceClass = request.getModelClass();
+ Object instance = getResource(url.toString(), resourceClass);
+ if(instance == null)
+ return QueryStatus.NOT_FOUND;
+
+ // get resource version
+ String resourceVersion = null;
+ Method getResourceVersionMethod = resourceClass.getMethod("getResourceVersion");
+ if(getResourceVersionMethod != null){
+ try {
+ getResourceVersionMethod.setAccessible(true);
+ Object object = getResourceVersionMethod.invoke(instance);
+ if(object != null)
+ resourceVersion = object.toString();
+ } catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
+ }
+ }
+
+ RelationshipList relationshipList = null;
+ Object obj = null;
+ Method getRelationshipListMethod = null;
+ try {
+ getRelationshipListMethod = resourceClass.getMethod("getRelationshipList");
+ } catch(Exception exc) {
+ getLogger().debug("Retrofiting relationship data: " + exc.getMessage());
+ }
+ if(getRelationshipListMethod != null){
+ try {
+ getRelationshipListMethod.setAccessible(true);
+ obj = getRelationshipListMethod.invoke(instance);
+ } catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
+ }
+ }
+ if(obj != null && obj instanceof RelationshipList){
+ relationshipList = (RelationshipList)obj;
+ } else {
+ getLogger().debug("No relationships found to process.");
+ return QueryStatus.NOT_FOUND;
+ }
+
+ if(relationshipList.getRelationship() == null || relationshipList.getRelationship().isEmpty()) {
+ return QueryStatus.NOT_FOUND;
+ }
+ String relatedTo = nameValues.get("related_to");
+ if(relatedTo == null) {
+ return QueryStatus.FAILURE;
+ }
+
+ 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>();
+
+ for(Relationship relationship : relationships) {
+ if(relatedTo.equals(relationship.getRelatedTo())) {
+ if(relatedLink != null) {
+ 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;
+ }
+
+ String path = url.toString();
+ path = path + "/relationship-list/relationship";
+ URL deleteUrl = new URL(path);
+
+ ObjectMapper mapper = AAIService.getObjectMapper();
+
+ boolean cumulativeResponse = true;
+
+ for(Relationship targetRelationship : relationshipsToDelete) {
+ String json_text = mapper.writeValueAsString(targetRelationship);
+ boolean response = deleteRelationshipList(deleteUrl, json_text);
+ if(!response)
+ cumulativeResponse = response;
+
+ }
+
+ if(!cumulativeResponse)
+ return QueryStatus.FAILURE;
+
+ return QueryStatus.SUCCESS;
+
+ } catch(Exception exc) {
+ getLogger().warn("processDelete", exc);
+ return QueryStatus.FAILURE;
+ }
+ }
+
+ static final Map<String, String> ctxGetBeginsWith( SvcLogicContext ctx, String prefix ) {
+ Map<String, String> tmpPrefixMap = new HashMap<>();
+
+ if(prefix == null || prefix.isEmpty()){
+ return tmpPrefixMap;
+ }
+
+ for( String key : ctx.getAttributeKeySet() ) {
+ if( key.startsWith(prefix) ) {
+ String tmpKey = key.substring(prefix.length() + 1);
+ tmpPrefixMap.put( tmpKey, ctx.getAttribute(key));
+ }
+ }
+
+ Map<String, String> prefixMap = new HashMap<>();
+ Pattern p = Pattern.compile(".*\\[\\d\\]");
+
+ SortedSet<String> keys = new TreeSet(tmpPrefixMap.keySet () );
+ for(String key : keys) {
+ Matcher m = p.matcher(key);
+ if(m.matches()) {
+ continue;
+ } else if(key.endsWith("_length")) {
+ String listKey = key.substring(0, key.indexOf("_length"));
+ int max = Integer.parseInt(tmpPrefixMap.get(key));
+
+ ArrayList<String> data = new ArrayList<>();
+ for(int x = 0; x < max; x++){
+ String tmpKey = String.format("%s[%d]", listKey, x);
+ String tmpValue = tmpPrefixMap.get(tmpKey);
+ if(tmpValue != null && !tmpValue.isEmpty()) {
+ data.add(tmpValue);
+ }
+ }
+ if(!data.isEmpty()) {
+ prefixMap.put(listKey, data.toString());
+ } else {
+ prefixMap.put(key, tmpPrefixMap.get(key));
+ }
+ } else {
+ prefixMap.put(key, tmpPrefixMap.get(key));
+ }
+ }
+
+ return prefixMap;
+ }
+
+ /**
+ */
+ protected NamedQueryData extractNamedQueryDataFromQueryPrefix(HashMap<String, String> nameValues, Map<String, String> parms) {
+ if(parms.isEmpty()) {
+ return null;
+ }
+
+ NamedQueryData data = new NamedQueryData();
+
+ // query parameters
+ if(data.getQueryParameters() == null) {
+ data.setQueryParameters(new QueryParameters());
+ }
+ String namedQueryUuid = nameValues.get("named-query-uuid".replaceAll("-", "_"));
+ if(namedQueryUuid == null) {
+ namedQueryUuid = parms.get("query-parameters.named-query.named-query-uuid");
+ }
+ NamedQuery namedQuery = new NamedQuery();
+ namedQuery.setNamedQueryUuid(namedQueryUuid);
+ data.getQueryParameters().setNamedQuery(namedQuery);
+
+ // instance filters
+ if(data.getInstanceFilters() == null) {
+ data.setInstanceFilters(new InstanceFilters());
+ }
+
+
+ String quantity = parms.get("instance-filters.instance-filter_length");
+ if(quantity != null && StringUtils.isNumeric(quantity)) {
+ int max = Integer.parseInt(quantity);
+ for(int i = 0; i < max; i++) {
+ String keyPattern = String.format("instance-filters.instance-filter[%d].", i);
+ Set<String> keys = parms.keySet();
+ for(String key: keys) {
+ if(key.startsWith(keyPattern)){
+ String value = parms.get(key);
+ String remainder = key.substring(keyPattern.length());
+ String[] split = remainder.split("\\.");
+ getLogger().debug(String.format("%s", remainder));
+ if("logical-link".equals(split[0])) {
+ InstanceFilter insf = null;
+ if(data.getInstanceFilters().getInstanceFilter().isEmpty()) {
+ insf = new InstanceFilter();
+ data.getInstanceFilters().getInstanceFilter().add(insf);
+ } else {
+ insf = data.getInstanceFilters().getInstanceFilter().get(0);
+ }
+ LogicalLink logicalLink = insf.getLogicalLink();
+ if(logicalLink == null) {
+ logicalLink = new LogicalLink();
+ insf.setLogicalLink(logicalLink);
+ }
+
+ switch(split[1]) {
+ case "link-name":
+ logicalLink.setLinkName(value);
+ break;
+ case "link-type":
+ logicalLink.setLinkType(value);
+ break;
+ case "operational-state":
+ logicalLink.setOperationalStatus(value);
+ break;
+ }
+
+ } else if("pnf".equals(split[0])) {
+ Pnf pnf = new Pnf();
+ pnf.setPnfName(value);
+
+ InstanceFilter insf = new InstanceFilter();
+ insf.setPnf(pnf);
+ data.getInstanceFilters().getInstanceFilter().add(insf);
+
+ } else if("service-instance".equals(split[0])) {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId(value);
+
+ InstanceFilter insf = new InstanceFilter();
+ insf.setServiceInstance(serviceInstance);
+ data.getInstanceFilters().getInstanceFilter().add(insf);
+
+ } else if("l3-network".equals(split[0])) {
+ L3Network l3Network = new L3Network();
+ if("network-role".equals(split[1])) {
+ l3Network.setNetworkRole(value);
+ }
+
+ InstanceFilter insf = new InstanceFilter();
+ insf.setL3Network(l3Network);
+ data.getInstanceFilters().getInstanceFilter().add(insf);
+ } else if("generic-vnf".equals(split[0])) {
+ GenericVnf vnf = new GenericVnf();
+ if("vnf-id".equals(split[1])) {
+ vnf.setVnfId(value);
+ }
+
+ InstanceFilter insf = new InstanceFilter();
+ insf.setGenericVnf(vnf);
+ data.getInstanceFilters().getInstanceFilter().add(insf);
+ }
+ }
+ }
+ }
+ }
+
+ return data;
+ }
+
+ public abstract <T> T getResource(String key, Class<T> type) throws AAIServiceException ;
+ protected abstract boolean deleteRelationshipList(URL url, String caller) throws AAIServiceException;
}
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
index 03121ac07..5388dbc85 100644..100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java
@@ -3,14 +3,14 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * 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.
@@ -34,6 +34,7 @@ import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
+import java.util.HashSet;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@@ -57,384 +58,417 @@ import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public abstract class AAIRequest {
- protected static final Logger LOG = LoggerFactory.getLogger(AAIRequest.class);
-
- protected static final String TARGET_URI = "org.onap.ccsdk.sli.adaptors.aai.uri";
-
- protected static final String MASTER_REQUEST = "master-request";
-
- public static final String RESOURCE_VERSION = "resource-version";
-
- public static final String DEPTH = "depth";
-
- protected static Properties configProperties;
- protected final String target_uri;
- protected static AAIService aaiService;
-
- protected AAIDatum requestDatum;
-
- protected final Properties requestProperties = new Properties();
-
-
- public static AAIRequest createRequest(String resoourceName, Map<String, String> nameValues){
-
- String resoource = resoourceName;
-
- if(resoource == null)
- return null;
-
- if(resoource.contains(":")) {
- String[] tokens = resoource.split(":");
- if(tokens != null && tokens.length > 0) {
- resoource = tokens[0];
- }
- }
-
- if(nameValues.containsKey("selflink")){
- Class<? extends AAIDatum> clazz = null;
- try {
- clazz = getClassFromResource(resoource) ;
- } catch (ClassNotFoundException e) {
- LOG.warn("AAIRequest does not support class: " + e.getMessage());
- return null;
- }
-
- if(clazz != null)
- return new SelfLinkRequest(clazz);
- else
- return null;
- }
-
- switch(resoource){
- case "generic-query":
- return new GenericQueryRequest();
- case "named-query":
- return new NamedQueryRequest();
- case "nodes-query":
- return new NodesQueryRequest();
- case "custom-query":
- case "formatted-query":
- return new CustomQueryRequest();
- case "linterface":
- return new LInterfaceRequest(LInterfaceRequest.TYPE.L2_BRIDGE_SBG);
- case "l2-bridge-sbg":
- return new SubInterfaceRequest(SubInterfaceRequest.TYPE.L2_BRIDGE_SBG);
- case "l2-bridge-bgf":
- return new SubInterfaceRequest(SubInterfaceRequest.TYPE.L2_BRIDGE_BGF);
- case "echo":
- case "test":
- return new EchoRequest();
-
- default:
- {
- AAIRequest request = getRequestFromResource(resoource);
- if(request == null) {
- return null;
- }
- return request;
- }
- }
- }
-
-
- /**
- * Map containing resource tag to its bit position in bitset mapping
- */
- private static Map<String, String> tagValues = new LinkedHashMap<>();
- /**
- * Map containing bitset value of the path to its path mapping
- */
- private static Map<BitSet, String> bitsetPaths = new LinkedHashMap<>();
-
-
- public static Set<String> getResourceNames() {
- return tagValues.keySet();
- }
-
-
- public static void setProperties(Properties props, AAIService aaiService) {
- AAIRequest.configProperties = props;
- AAIRequest.aaiService = aaiService;
-
- try
- {
- URL url = null;
- Bundle bundle = FrameworkUtil.getBundle(AAIServiceActivator.class);
- if(bundle != null) {
- BundleContext ctx = bundle.getBundleContext();
- if(ctx == null)
- return;
-
- url = ctx.getBundle().getResource(AAIService.PATH_PROPERTIES);
- } else {
- url = aaiService.getClass().getResource("/aai-path.properties");
- }
-
- InputStream in = url.openStream();
- Reader reader = new InputStreamReader(in, "UTF-8");
-
- Properties properties = new Properties();
- properties.load(reader);
- LOG.info("loaded " + properties.size());
-
- Set<String> keys = properties.stringPropertyNames();
-
- int index = 0;
- Set<String> resourceNames = new TreeSet<>();
-
- for(String key : keys) {
- String[] tags = key.split("\\|");
- for(String tag : tags) {
- if(!resourceNames.contains(tag)) {
- resourceNames.add(tag);
- tagValues.put(tag, Integer.toString(++index));
- }
- }
- BitSet bs = new BitSet(256);
- for(String tag : tags) {
- String value = tagValues.get(tag);
- Integer bitIndex = Integer.parseInt(value) ;
- bs.set(bitIndex);
- }
- String path = properties.getProperty(key);
- LOG.info(String.format("bitset %s\t\t%s", bs.toString(), path));
- bitsetPaths.put(bs, path);
- }
- LOG.info("loaded " + resourceNames.toString());
- }
- catch (Exception e)
- {
- LOG.error("Caught exception", e);
- }
- }
-
- public AAIRequest() {
- target_uri = configProperties.getProperty(TARGET_URI);
- }
-
- public void addRequestProperty(String key, String value) {
- requestProperties.put(key, value);
- }
-
- public final void setRequestObject(AAIDatum value) {
- requestDatum = value;
- }
-
- public final AAIDatum getRequestObject() {
- return requestDatum;
- }
-
- public final void addMasterRequest(AAIRequest masterRequest) {
- requestProperties.put(MASTER_REQUEST, masterRequest);
- }
-
- protected static String encodeQuery(String param) throws UnsupportedEncodingException {
- return URLEncoder.encode(param, "UTF-8").replace("+", "%20");
- }
-
- protected void handleException(AAIRequest lInterfaceRequest, JsonProcessingException exc) {
- aaiService.getLogger().warn("Could not deserialize object of type " + lInterfaceRequest.getClass().getSimpleName(), exc) ;
- }
-
- public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
-
- String request_url = null;
-
- request_url = target_uri + updatePathDataValues(resourceVersion);
-
- URL http_req_url = new URL(request_url);
-
- aaiService.LOGwriteFirstTrace(method, http_req_url.toString());
-
- return http_req_url;
- }
-
- public String updatePathDataValues(Object resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
- String request_url = getRequestPath();
-
- Set<String> uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames());
-
- for(String resoourceName:uniqueResources) {
- AAIRequest locRequest = AAIRequest.createRequest(resoourceName, new HashMap<String, String>());
- if(locRequest != null) {
- Class<?> clazz = locRequest.getClass();
- Method function = null;
- try {
- function = clazz.getMethod("processPathData", request_url.getClass(), requestProperties.getClass());
- request_url = (String) function.invoke(null, request_url, requestProperties);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- if(resourceVersion != null) {
- request_url = request_url +"?resource-version="+resourceVersion;
- }
-
- return request_url;
- }
-
-
- protected String getRequestPath() throws MalformedURLException {
- Set<String> uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames());
- BitSet bitset = new BitSet();
- for(String key : uniqueResources) {
- if(tagValues.containsKey(key)) {
- Object tmpValue = tagValues.get(key);
- if(tmpValue != null) {
- String value = tmpValue.toString();
- int bitIndex = Integer.parseInt(value);
- bitset.set(bitIndex);
- }
- }
- }
-
- String path = bitsetPaths.get(bitset);
- if(path == null) {
- throw new MalformedURLException("PATH not found for key string containing valies :" +requestProperties.toString());
- }
- return path;
- }
-
- public abstract URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException;
-
- public abstract String toJSONString();
-
- public abstract String[] getArgsList();
-
- public abstract Class<? extends AAIDatum> getModelClass() ;
-
- public String getPrimaryResourceName(String resource) {
- return resource;
- }
-
- public String formatKey(String argument) {
- return argument;
- }
-
- public AAIDatum jsonStringToObject(String jsonData) throws JsonParseException, JsonMappingException, IOException {
- if(jsonData == null) {
- return null;
- }
-
- AAIDatum response = null;
- ObjectMapper mapper = getObjectMapper();
- response = mapper.readValue(jsonData, getModelClass());
- return response;
- }
-
- protected static Set<String> extractUniqueResourceSetFromKeys(Set<String> keySet) {
- Set<String> uniqueResources = new TreeSet<>();
- List<String> keys = new ArrayList<>(keySet);
- for(String resource : keys) {
- if(resource.contains(".")) {
- String [] split = resource.split("\\.");
- uniqueResources.add(split[0].replaceAll("_", "-"));
- }
- }
- return uniqueResources;
- }
-
- public void processRequestPathValues(Map<String, String> nameValues) {
- Set<String> uniqueResources = extractUniqueResourceSetFromKeys(nameValues.keySet());
-
- Set<String> tokens = new TreeSet<>();
- tokens.add(DEPTH);
- tokens.addAll(Arrays.asList(this.getArgsList()));
-
- for(String resoourceName:uniqueResources) {
- AAIRequest locRequest = AAIRequest.createRequest(resoourceName, nameValues);
- if(locRequest != null)
- tokens.addAll(Arrays.asList(locRequest.getArgsList()));
- }
-
- String[] arguments = tokens.toArray(new String[0]);
- for(String name : arguments) {
- String tmpName = name.replaceAll("-", "_");
- String value = nameValues.get(tmpName);
- if(value != null && !value.isEmpty()) {
- value = value.trim().replace("'", "").replace("$", "").replace("'", "");
- this.addRequestProperty(name, value);
- }
- }
- }
-
- public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException {
- return request_url;
- }
-
- public boolean isDeleteDataRequired() {
- return false;
- }
-
- ObjectMapper getObjectMapper() {
+ protected static final Logger LOG = LoggerFactory.getLogger(AAIRequest.class);
+
+ protected static final String TARGET_URI = "org.onap.ccsdk.sli.adaptors.aai.uri";
+
+ protected static final String MASTER_REQUEST = "master-request";
+
+ public static final String RESOURCE_VERSION = "resource-version";
+
+ public static final String DEPTH = "depth";
+
+ protected static Properties configProperties;
+ protected final String target_uri;
+ protected static AAIService aaiService;
+
+ protected AAIDatum requestDatum;
+
+ protected final Properties requestProperties = new Properties();
+
+
+ public static AAIRequest createRequest(String resoourceName, Map<String, String> nameValues){
+
+ String resoource = resoourceName;
+
+ if(resoource == null)
+ return null;
+
+ if(resoource.contains(":")) {
+ String[] tokens = resoource.split(":");
+ if(tokens != null && tokens.length > 0) {
+ resoource = tokens[0];
+ }
+ }
+
+ if(nameValues.containsKey("selflink")){
+ Class<? extends AAIDatum> clazz = null;
+ try {
+ clazz = getClassFromResource(resoource) ;
+ } catch (ClassNotFoundException e) {
+ LOG.warn("AAIRequest does not support class: " + e.getMessage());
+ return null;
+ }
+
+ if(clazz != null)
+ return new SelfLinkRequest(clazz);
+ else
+ return null;
+ }
+
+ switch(resoource){
+ case "generic-query":
+ return new GenericQueryRequest();
+ case "named-query":
+ return new NamedQueryRequest();
+ case "nodes-query":
+ return new NodesQueryRequest();
+ case "custom-query":
+ case "formatted-query":
+ return new CustomQueryRequest();
+ case "linterface":
+ return new LInterfaceRequest(LInterfaceRequest.TYPE.L2_BRIDGE_SBG);
+ case "l2-bridge-sbg":
+ return new SubInterfaceRequest(SubInterfaceRequest.TYPE.L2_BRIDGE_SBG);
+ case "l2-bridge-bgf":
+ return new SubInterfaceRequest(SubInterfaceRequest.TYPE.L2_BRIDGE_BGF);
+ case "echo":
+ case "test":
+ return new EchoRequest();
+
+ default:
+ {
+ AAIRequest request = getRequestFromResource(resoource);
+ if(request == null) {
+ return null;
+ }
+ return request;
+ }
+ }
+ }
+
+
+ /**
+ * Map containing resource tag to its bit position in bitset mapping
+ */
+ private static Map<String, String> tagValues = new LinkedHashMap<>();
+ /**
+ * Map containing bitset value of the path to its path mapping
+ */
+ private static Map<BitSet, String> bitsetPaths = new LinkedHashMap<>();
+
+
+ public static Set<String> getResourceNames() {
+ return tagValues.keySet();
+ }
+
+
+ public static void setProperties(Properties props, AAIService aaiService) {
+ AAIRequest.configProperties = props;
+ AAIRequest.aaiService = aaiService;
+
+ try
+ {
+ URL url = null;
+ Bundle bundle = FrameworkUtil.getBundle(AAIServiceActivator.class);
+ if(bundle != null) {
+ BundleContext ctx = bundle.getBundleContext();
+ if(ctx == null)
+ return;
+
+ url = ctx.getBundle().getResource(AAIService.PATH_PROPERTIES);
+ } else {
+ url = aaiService.getClass().getResource("/aai-path.properties");
+ }
+
+ InputStream in = url.openStream();
+ Reader reader = new InputStreamReader(in, "UTF-8");
+
+ Properties properties = new Properties();
+ properties.load(reader);
+ LOG.info("loaded " + properties.size());
+
+ Set<String> keys = properties.stringPropertyNames();
+
+ int index = 0;
+ Set<String> resourceNames = new TreeSet<>();
+
+ for(String key : keys) {
+ String[] tags = key.split("\\|");
+ for(String tag : tags) {
+ if(!resourceNames.contains(tag)) {
+ resourceNames.add(tag);
+ tagValues.put(tag, Integer.toString(++index));
+ }
+ }
+ BitSet bs = new BitSet(256);
+ for(String tag : tags) {
+ String value = tagValues.get(tag);
+ Integer bitIndex = Integer.parseInt(value) ;
+ bs.set(bitIndex);
+ }
+ String path = properties.getProperty(key);
+ LOG.info(String.format("bitset %s\t\t%s", bs.toString(), path));
+ bitsetPaths.put(bs, path);
+ }
+ LOG.info("loaded " + resourceNames.toString());
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception", e);
+ }
+ }
+
+ public AAIRequest() {
+ target_uri = configProperties.getProperty(TARGET_URI);
+ }
+
+ public void addRequestProperty(String key, String value) {
+ requestProperties.put(key, value);
+ }
+
+ public final void setRequestObject(AAIDatum value) {
+ requestDatum = value;
+ }
+
+ public final AAIDatum getRequestObject() {
+ return requestDatum;
+ }
+
+ public final void addMasterRequest(AAIRequest masterRequest) {
+ requestProperties.put(MASTER_REQUEST, masterRequest);
+ }
+
+ protected static String encodeQuery(String param) throws UnsupportedEncodingException {
+ return URLEncoder.encode(param, "UTF-8").replace("+", "%20");
+ }
+
+ protected void handleException(AAIRequest lInterfaceRequest, JsonProcessingException exc) {
+ aaiService.getLogger().warn("Could not deserialize object of type " + lInterfaceRequest.getClass().getSimpleName(), exc) ;
+ }
+
+ public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
+
+ String request_url = null;
+
+ request_url = target_uri + updatePathDataValues(resourceVersion);
+
+ URL http_req_url = new URL(request_url);
+
+ aaiService.LOGwriteFirstTrace(method, http_req_url.toString());
+
+ return http_req_url;
+ }
+
+ public String updatePathDataValues(Object resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
+ String request_url = getRequestPath();
+
+ Set<String> uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames());
+
+ for(String resoourceName:uniqueResources) {
+ AAIRequest locRequest = AAIRequest.createRequest(resoourceName, new HashMap<String, String>());
+ if(locRequest != null) {
+ Class<?> clazz = locRequest.getClass();
+ Method function = null;
+ try {
+ function = clazz.getMethod("processPathData", request_url.getClass(), requestProperties.getClass());
+ request_url = (String) function.invoke(null, request_url, requestProperties);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ if(resourceVersion != null) {
+ request_url = request_url +"?resource-version="+resourceVersion;
+ }
+
+ return request_url;
+ }
+
+ protected String getRequestPath() throws MalformedURLException {
+ return getRequestPath(null);
+ }
+
+ protected String getRequestPath(String resource) throws MalformedURLException {
+ Set<String> uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames());
+ if(resource != null) {
+ // for group search add itself, but remove singular version of itself
+ if(!uniqueResources.contains(resource)) {
+ boolean replaced = false;
+ Set<String> tmpUniqueResources = new HashSet<String>();
+ tmpUniqueResources.addAll(uniqueResources);
+ for(String item : tmpUniqueResources){
+ String plural = item +"s";
+ if(item.endsWith("y")){
+ plural = item.substring(0, item.length()-1)+ "ies";
+ }
+ if(plural.equals(resource)) {
+ uniqueResources.remove(item);
+ uniqueResources.add(resource);
+ replaced = true;
+ break;
+ }
+ }
+ if(!replaced){
+ if(!uniqueResources.contains(resource)) {
+ uniqueResources.add(resource);
+ }
+ }
+ }
+ }
+ BitSet bitset = new BitSet();
+ for(String key : uniqueResources) {
+ if(tagValues.containsKey(key)) {
+ Object tmpValue = tagValues.get(key);
+ if(tmpValue != null) {
+ String value = tmpValue.toString();
+ int bitIndex = Integer.parseInt(value);
+ bitset.set(bitIndex);
+ }
+ }
+ }
+
+ String path = bitsetPaths.get(bitset);
+ if(path == null) {
+ throw new MalformedURLException("PATH not found for key string containing valies :" +requestProperties.toString());
+ }
+ return path;
+ }
+
+ public abstract URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException;
+
+ public abstract String toJSONString();
+
+ public abstract String[] getArgsList();
+
+ public abstract Class<? extends AAIDatum> getModelClass() ;
+
+ public String getPrimaryResourceName(String resource) {
+ return resource;
+ }
+
+ public String formatKey(String argument) {
+ return argument;
+ }
+
+ public AAIDatum jsonStringToObject(String jsonData) throws JsonParseException, JsonMappingException, IOException {
+ if(jsonData == null) {
+ return null;
+ }
+
+ AAIDatum response = null;
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(jsonData, getModelClass());
+ return response;
+ }
+
+ protected static Set<String> extractUniqueResourceSetFromKeys(Set<String> keySet) {
+ Set<String> uniqueResources = new TreeSet<>();
+ List<String> keys = new ArrayList<>(keySet);
+ for(String resource : keys) {
+ if(resource.contains(".")) {
+ String [] split = resource.split("\\.");
+ uniqueResources.add(split[0].replaceAll("_", "-"));
+ }
+ }
+ return uniqueResources;
+ }
+
+ public void processRequestPathValues(Map<String, String> nameValues) {
+ Set<String> uniqueResources = extractUniqueResourceSetFromKeys(nameValues.keySet());
+
+ Set<String> tokens = new TreeSet<>();
+ tokens.add(DEPTH);
+ tokens.addAll(Arrays.asList(this.getArgsList()));
+
+ for(String resoourceName:uniqueResources) {
+ AAIRequest locRequest = AAIRequest.createRequest(resoourceName, nameValues);
+ if(locRequest != null)
+ tokens.addAll(Arrays.asList(locRequest.getArgsList()));
+ }
+
+ String[] arguments = tokens.toArray(new String[0]);
+ for(String name : arguments) {
+ String tmpName = name.replaceAll("-", "_");
+ String value = nameValues.get(tmpName);
+ if(value != null && !value.isEmpty()) {
+ value = value.trim().replace("'", "").replace("$", "").replace("'", "");
+ this.addRequestProperty(name, value);
+ }
+ }
+ }
+
+ public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException {
+ return request_url;
+ }
+
+ public boolean isDeleteDataRequired() {
+ return false;
+ }
+
+ ObjectMapper getObjectMapper() {
return AAIService.getObjectMapper();
- }
-
- public static Class<? extends AAIDatum> getClassFromResource(String resoourceName) throws ClassNotFoundException {
- String className = GenericVnf.class.getName();
- String[] split = resoourceName.split("-");
- for(int i = 0; i < split.length; i++) {
- split[i] = StringUtils.capitalize(split[i]);
- }
-
- String caps = StringUtils.join(split);
- className = className.replace("GenericVnf", caps);
- Class<? extends AAIDatum> clazz = null;
- try {
- clazz = (Class<? extends AAIDatum>)Class.forName(className);
- } catch (ClassNotFoundException e) {
- LOG.warn("AAIRequest does not support class: " + e.getMessage());
- return null;
- }
-
- return clazz;
- }
-
- protected static AAIRequest getRequestFromResource(String resoourceName) {
-
- Class<? extends AAIDatum> clazz = null;
- try {
- clazz = getClassFromResource(resoourceName);
- } catch (ClassNotFoundException e) {
- LOG.warn("AAIRequest does not support class: " + e.getMessage());
- return null;
- }
- if(clazz == null) {
- return null;
- }
- GenericRequest request = new GenericRequest(clazz);
- return request;
- }
-
- public static Map<String, String> splitQuery(String query) throws UnsupportedEncodingException {
- Map<String, String> query_pairs = new LinkedHashMap<>();
-
- if(query != null && !query.isEmpty()) {
- String[] pairs = query.split("&");
- for (String pair : pairs) {
- int idx = pair.indexOf('=');
- query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8"));
- }
- }
- return query_pairs;
- }
-
- public static Map<String, String> splitPath(String path) throws UnsupportedEncodingException {
- Map<String, String> query_pairs = new LinkedHashMap<>();
-
- if(path != null && !path.isEmpty()) {
- String[] pairs = path.split("/");
- for (String pair : pairs) {
- int idx = pair.indexOf('=');
- query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8"));
- }
- }
- return query_pairs;
- }
-
- protected boolean expectsDataFromPUTRequest() {
- return false;
- }
+ }
+
+ public static Class<? extends AAIDatum> getClassFromResource(String resoourceName) throws ClassNotFoundException {
+ String className = GenericVnf.class.getName();
+ String[] split = resoourceName.split("-");
+ for(int i = 0; i < split.length; i++) {
+ split[i] = StringUtils.capitalize(split[i]);
+ }
+
+ String caps = StringUtils.join(split);
+ className = className.replace("GenericVnf", caps);
+ Class<? extends AAIDatum> clazz = null;
+ try {
+ clazz = (Class<? extends AAIDatum>)Class.forName(className);
+ } catch (ClassNotFoundException e) {
+ LOG.warn("AAIRequest does not support class: " + e.getMessage());
+ return null;
+ }
+
+ return clazz;
+ }
+
+ protected static AAIRequest getRequestFromResource(String resoourceName) {
+
+ Class<? extends AAIDatum> clazz = null;
+ try {
+ clazz = getClassFromResource(resoourceName);
+ } catch (ClassNotFoundException e) {
+ LOG.warn("AAIRequest does not support class: " + e.getMessage());
+ return null;
+ }
+ if(clazz == null) {
+ return null;
+ }
+ GenericRequest request = new GenericRequest(clazz);
+ return request;
+ }
+
+ public static Map<String, String> splitQuery(String query) throws UnsupportedEncodingException {
+ Map<String, String> query_pairs = new LinkedHashMap<>();
+
+ if(query != null && !query.isEmpty()) {
+ String[] pairs = query.split("&");
+ for (String pair : pairs) {
+ int idx = pair.indexOf('=');
+ query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8"));
+ }
+ }
+ return query_pairs;
+ }
+
+ public static Map<String, String> splitPath(String path) throws UnsupportedEncodingException {
+ Map<String, String> query_pairs = new LinkedHashMap<>();
+
+ if(path != null && !path.isEmpty()) {
+ String[] pairs = path.split("/");
+ for (String pair : pairs) {
+ int idx = pair.indexOf('=');
+ query_pairs.put(URLDecoder.decode(pair.substring(0, idx), "UTF-8"), URLDecoder.decode(pair.substring(idx + 1), "UTF-8"));
+ }
+ }
+ return query_pairs;
+ }
+
+ protected boolean expectsDataFromPUTRequest() {
+ return false;
+ }
+
+
+ public String getTargetUri() {
+ return target_uri;
+ }
}
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
index bea26328c..840062e76 100644..100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
@@ -3,7 +3,7 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -124,157 +124,152 @@ import com.sun.jersey.client.urlconnection.HTTPSProperties;
public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicResource {
- public static final String AAICLIENT_PROPERTIES = "/aaiclient.properties";
- public static final String PATH_PROPERTIES = "/aai-path.properties";
+ public static final String AAICLIENT_PROPERTIES = "/aaiclient.properties";
+ public static final String PATH_PROPERTIES = "/aai-path.properties";
- private static final Logger LOG = LoggerFactory.getLogger(AAIService.class);
+ private static final Logger LOG = LoggerFactory.getLogger(AAIService.class);
- private final String truststore_path;
- private final String truststore_password;
- private final String keystore_path;
- private final String keystore_password;
- private final Boolean ignore_certificate_host_error;
+ private final String truststore_path;
+ private final String truststore_password;
+ private final String keystore_path;
+ private final String keystore_password;
+ private final Boolean ignore_certificate_host_error;
- private final String target_uri;
- private final String query_path; // = "sdn-zone-query";
+ private final String target_uri;
+ private final String query_path;
- private final String network_vserver_path;
+ private final String network_vserver_path;
- private final String svc_instance_path;
- private final String svc_inst_qry_path;
+ private final String svc_instance_path;
+ private final String svc_inst_qry_path;
- private final String vnf_image_query_path;
+ private final String vnf_image_query_path;
- private final String param_service_type; //= "service-type";
+ private final String param_service_type; //= "service-type";
- private final String ubb_notify_path;
- private final String selflink_avpn;
- private final String selflink_fqdn;
+ private final String ubb_notify_path;
+ private final String selflink_avpn;
+ private final String selflink_fqdn;
- private final String p_interface_path;
+ private final String p_interface_path;
- private final String service_path;
- private final String site_pair_set_path;
+ private final String service_path;
+ private final String site_pair_set_path;
- private final int connection_timeout;
- private final int read_timeout;
+ private final int connection_timeout;
+ private final int read_timeout;
- // 1602
- private final String query_nodes_path;
- private final String update_path;
+ // 1602
+ private final String query_nodes_path;
+ private final String update_path;
- private final String application_id;
+ private final String application_id;
- // authentication credentials
- private String user_name;
- private String user_password;
+ // authentication credentials
+ private String user_name;
+ private String user_password;
- // runtime
- private final boolean runtimeOSGI;
+ // runtime
+ private final boolean runtimeOSGI;
- private SSLContext CTX;
+ private SSLContext CTX;
- private final MetricLogger ml = new MetricLogger();
+ private final MetricLogger ml = new MetricLogger();
- private final AAIRequestExecutor executor;
+ private final AAIRequestExecutor executor;
- public AAIService(URL propURL) {
- LOG.info("Entered AAIService.ctor");
+ public AAIService(URL propURL) {
+ LOG.info("Entered AAIService.ctor");
- String runtime = System.getProperty("aaiclient.runtime");
- if("OSGI".equals(runtime)) {
- runtimeOSGI = true;
- } else {
- runtimeOSGI = false;
- }
+ String runtime = System.getProperty("aaiclient.runtime");
+ if("OSGI".equals(runtime)) {
+ runtimeOSGI = true;
+ } else {
+ runtimeOSGI = false;
+ }
- Properties props = null;
- try {
- props = initialize(propURL);
- AAIRequest.setProperties(props, this);
+ Properties props = null;
+ try {
+ props = initialize(propURL);
+ AAIRequest.setProperties(props, this);
- } catch(Exception exc){
- LOG.error("AicAAIResource.static", exc);
- }
+ } catch(Exception exc){
+ LOG.error("AicAAIResource.static", exc);
+ }
executor = new AAIRequestExecutor();
- user_name = props.getProperty(CLIENT_NAME);
- user_password = props.getProperty(CLIENT_PWWD);
+ user_name = props.getProperty(CLIENT_NAME);
+ user_password = props.getProperty(CLIENT_PWWD);
if(user_name == null || user_name.isEmpty()){
- LOG.debug("Basic user name is not set");
+ LOG.debug("Basic user name is not set");
}
if(user_password == null || user_password.isEmpty()) {
- LOG.debug("Basic password is not set");
+ LOG.debug("Basic password is not set");
}
- truststore_path = props.getProperty(TRUSTSTORE_PATH);
- truststore_password = props.getProperty(TRUSTSTORE_PSSWD);
- keystore_path = props.getProperty(KEYSTORE_PATH);
- keystore_password = props.getProperty(KEYSTORE_PSSWD);
-
- target_uri = props.getProperty(TARGET_URI);
- query_path = props.getProperty(QUERY_PATH);
- update_path = props.getProperty(UPDATE_PATH);
-
- String applicationId =props.getProperty(APPLICATION_ID);
- if(applicationId == null || applicationId.isEmpty()) {
- applicationId = "SDNC";
- }
- application_id = applicationId;
+ truststore_path = props.getProperty(TRUSTSTORE_PATH);
+ truststore_password = props.getProperty(TRUSTSTORE_PSSWD);
+ keystore_path = props.getProperty(KEYSTORE_PATH);
+ keystore_password = props.getProperty(KEYSTORE_PSSWD);
- // connection timeout
- int tmpConnectionTimeout = 30000;
- int tmpReadTimeout = 30000;
+ target_uri = props.getProperty(TARGET_URI);
+ query_path = props.getProperty(QUERY_PATH);
+ update_path = props.getProperty(UPDATE_PATH);
- try {
- String tmpValue = null;
- tmpValue = props.getProperty(CONNECTION_TIMEOUT, "30000");
- tmpConnectionTimeout = Integer.parseInt(tmpValue);
- tmpValue = props.getProperty(READ_TIMEOUT, "30000");
- tmpReadTimeout = Integer.parseInt(tmpValue);
- } catch(Exception exc) {
- LOG.error("Failed setting connection timeout", exc);
- tmpConnectionTimeout = 30000;
- tmpReadTimeout = 30000;
- }
- connection_timeout = tmpConnectionTimeout;
- read_timeout = tmpReadTimeout;
-
- network_vserver_path =props.getProperty(NETWORK_VSERVER_PATH);
+ String applicationId =props.getProperty(APPLICATION_ID);
+ if(applicationId == null || applicationId.isEmpty()) {
+ applicationId = "SDNC";
+ }
+ application_id = applicationId;
- svc_instance_path = props.getProperty(SVC_INSTANCE_PATH); // "/aai/v1/business/customers/customer/{customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances");
-// "/aai/v1/business/customers/customer/ma9181-203-customerid/service-subscriptions/service-subscription/ma9181%20Hosted%20Voice/service-instances";
+ // connection timeout
+ int tmpConnectionTimeout = 30000;
+ int tmpReadTimeout = 30000;
-// svc_inst_qry_path = props.getProperty(SVC_INST_QRY_PATH, "/aai/v1/search/generic-query?key=service-instance.service-instance-id:ma9181-204-instance&start-node-type=service-instance&include=service-instance");
- svc_inst_qry_path = props.getProperty(SVC_INST_QRY_PATH); // "/aai/v1/search/generic-query?key=service-instance.service-instance-id:{svc-instance-id}&start-node-type=service-instance&include=service-instance");
+ try {
+ String tmpValue = null;
+ tmpValue = props.getProperty(CONNECTION_TIMEOUT, "30000");
+ tmpConnectionTimeout = Integer.parseInt(tmpValue);
+ tmpValue = props.getProperty(READ_TIMEOUT, "30000");
+ tmpReadTimeout = Integer.parseInt(tmpValue);
+ } catch(Exception exc) {
+ LOG.error("Failed setting connection timeout", exc);
+ tmpConnectionTimeout = 30000;
+ tmpReadTimeout = 30000;
+ }
+ connection_timeout = tmpConnectionTimeout;
+ read_timeout = tmpReadTimeout;
+ network_vserver_path =props.getProperty(NETWORK_VSERVER_PATH);
- param_service_type = props.getProperty(PARAM_SERVICE_TYPE, "service-type");
+ svc_instance_path = props.getProperty(SVC_INSTANCE_PATH);
+ svc_inst_qry_path = props.getProperty(SVC_INST_QRY_PATH);
+ param_service_type = props.getProperty(PARAM_SERVICE_TYPE, "service-type");
- // P-Interfaces
- p_interface_path = props.getProperty(P_INTERFACE_PATH);
+ // P-Interfaces
+ p_interface_path = props.getProperty(P_INTERFACE_PATH);
- vnf_image_query_path = props.getProperty(VNF_IMAGE_QUERY_PATH);
+ vnf_image_query_path = props.getProperty(VNF_IMAGE_QUERY_PATH);
- ubb_notify_path = props.getProperty(UBB_NOTIFY_PATH);
- selflink_avpn = props.getProperty(SELFLINK_AVPN);
- selflink_fqdn = props.getProperty(SELFLINK_FQDN);
+ ubb_notify_path = props.getProperty(UBB_NOTIFY_PATH);
+ selflink_avpn = props.getProperty(SELFLINK_AVPN);
+ selflink_fqdn = props.getProperty(SELFLINK_FQDN);
- service_path = props.getProperty(SERVICE_PATH);
+ service_path = props.getProperty(SERVICE_PATH);
- site_pair_set_path = props.getProperty(SITE_PAIR_SET_PATH);
+ site_pair_set_path = props.getProperty(SITE_PAIR_SET_PATH);
- query_nodes_path = props.getProperty(QUERY_NODES_PATH);
+ query_nodes_path = props.getProperty(QUERY_NODES_PATH);
- String iche = props.getProperty(CERTIFICATE_HOST_ERROR);
- boolean host_error = false;
- if(iche != null && !iche.isEmpty()) {
- host_error = Boolean.valueOf(iche);
- }
+ String iche = props.getProperty(CERTIFICATE_HOST_ERROR);
+ boolean host_error = false;
+ if(iche != null && !iche.isEmpty()) {
+ host_error = Boolean.valueOf(iche);
+ }
- ignore_certificate_host_error = host_error;
+ ignore_certificate_host_error = host_error;
HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier(){
public boolean verify(String string,SSLSession ssls) {
@@ -282,14 +277,13 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
}
});
- if(truststore_path != null && truststore_password != null && (new File(truststore_path)).exists()) {
- System.setProperty("javax.net.ssl.trustStore", truststore_path);
- System.setProperty("javax.net.ssl.trustStorePassword", truststore_password);
- }
+ if(truststore_path != null && truststore_password != null && (new File(truststore_path)).exists()) {
+ System.setProperty("javax.net.ssl.trustStore", truststore_path);
+ System.setProperty("javax.net.ssl.trustStorePassword", truststore_password);
+ }
- if(keystore_path != null && keystore_password != null && (new File(keystore_path)).exists())
- {
- DefaultClientConfig config = new DefaultClientConfig();
+ if(keystore_path != null && keystore_password != null && (new File(keystore_path)).exists()) {
+ DefaultClientConfig config = new DefaultClientConfig();
//both jersey and HttpURLConnection can use this
SSLContext ctx = null;
try {
@@ -297,17 +291,15 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
KeyManagerFactory kmf = null;
try {
- String def = "SunX509";
- String storeType = "PKCS12";
- def = KeyStore.getDefaultType();
+ String def = "SunX509";
+ String storeType = "PKCS12";
+ def = KeyStore.getDefaultType();
kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
FileInputStream fin = new FileInputStream(keystore_path);
-// KeyStore ks = KeyStore.getInstance("PKCS12");
String extension = keystore_path.substring(keystore_path.lastIndexOf(".") + 1);
-
if("JKS".equalsIgnoreCase(extension)) {
- storeType = "JKS";
+ storeType = "JKS";
}
KeyStore ks = KeyStore.getInstance(storeType);
@@ -315,7 +307,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
ks.load(fin, pwd);
kmf.init(ks, pwd);
} catch (Exception ex) {
- LOG.error("AAIResource", ex);
+ LOG.error("AAIResource", ex);
}
ctx.init(kmf.getKeyManagers(), null, null);
@@ -327,11 +319,11 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
}, ctx));
CTX = ctx;
- LOG.debug("SSLContext created");
+ LOG.debug("SSLContext created");
} catch (KeyManagementException | NoSuchAlgorithmException exc) {
- LOG.error("AAIResource", exc);
- }
+ LOG.error("AAIResource", exc);
+ }
}
LOG.info("AAIResource.ctor initialized.");
@@ -358,20 +350,20 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
e.printStackTrace();
}
- }
+ }
- public void cleanUp() {
+ public void cleanUp() {
- }
+ }
- /**
- *
- * @param http_req_url
- * @param method
- * @return
- * @throws Exception
- */
- protected HttpURLConnection getConfiguredConnection(URL http_req_url, String method) throws Exception {
+ /**
+ *
+ * @param http_req_url
+ * @param method
+ * @return
+ * @throws Exception
+ */
+ protected HttpURLConnection getConfiguredConnection(URL http_req_url, String method) throws Exception {
HttpURLConnection con = (HttpURLConnection) http_req_url.openConnection();
// Set up the connection properties
@@ -383,164 +375,164 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
con.setReadTimeout( read_timeout );
con.setRequestMethod( method );
con.setRequestProperty( "Accept", "application/json" );
- con.setRequestProperty( "Content-Type", "PATCH".equalsIgnoreCase(method) ? "application/merge-patch+json" : "application/json" );
+ con.setRequestProperty( "Content-Type", "PATCH".equalsIgnoreCase(method) ? "application/merge-patch+json" : "application/json" );
con.setRequestProperty("X-FromAppId", application_id);
con.setRequestProperty("X-TransactionId",TransactionIdTracker.getNextTransactionId());
String mlId = ml.getRequestID();
if(mlId != null && !mlId.isEmpty()) {
- LOG.debug(String.format("MetricLogger requestId = %s", mlId));
- con.setRequestProperty(MetricLogger.REQUEST_ID, mlId);
+ LOG.debug(String.format("MetricLogger requestId = %s", mlId));
+ con.setRequestProperty(MetricLogger.REQUEST_ID, mlId);
} else {
- LOG.debug("MetricLogger requestId is null");
+ LOG.debug("MetricLogger requestId is null");
}
if(user_name != null && !user_name.isEmpty() && user_password != null && !user_password.isEmpty()) {
- String basicAuth = "Basic " + new String(Base64.encodeBase64((user_name + ":" + user_password).getBytes()));
- con.setRequestProperty ("Authorization", basicAuth);
+ String basicAuth = "Basic " + new String(Base64.encodeBase64((user_name + ":" + user_password).getBytes()));
+ con.setRequestProperty ("Authorization", basicAuth);
}
if(con instanceof HttpsURLConnection && CTX != null) {
- SSLSocketFactory sockFact = CTX.getSocketFactory();
- HttpsURLConnection.class.cast(con).setSSLSocketFactory( sockFact );
+ SSLSocketFactory sockFact = CTX.getSocketFactory();
+ HttpsURLConnection.class.cast(con).setSSLSocketFactory( sockFact );
}
return con;
- }
-
-
- @Override
- public GenericVnf requestGenericVnfData(String vnf_id) throws AAIServiceException {
- GenericVnf response = null;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("generic-vnf");
- request.addRequestProperty("generic-vnf.vnf-id", vnf_id);
- String rv = executor.get(request);
- if(rv != null) {
- ObjectMapper mapper = getObjectMapper();
- response = mapper.readValue(rv, GenericVnf.class);
- }
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
- throw new AAIServiceException(exc);
- }
-
- return response;
-
- }
-
- @Override
- public boolean postGenericVnfData(String vnf_id, GenericVnf data) throws AAIServiceException {
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("generic-vnf");
- request.addRequestProperty("generic-vnf.vnf-id", vnf_id);
- request.setRequestObject(data);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestGenericVnfData", exc);
- throw new AAIServiceException(exc);
- }
- }
-
- @Override
- public boolean deleteGenericVnfData(String vnf_id, String resourceVersion) throws AAIServiceException {
- boolean response = false;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("generic-vnf");
- request.addRequestProperty("generic-vnf.vnf-id", vnf_id);
- response = executor.delete(request, resourceVersion);
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("deleteGenericVnfData", exc);
- throw new AAIServiceException(exc);
- }
- return response;
- }
-
- /* (non-Javadoc)
- * @see org.onap.ccsdk.sli.adaptors.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(Object.class.getClass().getEnclosingMethod().getName(), exc);
- throw new AAIServiceException(exc);
- }
-
- return response;
- }
-
-
- /* (non-Javadoc)
- * @see org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.resource.aic.AnAIClient#postNetworkVceData(java.lang.String, org.onap.ccsdk.sli.adaptors.resource.aic.aai.VCERequest)
- */
- @Override
- public boolean postNetworkVceData(String vnf_id, Vce data) throws AAIServiceException {
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("vce");
- request.addRequestProperty("vce.vnf-id", vnf_id);
- request.setRequestObject(data);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestGenericVnfData", exc);
- throw new AAIServiceException(exc);
- }
- }
-
-
- @Override
- public SearchResults requestServiceInstanceURL(String svc_instance_id) throws AAIServiceException {
- SearchResults response = null;
- InputStream inputStream = null;
-
- try {
- String path = svc_inst_qry_path;
- path = path.replace("{svc-instance-id}", encodeQuery(svc_instance_id));
-
- String request_url = target_uri+path;
- URL http_req_url = new URL(request_url);
-
- HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET);
+ }
+
+
+ @Override
+ public GenericVnf requestGenericVnfData(String vnf_id) throws AAIServiceException {
+ GenericVnf response = null;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("generic-vnf");
+ request.addRequestProperty("generic-vnf.vnf-id", vnf_id);
+ String rv = executor.get(request);
+ if(rv != null) {
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(rv, GenericVnf.class);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
+ throw new AAIServiceException(exc);
+ }
+
+ return response;
+
+ }
+
+ @Override
+ public boolean postGenericVnfData(String vnf_id, GenericVnf data) throws AAIServiceException {
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("generic-vnf");
+ request.addRequestProperty("generic-vnf.vnf-id", vnf_id);
+ request.setRequestObject(data);
+ Object response = executor.post(request);
+ return true;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestGenericVnfData", exc);
+ throw new AAIServiceException(exc);
+ }
+ }
+
+ @Override
+ public boolean deleteGenericVnfData(String vnf_id, String resourceVersion) throws AAIServiceException {
+ boolean response = false;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("generic-vnf");
+ request.addRequestProperty("generic-vnf.vnf-id", vnf_id);
+ response = executor.delete(request, resourceVersion);
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("deleteGenericVnfData", exc);
+ throw new AAIServiceException(exc);
+ }
+ return response;
+ }
+
+ /* (non-Javadoc)
+ * @see org.onap.ccsdk.sli.adaptors.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(Object.class.getClass().getEnclosingMethod().getName(), exc);
+ throw new AAIServiceException(exc);
+ }
+
+ return response;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.resource.aic.AnAIClient#postNetworkVceData(java.lang.String, org.onap.ccsdk.sli.adaptors.resource.aic.aai.VCERequest)
+ */
+ @Override
+ public boolean postNetworkVceData(String vnf_id, Vce data) throws AAIServiceException {
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("vce");
+ request.addRequestProperty("vce.vnf-id", vnf_id);
+ request.setRequestObject(data);
+ Object response = executor.post(request);
+ return true;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestGenericVnfData", exc);
+ throw new AAIServiceException(exc);
+ }
+ }
+
+
+ @Override
+ public SearchResults requestServiceInstanceURL(String svc_instance_id) throws AAIServiceException {
+ SearchResults response = null;
+ InputStream inputStream = null;
+
+ try {
+ String path = svc_inst_qry_path;
+ path = path.replace("{svc-instance-id}", encodeQuery(svc_instance_id));
+
+ String request_url = target_uri+path;
+ URL http_req_url = new URL(request_url);
+
+ HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET);
LOGwriteFirstTrace(HttpMethod.GET, http_req_url.toString());
LOGwriteDateTrace("svc_instance_id", svc_instance_id);
@@ -548,9 +540,9 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
// Check for errors
int responseCode = con.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
- inputStream = con.getInputStream();
+ inputStream = con.getInputStream();
} else {
- inputStream = con.getErrorStream();
+ inputStream = con.getErrorStream();
}
// Process the response
@@ -560,414 +552,354 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
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, SearchResults.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;
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ response = mapper.readValue(reader, SearchResults.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("requestServiceInstanceURL", exc);
- throw new AAIServiceException(exc);
- } finally {
- if(inputStream != null){
- try {
- inputStream.close();
- } catch(Exception exc) {
- }
- }
- }
- return response;
- }
-
- @Override
- public ServiceInstance requestServiceInterfaceData(String customer_id, String service_type, String svc_instance_id) throws AAIServiceException {
- ServiceInstance response = null;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("service-instance");
- request.addRequestProperty("customer.global-customer-id", customer_id);
- request.addRequestProperty("ervice-subscription.service-type", service_type);
- request.addRequestProperty("service-instance.service-instance-id", svc_instance_id);
-
- String rv = executor.get(request);
- if(rv != null) {
- ObjectMapper mapper = getObjectMapper();
- response = mapper.readValue(rv, ServiceInstance.class);
- }
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestServiceInterfaceData", exc);
- throw new AAIServiceException(exc);
- }
- return response;
- }
-
- @Override
- public boolean postServiceInterfaceData(String customer_id, String service_type, String svc_instance_id, ServiceInstance data) throws AAIServiceException {
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("service-instance");
- request.addRequestProperty("customer.customer-id", customer_id);
- request.addRequestProperty("service-subscription.service-type", service_type);
- request.addRequestProperty("service-instance.service-instance-id", svc_instance_id);
- request.setRequestObject(data);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestGenericVnfData", exc);
- throw new AAIServiceException(exc);
- }
- }
-
-
- private static Properties initialize(URL url ) throws ConfigurationException {
-
- if(url == null) {
- throw new NullPointerException();
- }
-
- InputStream is = null;
- Properties props = new Properties();
-
- try {
- if(LOG.isDebugEnabled())
- LOG.info("Property file is: " + url.toString());
-
- is = url.openStream();
-
- props.load(is);
- if(LOG.isDebugEnabled()) {
- LOG.info("Properties loaded: " + props.size());
- Enumeration<Object> en = props.keys();
-
- while(en.hasMoreElements()) {
- String key = (String)en.nextElement();
- String property = props.getProperty(key);
- LOG.debug(key + " : " + property);
- }
- }
- } catch (Exception e) {
- throw new ConfigurationException("Could not load properties file.", e);
- }
- return props;
- }
-
- static class TransactionIdTracker {
-// protected static AtomicLong tracker = new AtomicLong();
-
- public static String getNextTransactionId() {
- // Check if RequestId exists as MDC. If not, create new.
- String transactionId = MDC.get("RequestId");
- if ("".equals(transactionId) || transactionId == null) {
- transactionId = UUID.randomUUID().toString();
- LOG.info("Missing requestID. Assigned " + transactionId);
- MDC.put("RequestId", transactionId);
- }
- return transactionId;
- }
-
- }
-
- protected void LOGwriteFirstTrace(String method, String url) {
- String time = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(System.currentTimeMillis());
- LOG.info("A&AI transaction :");
- LOG.info("Request Time : " + time + ", Method : " + method);
- LOG.info("Request URL : "+ url);
- }
-
- protected void LOGwriteDateTrace(String name, String data) {
- LOG.info("Input - " + name + " : " + data);
- }
-
- protected void LOGwriteEndingTrace(int response_code, String comment, String data) {
- LOG.info("Response code : " + response_code +", " + comment);
- LOG.info(String.format("Response data : %s", data));
- }
-
- protected String encodeQuery(String param) throws UnsupportedEncodingException {
- return URLEncoder.encode(param, "UTF-8").replace("+", "%20");
- }
-
- private String encodeCustomerURL(final String selection)
- {
- String encrypted_url = selection;
- String apnpattern =
- "/aai/v11/business/customers/customer/(.+)/service-subscriptions/service-subscription/(.+)/service-instances/service-instance/(.+)/";
- Pattern pattern = Pattern.compile(apnpattern);
-
- try {
- URL url = new URL(selection);
- String path = url.getPath();
-
- LOG.info("Trying to match apn to <" + path + ">");
-
- Matcher matcher = pattern.matcher(path);
-
- while(matcher.find()) {
- String customer = matcher.group(1);
- String subscription = matcher.group(2);
- String service = matcher.group(3);
-
- encrypted_url = selection.replace(customer, encodeQuery(customer));
- encrypted_url = encrypted_url.replace(subscription, encodeQuery(subscription));
- encrypted_url = encrypted_url.replace(service, encodeQuery(service));
- }
- } catch (Exception e) {
- LOG.warn("", e);
- }
-
- 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(Object.class.getClass().getEnclosingMethod().getName(), exc);
- throw new AAIServiceException(exc);
- }
- return response;
- }
-
- @Override
- public boolean postNetworkVpeData(String vnf_id, Vpe data) throws AAIServiceException {
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("vpe");
- request.addRequestProperty("vpe.vnf-id", vnf_id);
- request.setRequestObject(data);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
- throw new AAIServiceException(exc);
- }
- }
-
- @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(Object.class.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(Object.class.getClass().getEnclosingMethod().getName(),
- exc);
- throw new AAIServiceException(exc);
- }
- return response;
- }
-
- @Override
- public boolean postNetworkVplsPeData(String equipment_name, VplsPe data) throws AAIServiceException {
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("vpls-pe");
- request.addRequestProperty("vpls-pe.equipment-name", equipment_name);
- request.setRequestObject(data);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestGenericVnfData", exc);
- throw new AAIServiceException(exc);
- }
- }
-
- @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;
-
- 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);
- }
- return response;
- }
-
- @Override
- public boolean postNetworkComplexData(String vnf_id, Complex data) throws AAIServiceException {
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("complex");
- request.addRequestProperty("complex.physical-location-id", vnf_id);
- request.setRequestObject(data);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("postNetworkComplexData", exc);
- throw new AAIServiceException(exc);
- }
- }
-
- @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)
- */
- @Override
- public Vserver requestVServerData(String tenantId, String vserverId, String cloudOwner, String cloudRegionId) throws AAIServiceException {
- Vserver response = null;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("vserver");
- request.addRequestProperty("cloud-region.cloud-owner", cloudOwner);
- request.addRequestProperty("cloud-region.cloud-region-id", cloudRegionId);
- request.addRequestProperty("tenant.tenant-id", tenantId);
- request.addRequestProperty("vserver.vserver-id", vserverId);
-
- String rv = executor.get(request);
- if(rv != null) {
- ObjectMapper mapper = getObjectMapper();
- response = mapper.readValue(rv, Vserver.class);
- }
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
- throw new AAIServiceException(exc);
- }
- return response;
- }
-
-
- @Override
- public boolean postVServerData(String tenantId, String vserverId, String cloudOwner, String cloudRegionId, Vserver data) throws AAIServiceException {
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("vserver");
- request.addRequestProperty("cloud-region.cloud-owner", cloudOwner);
- request.addRequestProperty("cloud-region.cloud-region-id", cloudRegionId);
- request.addRequestProperty("tenant.tenant-id", tenantId);
- request.addRequestProperty("vserver.vserver-id", vserverId);
- request.setRequestObject(data);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("postNetworkComplexData", exc);
- throw new AAIServiceException(exc);
- }
- }
-
- @Override
- public boolean deleteVServerData(String tenant_id, String vserver_id, String cloudOwner, String cloudRegionId, String resourceVersion) throws AAIServiceException {
- boolean response = false;
- InputStream inputStream = null;
-
- try {
- String local_network_complexes_path = network_vserver_path.replace("{tenant-id}", encodeQuery(tenant_id));
- local_network_complexes_path = local_network_complexes_path.replace("{vserver-id}", encodeQuery(vserver_id));
- local_network_complexes_path = local_network_complexes_path.replace("{cloud-owner}", encodeQuery(cloudOwner));
- local_network_complexes_path = local_network_complexes_path.replace("{cloud-region-id}", encodeQuery(cloudRegionId));
-
- String request_url = target_uri+local_network_complexes_path;
- if(resourceVersion!=null) {
- request_url = request_url +"?resource-version="+resourceVersion;
- }
- URL http_req_url = new URL(request_url);
+ 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("requestServiceInstanceURL", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ if(inputStream != null){
+ try {
+ inputStream.close();
+ } catch(Exception exc) {
+ }
+ }
+ }
+ return response;
+ }
+
+ @Override
+ public ServiceInstance requestServiceInterfaceData(String customer_id, String service_type, String svc_instance_id) throws AAIServiceException {
+ ServiceInstance response = null;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("service-instance");
+ request.addRequestProperty("customer.global-customer-id", customer_id);
+ request.addRequestProperty("service-subscription.service-type", service_type);
+ request.addRequestProperty("service-instance.service-instance-id", svc_instance_id);
+
+ String rv = executor.get(request);
+ if(rv != null) {
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(rv, ServiceInstance.class);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestServiceInterfaceData", exc);
+ throw new AAIServiceException(exc);
+ }
+ return response;
+ }
+
+ @Override
+ public boolean postServiceInterfaceData(String customer_id, String service_type, String svc_instance_id, ServiceInstance data) throws AAIServiceException {
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("service-instance");
+ request.addRequestProperty("customer.global-customer-id", customer_id);
+ request.addRequestProperty("service-subscription.service-type", service_type);
+ request.addRequestProperty("service-instance.service-instance-id", svc_instance_id);
+ request.setRequestObject(data);
+ Object response = executor.post(request);
+ return true;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestGenericVnfData", exc);
+ throw new AAIServiceException(exc);
+ }
+ }
+
+
+ private static Properties initialize(URL url ) throws ConfigurationException {
+
+ if(url == null) {
+ throw new NullPointerException();
+ }
+
+ InputStream is = null;
+ Properties props = new Properties();
+
+ try {
+ if(LOG.isDebugEnabled())
+ LOG.info("Property file is: " + url.toString());
+
+ is = url.openStream();
+
+ props.load(is);
+ if(LOG.isDebugEnabled()) {
+ LOG.info("Properties loaded: " + props.size());
+ Enumeration<Object> en = props.keys();
+
+ while(en.hasMoreElements()) {
+ String key = (String)en.nextElement();
+ String property = props.getProperty(key);
+ LOG.debug(key + " : " + property);
+ }
+ }
+ } catch (Exception e) {
+ throw new ConfigurationException("Could not load properties file.", e);
+ }
+ return props;
+ }
+
+ static class TransactionIdTracker {
+// protected static AtomicLong tracker = new AtomicLong();
+
+ public static String getNextTransactionId() {
+ // Check if RequestId exists as MDC. If not, create new.
+ String transactionId = MDC.get("RequestId");
+ if ("".equals(transactionId) || transactionId == null) {
+ transactionId = UUID.randomUUID().toString();
+ LOG.info("Missing requestID. Assigned " + transactionId);
+ MDC.put("RequestId", transactionId);
+ }
+ return transactionId;
+ }
+
+ }
+
+ protected void LOGwriteFirstTrace(String method, String url) {
+ String time = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(System.currentTimeMillis());
+ LOG.info("A&AI transaction :");
+ LOG.info("Request Time : " + time + ", Method : " + method);
+ LOG.info("Request URL : "+ url);
+ }
+
+ protected void LOGwriteDateTrace(String name, String data) {
+ LOG.info("Input - " + name + " : " + data);
+ }
+
+ protected void LOGwriteEndingTrace(int response_code, String comment, String data) {
+ LOG.info("Response code : " + response_code +", " + comment);
+ LOG.info(String.format("Response data : %s", data));
+ }
+
+ protected String encodeQuery(String param) throws UnsupportedEncodingException {
+ return URLEncoder.encode(param, "UTF-8").replace("+", "%20");
+ }
+
+ private String encodeCustomerURL(final String selection)
+ {
+ String encrypted_url = selection;
+ String apnpattern =
+ "/aai/v11/business/customers/customer/(.+)/service-subscriptions/service-subscription/(.+)/service-instances/service-instance/(.+)/";
+ Pattern pattern = Pattern.compile(apnpattern);
+
+ try {
+ URL url = new URL(selection);
+ String path = url.getPath();
+
+ LOG.info("Trying to match apn to <" + path + ">");
+
+ Matcher matcher = pattern.matcher(path);
+
+ while(matcher.find()) {
+ String customer = matcher.group(1);
+ String subscription = matcher.group(2);
+ String service = matcher.group(3);
+
+ encrypted_url = selection.replace(customer, encodeQuery(customer));
+ encrypted_url = encrypted_url.replace(subscription, encodeQuery(subscription));
+ encrypted_url = encrypted_url.replace(service, encodeQuery(service));
+ }
+ } catch (Exception e) {
+ LOG.warn("", e);
+ }
+
+ return encrypted_url;
+ }
+
+ @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(Object.class.getClass().getEnclosingMethod().getName(),
+ exc);
+ throw new AAIServiceException(exc);
+ }
+ return response;
+ }
+
+ @Override
+ public boolean postNetworkVplsPeData(String equipment_name, VplsPe data) throws AAIServiceException {
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("vpls-pe");
+ request.addRequestProperty("vpls-pe.equipment-name", equipment_name);
+ request.setRequestObject(data);
+ Object response = executor.post(request);
+ return true;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestGenericVnfData", exc);
+ throw new AAIServiceException(exc);
+ }
+ }
+
+ @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;
+
+ 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);
+ }
+ return response;
+ }
+
+ @Override
+ public boolean postNetworkComplexData(String vnf_id, Complex data) throws AAIServiceException {
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("complex");
+ request.addRequestProperty("complex.physical-location-id", vnf_id);
+ request.setRequestObject(data);
+ Object response = executor.post(request);
+ return true;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("postNetworkComplexData", exc);
+ throw new AAIServiceException(exc);
+ }
+ }
+
+ @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)
+ */
+ @Override
+ public Vserver requestVServerData(String tenantId, String vserverId, String cloudOwner, String cloudRegionId) throws AAIServiceException {
+ Vserver response = null;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("vserver");
+ request.addRequestProperty("cloud-region.cloud-owner", cloudOwner);
+ request.addRequestProperty("cloud-region.cloud-region-id", cloudRegionId);
+ request.addRequestProperty("tenant.tenant-id", tenantId);
+ request.addRequestProperty("vserver.vserver-id", vserverId);
+
+ String rv = executor.get(request);
+ if(rv != null) {
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(rv, Vserver.class);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
+ throw new AAIServiceException(exc);
+ }
+ return response;
+ }
+
+
+ @Override
+ public boolean postVServerData(String tenantId, String vserverId, String cloudOwner, String cloudRegionId, Vserver data) throws AAIServiceException {
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("vserver");
+ request.addRequestProperty("cloud-region.cloud-owner", cloudOwner);
+ request.addRequestProperty("cloud-region.cloud-region-id", cloudRegionId);
+ request.addRequestProperty("tenant.tenant-id", tenantId);
+ request.addRequestProperty("vserver.vserver-id", vserverId);
+ request.setRequestObject(data);
+ Object response = executor.post(request);
+ return true;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("postNetworkComplexData", exc);
+ throw new AAIServiceException(exc);
+ }
+ }
+
+ @Override
+ public boolean deleteVServerData(String tenant_id, String vserver_id, String cloudOwner, String cloudRegionId, String resourceVersion) throws AAIServiceException {
+ boolean response = false;
+ InputStream inputStream = null;
+
+ try {
+ String local_network_complexes_path = network_vserver_path.replace("{tenant-id}", encodeQuery(tenant_id));
+ local_network_complexes_path = local_network_complexes_path.replace("{vserver-id}", encodeQuery(vserver_id));
+ local_network_complexes_path = local_network_complexes_path.replace("{cloud-owner}", encodeQuery(cloudOwner));
+ local_network_complexes_path = local_network_complexes_path.replace("{cloud-region-id}", encodeQuery(cloudRegionId));
+
+ String request_url = target_uri+local_network_complexes_path;
+ if(resourceVersion!=null) {
+ request_url = request_url +"?resource-version="+resourceVersion;
+ }
+ URL http_req_url = new URL(request_url);
HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.DELETE);
@@ -980,9 +912,9 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
// Check for errors
int responseCode = con.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
- inputStream = con.getInputStream();
+ inputStream = con.getInputStream();
} else {
- inputStream = con.getErrorStream();
+ inputStream = con.getErrorStream();
}
// Process the response
@@ -993,225 +925,224 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
ObjectMapper mapper = getObjectMapper();
- if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
- StringBuilder stringBuilder = new StringBuilder();
-
- while( ( line = reader.readLine() ) != null ) {
- stringBuilder.append( line );
- }
- LOGwriteEndingTrace(responseCode, "SUCCESS", stringBuilder.toString());
- response = true;
- } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
- LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist.");
- response = false;
+ if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
+ StringBuilder stringBuilder = new StringBuilder();
+
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, "SUCCESS", stringBuilder.toString());
+ response = true;
+ } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
+ LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist.");
+ response = false;
} 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("deleteVServerData", exc);
- throw new AAIServiceException(exc);
- } finally {
- if(inputStream != null){
- try {
- inputStream.close();
- } catch(Exception exc) {
-
- }
- }
- }
- return response;
- }
-
-
- /*
- * (non-Javadoc)
- * @see org.onap.ccsdk.sli.adaptors.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;
-
- 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);
- }
- return response;
- }
-
- @Override
- public boolean postDvsSwitchData(String switch_name, DvsSwitch data) throws AAIServiceException {
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("dvs-switch");
- request.addRequestProperty("dvs-switch.switch-name", switch_name);
- request.setRequestObject(data);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
- throw new AAIServiceException(exc);
- }
- }
-
- @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
- public PhysicalLink requestPhysicalLinkData(String linkName) throws AAIServiceException {
- PhysicalLink response = null;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("physical-link");
- request.addRequestProperty("physical-link.link-name", linkName);
-
- String rv = executor.get(request);
- if(rv != null) {
- ObjectMapper mapper = getObjectMapper();
- response = mapper.readValue(rv, PhysicalLink.class);
- }
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestPhysicalLinkData", exc);
- throw new AAIServiceException(exc);
- }
- return response;
- }
-
- @Override
- public boolean postPhysicalLinkData(String linkName, PhysicalLink data) throws AAIServiceException {
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("physical-link");
- request.addRequestProperty("physical-link.link-name", linkName);
- request.setRequestObject(data);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
- throw new AAIServiceException(exc);
- }
- }
-
- @Override
- public boolean deletePhysicalLinkData(String linkName, String resourceVersion) throws AAIServiceException {
- boolean response = false;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("physical-link");
- request.addRequestProperty("physical-link.link-name", linkName);
- response = executor.delete(request, resourceVersion);
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("deletePhysicalLinkData", exc);
- throw new AAIServiceException(exc);
- }
- return response;
- }
- //================== End of PhysicalLink =================
- //==================== PInterface ======================
- @Override
- public PInterface requestPInterfaceData(String hostname, String interfaceName) throws AAIServiceException {
- PInterface response = null;
-
- try {
- AAIRequest request = new PInterfaceRequest();
- request.addRequestProperty(PInterfaceRequest.PINTERFACE_INTERFACE_NAME, interfaceName);
- request.addRequestProperty(PInterfaceRequest.PSERVER_HOSTNAME, hostname);
- String rv = executor.get(request);
- if(rv != null) {
- ObjectMapper mapper = getObjectMapper();
- response = mapper.readValue(rv, PInterface.class);
- }
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
- throw new AAIServiceException(exc);
- }
- return response;
- }
-
- @Override
- public boolean postPInterfaceData(String hostname, String interfaceName, PInterface 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+p_interface_path;
- String encoded_vnf = encodeQuery(hostname);
- request_url = request_url.replace("{hostname}", encoded_vnf) ;
- encoded_vnf = encodeQuery(interfaceName);
- request_url = request_url.replace("{interface-name}", encoded_vnf) ;
- URL http_req_url = new URL(request_url);
-
- HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.PUT);
+ 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("deleteVServerData", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ if(inputStream != null){
+ try {
+ inputStream.close();
+ } catch(Exception exc) {
+
+ }
+ }
+ }
+ return response;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.onap.ccsdk.sli.adaptors.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;
+
+ 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);
+ }
+ return response;
+ }
+
+ @Override
+ public boolean postDvsSwitchData(String switch_name, DvsSwitch data) throws AAIServiceException {
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("dvs-switch");
+ request.addRequestProperty("dvs-switch.switch-name", switch_name);
+ request.setRequestObject(data);
+ Object response = executor.post(request);
+ return true;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
+ throw new AAIServiceException(exc);
+ }
+ }
+
+ @Override
+ public boolean deleteDvsSwitchData(String vnf_id, String resourceVersion) throws AAIServiceException {
+ boolean response = false;
+
+ 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
+ public PhysicalLink requestPhysicalLinkData(String linkName) throws AAIServiceException {
+ PhysicalLink response = null;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("physical-link");
+ request.addRequestProperty("physical-link.link-name", linkName);
+
+ String rv = executor.get(request);
+ if(rv != null) {
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(rv, PhysicalLink.class);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestPhysicalLinkData", exc);
+ throw new AAIServiceException(exc);
+ }
+ return response;
+ }
+
+ @Override
+ public boolean postPhysicalLinkData(String linkName, PhysicalLink data) throws AAIServiceException {
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("physical-link");
+ request.addRequestProperty("physical-link.link-name", linkName);
+ request.setRequestObject(data);
+ Object response = executor.post(request);
+ return true;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
+ throw new AAIServiceException(exc);
+ }
+ }
+
+ @Override
+ public boolean deletePhysicalLinkData(String linkName, String resourceVersion) throws AAIServiceException {
+ boolean response = false;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("physical-link");
+ request.addRequestProperty("physical-link.link-name", linkName);
+ response = executor.delete(request, resourceVersion);
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("deletePhysicalLinkData", exc);
+ throw new AAIServiceException(exc);
+ }
+ return response;
+ }
+ //================== End of PhysicalLink =================
+ //==================== PInterface ======================
+ @Override
+ public PInterface requestPInterfaceData(String hostname, String interfaceName) throws AAIServiceException {
+ PInterface response = null;
+
+ try {
+ AAIRequest request = new PInterfaceRequest();
+ request.addRequestProperty(PInterfaceRequest.PINTERFACE_INTERFACE_NAME, interfaceName);
+ request.addRequestProperty(PInterfaceRequest.PSERVER_HOSTNAME, hostname);
+ String rv = executor.get(request);
+ if(rv != null) {
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(rv, PInterface.class);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
+ throw new AAIServiceException(exc);
+ }
+ return response;
+ }
+
+ @Override
+ public boolean postPInterfaceData(String hostname, String interfaceName, PInterface 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+p_interface_path;
+ String encoded_vnf = encodeQuery(hostname);
+ request_url = request_url.replace("{hostname}", encoded_vnf) ;
+ encoded_vnf = encodeQuery(interfaceName);
+ request_url = request_url.replace("{interface-name}", 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);
@@ -1227,9 +1158,9 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
// 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();
+ inputStream = con.getInputStream();
} else {
- inputStream = con.getErrorStream();
+ inputStream = con.getErrorStream();
}
// Process the response
@@ -1237,92 +1168,92 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
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();
+ 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.length() > 0) ? stringBuilder.toString() : "{no-data}");
- return true;
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder.length() > 0) ? 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("postPInterfaceData", exc);
- throw new AAIServiceException(exc);
- } finally {
- try {
- if(inputStream != null)
- inputStream.close();
- } catch (Exception exc) {
-
- }
- }
- }
-
- @Override
- public boolean deletePInterfaceData(String hostname, String interfaceName, String resourceVersion) throws AAIServiceException {
- boolean response = false;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("p-interface");
- request.addRequestProperty("p-interface.interface-name", interfaceName);
- request.addRequestProperty("pserver.hostname", hostname);
- response = executor.delete(request, resourceVersion);
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("deletePInterfaceData", exc);
- throw new AAIServiceException(exc);
- }
- 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(Object.class.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);
+ 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("postPInterfaceData", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ try {
+ if(inputStream != null)
+ inputStream.close();
+ } catch (Exception exc) {
+
+ }
+ }
+ }
+
+ @Override
+ public boolean deletePInterfaceData(String hostname, String interfaceName, String resourceVersion) throws AAIServiceException {
+ boolean response = false;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("p-interface");
+ request.addRequestProperty("p-interface.interface-name", interfaceName);
+ request.addRequestProperty("pserver.hostname", hostname);
+ response = executor.delete(request, resourceVersion);
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("deletePInterfaceData", exc);
+ throw new AAIServiceException(exc);
+ }
+ 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(Object.class.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);
@@ -1337,9 +1268,9 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
// 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();
+ inputStream = con.getInputStream();
} else {
- inputStream = con.getErrorStream();
+ inputStream = con.getErrorStream();
}
// Process the response
@@ -1347,95 +1278,94 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
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();
+ 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.length() > 0) ? stringBuilder.toString() : "{no-data}");
- return true;
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder.length() > 0) ? 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
- public Service requestServiceData(String serviceId) throws AAIServiceException {
- Service response = null;
- InputStream inputStream = null;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("service");
- request.addRequestProperty("service.service-id", serviceId);
-
-
- String rv = executor.get(request);
- if(rv != null) {
- ObjectMapper mapper = getObjectMapper();
- response = mapper.readValue(rv, Service.class);
- }
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestServiceData", exc);
- throw new AAIServiceException(exc);
- }
- return response;
- }
-
- @Override
- public boolean postServiceData(String linkName, Service 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+service_path;
- String encoded_vnf = encodeQuery(linkName);
- request_url = request_url.replace("{service-id}", encoded_vnf) ;
- URL http_req_url = new URL(request_url);
-
- HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.PUT);
+ 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
+ public Service requestServiceData(String serviceId) throws AAIServiceException {
+ Service response = null;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("service");
+ request.addRequestProperty("service.service-id", serviceId);
+
+
+ String rv = executor.get(request);
+ if(rv != null) {
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(rv, Service.class);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestServiceData", exc);
+ throw new AAIServiceException(exc);
+ }
+ return response;
+ }
+
+ @Override
+ public boolean postServiceData(String linkName, Service 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+service_path;
+ String encoded_vnf = encodeQuery(linkName);
+ request_url = request_url.replace("{service-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);
@@ -1450,9 +1380,9 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
// 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();
+ inputStream = con.getInputStream();
} else {
- inputStream = con.getErrorStream();
+ inputStream = con.getErrorStream();
}
// Process the response
@@ -1460,262 +1390,249 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
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();
+ 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.length() > 0) ? stringBuilder.toString() : "{no-data}");
- return true;
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder.length() > 0) ? stringBuilder.toString() : "{no-data}");
+ return true;
} else {
- ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
- LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse));
+ ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
+ LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse));
- throw new AAIServiceException(responseCode, errorresponse);
+ throw new AAIServiceException(responseCode, errorresponse);
}
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("postServiceData", exc);
- throw new AAIServiceException(exc);
- } finally {
- try {
- if(inputStream != null)
- inputStream.close();
- } catch (Exception exc) {
-
- }
- }
- }
-
- @Override
- public boolean deleteServiceData(String service_id, String resourceVersion) throws AAIServiceException {
- boolean response = false;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("service");
- request.addRequestProperty("service.service-id", service_id);
- response = executor.delete(request, resourceVersion);
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("deleteServiceData", exc);
- throw new AAIServiceException(exc);
- }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("postServiceData", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ try {
+ if(inputStream != null)
+ inputStream.close();
+ } catch (Exception exc) {
- return response;
- }
- //================== End of Service =================
+ }
+ }
+ }
+ @Override
+ public boolean deleteServiceData(String service_id, String resourceVersion) throws AAIServiceException {
+ boolean response = false;
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("service");
+ request.addRequestProperty("service.service-id", service_id);
+ response = executor.delete(request, resourceVersion);
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("deleteServiceData", exc);
+ throw new AAIServiceException(exc);
+ }
- // 1507 - Request
- @Override
- public VServer dataChangeRequestVServerData(URL url) throws AAIServiceException {
+ return response;
+ }
+ //================== End of Service =================
- if(url == null) {
- throw new NullPointerException();
- }
- return this.getResource(url.toString(), VServer.class);
- }
- @Override
- public Pserver dataChangeRequestPServerData(URL url) throws AAIServiceException {
+ // 1507 - Request
+ @Override
+ public VServer dataChangeRequestVServerData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return this.getResource(url.toString(), Pserver.class);
- }
+ return this.getResource(url.toString(), VServer.class);
+ }
- @Override
- public CtagPool dataChangeRequestCtagPoolData(URL url) throws AAIServiceException {
+ @Override
+ public Pserver dataChangeRequestPServerData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return this.getResource(url.toString(), CtagPool.class);
- }
+ return this.getResource(url.toString(), Pserver.class);
+ }
- @Override
- public VplsPe dataChangeRequestVplsPeData(URL url) throws AAIServiceException {
+ @Override
+ public CtagPool dataChangeRequestCtagPoolData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return this.getResource(url.toString(), VplsPe.class);
- }
+ return this.getResource(url.toString(), CtagPool.class);
+ }
- @Override
- public Vpe dataChangeRequestVpeData(URL url) throws AAIServiceException {
+ @Override
+ public VplsPe dataChangeRequestVplsPeData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return this.getResource(url.toString(), Vpe.class);
- }
+ return this.getResource(url.toString(), VplsPe.class);
+ }
- @Override
- public DvsSwitch dataChangeRequestDvsSwitchData(URL url) throws AAIServiceException {
+ @Override
+ public DvsSwitch dataChangeRequestDvsSwitchData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return this.getResource(url.toString(), DvsSwitch.class);
- }
+ return this.getResource(url.toString(), DvsSwitch.class);
+ }
- @Override
- public OamNetwork dataChangeRequestOAMNetworkData(URL url) throws AAIServiceException {
+ @Override
+ public OamNetwork dataChangeRequestOAMNetworkData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return this.getResource(url.toString(), OamNetwork.class);
- }
+ return this.getResource(url.toString(), OamNetwork.class);
+ }
- @Override
- public AvailabilityZone dataChangeRequestAvailabilityZoneData(URL url) throws AAIServiceException {
+ @Override
+ public AvailabilityZone dataChangeRequestAvailabilityZoneData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return this.getResource(url.toString(), AvailabilityZone.class);
- }
+ return this.getResource(url.toString(), AvailabilityZone.class);
+ }
- @Override
- public Complex dataChangeRequestComplexData(URL url) throws AAIServiceException {
+ @Override
+ public Complex dataChangeRequestComplexData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return this.getResource(url.toString(), Complex.class);
- }
+ return this.getResource(url.toString(), Complex.class);
+ }
- /* DELETE */
- @Override
- public boolean dataChangeDeleteVServerData(URL url) throws AAIServiceException {
+ /* DELETE */
+ @Override
+ public boolean dataChangeDeleteVServerData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
- .getName());
- }
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
+ }
- @Override
- public boolean dataChangeDeleteCtagPoolData(URL url) throws AAIServiceException {
+ @Override
+ public boolean dataChangeDeleteCtagPoolData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
- .getName());
- }
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
+ }
- @Override
- public boolean dataChangeDeleteVplsPeData(URL url) throws AAIServiceException {
+ @Override
+ public boolean dataChangeDeleteVplsPeData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
- .getName());
- }
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
+ }
- @Override
- public boolean dataChangeDeleteVpeData(URL url) throws AAIServiceException {
+ @Override
+ public boolean dataChangeDeleteVpeData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
- .getName());
- }
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
+ }
- @Override
- public boolean dataChangeDeleteDvsSwitchData(URL url) throws AAIServiceException {
+ @Override
+ public boolean dataChangeDeleteDvsSwitchData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
- .getName());
- }
- //OAM-Network:
- @Override
- public boolean dataChangeDeleteOAMNetworkData(URL url) throws AAIServiceException {
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
+ }
+ //OAM-Network:
+ @Override
+ public boolean dataChangeDeleteOAMNetworkData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
- .getName());
- }
- //Availability-Zone:
- @Override
- public boolean dataChangeDeleteAvailabilityZoneData(URL url) throws AAIServiceException {
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
+ }
+ //Availability-Zone:
+ @Override
+ public boolean dataChangeDeleteAvailabilityZoneData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
- .getName());
- }
- //Complex:
- @Override
- public boolean dataChangeDeleteComplexData(URL url) throws AAIServiceException {
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
+ }
+ //Complex:
+ @Override
+ public boolean dataChangeDeleteComplexData(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
- .getName());
- }
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
+ }
- private boolean deleteAAIEntity(URL url, String caller) throws AAIServiceException {
+ private boolean deleteAAIEntity(URL url, String caller) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- boolean response = false;
- InputStream inputStream = null;
+ boolean response = false;
+ InputStream inputStream = null;
- try {
- URL http_req_url = url;
+ try {
+ URL http_req_url = url;
HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.DELETE);
-// SSLSocketFactory sockFact = CTX.getSocketFactory();
-// con.setSSLSocketFactory( sockFact );
-
LOGwriteFirstTrace("DELETE", http_req_url.toString());
// Check for errors
int responseCode = con.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
- inputStream = con.getInputStream();
+ inputStream = con.getInputStream();
} else {
- inputStream = con.getErrorStream();
+ inputStream = con.getErrorStream();
}
// Process the response
@@ -1726,39 +1643,39 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
ObjectMapper mapper = getObjectMapper();
- if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
- StringBuilder stringBuilder = new StringBuilder();
-
- while( ( line = reader.readLine() ) != null ) {
- stringBuilder.append( line );
- }
- LOGwriteEndingTrace(responseCode, "SUCCESS", stringBuilder.toString());
- response = true;
- } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
- LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist.");
- response = false;
+ if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
+ StringBuilder stringBuilder = new StringBuilder();
+
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, "SUCCESS", stringBuilder.toString());
+ response = true;
+ } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
+ LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist.");
+ response = false;
} 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(caller, exc);
- throw new AAIServiceException(exc);
- } finally {
- if(inputStream != null){
- try {
- inputStream.close();
- } catch(Exception exc) {
-
- }
- }
- }
- return response;
- }
+ 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(caller, exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ if(inputStream != null){
+ try {
+ inputStream.close();
+ } catch(Exception exc) {
+
+ }
+ }
+ }
+ return response;
+ }
/**
* Generic method to GET json data from an A&AI callback URL.
@@ -1783,10 +1700,10 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
SvcLogicContext ctx = new SvcLogicContext();
if(!key.contains(" = ") && isValidURL(key)) {
- key = String.format("selflink = '%s'", key);
+ key = String.format("selflink = '%s'", key);
} else
if(!key.contains(" = ") && isValidURI(key)) {
- key = String.format("resource-path = '%s'", key);
+ key = String.format("resource-path = '%s'", key);
}
HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
@@ -1799,228 +1716,226 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
return response != null ? type.cast(response) : response;
}
- @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 {
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("pserver");
- request.addRequestProperty("pserver.hostname", hostname);
- request.setRequestObject(data);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
- throw new AAIServiceException(exc);
- }
- }
-
- @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;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("l3-network");
- request.addRequestProperty("l3-network.network-id", networkId);
-
- String rv = executor.get(request);
- if(rv != null) {
- ObjectMapper mapper = getObjectMapper();
- response = mapper.readValue(rv, L3Network.class);
- }
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestL3NetworkData", exc);
- throw new AAIServiceException(exc);
- }
- return response;
- }
-
- @Override
- public L3Network requestL3NetworkQueryByName(String networkName) throws AAIServiceException {
- L3Network response = null;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("l3-network");
- request.addRequestProperty("l3-network.network-name", networkName);
-
- String rv = executor.get(request);
- if(rv != null) {
- ObjectMapper mapper = getObjectMapper();
- response = mapper.readValue(rv, L3Network.class);
- }
-
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestL3NetworkQueryByName", exc);
- throw new AAIServiceException(exc);
- }
- return response;
- }
-
- @Override
- public boolean postL3NetworkData(String networkId, L3Network data) throws AAIServiceException {
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("l3-network");
- request.addRequestProperty("l3-network.network-id", networkId);
- request.setRequestObject(data);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
- throw new AAIServiceException(exc);
- }
- }
-
- @Override
- public boolean deleteL3NetworkData(String networkId, String resourceVersion) throws AAIServiceException {
- boolean response = false;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("l3-network");
- request.addRequestProperty("l3-network.network-id", networkId);
- response = executor.delete(request, resourceVersion);
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("deleteL3NetworkData", exc);
- throw new AAIServiceException(exc);
- }
-
- return response;
- }
-
-
- @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 vnf_image_uuid) throws AAIServiceException {
- VnfImage response = null;
-
- try {
- AAIRequest request = AAIRequest.getRequestFromResource("vnf-image");
- request.addRequestProperty("vnf-image.vnf-image-uuid", vnf_image_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);
+ @Override
+ public Pserver requestPServerData(String hostname) throws AAIServiceException {
+ Pserver response = 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 {
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("pserver");
+ request.addRequestProperty("pserver.hostname", hostname);
+ request.setRequestObject(data);
+ Object response = executor.post(request);
+ return true;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
+ throw new AAIServiceException(exc);
+ }
+ }
+
+ @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;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("l3-network");
+ request.addRequestProperty("l3-network.network-id", networkId);
+
+ String rv = executor.get(request);
+ if(rv != null) {
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(rv, L3Network.class);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestL3NetworkData", exc);
+ throw new AAIServiceException(exc);
+ }
+ return response;
+ }
+
+ @Override
+ public L3Network requestL3NetworkQueryByName(String networkName) throws AAIServiceException {
+ L3Network response = null;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("l3-network");
+ request.addRequestProperty("l3-network.network-name", networkName);
+
+ String rv = executor.get(request);
+ if(rv != null) {
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(rv, L3Network.class);
+ }
+
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestL3NetworkQueryByName", exc);
+ throw new AAIServiceException(exc);
+ }
+ return response;
+ }
+
+ @Override
+ public boolean postL3NetworkData(String networkId, L3Network data) throws AAIServiceException {
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("l3-network");
+ request.addRequestProperty("l3-network.network-id", networkId);
+ request.setRequestObject(data);
+ Object response = executor.post(request);
+ return true;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
+ throw new AAIServiceException(exc);
+ }
+ }
+
+ @Override
+ public boolean deleteL3NetworkData(String networkId, String resourceVersion) throws AAIServiceException {
+ boolean response = false;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("l3-network");
+ request.addRequestProperty("l3-network.network-id", networkId);
+ response = executor.delete(request, resourceVersion);
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("deleteL3NetworkData", exc);
+ throw new AAIServiceException(exc);
+ }
+
+ return response;
+ }
+
+
+ @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 vnf_image_uuid) throws AAIServiceException {
+ VnfImage response = null;
+
+ try {
+ AAIRequest request = AAIRequest.getRequestFromResource("vnf-image");
+ request.addRequestProperty("vnf-image.vnf-image-uuid", vnf_image_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);
@@ -2028,15 +1943,15 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
LOGwriteDateTrace("application_vendor", vendor);
LOGwriteDateTrace("application_model", model);
if(version != null) {
- LOGwriteDateTrace("application_version", version);
+ LOGwriteDateTrace("application_version", version);
}
// Check for errors
int responseCode = con.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
- inputStream = con.getInputStream();
+ inputStream = con.getInputStream();
} else {
- inputStream = con.getErrorStream();
+ inputStream = con.getErrorStream();
}
// Process the response
@@ -2046,71 +1961,65 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
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;
-
- try {
-
- String selfLink = selflink_fqdn;
- if(SELFLINK_AVPN != null && SELFLINK_AVPN.equals(pathCode)) {
- selfLink = selflink_avpn;
- }
- selfLink = selfLink.replace("{service-instance-id}", encodeQuery(serviceInstanceId));
- event.setSelflink(selfLink);
-
- ObjectMapper mapper = getObjectMapper();
- String json_text = mapper.writeValueAsString(event);
-
- SSLSocketFactory sockFact = CTX.getSocketFactory();
-
- String request_url = target_uri+ubb_notify_path;
- URL http_req_url = new URL(request_url);
-
- HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.PUT);
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ 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;
+
+ try {
+
+ String selfLink = selflink_fqdn;
+ if(SELFLINK_AVPN != null && SELFLINK_AVPN.equals(pathCode)) {
+ selfLink = selflink_avpn;
+ }
+ selfLink = selfLink.replace("{service-instance-id}", encodeQuery(serviceInstanceId));
+ event.setSelflink(selfLink);
+
+ ObjectMapper mapper = getObjectMapper();
+ String json_text = mapper.writeValueAsString(event);
+
+ SSLSocketFactory sockFact = CTX.getSocketFactory();
+
+ String request_url = target_uri+ubb_notify_path;
+ 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);
@@ -2124,9 +2033,9 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
// 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();
+ inputStream = con.getInputStream();
} else {
- inputStream = con.getErrorStream();
+ inputStream = con.getErrorStream();
}
// Process the response
@@ -2134,47 +2043,47 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
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();
+ 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.length() > 0) ? stringBuilder.toString() :
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder.length() > 0) ? stringBuilder.toString() :
"{no-data}");
- return true;
+ 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("sendNotify", exc);
- throw new AAIServiceException(exc);
- } finally {
- try {
- if(inputStream != null)
- inputStream.close();
- } catch (Exception exc) {
-
- }
- }
- }
-
- @Override
- public SearchResults requestNodeQuery(String node_type, String entityIdentifier, String entityName) throws AAIServiceException {
- SearchResults response = null;
- InputStream inputStream = null;
-
- try {
- String request_url = target_uri+query_nodes_path;
- request_url = request_url.replace("{node-type}", encodeQuery(node_type)) ;
- request_url = request_url.replace("{entity-identifier}", entityIdentifier) ;
- request_url = request_url.replace("{entity-name}", encodeQuery(entityName)) ;
- URL http_req_url = new URL(request_url);
+ 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("sendNotify", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ try {
+ if(inputStream != null)
+ inputStream.close();
+ } catch (Exception exc) {
+
+ }
+ }
+ }
+
+ @Override
+ public SearchResults requestNodeQuery(String node_type, String entityIdentifier, String entityName) throws AAIServiceException {
+ SearchResults response = null;
+ InputStream inputStream = null;
+
+ try {
+ String request_url = target_uri+query_nodes_path;
+ request_url = request_url.replace("{node-type}", encodeQuery(node_type)) ;
+ request_url = request_url.replace("{entity-identifier}", entityIdentifier) ;
+ request_url = request_url.replace("{entity-name}", encodeQuery(entityName)) ;
+ URL http_req_url = new URL(request_url);
HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET);
@@ -2185,9 +2094,9 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
// Check for errors
int responseCode = con.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
- inputStream = con.getInputStream();
+ inputStream = con.getInputStream();
} else {
- inputStream = con.getErrorStream();
+ inputStream = con.getErrorStream();
}
// Process the response
@@ -2197,49 +2106,49 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
ObjectMapper mapper = getObjectMapper();
- if (responseCode == HttpURLConnection.HTTP_OK) {
- response = mapper.readValue(reader, SearchResults.class);
- LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response));
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ response = mapper.readValue(reader, SearchResults.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);
+ 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("requestNodeQuery", exc);
- throw new AAIServiceException(exc);
- } finally {
- if(inputStream != null){
- try {
- inputStream.close();
- } catch(Exception exc) {
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestNodeQuery", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ if(inputStream != null){
+ try {
+ inputStream.close();
+ } catch(Exception exc) {
- }
- }
- }
- return response;
+ }
+ }
+ }
+ return response;
- }
+ }
- @Override
- public String requestDataByURL(URL url) throws AAIServiceException {
+ @Override
+ public String requestDataByURL(URL url) throws AAIServiceException {
- if(url == null) {
- throw new NullPointerException();
- }
+ if(url == null) {
+ throw new NullPointerException();
+ }
- String response = null;
- InputStream inputStream = null;
+ String response = null;
+ InputStream inputStream = null;
- try {
- URL http_req_url = url;
+ try {
+ URL http_req_url = url;
HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET);
@@ -2248,9 +2157,9 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
// Check for errors
int responseCode = con.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
- inputStream = con.getInputStream();
+ inputStream = con.getInputStream();
} else {
- inputStream = con.getErrorStream();
+ inputStream = con.getErrorStream();
}
// Process the response
@@ -2260,714 +2169,705 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
ObjectMapper mapper = getObjectMapper();
- if (responseCode == HttpURLConnection.HTTP_OK) {
- StringBuilder stringBuilder = new StringBuilder("\n");
- String line = null;
- while( ( line = reader.readLine() ) != null ) {
- stringBuilder.append( line );
- }
- LOG.info(stringBuilder.toString());
-// response = mapper.readValue(reader, String.class);
- response = stringBuilder.toString();
- LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response));
- } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
- LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist.");
- response = null;
- } 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("requestNetworkVceData", exc);
- throw new AAIServiceException(exc);
- } finally {
- if(inputStream != null){
- try {
- inputStream.close();
- } catch(Exception exc) {
-
- }
- }
- }
- return response;
- }
-
-
- @Override
- public GenericVnf requestGenericVnfeNodeQuery(String vnf_name) throws AAIServiceException {
-
- if(vnf_name == null) {
- throw new NullPointerException();
- }
-
- GenericVnf entity = null;
- SearchResults resp = this.requestNodeQuery("generic-vnf", "vnf-name", vnf_name);
-
- List<ResultData> resultDataList = resp.getResultData();
-
- try {
- for (ResultData datum : resultDataList) {
- String data_type = datum.getResourceType();
- URL url = new URL(datum.getResourceLink());
- entity = this.getResource(url.toString(), GenericVnf.class);
- }
- }
- catch (Exception e)
- {
- LOG.error("Caught exception", e);
- }
- return entity;
- }
-
- @Override
- public Vserver requestVServerDataByURL(URL url) throws AAIServiceException {
-
- if(url == null) {
- throw new NullPointerException();
- }
-
- Vserver entity = null;
-
- try {
- entity = this.getResource(url.toString(), Vserver.class);
- } catch (AAIServiceException exc) {
- throw exc;
- } catch (Exception e) {
- throw new AAIServiceException(e);
- }
- return entity;
- }
-
- @Override
- public URL requestVserverURLNodeQuery(String vserver_name) throws AAIServiceException {
-
- if(vserver_name == null) {
- throw new NullPointerException();
- }
-
- URL entity = null;
- SearchResults resp = this.requestNodeQuery("vserver", "vserver-name", vserver_name);
-
- List<ResultData> resultDataList = resp.getResultData();
-
- try {
- for (ResultData datum : resultDataList) {
- String data_type = datum.getResourceType();
- String resourceLink = datum.getResourceLink();
- if(!resourceLink.isEmpty() && !resourceLink.toLowerCase().startsWith("http")) {
- resourceLink = (new EchoRequest()).target_uri + resourceLink;
- }
- entity = new URL(resourceLink);
- }
- } catch (Exception e) {
- throw new AAIServiceException(e);
- }
- return entity;
- }
-
- class AAIRequestExecutor implements AAIExecutorInterface {
-
- @Override
- public String get(AAIRequest request) throws AAIServiceException {
- String response = null;
- InputStream inputStream = null;
- HttpURLConnection con = null;
- URL requestUrl = null;
-
- String requestId = UUID.randomUUID().toString();
- StringBuilder errorStringBuilder = new StringBuilder();
-
- try {
-
- if(request.getRequestObject() != null) {
- requestUrl = request.getRequestUrl(HttpMethod.POST, null);
- requestUrl = appendDepth(requestUrl, request);
- con = getConfiguredConnection(requestUrl, HttpMethod.POST);
- String json_text = request.toJSONString();
- LOGwriteDateTrace("data", json_text);
- logMetricRequest(requestId, "POST "+requestUrl.getPath(), json_text, requestUrl.getPath());
- OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream());
- osw.write(json_text);
- osw.flush();
- } else {
- requestUrl = request.getRequestUrl(HttpMethod.GET, null);
- requestUrl = appendDepth(requestUrl, request);
- con = getConfiguredConnection(requestUrl, HttpMethod.GET);
- logMetricRequest(requestId, "GET "+requestUrl.getPath(), "", requestUrl.getPath());
- }
-
- // Check for errors
- String responseMessage = con.getResponseMessage();
- int responseCode = con.getResponseCode();
- if (responseCode == HttpURLConnection.HTTP_OK) {
- inputStream = con.getInputStream();
- } else {
- inputStream = con.getErrorStream();
- }
-
- // Process the response
- LOG.debug("HttpURLConnection result:" + responseCode + " : " + responseMessage);
- logMetricResponse(requestId, responseCode, responseMessage);
-
- 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();
- String line = null;
- while( ( line = reader.readLine() ) != null ) {
- stringBuilder.append( line );
- }
- response = stringBuilder.toString();
- try {
- Object object = mapper.readValue(response, Object.class);
- LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, responseMessage, mapper.writeValueAsString(object));
- } catch(Exception exc) {
- LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, responseMessage, mapper.writeValueAsString(response));
- }
- } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) {
- LOGwriteEndingTrace(responseCode, responseMessage, "Entry does not exist.");
- ErrorResponse errorresponse = null;
- try {
- errorresponse = mapper.readValue(reader, ErrorResponse.class);
- } catch(Exception exc) {
- errorresponse = new ErrorResponse();
- RequestError requestError = new RequestError();
- ServiceException serviceException = new ServiceException();
- serviceException.setText("Entry does not exist.");
- requestError.setServiceException(serviceException);
- errorresponse.setRequestError(requestError );
- }
- throw new AAIServiceException(responseCode, errorresponse);
- } else if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) {
- StringBuilder stringBuilder = new StringBuilder();
- String line = null;
- while( ( line = reader.readLine() ) != null ) {
- stringBuilder.append( line );
- }
- LOGwriteEndingTrace(responseCode, responseMessage, stringBuilder.toString());
- ServiceException serviceException = new ServiceException();
- serviceException.setMessageId("HTTP_UNAUTHORIZED");
- serviceException.setText(stringBuilder.toString());
- RequestError requestError = new RequestError();
- requestError.setServiceException(serviceException);
- ErrorResponse errorresponse = new ErrorResponse();
- errorresponse.setRequestError(requestError);
- throw new AAIServiceException(responseCode, errorresponse);
- } else {
-// StringBuilder errorStringBuilder = new StringBuilder();
- String line = null;
- while( ( line = reader.readLine() ) != null ) {
- errorStringBuilder.append("\n").append( line );
- }
-
- ErrorResponse errorresponse = mapper.readValue(errorStringBuilder.toString(), ErrorResponse.class);
-// ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
- LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse));
- throw new AAIServiceException(responseCode, errorresponse);
- }
-
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn(errorStringBuilder.toString(), exc);
- throw new AAIServiceException(exc);
- } finally {
- if(inputStream != null){
- try {
- inputStream.close();
- } catch(Exception exc) {
-
- }
- }
- }
- return response;
- }
-
- private URL appendDepth(URL requestUrl, AAIRequest request) throws MalformedURLException {
-
- String depth = request.requestProperties.getProperty("depth", "1");
- String path = requestUrl.toString();
- if(path.contains("?depth=") || path.contains("&depth=")) {
- return requestUrl;
- } else {
- if(path.contains("?")) {
- path = String.format("%s&depth=%s", path, depth);
- } else {
- path = String.format("%s?depth=%s", path, depth);
- }
- return new URL(path);
- }
- }
-
- @Override
- public String post(AAIRequest request) throws AAIServiceException {
- InputStream inputStream = null;
- String requestId = UUID.randomUUID().toString();
-
- try {
- String resourceVersion = null;
- AAIDatum instance = request.getRequestObject();
-
- Method getResourceVersionMethod = instance.getClass().getMethod("getResourceVersion");
- if(getResourceVersionMethod != null){
- try {
- getResourceVersionMethod.setAccessible(true);
- Object object = getResourceVersionMethod.invoke(instance);
- if(object != null)
- resourceVersion = object.toString();
- } catch (InvocationTargetException x) {
- Throwable cause = x.getCause();
- }
- }
-
- URL requestUrl = null;
- HttpURLConnection con = getConfiguredConnection(requestUrl = request.getRequestUrl(HttpMethod.PUT, resourceVersion), HttpMethod.PUT);
- ObjectMapper mapper = getObjectMapper();
- String json_text = request.toJSONString();
-
- LOGwriteDateTrace("data", json_text);
- logMetricRequest(requestId, "PUT "+requestUrl.getPath(), json_text, requestUrl.getPath());
-
- OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream());
- osw.write(json_text);
- osw.flush();
-
- // Check for errors
- String responseMessage = con.getResponseMessage();
- 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();
- }
-
- LOG.debug("HttpURLConnection result:" + responseCode + " : " + responseMessage);
- logMetricResponse(requestId,responseCode, responseMessage);
-
- // Process the response
- BufferedReader reader;
- String line = null;
- reader = new BufferedReader( new InputStreamReader( inputStream ) );
- mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-
- if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
- StringBuilder stringBuilder = new StringBuilder();
-
- while( ( line = reader.readLine() ) != null ) {
- stringBuilder.append( line );
- }
- LOGwriteEndingTrace(responseCode, responseMessage, (stringBuilder != null) ? stringBuilder.toString() : "{no-data}");
- return stringBuilder.toString();
- } else {
- ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
- LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse));
-
- throw new AAIServiceException(responseCode, errorresponse);
- }
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("AAIRequestExecutor.post", exc);
- throw new AAIServiceException(exc);
- } finally {
- try {
- if(inputStream != null)
- inputStream.close();
- } catch (Exception exc) {
-
- }
- }
- }
-
- @Override
- public Boolean delete(AAIRequest request, String resourceVersion) throws AAIServiceException {
- Boolean response = null;
- InputStream inputStream = null;
- String requestId = UUID.randomUUID().toString();
-
- if(resourceVersion == null) {
- throw new AAIServiceException("resource-version is required for DELETE request");
- }
-
- try {
- URL requestUrl = null;
- HttpURLConnection conn = getConfiguredConnection(requestUrl = request.getRequestUrl(HttpMethod.DELETE, resourceVersion), HttpMethod.DELETE);
- logMetricRequest(requestId, "DELETE "+requestUrl.getPath(), "", requestUrl.getPath());
- conn.setDoOutput(true);
-// if(request.isDeleteDataRequired()) {
-// String json_text = request.toJSONString();
-//
-// LOGwriteDateTrace("data", json_text);
-// OutputStream os = con.getOutputStream();
-// OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream());
-// osw.write(json_text);
-// osw.flush();
-// }
-
- // Check for errors
- String responseMessage = conn.getResponseMessage();
- int responseCode = conn.getResponseCode();
- if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
- inputStream = conn.getInputStream();
- } else {
- inputStream = conn.getErrorStream();
- }
-
- // Process the response
- LOG.debug("HttpURLConnection result:" + responseCode + " : " + responseMessage);
- logMetricResponse(requestId,responseCode, responseMessage);
-
- if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8));
- BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) );
- String line = null;
-
- ObjectMapper mapper = getObjectMapper();
-
- if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
- StringBuilder stringBuilder = new StringBuilder();
-
- while( ( line = reader.readLine() ) != null ) {
- stringBuilder.append( line );
- }
- LOGwriteEndingTrace(responseCode, responseMessage, stringBuilder.toString());
- response = true;
- } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
- LOGwriteEndingTrace(responseCode, responseMessage, "Entry does not exist.");
- response = false;
- } else {
- ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
- LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse));
- throw new AAIServiceException(responseCode, errorresponse);
- }
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("delete", exc);
- throw new AAIServiceException(exc);
- } finally {
- if(inputStream != null){
- try {
- inputStream.close();
- } catch(Exception exc) {
-
- }
- }
- }
- return response;
- }
-
- @Override
- public Object query(AAIRequest request, Class clas) throws AAIServiceException {
- Object response = null;
- InputStream inputStream = null;
- HttpURLConnection con = null;
- URL requestUrl = null;
- String requestId = UUID.randomUUID().toString();
-
- try {
- requestUrl = request.getRequestQueryUrl(HttpMethod.GET);
- con = getConfiguredConnection(requestUrl , HttpMethod.GET);
- logMetricRequest(requestId, "GET "+requestUrl.getPath(), "", requestUrl.getPath());
-
- // Check for errors
- String responseMessage = con.getResponseMessage();
- int responseCode = con.getResponseCode();
- if (responseCode == HttpURLConnection.HTTP_OK) {
- inputStream = con.getInputStream();
- } else {
- inputStream = con.getErrorStream();
- }
-
- logMetricResponse(requestId,responseCode, responseMessage);
- ObjectMapper mapper = getObjectMapper();
-
- if (responseCode == HttpURLConnection.HTTP_OK) {
- // Process the response
- BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) );
- response = mapper.readValue(reader, clas);
- 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 {
- BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) );
- 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("GET", exc);
- throw new AAIServiceException(exc);
- } finally {
- if(inputStream != null){
- try {
- inputStream.close();
- } catch(Exception exc) {
-
- }
- }
- con = null;
- }
- return response;
- }
-
- @Override
- public Boolean patch(AAIRequest request, String resourceVersion) throws AAIServiceException {
- InputStream inputStream = null;
- String requestId = UUID.randomUUID().toString();
-
- try {
- AAIDatum instance = request.getRequestObject();
- if(instance instanceof ResourceVersion) {
- resourceVersion = ((ResourceVersion)instance).getResourceVersion();
- }
-
- URL requestUrl = null;
- HttpURLConnection con = getConfiguredConnection(requestUrl = request.getRequestUrl("PATCH", resourceVersion), "PATCH");
- ObjectMapper mapper = getObjectMapper();
- String json_text = request.toJSONString();
-
- LOGwriteDateTrace("data", json_text);
- logMetricRequest(requestId, "PATCH "+requestUrl.getPath(), json_text, requestUrl.getPath());
-
- OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream());
- osw.write(json_text);
- osw.flush();
-
- // Check for errors
- String responseMessage = con.getResponseMessage();
- 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();
- }
-
- LOG.info("HttpURLConnection result: " + responseCode + " : " + responseMessage);
- logMetricResponse(requestId,responseCode, responseMessage);
-
- // Process the response
- BufferedReader reader;
- String line = null;
- reader = new BufferedReader( new InputStreamReader( inputStream ) );
- mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-
- if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
- StringBuilder stringBuilder = new StringBuilder();
-
- while( ( line = reader.readLine() ) != null ) {
- stringBuilder.append( line );
- }
- LOGwriteEndingTrace(responseCode, responseMessage,
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ StringBuilder stringBuilder = new StringBuilder("\n");
+ String line = null;
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOG.info(stringBuilder.toString());
+// response = mapper.readValue(reader, String.class);
+ response = stringBuilder.toString();
+ LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response));
+ } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
+ LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist.");
+ response = null;
+ } 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("requestNetworkVceData", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ if(inputStream != null){
+ try {
+ inputStream.close();
+ } catch(Exception exc) {
+
+ }
+ }
+ }
+ return response;
+ }
+
+
+ @Override
+ public GenericVnf requestGenericVnfeNodeQuery(String vnf_name) throws AAIServiceException {
+
+ if(vnf_name == null) {
+ throw new NullPointerException();
+ }
+
+ GenericVnf entity = null;
+ SearchResults resp = this.requestNodeQuery("generic-vnf", "vnf-name", vnf_name);
+
+ List<ResultData> resultDataList = resp.getResultData();
+
+ try {
+ for (ResultData datum : resultDataList) {
+ String data_type = datum.getResourceType();
+ URL url = new URL(datum.getResourceLink());
+ entity = this.getResource(url.toString(), GenericVnf.class);
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Caught exception", e);
+ }
+ return entity;
+ }
+
+ @Override
+ public Vserver requestVServerDataByURL(URL url) throws AAIServiceException {
+
+ if(url == null) {
+ throw new NullPointerException();
+ }
+
+ Vserver entity = null;
+
+ try {
+ entity = this.getResource(url.toString(), Vserver.class);
+ } catch (AAIServiceException exc) {
+ throw exc;
+ } catch (Exception e) {
+ throw new AAIServiceException(e);
+ }
+ return entity;
+ }
+
+ @Override
+ public URL requestVserverURLNodeQuery(String vserver_name) throws AAIServiceException {
+
+ if(vserver_name == null) {
+ throw new NullPointerException();
+ }
+
+ URL entity = null;
+ SearchResults resp = this.requestNodeQuery("vserver", "vserver-name", vserver_name);
+
+ List<ResultData> resultDataList = resp.getResultData();
+
+ try {
+ for (ResultData datum : resultDataList) {
+ String data_type = datum.getResourceType();
+ String resourceLink = datum.getResourceLink();
+ if(!resourceLink.isEmpty() && !resourceLink.toLowerCase().startsWith("http")) {
+ resourceLink = (new EchoRequest()).target_uri + resourceLink;
+ }
+ entity = new URL(resourceLink);
+ }
+ } catch (Exception e) {
+ throw new AAIServiceException(e);
+ }
+ return entity;
+ }
+
+ class AAIRequestExecutor implements AAIExecutorInterface {
+
+ @Override
+ public String get(AAIRequest request) throws AAIServiceException {
+ String response = null;
+ InputStream inputStream = null;
+ HttpURLConnection con = null;
+ URL requestUrl = null;
+
+ String requestId = UUID.randomUUID().toString();
+ StringBuilder errorStringBuilder = new StringBuilder();
+
+ try {
+
+ if(request.getRequestObject() != null) {
+ requestUrl = request.getRequestUrl(HttpMethod.POST, null);
+ requestUrl = appendDepth(requestUrl, request);
+ con = getConfiguredConnection(requestUrl, HttpMethod.POST);
+ String json_text = request.toJSONString();
+ LOGwriteDateTrace("data", json_text);
+ logMetricRequest(requestId, "POST "+requestUrl.getPath(), json_text, requestUrl.getPath());
+ OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream());
+ osw.write(json_text);
+ osw.flush();
+ } else {
+ requestUrl = request.getRequestUrl(HttpMethod.GET, null);
+ requestUrl = appendDepth(requestUrl, request);
+ con = getConfiguredConnection(requestUrl, HttpMethod.GET);
+ logMetricRequest(requestId, "GET "+requestUrl.getPath(), "", requestUrl.getPath());
+ }
+
+ // Check for errors
+ String responseMessage = con.getResponseMessage();
+ int responseCode = con.getResponseCode();
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ inputStream = con.getInputStream();
+ } else {
+ inputStream = con.getErrorStream();
+ }
+
+ // Process the response
+ LOG.debug("HttpURLConnection result:" + responseCode + " : " + responseMessage);
+ logMetricResponse(requestId, responseCode, responseMessage);
+
+ 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();
+ String line = null;
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ response = stringBuilder.toString();
+ try {
+ Object object = mapper.readValue(response, Object.class);
+ LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, responseMessage, mapper.writeValueAsString(object));
+ } catch(Exception exc) {
+ LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, responseMessage, mapper.writeValueAsString(response));
+ }
+ } else if (responseCode == HttpURLConnection.HTTP_NOT_FOUND) {
+ LOGwriteEndingTrace(responseCode, responseMessage, "Entry does not exist.");
+ ErrorResponse errorresponse = null;
+ try {
+ errorresponse = mapper.readValue(reader, ErrorResponse.class);
+ } catch(Exception exc) {
+ errorresponse = new ErrorResponse();
+ RequestError requestError = new RequestError();
+ ServiceException serviceException = new ServiceException();
+ serviceException.setText("Entry does not exist.");
+ requestError.setServiceException(serviceException);
+ errorresponse.setRequestError(requestError );
+ }
+ throw new AAIServiceException(responseCode, errorresponse);
+ } else if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED) {
+ StringBuilder stringBuilder = new StringBuilder();
+ String line = null;
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, responseMessage, stringBuilder.toString());
+ ServiceException serviceException = new ServiceException();
+ serviceException.setMessageId("HTTP_UNAUTHORIZED");
+ serviceException.setText(stringBuilder.toString());
+ RequestError requestError = new RequestError();
+ requestError.setServiceException(serviceException);
+ ErrorResponse errorresponse = new ErrorResponse();
+ errorresponse.setRequestError(requestError);
+ throw new AAIServiceException(responseCode, errorresponse);
+ } else {
+// StringBuilder errorStringBuilder = new StringBuilder();
+ String line = null;
+ while( ( line = reader.readLine() ) != null ) {
+ errorStringBuilder.append("\n").append( line );
+ }
+
+ ErrorResponse errorresponse = mapper.readValue(errorStringBuilder.toString(), ErrorResponse.class);
+// ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
+ LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse));
+ throw new AAIServiceException(responseCode, errorresponse);
+ }
+
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn(errorStringBuilder.toString(), exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ if(inputStream != null){
+ try {
+ inputStream.close();
+ } catch(Exception exc) {
+
+ }
+ }
+ }
+ return response;
+ }
+
+ private URL appendDepth(URL requestUrl, AAIRequest request) throws MalformedURLException {
+
+ String depth = request.requestProperties.getProperty("depth", "1");
+ String path = requestUrl.toString();
+ if(path.contains("?depth=") || path.contains("&depth=")) {
+ return requestUrl;
+ } else {
+ if(path.contains("?")) {
+ path = String.format("%s&depth=%s", path, depth);
+ } else {
+ path = String.format("%s?depth=%s", path, depth);
+ }
+ return new URL(path);
+ }
+ }
+
+ @Override
+ public String post(AAIRequest request) throws AAIServiceException {
+ InputStream inputStream = null;
+ String requestId = UUID.randomUUID().toString();
+
+ try {
+ String resourceVersion = null;
+ AAIDatum instance = request.getRequestObject();
+
+ Method getResourceVersionMethod = instance.getClass().getMethod("getResourceVersion");
+ if(getResourceVersionMethod != null){
+ try {
+ getResourceVersionMethod.setAccessible(true);
+ Object object = getResourceVersionMethod.invoke(instance);
+ if(object != null)
+ resourceVersion = object.toString();
+ } catch (InvocationTargetException x) {
+ Throwable cause = x.getCause();
+ }
+ }
+
+ URL requestUrl = null;
+ HttpURLConnection con = getConfiguredConnection(requestUrl = request.getRequestUrl(HttpMethod.PUT, resourceVersion), HttpMethod.PUT);
+ ObjectMapper mapper = getObjectMapper();
+ String json_text = request.toJSONString();
+
+ LOGwriteDateTrace("data", json_text);
+ logMetricRequest(requestId, "PUT "+requestUrl.getPath(), json_text, requestUrl.getPath());
+
+ OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream());
+ osw.write(json_text);
+ osw.flush();
+
+ // Check for errors
+ String responseMessage = con.getResponseMessage();
+ 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();
+ }
+
+ LOG.debug("HttpURLConnection result:" + responseCode + " : " + responseMessage);
+ logMetricResponse(requestId,responseCode, responseMessage);
+
+ // Process the response
+ BufferedReader reader;
+ String line = null;
+ reader = new BufferedReader( new InputStreamReader( inputStream ) );
+ mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+
+ if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
+ StringBuilder stringBuilder = new StringBuilder();
+
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, responseMessage, (stringBuilder != null) ? stringBuilder.toString() : "{no-data}");
+ return stringBuilder.toString();
+ } else {
+ ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
+ LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse));
+
+ throw new AAIServiceException(responseCode, errorresponse);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("AAIRequestExecutor.post", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ try {
+ if(inputStream != null)
+ inputStream.close();
+ } catch (Exception exc) {
+
+ }
+ }
+ }
+
+ @Override
+ public Boolean delete(AAIRequest request, String resourceVersion) throws AAIServiceException {
+ Boolean response = null;
+ InputStream inputStream = null;
+ String requestId = UUID.randomUUID().toString();
+
+ if(resourceVersion == null) {
+ throw new AAIServiceException("resource-version is required for DELETE request");
+ }
+
+ try {
+ URL requestUrl = null;
+ HttpURLConnection conn = getConfiguredConnection(requestUrl = request.getRequestUrl(HttpMethod.DELETE, resourceVersion), HttpMethod.DELETE);
+ logMetricRequest(requestId, "DELETE "+requestUrl.getPath(), "", requestUrl.getPath());
+ conn.setDoOutput(true);
+
+ // Check for errors
+ String responseMessage = conn.getResponseMessage();
+ int responseCode = conn.getResponseCode();
+ if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
+ inputStream = conn.getInputStream();
+ } else {
+ inputStream = conn.getErrorStream();
+ }
+
+ // Process the response
+ LOG.debug("HttpURLConnection result:" + responseCode + " : " + responseMessage);
+ logMetricResponse(requestId,responseCode, responseMessage);
+
+ if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8));
+ BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) );
+ String line = null;
+
+ ObjectMapper mapper = getObjectMapper();
+
+ if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
+ StringBuilder stringBuilder = new StringBuilder();
+
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, responseMessage, stringBuilder.toString());
+ response = true;
+ } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
+ LOGwriteEndingTrace(responseCode, responseMessage, "Entry does not exist.");
+ response = false;
+ } else {
+ ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
+ LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse));
+ throw new AAIServiceException(responseCode, errorresponse);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("delete", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ if(inputStream != null){
+ try {
+ inputStream.close();
+ } catch(Exception exc) {
+
+ }
+ }
+ }
+ return response;
+ }
+
+ @Override
+ public Object query(AAIRequest request, Class clas) throws AAIServiceException {
+ Object response = null;
+ InputStream inputStream = null;
+ HttpURLConnection con = null;
+ URL requestUrl = null;
+ String requestId = UUID.randomUUID().toString();
+
+ try {
+ requestUrl = request.getRequestQueryUrl(HttpMethod.GET);
+ con = getConfiguredConnection(requestUrl , HttpMethod.GET);
+ logMetricRequest(requestId, "GET "+requestUrl.getPath(), "", requestUrl.getPath());
+
+ // Check for errors
+ String responseMessage = con.getResponseMessage();
+ int responseCode = con.getResponseCode();
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ inputStream = con.getInputStream();
+ } else {
+ inputStream = con.getErrorStream();
+ }
+
+ logMetricResponse(requestId,responseCode, responseMessage);
+ ObjectMapper mapper = getObjectMapper();
+
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ // Process the response
+ BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) );
+ response = mapper.readValue(reader, clas);
+ 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 {
+ BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) );
+ 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("GET", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ if(inputStream != null){
+ try {
+ inputStream.close();
+ } catch(Exception exc) {
+
+ }
+ }
+ con = null;
+ }
+ return response;
+ }
+
+ @Override
+ public Boolean patch(AAIRequest request, String resourceVersion) throws AAIServiceException {
+ InputStream inputStream = null;
+ String requestId = UUID.randomUUID().toString();
+
+ try {
+ AAIDatum instance = request.getRequestObject();
+ if(instance instanceof ResourceVersion) {
+ resourceVersion = ((ResourceVersion)instance).getResourceVersion();
+ }
+
+ URL requestUrl = null;
+ HttpURLConnection con = getConfiguredConnection(requestUrl = request.getRequestUrl("PATCH", resourceVersion), "PATCH");
+ ObjectMapper mapper = getObjectMapper();
+ String json_text = request.toJSONString();
+
+ LOGwriteDateTrace("data", json_text);
+ logMetricRequest(requestId, "PATCH "+requestUrl.getPath(), json_text, requestUrl.getPath());
+
+ OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream());
+ osw.write(json_text);
+ osw.flush();
+
+ // Check for errors
+ String responseMessage = con.getResponseMessage();
+ 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();
+ }
+
+ LOG.info("HttpURLConnection result: " + responseCode + " : " + responseMessage);
+ logMetricResponse(requestId,responseCode, responseMessage);
+
+ // Process the response
+ BufferedReader reader;
+ String line = null;
+ reader = new BufferedReader( new InputStreamReader( inputStream ) );
+ mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+
+ if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_CREATED || responseCode == HttpURLConnection.HTTP_ACCEPTED || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
+ StringBuilder stringBuilder = new StringBuilder();
+
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, responseMessage,
(stringBuilder.length() > 0) ? stringBuilder.toString() : "{no-data}");
- return true;
- } else {
- StringBuilder stringBuilder = new StringBuilder();
-
- while( ( line = reader.readLine() ) != null ) {
- stringBuilder.append("\n").append( line );
- }
- LOG.info(stringBuilder.toString());
-
-
- ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
- LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse));
-
- throw new AAIServiceException(responseCode, errorresponse);
- }
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("AAIRequestExecutor.patch", exc);
- throw new AAIServiceException(exc);
- } finally {
- try {
- if(inputStream != null)
- inputStream.close();
- } catch (Exception exc) {
-
- }
- }
- }
- }
-
- @Override
- public Tenant requestTenantData(String tenant_id, String cloudOwner, String cloudRegionId) throws AAIServiceException {
- Tenant response = null;
-
- try {
- 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) {
- ObjectMapper mapper = getObjectMapper();
- response = mapper.readValue(rv, Tenant.class);
- }
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestTenantData", exc);
- throw new AAIServiceException(exc);
- }
-
- return response;
- }
-
- @Override
- public Tenant requestTenantDataByName(String tenant_name, String cloudOwner, String cloudRegionId) throws AAIServiceException {
- Tenant response = null;
-
- try {
- 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;
- else
- response = (Tenant)rv;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestTenantDataByName", exc);
- throw new AAIServiceException(exc);
- }
-
- return response;
- }
-
-
- @Override
- public boolean postTenantData(String tenant_id, String cloudOwner, String cloudRegionId, Tenant tenannt) throws AAIServiceException {
- try {
- 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);
- Object response = executor.post(request);
- return true;
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("postTenantData", exc);
- throw new AAIServiceException(exc);
- }
- }
-
-
- @Override
- public String getTenantIdFromVserverUrl(URL url) {
-
- String path = url.getPath();
-
- String[] split = path.split("/tenants/tenant/");
- if(split.length > 1) {
- split = split[1].split("/");
- return split[0];
- } else {
- return null;
- }
- }
-
- @Override
- public String getCloudOwnerFromVserverUrl(URL url) {
-
- String path = url.getPath();
-
- String[] split = path.split("/cloud-regions/cloud-region/");
- if(split.length > 1) {
- split = split[1].split("/");
- return split[0];
- } else {
- return null;
- }
- }
-
- @Override
- public String getCloudRegionFromVserverUrl(URL url) {
-
- String path = url.getPath();
-
- String[] split = path.split("/cloud-regions/cloud-region/");
- if(split.length > 1) {
- split = split[1].split("/");
- return split[1];
- } else {
- return null;
- }
- }
-
- @Override
- public String getVServerIdFromVserverUrl(URL url, String tenantId) {
- String pattern = network_vserver_path;
- pattern = pattern.replace("{tenant-id}", tenantId);
-
- int end = pattern.indexOf("{vserver-id}");
- String prefix = pattern.substring(0, end);
-
- String path = url.getPath();
-
- if(path.startsWith(prefix)) {
- path = path.substring(prefix.length());
- }
-
- return path;
- }
-
- protected Logger getLogger(){
- return LOG;
- }
-
-
- @Override
- public AAIRequestExecutor getExecutor() {
- return executor;
- }
-
- /**
- * Creates a current time stamp in UTC i.e. 2016-03-08T22:15:13.343Z.
- * If there are any parameters the values are appended to the time stamp.
- *
- * @param parameters
- * values to be appended to current time stamp
- * @param ctx
- * used to set an attribute for a DG
- * @throws SvcLogicException
- */
- public void setStatusMethod(Map<String, String> parameters, SvcLogicContext ctx) throws SvcLogicException {
- if (ctx == null) {
- throw new SvcLogicException("SvcLogicContext is null.");
- }
-
- StringBuilder sb = new StringBuilder();
- sb.append(String.format("%tFT%<tTZ", Calendar.getInstance(TimeZone.getTimeZone("Z")))).append(" - ");
-
- for (Entry<String, String> entry : parameters.entrySet()) {
- sb.append(entry.getValue()).append(" ");
- }
-
- if (sb.length() > 0) {
- sb.setLength(sb.length() - 2);
- }
-
- ctx.setAttribute("aai-summary-status-message", sb.toString());
- LOG.info("aai-summary-status-message: " + sb.toString());
- }
+ return true;
+ } else {
+ StringBuilder stringBuilder = new StringBuilder();
+
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append("\n").append( line );
+ }
+ LOG.info(stringBuilder.toString());
+
+
+ ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
+ LOGwriteEndingTrace(responseCode, responseMessage, mapper.writeValueAsString(errorresponse));
+
+ throw new AAIServiceException(responseCode, errorresponse);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("AAIRequestExecutor.patch", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ try {
+ if(inputStream != null)
+ inputStream.close();
+ } catch (Exception exc) {
+
+ }
+ }
+ }
+ }
+
+ @Override
+ public Tenant requestTenantData(String tenant_id, String cloudOwner, String cloudRegionId) throws AAIServiceException {
+ Tenant response = null;
+
+ try {
+ 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) {
+ ObjectMapper mapper = getObjectMapper();
+ response = mapper.readValue(rv, Tenant.class);
+ }
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestTenantData", exc);
+ throw new AAIServiceException(exc);
+ }
+
+ return response;
+ }
+
+ @Override
+ public Tenant requestTenantDataByName(String tenant_name, String cloudOwner, String cloudRegionId) throws AAIServiceException {
+ Tenant response = null;
+
+ try {
+ 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;
+ else
+ response = (Tenant)rv;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("requestTenantDataByName", exc);
+ throw new AAIServiceException(exc);
+ }
+
+ return response;
+ }
+
+
+ @Override
+ public boolean postTenantData(String tenant_id, String cloudOwner, String cloudRegionId, Tenant tenannt) throws AAIServiceException {
+ try {
+ 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);
+ Object response = executor.post(request);
+ return true;
+ } catch(AAIServiceException aaiexc) {
+ throw aaiexc;
+ } catch (Exception exc) {
+ LOG.warn("postTenantData", exc);
+ throw new AAIServiceException(exc);
+ }
+ }
+
+
+ @Override
+ public String getTenantIdFromVserverUrl(URL url) {
+
+ String path = url.getPath();
+
+ String[] split = path.split("/tenants/tenant/");
+ if(split.length > 1) {
+ split = split[1].split("/");
+ return split[0];
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public String getCloudOwnerFromVserverUrl(URL url) {
+
+ String path = url.getPath();
+
+ String[] split = path.split("/cloud-regions/cloud-region/");
+ if(split.length > 1) {
+ split = split[1].split("/");
+ return split[0];
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public String getCloudRegionFromVserverUrl(URL url) {
+
+ String path = url.getPath();
+
+ String[] split = path.split("/cloud-regions/cloud-region/");
+ if(split.length > 1) {
+ split = split[1].split("/");
+ return split[1];
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public String getVServerIdFromVserverUrl(URL url, String tenantId) {
+ String pattern = network_vserver_path;
+ pattern = pattern.replace("{tenant-id}", tenantId);
+
+ int end = pattern.indexOf("{vserver-id}");
+ String prefix = pattern.substring(0, end);
+
+ String path = url.getPath();
+
+ if(path.startsWith(prefix)) {
+ path = path.substring(prefix.length());
+ }
+
+ return path;
+ }
+
+ protected Logger getLogger(){
+ return LOG;
+ }
+
+
+ @Override
+ public AAIRequestExecutor getExecutor() {
+ return executor;
+ }
+
+ /**
+ * Creates a current time stamp in UTC i.e. 2016-03-08T22:15:13.343Z.
+ * If there are any parameters the values are appended to the time stamp.
+ *
+ * @param parameters
+ * values to be appended to current time stamp
+ * @param ctx
+ * used to set an attribute for a DG
+ * @throws SvcLogicException
+ */
+ public void setStatusMethod(Map<String, String> parameters, SvcLogicContext ctx) throws SvcLogicException {
+ if (ctx == null) {
+ throw new SvcLogicException("SvcLogicContext is null.");
+ }
+
+ StringBuilder sb = new StringBuilder();
+ sb.append(String.format("%tFT%<tTZ", Calendar.getInstance(TimeZone.getTimeZone("Z")))).append(" - ");
+
+ for (Entry<String, String> entry : parameters.entrySet()) {
+ sb.append(entry.getValue()).append(" ");
+ }
+
+ if (sb.length() > 0) {
+ sb.setLength(sb.length() - 2);
+ }
+
+ ctx.setAttribute("aai-summary-status-message", sb.toString());
+ LOG.info("aai-summary-status-message: " + sb.toString());
+ }
/**
* Generic method to GET json data from an A&AI using key structure.
@@ -2984,82 +2884,81 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
* if empty or null key and or type or there's an error with processing
*/
- public <T> T getResource(String key, Class<T> type) throws AAIServiceException {
- if (StringUtils.isEmpty(key) || type == null) {
- throw new AAIServiceException("Key is empty or null and or type is null");
- }
+ public <T> T getResource(String key, Class<T> type) throws AAIServiceException {
+ if (StringUtils.isEmpty(key) || type == null) {
+ throw new AAIServiceException("Key is empty or null and or type is null");
+ }
- T response = null;
+ T response = null;
- SvcLogicContext ctx = new SvcLogicContext();
- if(!key.contains(" = ")) {
- if(isValidURL(key)) {
- key = String.format("selflink = '%s'", key);
- } else if(isValidURI(key)) {
- key = String.format("resource-path = '%s'", key);
- } else {
- return response;
- }
- }
+ SvcLogicContext ctx = new SvcLogicContext();
+ if(!key.contains(" = ")) {
+ if(isValidURL(key)) {
+ key = String.format("selflink = '%s'", key);
+ } else if(isValidURI(key)) {
+ key = String.format("resource-path = '%s'", key);
+ } else {
+ return response;
+ }
+ }
- HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
+ HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
- AAIRequest request = new SelfLinkRequest(type);
- if(nameValues.containsKey(PathRequest.RESOURCE_PATH.replaceAll("-", "_"))) {
- request = new PathRequest(type);
- }
+ AAIRequest request = new SelfLinkRequest(type);
+ if(nameValues.containsKey(PathRequest.RESOURCE_PATH.replaceAll("-", "_"))) {
+ request = new PathRequest(type);
+ }
- request.processRequestPathValues(nameValues);
- Object obj = this.getExecutor().query(request, type);
- response = type.cast(obj);
+ request.processRequestPathValues(nameValues);
+ Object obj = this.getExecutor().query(request, type);
+ response = type.cast(obj);
- return response != null ? type.cast(response) : response;
- }
+ return response != null ? type.cast(response) : response;
+ }
- public boolean isValidURL(String url) {
+ public boolean isValidURL(String url) {
- URL u = null;
+ URL u = null;
- try {
- u = new URL(url);
- } catch (MalformedURLException e) {
- return false;
- }
+ try {
+ u = new URL(url);
+ } catch (MalformedURLException e) {
+ return false;
+ }
- try {
- u.toURI();
- } catch (URISyntaxException e) {
- return false;
- }
+ try {
+ u.toURI();
+ } catch (URISyntaxException e) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- public boolean isValidURI(String url) {
+ public boolean isValidURI(String url) {
- URI u = null;
+ URI u = null;
- try {
- u = new URI(url);
- } catch (URISyntaxException e) {
- return false;
- }
+ try {
+ u = new URI(url);
+ } catch (URISyntaxException e) {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- @Override
- protected boolean deleteRelationshipList(URL httpReqUrl, String json_text) throws AAIServiceException {
- if(httpReqUrl == null) {
- throw new NullPointerException();
- }
+ protected boolean deleteRelationshipList(URL httpReqUrl, String json_text) throws AAIServiceException {
+ if(httpReqUrl == null) {
+ throw new NullPointerException();
+ }
- boolean response = false;
- InputStream inputStream = null;
+ boolean response = false;
+ InputStream inputStream = null;
- try {
+ try {
HttpURLConnection con = getConfiguredConnection(httpReqUrl, HttpMethod.DELETE);
// SSLSocketFactory sockFact = CTX.getSocketFactory();
@@ -3071,14 +2970,14 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
LOGwriteFirstTrace("DELETE", httpReqUrl.toString());
- LOGwriteDateTrace("data", json_text);
+ LOGwriteDateTrace("data", json_text);
// Check for errors
int responseCode = con.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
- inputStream = con.getInputStream();
+ inputStream = con.getInputStream();
} else {
- inputStream = con.getErrorStream();
+ inputStream = con.getErrorStream();
}
// Process the response
@@ -3089,241 +2988,275 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
ObjectMapper mapper = getObjectMapper();
- if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
- StringBuilder stringBuilder = new StringBuilder();
-
- while( ( line = reader.readLine() ) != null ) {
- stringBuilder.append( line );
- }
- LOGwriteEndingTrace(responseCode, "SUCCESS", stringBuilder.toString());
- response = true;
- } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
- LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist.");
- response = false;
+ if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_NO_CONTENT) {
+ StringBuilder stringBuilder = new StringBuilder();
+
+ while( ( line = reader.readLine() ) != null ) {
+ stringBuilder.append( line );
+ }
+ LOGwriteEndingTrace(responseCode, "SUCCESS", stringBuilder.toString());
+ response = true;
+ } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
+ LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist.");
+ response = false;
} 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("deleteRelationshipList", exc);
- throw new AAIServiceException(exc);
- } finally {
- if(inputStream != null){
- try {
- inputStream.close();
- } catch(Exception exc) {
-
- }
- }
- }
- return response;
- }
-
- public static ObjectMapper getObjectMapper() {
+ 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("deleteRelationshipList", exc);
+ throw new AAIServiceException(exc);
+ } finally {
+ if(inputStream != null){
+ try {
+ inputStream.close();
+ } catch(Exception exc) {
+
+ }
+ }
+ }
+ return response;
+ }
+
+ public static ObjectMapper getObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
- AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
- AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
- mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(introspector, secondary));
+ AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
+ AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
+ mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(introspector, secondary));
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
mapper.setSerializationInclusion(Include.NON_NULL);
return mapper;
- }
-
- public void logMetricRequest(String requestId, String targetServiceName, String msg, String path){
- String svcInstanceId = "";
- String svcName = null;
- String partnerName = null;
- String targetEntity = "A&AI";
- String targetVirtualEntity = null;
-
- targetServiceName = "";
-
- ml.logRequest(svcInstanceId, svcName, partnerName, targetEntity, targetServiceName, targetVirtualEntity, msg);
- }
-
- public void logMetricResponse(String requestId, int responseCode, String responseDescription){
- ml.logResponse(responseCode < 400 ? "SUCCESS" : "FAILURE", Integer.toString(responseCode), responseDescription);
- }
-
- public void logKeyError(String keys){
- LOG.error("Atleast one of the keys [" + keys + "] should have been populated. This will cause a NPE.");
- }
-
-
- /**
- * Retrofit code
- */
- @Override
- public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map<String, String> params, String prefix, SvcLogicContext ctx)
- throws SvcLogicException {
- String normResource = resource.split(":")[0];
-
- switch(normResource){
- case "formatted-query":
- case "generic-query":
- case "named-query":
- case "nodes-query":
- case "linterface":
- case "l2-bridge-sbg":
- case "l2-bridge-bgf":
- case "echo":
- case "test":
- break;
-
- default:
- if(key.contains("selflink =")) {
- break;
- }
- if(!key.contains(String.format("%s.", normResource))) {
- key = rewriteKey(resource, key, ctx);
- }
- }
- return super.save(resource, force, localOnly, key, params, prefix, ctx);
- }
-
- @Override
- public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx)
- throws SvcLogicException {
- String normResource = resource.split(":")[0];
-
- switch(normResource){
- case "formatted-query":
- case "generic-query":
- case "named-query":
- case "nodes-query":
- case "linterface":
- case "l2-bridge-sbg":
- case "l2-bridge-bgf":
- case "echo":
- case "test":
- break;
-
- default:
- if(key.contains("selflink =")) {
- break;
- }
- if(!key.contains(String.format("%s.", normResource))) {
- key = rewriteKey(resource, key, ctx);
- }
- }
-
- return super.query(resource, localOnly, select, key, prefix, orderBy, ctx);
- }
-
- @Override
- public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException {
- String normResource = resource.split(":")[0];
-
- switch(normResource){
- case "formatted-query":
- case "generic-query":
- case "named-query":
- case "nodes-query":
- case "linterface":
- case "l2-bridge-sbg":
- case "l2-bridge-bgf":
- case "echo":
- case "test":
- break;
-
- default:
- if(key.contains("selflink =")) {
- break;
- }
- if(!key.contains(String.format("%s.", normResource))) {
- key = rewriteKey(resource, key, ctx);
- }
- }
-
- return super.delete(resource, key, ctx);
- }
-
- @Override
- public QueryStatus update(String resource, String key, Map<String, String> params, String prefix, SvcLogicContext ctx) throws SvcLogicException {
- String normResource = resource.split(":")[0];
-
- switch(normResource){
- case "formatted-query":
- case "generic-query":
- case "named-query":
- case "nodes-query":
- case "linterface":
- case "l2-bridge-sbg":
- case "l2-bridge-bgf":
- case "echo":
- case "test":
- break;
-
- default:
- if(key.contains("selflink =")) {
- break;
- }
- if(!key.contains(String.format("%s.", normResource))) {
- key = rewriteKey(resource, key, ctx);
- }
- }
-
- return super.update(resource, key, params, prefix, ctx);
- }
-
- 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);
-
- String normResource = resource.split(":")[0];
- Class<? extends AAIDatum> clazz = null;
- try {
- clazz = AAIRequest.getClassFromResource(normResource) ;
- } catch (ClassNotFoundException e) {
- LOG.warn("AAIRequest does not support class: " + e.getMessage());
- return key;
- }
- if(clazz == null)
- return key;
-
- List<String> fieldAnnotatedNames = new LinkedList<>();
-
- Field[] fields = clazz.getDeclaredFields();
- for(Field field : fields) {
- String fieldName = field.getName();
- XmlElement annotation = field.getAnnotation(XmlElement.class);
- if(annotation == null)
- continue;
- String primaryId = annotation.name();
- if("##default".equals(primaryId)) {
- primaryId = fieldName;
- }
- fieldAnnotatedNames.add(primaryId);
- }
-
- HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
- Set<String> keyset = nameValues.keySet();
- for(String keyName : keyset) {
- if(keyName.contains("."))
- continue;
- else {
- String tmpKeyName = keyName.replaceAll("_", "-");
- String valueToSubstitute = String.format("%s =", tmpKeyName);
- if(fieldAnnotatedNames.contains(tmpKeyName) && key.contains(valueToSubstitute)) {
- key = key.replace(valueToSubstitute, String.format("%s.%s =", normResource, tmpKeyName));
- }
- }
- }
-
-
- return key;
- }
-
- @Override
- public String getPathTemplateForResource(String resoourceName, String keys, SvcLogicContext ctx) throws MalformedURLException {
- return AAIServiceUtils.getPathForResource(resoourceName, StringUtils.join(keys, " AND "), ctx);
- }
-
- @Override
- public boolean isDeprecatedFormat(String resource, HashMap<String, String> nameValues) {
- return !AAIServiceUtils.isValidFormat(resource, nameValues);
- }
+ }
+
+ public void logMetricRequest(String requestId, String targetServiceName, String msg, String path){
+ String svcInstanceId = "";
+ String svcName = null;
+ String partnerName = null;
+ String targetEntity = "A&AI";
+ String targetVirtualEntity = null;
+
+ targetServiceName = "";
+
+ ml.logRequest(svcInstanceId, svcName, partnerName, targetEntity, targetServiceName, targetVirtualEntity, msg);
+ }
+
+ public void logMetricResponse(String requestId, int responseCode, String responseDescription){
+ ml.logResponse(responseCode < 400 ? "SUCCESS" : "FAILURE", Integer.toString(responseCode), responseDescription);
+ }
+
+ public void logKeyError(String keys){
+ LOG.error("Atleast one of the keys [" + keys + "] should have been populated. This will cause a NPE.");
+ }
+
+
+ /**
+ * Retrofit code
+ */
+ @Override
+ public QueryStatus save(String resource, boolean force, boolean localOnly, String key, Map<String, String> params, String prefix, SvcLogicContext ctx)
+ throws SvcLogicException {
+ String normResource = resource.split(":")[0];
+
+ switch(normResource){
+ case "custom-query":
+ case "formatted-query":
+ case "generic-query":
+ case "named-query":
+ case "nodes-query":
+ case "linterface":
+ case "l2-bridge-sbg":
+ case "l2-bridge-bgf":
+ case "echo":
+ case "test":
+ break;
+
+ default:
+ if(key.contains("selflink =")) {
+ break;
+ }
+ if(!key.contains(String.format("%s.", normResource))) {
+ key = rewriteKey(resource, key, ctx);
+ }
+ }
+ return super.save(resource, force, localOnly, key, params, prefix, ctx);
+ }
+
+ @Override
+ public QueryStatus query(String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx)
+ throws SvcLogicException {
+ String normResource = resource.split(":")[0];
+
+ switch(normResource){
+ case "formatted-query":
+ case "generic-query":
+ case "named-query":
+ case "nodes-query":
+ case "linterface":
+ case "l2-bridge-sbg":
+ case "l2-bridge-bgf":
+ case "echo":
+ case "test":
+ break;
+
+ default:
+ if(key.contains("selflink =")) {
+ break;
+ }
+ if(!key.contains(String.format("%s.", normResource))) {
+ key = rewriteKey(resource, key, ctx);
+ }
+ }
+
+ return super.query(resource, localOnly, select, key, prefix, orderBy, ctx);
+ }
+
+ @Override
+ public QueryStatus delete(String resource, String key, SvcLogicContext ctx) throws SvcLogicException {
+ String normResource = resource.split(":")[0];
+
+ switch(normResource){
+ case "formatted-query":
+ case "generic-query":
+ case "named-query":
+ case "nodes-query":
+ case "linterface":
+ case "l2-bridge-sbg":
+ case "l2-bridge-bgf":
+ case "echo":
+ case "test":
+ break;
+
+ default:
+ if(key.contains("selflink =")) {
+ break;
+ }
+ if(!key.contains(String.format("%s.", normResource))) {
+ key = rewriteKey(resource, key, ctx);
+ }
+ }
+
+ return super.delete(resource, key, ctx);
+ }
+
+ @Override
+ public QueryStatus update(String resource, String key, Map<String, String> params, String prefix, SvcLogicContext ctx) throws SvcLogicException {
+ String normResource = resource.split(":")[0];
+
+ switch(normResource){
+ case "formatted-query":
+ case "generic-query":
+ case "named-query":
+ case "nodes-query":
+ case "linterface":
+ case "l2-bridge-sbg":
+ case "l2-bridge-bgf":
+ case "echo":
+ case "test":
+ break;
+
+ default:
+ if(key.contains("selflink =")) {
+ break;
+ }
+ if(!key.contains(String.format("%s.", normResource))) {
+ key = rewriteKey(resource, key, ctx);
+ }
+ }
+
+ return super.update(resource, key, params, prefix, ctx);
+ }
+
+ 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);
+
+ String normResource = resource.split(":")[0];
+ Class<? extends AAIDatum> clazz = null;
+ try {
+ clazz = AAIRequest.getClassFromResource(normResource) ;
+ } catch (ClassNotFoundException e) {
+ LOG.warn("AAIRequest does not support class: " + e.getMessage());
+ return key;
+ }
+ if(clazz == null)
+ return key;
+
+ List<String> fieldAnnotatedNames = new LinkedList<>();
+
+ Field[] fields = clazz.getDeclaredFields();
+ for(Field field : fields) {
+ String fieldName = field.getName();
+ XmlElement annotation = field.getAnnotation(XmlElement.class);
+ if(annotation == null)
+ continue;
+ String primaryId = annotation.name();
+ if("##default".equals(primaryId)) {
+ primaryId = fieldName;
+ }
+ fieldAnnotatedNames.add(primaryId);
+ }
+
+ HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
+ Set<String> keyset = nameValues.keySet();
+ for(String keyName : keyset) {
+ if(keyName.contains("."))
+ continue;
+ else {
+ String tmpKeyName = keyName.replaceAll("_", "-");
+ String valueToSubstitute = String.format("%s =", tmpKeyName);
+ if(fieldAnnotatedNames.contains(tmpKeyName) && key.contains(valueToSubstitute)) {
+ key = key.replace(valueToSubstitute, String.format("%s.%s =", normResource, tmpKeyName));
+ }
+ }
+ }
+
+
+ return key;
+ }
+
+ @Override
+ public String getPathTemplateForResource(String resoourceName, String keys, SvcLogicContext ctx) throws MalformedURLException {
+ return AAIServiceUtils.getPathForResource(resoourceName, StringUtils.join(keys, " AND "), ctx);
+ }
+
+ @Override
+ public boolean isDeprecatedFormat(String resource, HashMap<String, String> nameValues) {
+ return !AAIServiceUtils.isValidFormat(resource, nameValues);
+ }
+
+ public AAIRequest getRequestFromResource(String resoourceName) {
+ return AAIRequest.getRequestFromResource(resoourceName);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.sdnc.sli.aai.haha#query(org.openecomp.sdnc.sli.aai.AAIRequest)
+ */
+ @Override
+ public String query(AAIRequest request) throws AAIServiceException {
+ return executor.get(request);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.sdnc.sli.aai.haha#save(org.openecomp.sdnc.sli.aai.AAIRequest)
+ */
+ @Override
+ public String save(AAIRequest request) throws AAIServiceException {
+ return executor.post(request);
+ }
+
+ public boolean update(AAIRequest request, String resourceVersion) throws AAIServiceException {
+ return executor.patch(request, resourceVersion);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.sdnc.sli.aai.haha#delete(org.openecomp.sdnc.sli.aai.AAIRequest, java.lang.String)
+ */
+ @Override
+ public boolean delete(AAIRequest request, String resourceVersion) throws AAIServiceException {
+ return executor.patch(request, resourceVersion);
+ }
+
}
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java
index e1fa90709..37a207fb9 100644..100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java
@@ -76,6 +76,7 @@ public class AAIServiceActivator implements BundleActivator {
}
Properties properties = new Properties();
+ InputStream input = null;
// find aaiclient config file
File[] files = findFiles(configDirectory, DEFAULT_CONFIG_FILE_NAME);
@@ -83,12 +84,20 @@ public class AAIServiceActivator implements BundleActivator {
// read the aai config data
if(files != null && files.length > 0) {
LOG.debug("AAIService config file exists and it is named :" + files[0].getAbsolutePath() );
- try ( InputStream input = new FileInputStream(files[0])) {
+ try {
+ input = new FileInputStream(files[0]);
properties.load(input);
LOG.debug("Loaded AAI Client properties from " + files[0].getAbsolutePath());
} catch (IOException exc) {
LOG.warn("Problem loading AAI Client properties from " + files[0].getAbsolutePath(), exc);
} finally {
+ if(input != null ) {
+ try {
+ input.close();
+ } catch(Exception exc) {
+ // ignore
+ }
+ }
int size = properties.keySet().size() ;
if(size == 0) {
LOG.debug(files[0].getAbsolutePath() + " contained no entries. Adding the default entry");
@@ -148,13 +157,13 @@ public class AAIServiceActivator implements BundleActivator {
if (sdnConfigDirectory == null || sdnConfigDirectory.isEmpty()) {
String filename = DEFAULT_SDNC_PROPERTY_FILE;
File file = new File(filename);
- if(file.exists()) {
+ if(file != null && file.exists()) {
propertiesPath = filename;
LOG.info("Using property file (1): " + propertiesPath);
} else {
filename = BVC_PROPERTY_FILE;
file = new File(filename);
- if(file.exists()) {
+ if(file != null && file.exists()) {
propertiesPath = filename;
LOG.info("Using property file (1): " + propertiesPath);
} else {
@@ -170,13 +179,13 @@ public class AAIServiceActivator implements BundleActivator {
if(!propFile.exists()) {
String filename = DEFAULT_SDNC_PROPERTY_FILE;
File file = new File(filename);
- if(file.exists()) {
+ if(file != null && file.exists()) {
propertiesPath = filename;
LOG.info("Using property file (1): " + propertiesPath);
} else {
filename = BVC_PROPERTY_FILE;
file = new File(filename);
- if(file.exists()) {
+ if(file != null && file.exists()) {
propertiesPath = filename;
LOG.info("Using property file (1): " + propertiesPath);
} else {
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java
index ebcd46545..0566aac72 100644..100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java
@@ -3,14 +3,14 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * 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.
@@ -27,6 +27,7 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -44,297 +45,335 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AAIServiceUtils {
-
- private static final Logger LOG = LoggerFactory.getLogger(AAIService.class);
-
- public static String getPrimaryIdFromClass(Class<? extends AAIDatum> resourceClass){
- // 1. find class
- getLogger().debug(resourceClass.getName());
- AAIDatum instance = null;
-
- try {
- instance = resourceClass.newInstance();
-
- Annotation[] annotations = resourceClass.getAnnotations();
- for(Annotation annotation : annotations) {
- Class<? extends Annotation> anotationType = annotation.annotationType();
- String annotationName = anotationType.getName();
-
- // 2. find string property setters and getters for the lists
- if("javax.xml.bind.annotation.XmlType".equals(annotationName)){
- XmlType order = (XmlType)annotation;
- String[] values = order.propOrder();
- for(String value : values) {
- String id = camelCaseToDashedString(value);
- return id;
- }
- }
- }
- } catch(Exception exc) {
-
- }
- return null;
- }
-
- public static String getSecondaryIdFromClass(Class<? extends AAIDatum> resourceClass){
- // 1. find class
- getLogger().debug(resourceClass.getName());
- AAIDatum instance = null;
-
- try {
- instance = resourceClass.newInstance();
-
- Annotation[] annotations = resourceClass.getAnnotations();
- for(Annotation annotation : annotations) {
- Class<? extends Annotation> anotationType = annotation.annotationType();
- String annotationName = anotationType.getName();
-
- // 2. find string property setters and getters for the lists
- if("javax.xml.bind.annotation.XmlType".equals(annotationName)){
- boolean primaryIdFound = false;
- XmlType order = (XmlType)annotation;
- String[] values = order.propOrder();
- for(String value : values) {
- String id = camelCaseToDashedString(value);
- if(primaryIdFound) {
- return id;
- } else {
- primaryIdFound = true;
- }
- }
- }
- }
- } catch(Exception exc) {
-
- }
- return null;
- }
-
-
- private static Logger getLogger() {
- return LOG;
- }
-
-
- private static final String regex = "([A-Z][a-z,0-9]+)";
- private static final String replacement = "-$1";
-
- public static String camelCaseToDashedString(String propOrder) {
- return propOrder.replaceAll(regex, replacement).toLowerCase();
- }
-
- public static HashMap<String,String> keyToHashMap(String key, SvcLogicContext ctx) {
- if (key == null) {
- return (null);
- }
-
- getLogger().debug("Converting key [" + key + "] to where clause");
-
- if (key.startsWith("'") && key.endsWith("'")) {
- key = key.substring(1, key.length() - 1);
-
- getLogger().debug("Stripped outer single quotes - key is now [" + key + "]");
- }
-
- String[] keyTerms = key.split("\\s+");
-
- StringBuffer whereBuff = new StringBuffer();
- String term1 = null;
- String op = null;
- String term2 = null;
- HashMap<String, String> results = new HashMap<String, String>();
-
- for (int i = 0; i < keyTerms.length; i++) {
- if (term1 == null) {
- if ("and".equalsIgnoreCase(keyTerms[i])
- || "or".equalsIgnoreCase(keyTerms[i])) {
- // Skip over ADD/OR
- } else {
- term1 = resolveTerm(keyTerms[i], ctx);
- }
- } else if (op == null) {
- if ("==".equals(keyTerms[i])) {
- op = "=";
- } else {
- op = keyTerms[i];
- }
- } else {
- term2 = resolveTerm(keyTerms[i], ctx);
- term2 = term2.trim().replace("'", "").replace("$", "").replace("'", "");
- results.put(term1, term2);
-
- term1 = null;
- op = null;
- term2 = null;
- }
- }
-
- return (results);
- }
-
- private static String resolveTerm(String term, SvcLogicContext ctx) {
- if (term == null) {
- return (null);
- }
-
- getLogger().debug("resolveTerm: term is " + term);
-
- if (term.startsWith("$") && (ctx != null)) {
- // Resolve any index variables.
-
- return ("'" + resolveCtxVariable(term.substring(1), ctx) + "'");
- } else if (term.startsWith("'") || term.startsWith("\"")) {
- return (term);
- } else {
- return (term.replaceAll("-", "_"));
-
- }
- }
-
- private static String resolveCtxVariable(String ctxVarName, SvcLogicContext ctx) {
-
- if (ctxVarName.indexOf('[') == -1) {
- // Ctx variable contains no arrays
- return (ctx.getAttribute(ctxVarName));
- }
-
- // Resolve any array references
- StringBuffer sbuff = new StringBuffer();
- String[] ctxVarParts = ctxVarName.split("\\[");
- sbuff.append(ctxVarParts[0]);
- for (int i = 1; i < ctxVarParts.length; i++) {
- if (ctxVarParts[i].startsWith("$")) {
- int endBracketLoc = ctxVarParts[i].indexOf("]");
- if (endBracketLoc == -1) {
- // Missing end bracket ... give up parsing
- getLogger().warn("Variable reference " + ctxVarName
- + " seems to be missing a ']'");
- return (ctx.getAttribute(ctxVarName));
- }
-
- String idxVarName = ctxVarParts[i].substring(1, endBracketLoc);
- String remainder = ctxVarParts[i].substring(endBracketLoc);
-
- sbuff.append("[");
- sbuff.append(ctx.getAttribute(idxVarName));
- sbuff.append(remainder);
-
- } else {
- // Index is not a variable reference
- sbuff.append("[");
- sbuff.append(ctxVarParts[i]);
- }
- }
-
- return (ctx.getAttribute(sbuff.toString()));
- }
-
- public static void populateRelationshipDataFromPath(RelationshipList rl) throws URISyntaxException {
- List<Relationship> list = rl.getRelationship();
- if(list != null && !list.isEmpty()) {
- for(Relationship relationship : list) {
- if(relationship.getRelationshipData().isEmpty()){
- String link = relationship.getRelatedLink();
- URI uri = new URI(link);
- link = uri.getPath();
- HashMap<String,String> contributors = pathToHashMap(link);
- for(String key : contributors.keySet()) {
- RelationshipData rd = new RelationshipData();
- rd.setRelationshipKey(key);
- rd.setRelationshipValue(contributors.get(key));
- relationship.getRelationshipData().add(rd);
- }
- }
- }
- }
- }
-
- protected static HashMap<String,String> pathToHashMap(String path) {
- HashMap<String, String> nameValues = new HashMap<String, String>();
-
- String[] split = path.split("/");
-
- LinkedList<String> list = new LinkedList<String>( Arrays.asList(split));
- Iterator<String> it = list.iterator();
-
- while(it.hasNext()) {
- String tag = it.next();
- if(!tag.isEmpty()) {
- if(AAIRequest.getResourceNames().contains(tag)){
- LOG.info(tag);
- // get the class from tag
- Class<? extends AAIDatum> clazz = null;
- try {
- clazz = AAIRequest.getClassFromResource(tag);
- String fieldName = AAIServiceUtils.getPrimaryIdFromClass(clazz);
-
- String value = it.next();
- if(!StringUtils.isEmpty(value)){
- nameValues.put(String.format("%s.%s", tag, fieldName), value);
- switch(tag) {
- case "cloud-region":
- case "entitlement":
- case "license":
- case "route-target":
- case "service-capability":
- case "ctag-pool":
- String secondaryFieldName = AAIServiceUtils.getSecondaryIdFromClass(clazz);
- if(secondaryFieldName != null) {
- value = it.next();
- nameValues.put(String.format("%s.%s", tag, secondaryFieldName), value);
- }
- break;
- default:
- break;
- }
- }
- } catch (ClassNotFoundException exc) {
- LOG.info("Caught exception", exc);
- }
- }
- }
- }
- return nameValues;
- }
-
- public static String getPathForResource(String resource, String key, SvcLogicContext ctx ) throws MalformedURLException{
- HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
- AAIRequest request = AAIRequest.createRequest(resource, nameValues);
-
- for(String name : nameValues.keySet()) {
- request.addRequestProperty(name, nameValues.get(name));
- }
- return request.getRequestPath();
- }
-
- public static boolean isValidFormat(String resource, HashMap<String, String> nameValues) {
-
- switch(resource){
- case "formatted-query":
- case "generic-query":
- case "named-query":
- case "nodes-query":
- case "linterface":
- case "l2-bridge-sbg":
- case "l2-bridge-bgf":
- case "echo":
- case "test":
- return true;
- }
- if(resource.contains(":")) {
- resource = resource.substring(0, resource.indexOf(":"));
- }
-
- Set<String> keys = nameValues.keySet();
- for(String key : keys) {
- if(!key.contains(".")) {
- if("depth".equals(key) || "related-to".equals(key) || "related_to".equals(key) || "related-link".equals(key) || "related_link".equals(key) || "selflink".equals(key))
- continue;
- else {
- getLogger().warn(String.format("key %s is incompatible with resource type '%s'", key, resource));
- }
- }
- }
- return true;
- }
+
+ private static final Logger LOG = LoggerFactory.getLogger(AAIService.class);
+
+ public static String getPrimaryIdFromClass(Class<? extends AAIDatum> resourceClass){
+ // 1. find class
+ getLogger().debug(resourceClass.getName());
+ AAIDatum instance = null;
+
+ try {
+ instance = resourceClass.newInstance();
+
+ Annotation[] annotations = resourceClass.getAnnotations();
+ for(Annotation annotation : annotations) {
+ Class<? extends Annotation> anotationType = annotation.annotationType();
+ String annotationName = anotationType.getName();
+
+ // 2. find string property setters and getters for the lists
+ if("javax.xml.bind.annotation.XmlType".equals(annotationName)){
+ XmlType order = (XmlType)annotation;
+ String[] values = order.propOrder();
+ for(String value : values) {
+ String id = camelCaseToDashedString(value);
+ return id;
+ }
+ }
+ }
+ } catch(Exception exc) {
+
+ }
+ return null;
+ }
+
+ public static String getSecondaryIdFromClass(Class<? extends AAIDatum> resourceClass){
+ // 1. find class
+ getLogger().debug(resourceClass.getName());
+ AAIDatum instance = null;
+
+ try {
+ instance = resourceClass.newInstance();
+
+ Annotation[] annotations = resourceClass.getAnnotations();
+ for(Annotation annotation : annotations) {
+ Class<? extends Annotation> anotationType = annotation.annotationType();
+ String annotationName = anotationType.getName();
+
+ // 2. find string property setters and getters for the lists
+ if("javax.xml.bind.annotation.XmlType".equals(annotationName)){
+ boolean primaryIdFound = false;
+ XmlType order = (XmlType)annotation;
+ String[] values = order.propOrder();
+ for(String value : values) {
+ String id = camelCaseToDashedString(value);
+ if(primaryIdFound) {
+ return id;
+ } else {
+ primaryIdFound = true;
+ }
+ }
+ }
+ }
+ } catch(Exception exc) {
+
+ }
+ return null;
+ }
+
+
+ private static Logger getLogger() {
+ return LOG;
+ }
+
+
+ private static final String regex = "([A-Z][a-z,0-9]+)";
+ private static final String replacement = "-$1";
+
+ public static String camelCaseToDashedString(String propOrder) {
+ return propOrder.replaceAll(regex, replacement).toLowerCase();
+ }
+
+ public static HashMap<String,String> keyToHashMap(String key, SvcLogicContext ctx) {
+ if (key == null) {
+ return (null);
+ }
+
+ getLogger().debug("Converting key [" + key + "] to where clause");
+
+ if (key.startsWith("'") && key.endsWith("'")) {
+ key = key.substring(1, key.length() - 1);
+
+ getLogger().debug("Stripped outer single quotes - key is now [" + key + "]");
+ }
+
+ String[] keyTerms = key.split("\\s+");
+
+ StringBuffer whereBuff = new StringBuffer();
+ String term1 = null;
+ String op = null;
+ String term2 = null;
+ HashMap<String, String> results = new HashMap<String, String>();
+
+ for (int i = 0; i < keyTerms.length; i++) {
+ if (term1 == null) {
+ if ("and".equalsIgnoreCase(keyTerms[i])
+ || "or".equalsIgnoreCase(keyTerms[i])) {
+ // Skip over ADD/OR
+ } else {
+ term1 = resolveTerm(keyTerms[i], ctx);
+ }
+ } else if (op == null) {
+ if ("==".equals(keyTerms[i])) {
+ op = "=";
+ } else {
+ op = keyTerms[i];
+ }
+ } else {
+ term2 = resolveTerm(keyTerms[i], ctx);
+ term2 = term2.trim().replace("'", "").replace("$", "").replace("'", "");
+ results.put(term1, term2);
+
+ term1 = null;
+ op = null;
+ term2 = null;
+ }
+ }
+
+ return (results);
+ }
+
+ private static String resolveTerm(String term, SvcLogicContext ctx) {
+ if (term == null) {
+ return (null);
+ }
+
+ getLogger().debug("resolveTerm: term is " + term);
+
+ if (term.startsWith("$") && (ctx != null)) {
+ // Resolve any index variables.
+
+ return ("'" + resolveCtxVariable(term.substring(1), ctx) + "'");
+ } else if (term.startsWith("'") || term.startsWith("\"")) {
+ return (term);
+ } else {
+ return (term.replaceAll("-", "_"));
+
+ }
+ }
+
+ private static String resolveCtxVariable(String ctxVarName, SvcLogicContext ctx) {
+
+ if (ctxVarName.indexOf('[') == -1) {
+ // Ctx variable contains no arrays
+ return (ctx.getAttribute(ctxVarName));
+ }
+
+ // Resolve any array references
+ StringBuffer sbuff = new StringBuffer();
+ String[] ctxVarParts = ctxVarName.split("\\[");
+ sbuff.append(ctxVarParts[0]);
+ for (int i = 1; i < ctxVarParts.length; i++) {
+ if (ctxVarParts[i].startsWith("$")) {
+ int endBracketLoc = ctxVarParts[i].indexOf("]");
+ if (endBracketLoc == -1) {
+ // Missing end bracket ... give up parsing
+ getLogger().warn("Variable reference " + ctxVarName
+ + " seems to be missing a ']'");
+ return (ctx.getAttribute(ctxVarName));
+ }
+
+ String idxVarName = ctxVarParts[i].substring(1, endBracketLoc);
+ String remainder = ctxVarParts[i].substring(endBracketLoc);
+
+ sbuff.append("[");
+ sbuff.append(ctx.getAttribute(idxVarName));
+ sbuff.append(remainder);
+
+ } else {
+ // Index is not a variable reference
+ sbuff.append("[");
+ sbuff.append(ctxVarParts[i]);
+ }
+ }
+
+ return (ctx.getAttribute(sbuff.toString()));
+ }
+
+ public static void populateRelationshipDataFromPath(RelationshipList rl) throws URISyntaxException {
+ List<Relationship> list = rl.getRelationship();
+ if(list != null && !list.isEmpty()) {
+ for(Relationship relationship : list) {
+ if(relationship.getRelationshipData().isEmpty()){
+ String link = relationship.getRelatedLink();
+ URI uri = new URI(link);
+ link = uri.getPath();
+ HashMap<String,String> contributors = pathToHashMap(link);
+ for(String key : contributors.keySet()) {
+ RelationshipData rd = new RelationshipData();
+ rd.setRelationshipKey(key);
+ rd.setRelationshipValue(contributors.get(key));
+ relationship.getRelationshipData().add(rd);
+ }
+ }
+ }
+ }
+ }
+
+ protected static HashMap<String,String> pathToHashMap(String path) {
+ HashMap<String, String> nameValues = new HashMap<String, String>();
+
+ String[] split = path.split("/");
+
+ LinkedList<String> list = new LinkedList<String>( Arrays.asList(split));
+ Iterator<String> it = list.iterator();
+
+ while(it.hasNext()) {
+ String tag = it.next();
+ if(!tag.isEmpty()) {
+ if(AAIRequest.getResourceNames().contains(tag)){
+ LOG.info(tag);
+ // get the class from tag
+ Class<? extends AAIDatum> clazz = null;
+ try {
+ clazz = AAIRequest.getClassFromResource(tag);
+ String fieldName = AAIServiceUtils.getPrimaryIdFromClass(clazz);
+
+ String value = it.next();
+ if(!StringUtils.isEmpty(value)){
+ nameValues.put(String.format("%s.%s", tag, fieldName), value);
+ switch(tag) {
+ case "cloud-region":
+ case "entitlement":
+ case "license":
+ case "route-target":
+ case "service-capability":
+ case "ctag-pool":
+ String secondaryFieldName = AAIServiceUtils.getSecondaryIdFromClass(clazz);
+ if(secondaryFieldName != null) {
+ value = it.next();
+ nameValues.put(String.format("%s.%s", tag, secondaryFieldName), value);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ } catch (ClassNotFoundException exc) {
+ LOG.info("Caught exception", exc);
+ }
+ }
+ }
+ }
+ return nameValues;
+ }
+
+ public static String getPathForResource(String resource, String key, SvcLogicContext ctx ) throws MalformedURLException{
+ HashMap<String, String> nameValues = AAIServiceUtils.keyToHashMap(key, ctx);
+ AAIRequest request = AAIRequest.createRequest(resource, nameValues);
+
+ for(String name : nameValues.keySet()) {
+ request.addRequestProperty(name, nameValues.get(name));
+ }
+ return request.getRequestPath();
+ }
+
+ public static boolean isValidFormat(String resource, HashMap<String, String> nameValues) {
+
+ switch(resource){
+ case "formatted-query":
+ case "generic-query":
+ case "named-query":
+ case "nodes-query":
+ case "linterface":
+ case "l2-bridge-sbg":
+ case "l2-bridge-bgf":
+ case "echo":
+ case "test":
+ return true;
+ }
+ if(resource.contains(":")) {
+ resource = resource.substring(0, resource.indexOf(":"));
+ }
+
+ Set<String> keys = nameValues.keySet();
+ for(String key : keys) {
+ if(!key.contains(".")) {
+ if("depth".equals(key) || "related-to".equals(key) || "related_to".equals(key) || "related-link".equals(key) || "related_link".equals(key) || "selflink".equals(key))
+ continue;
+ else {
+ getLogger().warn(String.format("key %s is incompatible with resource type '%s'", key, resource));
+ }
+ }
+ }
+ return true;
+ }
+
+ public static boolean containsResource(String resource, HashMap<String, String> nameValues) {
+ if(resource.contains(":")) {
+ return true;
+ }
+
+ switch(resource){
+ case "custom-query":
+ case "formatted-query":
+ case "generic-query":
+ case "named-query":
+ case "nodes-query":
+ case "linterface":
+ case "l2-bridge-sbg":
+ case "l2-bridge-bgf":
+ case "echo":
+ case "test":
+ return true;
+
+ default:
+ if(nameValues.containsKey("selflink")) {
+ return true;
+ }
+ }
+
+ Set<String> tags = new HashSet<>();
+
+ for(String key : nameValues.keySet()) {
+ key = key.replace("_", "-");
+ if(key.contains(".")) {
+ String[] split = key.split("\\.");
+ tags.add(split[0]);
+ } else {
+ tags.add(key);
+ }
+ }
+ return tags.contains(resource);
+ }
}
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java
index e2bf885d9..dd192b798 100644..100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java
@@ -3,14 +3,14 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * 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.
@@ -22,6 +22,7 @@
package org.onap.ccsdk.sli.adaptors.aai;
import java.io.UnsupportedEncodingException;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
@@ -30,6 +31,7 @@ import java.util.Map;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
import org.openecomp.aai.inventory.v11.L3Network;
@@ -42,278 +44,213 @@ import com.google.common.base.Joiner;
public class GenericRequest extends AAIRequest {
- protected Class<? extends AAIDatum> model;
-
- public GenericRequest(Class<? extends AAIDatum> clazz) {
- model = clazz;
- }
-
- @Override
- public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
-
- String request_url = null;
- String originalPath = null;
- String pathSubstitute = null;
-
- request_url = target_uri + getRequestPath();
-
- Map<String, String> queryParams = new HashMap<String, String> ();
- if(resourceVersion != null) {
- queryParams.put("resource-version",resourceVersion);
- }
-
- Set<String> uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames());
-
- String[] keys = requestProperties.keySet().toArray(new String[0]);
- for(String key : keys) {
- if("cloud-region.cloud-region-id".equals(key))
- continue;
- if("entitlement.resource-uuid".equals(key))
- continue;
- if("license.resource-uuid".equals(key))
- continue;
-
-
- String value = requestProperties.getProperty(key);
- if(key.contains(".")) {
- String[] splitKey = key.split("\\.");
- if("cloud-region".equals(splitKey[0])){
- String cloudRegionId = requestProperties.getProperty("cloud-region.cloud-region-id");
- aaiService.LOGwriteDateTrace("cloud-region-id", cloudRegionId);
- String token = String.format("%s/{%s}/{cloud-region-id}", splitKey[0], splitKey[1] );
- String encoded_owner = encodeQuery(value);
- String encoded_region = encodeQuery(cloudRegionId);
- request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region));
- } else if("entitlement".equals(splitKey[0])){
- String cloudRegionId = requestProperties.getProperty("entitlement.resource-uuid");
- aaiService.LOGwriteDateTrace("resource-uuid", cloudRegionId);
- String token = String.format("%s/{%s}/{resource-uuid}", splitKey[0], splitKey[1] );
- String encoded_owner = encodeQuery(value);
- String encoded_region = encodeQuery(cloudRegionId);
- request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region));
- } else if("license".equals(splitKey[0])){
- String cloudRegionId = requestProperties.getProperty("license.resource-uuid");
- aaiService.LOGwriteDateTrace("resource-uuid", cloudRegionId);
- String token = String.format("%s/{%s}/{resource-uuid}", splitKey[0], splitKey[1] );
- String encoded_owner = encodeQuery(value);
- String encoded_region = encodeQuery(cloudRegionId);
- request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region));
- } else {
- Class<? extends AAIDatum> clazz = null;
- try {
- clazz = getClassFromResource(splitKey[0]);
- } catch (ClassNotFoundException exc) {
- LOG.warn("AAIRequest does not support class: " + exc.getMessage());
- return null;
- }
-
- if(clazz != null) {
- if(clazz == this.model) {
- Field[] fields = this.model.getDeclaredFields();
- Field field = fields[0];
- String fieldName = field.getName();
- XmlElement annotation = field.getAnnotation(XmlElement.class);
- String primaryId = annotation.name();
- if("##default".equals(primaryId)) {
- primaryId = fieldName;
- }
-
- String token = String.format("%s/{%s}", splitKey[0], primaryId);
-
- if(splitKey[1].equals(primaryId)) {
- String encoded_vnf = encodeQuery(value);
- request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf));
- } else {
- queryParams.put(splitKey[1], encodeQuery(value));
- originalPath = token;
- pathSubstitute = String.format("%s", splitKey[0]);
- }
- } else if(L3Networks.class == this.model) {
- Field[] fields = L3Network.class.getDeclaredFields();
- Field field = fields[0];
- String fieldName = field.getName();
- XmlElement annotation = field.getAnnotation(XmlElement.class);
- String primaryId = annotation.name();
- if("##default".equals(primaryId)) {
- primaryId = fieldName;
- }
-
- String token = String.format("%s/{%s}", splitKey[0], primaryId);
- originalPath = token;
- pathSubstitute = String.format("");
-
- queryParams.put(splitKey[1], encodeQuery(value));
- } else {
- String token = String.format("%s/{%s}", splitKey[0], splitKey[1]);
- String encoded_vnf = encodeQuery(value);
- request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf));
- }
- }
-
- }
- aaiService.LOGwriteDateTrace(splitKey[1], value);
- }
- }
-
- if(originalPath != null && pathSubstitute != null)
- request_url = request_url.replace(originalPath, pathSubstitute);
-
- if(!queryParams.isEmpty()) {
- Joiner.MapJoiner mapJoiner = Joiner.on("&").withKeyValueSeparator("=");
- String queryString = mapJoiner.join(queryParams);
- 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;
- }
-
-
- public URL OriginalgetRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
-
- String request_url = null;
-
- request_url = target_uri + getRequestPath();
-
- Map<String, String> keyValuepairs = new HashMap<String, String> ();
- Set<String> uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames());
-
- String[] keys = requestProperties.keySet().toArray(new String[0]);
- for(String key : keys) {
- if("cloud-region.cloud-region-id".equals(key))
- continue;
- if("entitlement.resource-uuid".equals(key))
- continue;
- if("license.resource-uuid".equals(key))
- continue;
-
-
- String value = requestProperties.getProperty(key);
- if(key.contains(".")) {
- String[] splitKey = key.split("\\.");
- if("cloud-region".equals(splitKey[0])){
- String cloudRegionId = requestProperties.getProperty("cloud-region.cloud-region-id");
- aaiService.LOGwriteDateTrace("cloud-region-id", cloudRegionId);
- String token = String.format("%s/{%s}/{cloud-region-id}", splitKey[0], splitKey[1] );
- String encoded_owner = encodeQuery(value);
- String encoded_region = encodeQuery(cloudRegionId);
- request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region));
- } else if("entitlement".equals(splitKey[0])){
- String cloudRegionId = requestProperties.getProperty("entitlement.resource-uuid");
- aaiService.LOGwriteDateTrace("resource-uuid", cloudRegionId);
- String token = String.format("%s/{%s}/{resource-uuid}", splitKey[0], splitKey[1] );
- String encoded_owner = encodeQuery(value);
- String encoded_region = encodeQuery(cloudRegionId);
- request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region));
- } else if("license".equals(splitKey[0])){
- String cloudRegionId = requestProperties.getProperty("license.resource-uuid");
- aaiService.LOGwriteDateTrace("resource-uuid", cloudRegionId);
- String token = String.format("%s/{%s}/{resource-uuid}", splitKey[0], splitKey[1] );
- String encoded_owner = encodeQuery(value);
- String encoded_region = encodeQuery(cloudRegionId);
- request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region));
- } else {
- Class<? extends AAIDatum> clazz = null;
- try {
- clazz = getClassFromResource(splitKey[0]);
- } catch (ClassNotFoundException exc) {
- LOG.warn("AAIRequest does not support class: " + exc.getMessage());
- return null;
- }
-
- if(clazz != null) {
- if(clazz == this.model) {
- Field[] fields = this.model.getDeclaredFields();
- Field field = fields[0];
- String fieldName = field.getName();
- XmlElement annotation = field.getAnnotation(XmlElement.class);
- String primaryId = annotation.name();
- if("##default".equals(primaryId)) {
- primaryId = fieldName;
- }
-
- String token = String.format("%s/{%s}", splitKey[0], primaryId);
-
- if(splitKey[1].equals(primaryId)) {
- String encoded_vnf = encodeQuery(value);
- request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf));
- } else {
- String replacement = String.format("%s?%s=%s", splitKey[0], splitKey[1], encodeQuery(value));
- if(request_url.contains(token))
- request_url = request_url.replace(token, replacement);
- }
- } else {
- String token = String.format("%s/{%s}", splitKey[0], splitKey[1]);
- String encoded_vnf = encodeQuery(value);
- request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf));
- }
- }
-
- }
- aaiService.LOGwriteDateTrace(splitKey[1], value);
- }
- }
-
-
- 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();
-
- String json_text = null;
- try {
- json_text = mapper.writeValueAsString(requestDatum);
- } catch (JsonProcessingException exc) {
- handleException(this, exc);
- return null;
- }
- return json_text;
- }
-
- @Override
- public String[] getArgsList() {
- String[] args = {};
- return args;
- }
-
- @Override
- public Class<? extends AAIDatum> getModelClass() {
- return model;
- }
-
- public void processRequestPathValues(Map<String, String> nameValues) {
- // identify unique resources
- Set<String> uniqueResources = AAIRequest.extractUniqueResourceSetFromKeys(nameValues.keySet());
-
- String[] arguments = nameValues.keySet().toArray(new String[0]);
- for(String name : arguments) {
- String tmpName = name.replaceAll("-", "_");
- String value = nameValues.get(tmpName);
- if(value != null && !value.isEmpty()) {
- value = value.trim().replace("'", "").replace("$", "").replace("'", "");
- tmpName = name.replaceAll("_", "-");
- this.addRequestProperty(tmpName, value);
- }
- }
- }
+ protected Class<? extends AAIDatum> model;
+
+ public GenericRequest(Class<? extends AAIDatum> clazz) {
+ model = clazz;
+ }
+
+ @Override
+ public String updatePathDataValues(Object resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
+
+ String originalPath = null;
+ String pathSubstitute = null;
+ String resourceName = null;
+
+ Annotation[] annotations = model.getAnnotations();
+ for(Annotation annotation : annotations) {
+ Class<? extends Annotation> anotationType = annotation.annotationType();
+ String annotationName = anotationType.getName();
+ if("javax.xml.bind.annotation.XmlRootElement".equals(annotationName)){
+ XmlRootElement order = (XmlRootElement)annotation;
+ resourceName = order.name();
+ }
+ }
+
+ String request_url = getRequestPath(resourceName);
+
+ Map<String, String> queryParams = new HashMap<String, String> ();
+ if(resourceVersion != null) {
+ queryParams.put("resource-version", resourceVersion.toString());
+ }
+
+ Set<String> uniqueResources = extractUniqueResourceSetFromKeys(requestProperties.stringPropertyNames());
+
+ String[] keys = requestProperties.keySet().toArray(new String[0]);
+ for(String key : keys) {
+ switch(key) {
+ case "cloud-region.cloud-region-id":
+ case "entitlement.resource-uuid":
+ case "license.resource-uuid":
+ case "route-target.route-target-role":
+ case "service-capability.vnf-type":
+ case "ctag-pool.availability-zone-name":
+ continue;
+ }
+
+ String value = requestProperties.getProperty(key);
+ if(key.contains(".")) {
+ String[] splitKey = key.split("\\.");
+ if("cloud-region".equals(splitKey[0])){
+ String cloudRegionId = requestProperties.getProperty("cloud-region.cloud-region-id");
+ aaiService.LOGwriteDateTrace("cloud-region-id", cloudRegionId);
+ String token = String.format("%s/{%s}/{cloud-region-id}", splitKey[0], splitKey[1] );
+ String encoded_owner = encodeQuery(value);
+ String encoded_region = encodeQuery(cloudRegionId);
+ request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region));
+ } else if("entitlement".equals(splitKey[0])){
+ String cloudRegionId = requestProperties.getProperty("entitlement.resource-uuid");
+ aaiService.LOGwriteDateTrace("resource-uuid", cloudRegionId);
+ String token = String.format("%s/{%s}/{resource-uuid}", splitKey[0], splitKey[1] );
+ String encoded_owner = encodeQuery(value);
+ String encoded_region = encodeQuery(cloudRegionId);
+ request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region));
+ } else if("license".equals(splitKey[0])){
+ String cloudRegionId = requestProperties.getProperty("license.resource-uuid");
+ aaiService.LOGwriteDateTrace("resource-uuid", cloudRegionId);
+ String token = String.format("%s/{%s}/{resource-uuid}", splitKey[0], splitKey[1] );
+ String encoded_owner = encodeQuery(value);
+ String encoded_region = encodeQuery(cloudRegionId);
+ request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region));
+ } else if("route-target".equals(splitKey[0])){
+ String cloudRegionId = requestProperties.getProperty("route-target.route-target-role");
+ aaiService.LOGwriteDateTrace("route-target-role", cloudRegionId);
+ String token = String.format("%s/{%s}/{route-target-role}", splitKey[0], splitKey[1] );
+ String encoded_owner = encodeQuery(value);
+ String encoded_region = encodeQuery(cloudRegionId);
+ request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region));
+ } else if("service-capability".equals(splitKey[0])){
+ String vnfType = requestProperties.getProperty("service-capability.vnf-type");
+ aaiService.LOGwriteDateTrace("vnf-type", vnfType);
+ String token = String.format("%s/{%s}/{vnf-type}", splitKey[0], splitKey[1] );
+ String encoded_service_type = encodeQuery(value);
+ String encoded_vnf_type = encodeQuery(vnfType);
+ if("service-capability".equals(resourceName)) {
+ request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_service_type, encoded_vnf_type));
+ } else if("service-capabilities".equals(resourceName)) {
+ queryParams.put("service-type", encoded_service_type);
+ queryParams.put("vnf-type", encoded_vnf_type);
+ }
+ } else if("ctag-pool".equals(splitKey[0])){
+ String cloudRegionId = requestProperties.getProperty("ctag-pool.availability-zone-name");
+ aaiService.LOGwriteDateTrace("availability-zone-name", cloudRegionId);
+ String token = String.format("%s/{%s}/{availability-zone-name}", splitKey[0], splitKey[1] );
+ String encoded_owner = encodeQuery(value);
+ String encoded_region = encodeQuery(cloudRegionId);
+ request_url = request_url.replace(token, String.format("%s/%s/%s", splitKey[0], encoded_owner, encoded_region));
+ } else {
+ Class<? extends AAIDatum> clazz = null;
+ try {
+ clazz = getClassFromResource(splitKey[0]);
+ } catch (ClassNotFoundException exc) {
+ LOG.warn("AAIRequest does not support class: " + exc.getMessage());
+ return null;
+ }
+
+ if(clazz != null) {
+ if(clazz == this.model) {
+ Field[] fields = this.model.getDeclaredFields();
+ Field field = fields[0];
+ String fieldName = field.getName();
+ XmlElement annotation = field.getAnnotation(XmlElement.class);
+ String primaryId = annotation.name();
+ if("##default".equals(primaryId)) {
+ primaryId = fieldName;
+ }
+
+ String token = String.format("%s/{%s}", splitKey[0], primaryId);
+
+ if(splitKey[1].equals(primaryId)) {
+ String encoded_vnf = encodeQuery(value);
+ request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf));
+ } else {
+ queryParams.put(splitKey[1], encodeQuery(value));
+ originalPath = token;
+ pathSubstitute = String.format("%s", splitKey[0]);
+ }
+ } else if(L3Networks.class == this.model) {
+ Field[] fields = L3Network.class.getDeclaredFields();
+ Field field = fields[0];
+ String fieldName = field.getName();
+ XmlElement annotation = field.getAnnotation(XmlElement.class);
+ String primaryId = annotation.name();
+ if("##default".equals(primaryId)) {
+ primaryId = fieldName;
+ }
+
+ String token = String.format("%s/{%s}", splitKey[0], primaryId);
+ originalPath = token;
+ pathSubstitute = String.format("");
+
+ queryParams.put(splitKey[1], encodeQuery(value));
+ } else {
+ String token = String.format("%s/{%s}", splitKey[0], splitKey[1]);
+ String encoded_vnf = encodeQuery(value);
+ request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf));
+ }
+ }
+
+ }
+ aaiService.LOGwriteDateTrace(splitKey[1], value);
+ }
+ }
+
+ if(originalPath != null && pathSubstitute != null)
+ request_url = request_url.replace(originalPath, pathSubstitute);
+
+ if(!queryParams.isEmpty()) {
+ Joiner.MapJoiner mapJoiner = Joiner.on("&").withKeyValueSeparator("=");
+ String queryString = mapJoiner.join(queryParams);
+ request_url = String.format("%s?%s", request_url, queryString);
+ }
+
+ return request_url;
+ }
+
+ @Override
+ public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException {
+ return this.getRequestUrl(method, null);
+ }
+
+
+ @Override
+ public String toJSONString() {
+ ObjectMapper mapper = getObjectMapper();
+
+ String json_text = null;
+ try {
+ json_text = mapper.writeValueAsString(requestDatum);
+ } catch (JsonProcessingException exc) {
+ handleException(this, exc);
+ return null;
+ }
+ return json_text;
+ }
+
+ @Override
+ public String[] getArgsList() {
+ String[] args = {};
+ return args;
+ }
+
+ @Override
+ public Class<? extends AAIDatum> getModelClass() {
+ return model;
+ }
+
+ public void processRequestPathValues(Map<String, String> nameValues) {
+ // identify unique resources
+ Set<String> uniqueResources = AAIRequest.extractUniqueResourceSetFromKeys(nameValues.keySet());
+
+ String[] arguments = nameValues.keySet().toArray(new String[0]);
+ for(String name : arguments) {
+ String tmpName = name.replaceAll("-", "_");
+ String value = nameValues.get(tmpName);
+ if(value != null && !value.isEmpty()) {
+ value = value.trim().replace("'", "").replace("$", "").replace("'", "");
+ tmpName = name.replaceAll("_", "-");
+ this.addRequestProperty(tmpName, value);
+ }
+ }
+ }
}
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java
index 37410e00d..1236971fc 100644..100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java
@@ -3,14 +3,14 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * 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.
@@ -45,146 +45,166 @@ import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
public class NamedQueryRequest extends AAIRequest {
- public static final String NAMED_SEARCH_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.named";
+ public static final String NAMED_SEARCH_PATH = "org.onap.ccsdk.sli.adaptors.aai.query.named";
- private final String named_search_path;
+ private final String named_search_path;
- public static final String NAMED_QUERY_UUID = "named-query-uuid";
- public static final String PREFIX = "prefix";
+ public static final String NAMED_QUERY_UUID = "named-query-uuid";
+ public static final String PREFIX = "prefix";
- public NamedQueryRequest() {
- named_search_path = configProperties.getProperty(NAMED_SEARCH_PATH);
- }
+ public NamedQueryRequest() {
+ named_search_path = configProperties.getProperty(NAMED_SEARCH_PATH);
+ }
- @Override
- public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
+ @Override
+ public URL getRequestUrl(String method, String resourceVersion) throws UnsupportedEncodingException, MalformedURLException {
- String request_url = target_uri+named_search_path;
+ String request_url = target_uri+named_search_path;
- request_url = processPathData(request_url, requestProperties);
+ request_url = processPathData(request_url, requestProperties);
- if(resourceVersion != null) {
- request_url = request_url +"?resource-version="+resourceVersion;
- }
- URL http_req_url = new URL(request_url);
+ 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.LOGwriteFirstTrace(method, http_req_url.toString());
- return http_req_url;
- }
+ return http_req_url;
+ }
- @Override
- public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException {
- return getRequestUrl(method, null);
- }
+ @Override
+ public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException {
+ return getRequestUrl(method, null);
+ }
- @Override
- public String toJSONString() {
- ObjectMapper mapper = AAIService.getObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- mapper.setSerializationInclusion(Include.NON_EMPTY);
- mapper.setSerializationInclusion(Include.NON_DEFAULT);
+ @Override
+ public String toJSONString() {
+ ObjectMapper mapper = AAIService.getObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ mapper.setSerializationInclusion(Include.NON_EMPTY);
+ mapper.setSerializationInclusion(Include.NON_DEFAULT);
- AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
- AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
- mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(introspector, secondary));
+ AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(TypeFactory.defaultInstance());
+ AnnotationIntrospector secondary = new JacksonAnnotationIntrospector();
+ mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(introspector, secondary));
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
AAIDatum tenant = (AAIDatum)requestDatum;
- String json_text = null;
- try {
- ObjectNode node = mapper.valueToTree(tenant);
- Iterator<JsonNode> it = node.elements();
- while(it.hasNext()){
- JsonNode jn = it.next();
- JsonNode child = jn.get("instance-filter");
- if(child != null) {
- child = child.get(0);
- if(child.has("l3-network")) {
- JsonNode innerChild = child.get("l3-network");
- if(innerChild != null) {
- if(innerChild instanceof ObjectNode) {
- ObjectNode on = ObjectNode.class.cast(innerChild);
- List<String> namesToDelete = new ArrayList<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);
- return null;
- }
- return json_text;
- }
-
-
- @Override
- public String[] getArgsList() {
- String[] args = {NAMED_QUERY_UUID, PREFIX};
- return args;
- }
-
-
- @Override
- public Class<? extends AAIDatum> getModelClass() {
- return InventoryResponseItems.class;
- }
-
-
- public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException {
-
-
- String encoded_vnf ;
- String key = NAMED_QUERY_UUID;
-
- if(requestProperties.containsKey(key)) {
- encoded_vnf = encodeQuery(requestProperties.getProperty(key));
- request_url = request_url.replace("{named-query-uuid}", encoded_vnf) ;
- aaiService.LOGwriteDateTrace("named-query-uuid", requestProperties.getProperty(key));
- }
-
- key = PREFIX;
-
- if(requestProperties.containsKey(key)) {
- encoded_vnf = encodeQuery(requestProperties.getProperty(key));
- request_url = request_url.replace("{prefix}", encoded_vnf) ;
- aaiService.LOGwriteDateTrace("prefix", requestProperties.getProperty(key));
- }
-
- return request_url;
- }
+ 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);
+ }
+ }
+ }
+ } else if(child.has("generic-vnf")) {
+ JsonNode innerChild = child.get("generic-vnf");
+ if(innerChild != null) {
+ if(innerChild instanceof ObjectNode) {
+ ObjectNode on = ObjectNode.class.cast(innerChild);
+ List<String> namesToDelete = new ArrayList<String>();
+ Iterator<String> names = on.fieldNames();
+ while(names.hasNext()) {
+ String name = names.next();
+ if(name != null && name.startsWith("is-")) {
+ namesToDelete.add(name);
+ } else if(name != null && name.startsWith("in-maint")) {
+ namesToDelete.add(name);
+ }
+ }
+ for(String nameToDelete : namesToDelete) {
+ on.remove(nameToDelete);
+ }
+ }
+ }
+ }
+ }
+ }
+ json_text = node.toString();
+ if(json_text == null)
+ json_text = mapper.writeValueAsString(tenant);
+ } catch (JsonProcessingException exc) {
+ handleException(this, exc);
+ return null;
+ }
+ return json_text;
+ }
+
+
+ @Override
+ public String[] getArgsList() {
+ String[] args = {NAMED_QUERY_UUID, PREFIX};
+ return args;
+ }
+
+
+ @Override
+ public Class<? extends AAIDatum> getModelClass() {
+ return InventoryResponseItems.class;
+ }
+
+
+ public static String processPathData(String request_url, Properties requestProperties) throws UnsupportedEncodingException {
+
+
+ String encoded_vnf ;
+ String key = NAMED_QUERY_UUID;
+
+ if(requestProperties.containsKey(key)) {
+ encoded_vnf = encodeQuery(requestProperties.getProperty(key));
+ request_url = request_url.replace("{named-query-uuid}", encoded_vnf) ;
+ aaiService.LOGwriteDateTrace("named-query-uuid", requestProperties.getProperty(key));
+ }
+
+ key = PREFIX;
+
+ if(requestProperties.containsKey(key)) {
+ encoded_vnf = encodeQuery(requestProperties.getProperty(key));
+ request_url = request_url.replace("{prefix}", encoded_vnf) ;
+ aaiService.LOGwriteDateTrace("prefix", requestProperties.getProperty(key));
+ }
+
+ return request_url;
+ }
}
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/FormattedQueryResultList.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/FormattedQueryResultList.java
index e25254900..a50bf78b2 100644..100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/FormattedQueryResultList.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/FormattedQueryResultList.java
@@ -3,14 +3,14 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * 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.
@@ -38,15 +38,16 @@ import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum;
@XmlRootElement(name = "result-list")
public class FormattedQueryResultList implements AAIDatum {
- @XmlElement(name = "results")
- private List<Results> results;
- @XmlElement(name = "results")
- public List<Results> getResults ()
+ @XmlElement(name = "results")
+ private List<Result> results;
+
+ @XmlElement(name = "results")
+ public List<Result> getResults ()
{
return results;
}
@XmlElement(name = "results")
- public void setResults (List<Results> results)
+ public void setResults (List<Result> results)
{
this.results = results;
}
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFilter.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFilter.java
index efc16b934..186f099e1 100644..100755
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFilter.java
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/InstanceFilter.java
@@ -3,14 +3,14 @@
* openECOMP : SDN-C
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
+ * 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.
@@ -33,10 +33,16 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.openecomp.aai.inventory.v11.CloudRegion;
+import org.openecomp.aai.inventory.v11.GenericVnf;
import org.openecomp.aai.inventory.v11.L3Network;
import org.openecomp.aai.inventory.v11.Pnf;
import org.openecomp.aai.inventory.v11.LogicalLink;
+import org.openecomp.aai.inventory.v11.PInterface;
import org.openecomp.aai.inventory.v11.ServiceInstance;
+import org.openecomp.aai.inventory.v11.Tenant;
+import org.openecomp.aai.inventory.v11.Vnf;
+import org.openecomp.aai.inventory.v11.Vserver;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("org.jsonschema2pojo")
@@ -44,7 +50,13 @@ import org.openecomp.aai.inventory.v11.ServiceInstance;
"logical-link",
"pnf",
"l3-network",
- "service-instance"
+ "p-interface",
+ "generic-vnf",
+ "vserver",
+ "tenant",
+ "cloud-region",
+ "service-instance",
+ "vnfc"
})
public class InstanceFilter {
@@ -52,16 +64,28 @@ public class InstanceFilter {
private LogicalLink logicalLink;
@JsonProperty("pnf")
private Pnf pnf;
- @JsonProperty("l3-network")
+ @JsonProperty("l3-network")
private L3Network l3Network;
- @JsonProperty("service-instance")
+ @JsonProperty("p-interface")
+ private PInterface pInterface;
+ @JsonProperty("generic-vnf")
+ private GenericVnf genericVnf;
+ @JsonProperty("vserver")
+ private Vserver vserver;
+ @JsonProperty("tenant")
+ private Tenant tenant;
+ @JsonProperty("cloud-region")
+ private CloudRegion cloudRegion;
+ @JsonProperty("service-instance")
private ServiceInstance serviceInstance;
+ @JsonProperty("vnfc")
+ private Vnf vnfc;
@JsonIgnore
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
/**
- *
+ *
* @return
* The logicalLink
*/
@@ -71,7 +95,7 @@ public class InstanceFilter {
}
/**
- *
+ *
* @param logicalLink
* The logical-link
*/
@@ -81,7 +105,7 @@ public class InstanceFilter {
}
/**
- *
+ *
* @return
* The pnf
*/
@@ -91,7 +115,7 @@ public class InstanceFilter {
}
/**
- *
+ *
* @param pnf
* The pnf
*/
@@ -102,13 +126,13 @@ public class InstanceFilter {
@JsonProperty("l3-network")
public L3Network getL3Network() {
- return l3Network;
- }
+ return l3Network;
+ }
@JsonProperty("l3-network")
public void setL3Network(L3Network l3Network) {
- this.l3Network = l3Network;
- }
+ this.l3Network = l3Network;
+ }
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
@@ -121,13 +145,61 @@ public class InstanceFilter {
}
@JsonProperty("service-instance")
- public ServiceInstance getServiceInstance() {
- return serviceInstance;
- }
+ public ServiceInstance getServiceInstance() {
+ return serviceInstance;
+ }
@JsonProperty("service-instance")
- public void setServiceInstance(ServiceInstance serviceInstance) {
- this.serviceInstance = serviceInstance;
- }
+ public void setServiceInstance(ServiceInstance serviceInstance) {
+ this.serviceInstance = serviceInstance;
+ }
+ @JsonProperty("p-interface")
+ public PInterface getpInterface() {
+ return pInterface;
+ }
+ @JsonProperty("p-interface")
+ public void setpInterface(PInterface pInterface) {
+ this.pInterface = pInterface;
+ }
+ @JsonProperty("generic-vnf")
+ public GenericVnf getGenericVnf() {
+ return genericVnf;
+ }
+ @JsonProperty("generic-vnf")
+ public void setGenericVnf(GenericVnf genericVnf) {
+ this.genericVnf = genericVnf;
+ }
+ @JsonProperty("vserver")
+ public Vserver getVserver() {
+ return vserver;
+ }
+ @JsonProperty("vserver")
+ public void setVserver(Vserver vserver) {
+ this.vserver = vserver;
+ }
+ @JsonProperty("tenant")
+ public Tenant getTenant() {
+ return tenant;
+ }
+ @JsonProperty("tenant")
+ public void setTenant(Tenant tenant) {
+ this.tenant = tenant;
+ }
+ @JsonProperty("cloud-region")
+ public CloudRegion getCloudRegion() {
+ return cloudRegion;
+ }
+ @JsonProperty("cloud-region")
+ public void setCloudRegion(CloudRegion cloudRegion) {
+ this.cloudRegion = cloudRegion;
+ }
+ @JsonProperty("vnfc")
+ public Vnf getVnfc() {
+ return vnfc;
+ }
+ @JsonProperty("vnfc")
+ public void setVnfc(Vnf vnfc) {
+ this.vnfc = vnfc;
+ }
}
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Result.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Result.java
new file mode 100755
index 000000000..0bff86089
--- /dev/null
+++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Result.java
@@ -0,0 +1,217 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.adaptors.aai.query;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.openecomp.aai.inventory.v11.CloudRegion;
+import org.openecomp.aai.inventory.v11.Complex;
+import org.openecomp.aai.inventory.v11.GenericVnf;
+import org.openecomp.aai.inventory.v11.L3InterfaceIpv4AddressList;
+import org.openecomp.aai.inventory.v11.L3InterfaceIpv6AddressList;
+import org.openecomp.aai.inventory.v11.L3Network;
+import org.openecomp.aai.inventory.v11.LInterface;
+import org.openecomp.aai.inventory.v11.Pserver;
+import org.openecomp.aai.inventory.v11.ServiceInstance;
+import org.openecomp.aai.inventory.v11.Vnfc;
+import org.openecomp.aai.inventory.v11.Vserver;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "cloud-region",
+ "complex",
+ "generic-vnf",
+ "l3-interface-ipv4-address-list",
+ "l3-interface-ipv6-address-list",
+ "l3-network",
+ "l-interface",
+ "owning-entity",
+ "pserver",
+ "service-instance",
+ "vnfc",
+ "vserver"
+})
+@XmlRootElement(name = "result")
+public class Result {
+
+ @XmlElement(name = "cloud-region")
+ private CloudRegion cloudRegion;
+ @XmlElement(name = "complex")
+ private Complex complex;
+ @XmlElement(name = "generic-vnf")
+ private GenericVnf genericVnf;
+ @XmlElement(name = "l3-interface-ipv4-address-list")
+ private L3InterfaceIpv4AddressList l3InterfaceIpv4AddressList;
+ @XmlElement(name = "l3-interface-ipv6-address-list")
+ private L3InterfaceIpv6AddressList l3InterfaceIpv6AddressList;
+ @XmlElement(name = "l3-network")
+ private L3Network l3Network;
+ @XmlElement(name = "l-interface")
+ private LInterface lInterface;
+ @XmlElement(name = "pserver")
+ private Pserver pserver;
+ @XmlElement(name = "service-instance")
+ private ServiceInstance serviceInstance;
+ @XmlElement(name = "vnfc")
+ private Vnfc vnfc;
+ @XmlElement(name = "vserver")
+ private Vserver vserver;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @XmlElement(name = "cloud-region")
+ public CloudRegion getCloudRegion() {
+ return cloudRegion;
+ }
+
+ @XmlElement(name = "cloud-region")
+ public void setCloudRegion(CloudRegion cloudRegion) {
+ this.cloudRegion = cloudRegion;
+ }
+
+ @XmlElement(name = "complex")
+ public Complex getComplex() {
+ return complex;
+ }
+
+ @XmlElement(name = "complex")
+ public void setComplex(Complex complex) {
+ this.complex = complex;
+ }
+
+ @XmlElement(name = "generic-vnf")
+ public GenericVnf getGenericVnf ()
+ {
+ return genericVnf;
+ }
+
+ @XmlElement(name = "generic-vnf")
+ public void setGenericVnf (GenericVnf genericVnf)
+ {
+ this.genericVnf = genericVnf;
+ }
+
+ @JsonProperty("l3-interface-ipv4-address-list")
+ public L3InterfaceIpv4AddressList getL3InterfaceIpv4AddressList() {
+ return l3InterfaceIpv4AddressList;
+ }
+
+ @JsonProperty("l3-interface-ipv4-address-list")
+ public void setL3InterfaceIpv4AddressList(L3InterfaceIpv4AddressList l3InterfaceIpv4AddressList) {
+ this.l3InterfaceIpv4AddressList = l3InterfaceIpv4AddressList;
+ }
+
+ @JsonProperty("l3-interface-ipv6-address-list")
+ public L3InterfaceIpv6AddressList getL3InterfaceIpv6AddressList() {
+ return l3InterfaceIpv6AddressList;
+ }
+
+ @JsonProperty("l3-interface-ipv6-address-list")
+ public void setL3InterfaceIpv6AddressList(L3InterfaceIpv6AddressList l3InterfaceIpv6AddressList) {
+ this.l3InterfaceIpv6AddressList = l3InterfaceIpv6AddressList;
+ }
+
+ @XmlElement(name = "l3-network")
+ public L3Network getL3Network() {
+ return l3Network;
+ }
+
+ @XmlElement(name = "l3-network")
+ public void setL3Network(L3Network l3Network) {
+ this.l3Network = l3Network;
+ }
+
+ @XmlElement(name = "l-interface")
+ public LInterface getLInterface() {
+ return lInterface;
+ }
+ @XmlElement(name = "l-interface")
+ public void setLInterface(LInterface linterface) {
+ this.lInterface = linterface;
+ }
+
+ @XmlElement(name = "pserver")
+ public Pserver getPserver() {
+ return pserver;
+ }
+ @XmlElement(name = "pserver")
+ public void setPserver(Pserver pserver) {
+ this.pserver = pserver;
+ }
+
+ @XmlElement(name = "service-instance")
+ public ServiceInstance getServiceInstance() {
+ return serviceInstance;
+ }
+
+ @XmlElement(name = "service-instance")
+ public void setServiceInstance(ServiceInstance serviceInstance) {
+ this.serviceInstance = serviceInstance;
+ }
+
+ @XmlElement(name = "vnfc")
+ public Vnfc getVnfc() {
+ return vnfc;
+ }
+
+ @XmlElement(name = "vnfc")
+ public void setVnfc(Vnfc vnfc) {
+ this.vnfc = vnfc;
+ }
+
+ @XmlElement(name = "vserver")
+ public Vserver getVserver() {
+ return vserver;
+ }
+ @XmlElement(name = "vserver")
+ public void setVserver(Vserver vserver) {
+ this.vserver = vserver;
+ }
+
+ @Override
+ public String toString()
+ {
+ return " [generic-vnf = "+genericVnf+"]";
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+}
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Results.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Results.java
deleted file mode 100644
index efd50533b..000000000
--- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/query/Results.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * openECOMP : SDN-C
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.ccsdk.sli.adaptors.aai.query;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-import org.openecomp.aai.inventory.v11.*;
-
-
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "genericVnf",
- "pserver",
- "complex"
-})
-@XmlRootElement(name = "results")
-public class Results {
-
- @XmlElement(name = "generic-vnf")
- private GenericVnf genericVnf;
-
- @XmlElement(name = "complex")
- private Complex complex;
-
- @XmlElement(name = "pserver")
- private Pserver pserver;
-
-
- @XmlElement(name = "generic-vnf")
- public GenericVnf getGenericVnf ()
- {
- return genericVnf;
- }
- @XmlElement(name = "generic-vnf")
- public void setGenericVnf (GenericVnf genericVnf)
- {
- this.genericVnf = genericVnf;
- }
-
- @Override
- public String toString()
- {
- return " [generic-vnf = "+genericVnf+"]";
- }
- @XmlElement(name = "complex")
- public Complex getComplex() {
- return complex;
- }
- @XmlElement(name = "complex")
- public void setComplex(Complex complex) {
- this.complex = complex;
- }
- @XmlElement(name = "pserver")
- public Pserver getPserver() {
- return pserver;
- }
- @XmlElement(name = "pserver")
- public void setPserver(Pserver pserver) {
- this.pserver = pserver;
- }
-}
diff --git a/aai-service/provider/src/main/resources/aai-path.properties b/aai-service/provider/src/main/resources/aai-path.properties
index 73ed15cc9..8e144ecf5 100644..100755
--- a/aai-service/provider/src/main/resources/aai-path.properties
+++ b/aai-service/provider/src/main/resources/aai-path.properties
@@ -19,171 +19,291 @@
# ============LICENSE_END=========================================================
###
-complex|ctag-pool = /aai/v11/cloud-infrastructure/complexes/complex/{physical-location-id}/ctag-pools/ctag-pool/{target-pe}/{availability-zone-name}
-complex = /aai/v11/cloud-infrastructure/complexes/complex/{physical-location-id}
-cloud-region|volume-group = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/volume-groups/volume-group/{volume-group-id}
-cloud-region|tenant|vserver|volume = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/volumes/volume/{volume-id}
-cloud-region|tenant|vserver|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-cloud-region|tenant|vserver|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-cloud-region|tenant|vserver|l-interface|vlan = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-cloud-region|tenant|vserver|l-interface|sriov-vf = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
-cloud-region|tenant|vserver|l-interface|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-cloud-region|tenant|vserver|l-interface|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-cloud-region|tenant|vserver|l-interface = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}
-cloud-region|tenant|vserver = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}
-cloud-region|tenant = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}
+cloud-region = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}
+cloud-region|availability-zone = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/availability-zones/availability-zone/{availability-zone-name}
+cloud-region|availability-zones = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/availability-zones
+cloud-region|dvs-switch = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/dvs-switches/dvs-switch/{switch-name}
+cloud-region|dvs-switches = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/dvs-switches
cloud-region|flavor = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/flavors/flavor/{flavor-id}
+cloud-region|flavors = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/flavors
cloud-region|group-assignment = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/group-assignments/group-assignment/{group-id}
-cloud-region|snapshot = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/snapshots/snapshot/{snapshot-id}
-cloud-region|image|metadatum = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/images/image/{image-id}/metadata/metadatum/{metaname}
+cloud-region|group-assignments = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/group-assignments
cloud-region|image = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/images/image/{image-id}
-cloud-region|dvs-switch = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/dvs-switches/dvs-switch/{switch-name}
+cloud-region|image|metadata = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/images/image/{image-id}/metadata
+cloud-region|image|metadatum = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/images/image/{image-id}/metadata/metadatum/{metaname}
+cloud-region|images = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/images
cloud-region|oam-network = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/oam-networks/oam-network/{network-uuid}
-cloud-region|availability-zone = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/availability-zones/availability-zone/{availability-zone-name}
-cloud-region = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}
-network-profile = /aai/v11/cloud-infrastructure/network-profiles/network-profile/{nm-profile-name}
-pserver|p-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-pserver|p-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/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}
-pserver|p-interface|l-interface|vlan = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-pserver|p-interface|l-interface|sriov-vf = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
-pserver|p-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-pserver|p-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-pserver|p-interface|l-interface = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
-pserver|p-interface = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}
-pserver|lag-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/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}
-pserver|lag-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-pserver|lag-interface|l-interface|vlan = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-pserver|lag-interface|l-interface|sriov-vf = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
-pserver|lag-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-pserver|lag-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-pserver|lag-interface|l-interface = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
-pserver|lag-interface = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}
-pserver = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}
-virtual-data-center = /aai/v11/cloud-infrastructure/virtual-data-centers/virtual-data-center/{vdc-id}
-connector|metadatum = /aai/v11/business/connectors/connector/{resource-instance-id}/metadata/metadatum/{metaname}
+cloud-region|oam-networks = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/oam-networks
+cloud-regions = /aai/v11/cloud-infrastructure/cloud-regions
+cloud-region|snapshot = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/snapshots/snapshot/{snapshot-id}
+cloud-region|snapshot = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/snapshots/snapshot/{snapshot-id}
+cloud-region|snapshots = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/snapshots
+cloud-region|tenant = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}
+cloud-region|tenants = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants
+cloud-region|tenant|vserver = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}
+cloud-region|tenant|vserver|l-interface = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}
+cloud-region|tenant|vserver|l-interface|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+cloud-region|tenant|vserver|l-interface|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+cloud-region|tenant|vserver|l-interfaces = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces
+cloud-region|tenant|vserver|l-interface|sriov-vf = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+cloud-region|tenant|vserver|l-interface|sriov-vfs = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/sriov-vfs
+cloud-region|tenant|vserver|l-interface|vlan = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+cloud-region|tenant|vserver|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+cloud-region|tenant|vserver|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+cloud-region|tenant|vserver|l-interface|vlans = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/l-interfaces/l-interface/{interface-name}/vlans
+cloud-region|tenant|vservers = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers
+cloud-region|tenant|vserver|volume = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/volumes/volume/{volume-id}
+cloud-region|tenant|vserver|volumes = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}/volumes
+cloud-region|volume-group = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/volume-groups/volume-group/{volume-group-id}
+cloud-region|volume-groups = /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/volume-groups
+complex = /aai/v11/cloud-infrastructure/complexes/complex/{physical-location-id}
+complex|ctag-pool = /aai/v11/cloud-infrastructure/complexes/complex/{physical-location-id}/ctag-pools/ctag-pool/{target-pe}/{availability-zone-name}
+complex|ctag-pools = /aai/v11/cloud-infrastructure/complexes/complex/{physical-location-id}/ctag-pools
+complexes = /aai/v11/cloud-infrastructure/complexes
connector = /aai/v11/business/connectors/connector/{resource-instance-id}
-customer|service-subscription|service-instance|metadatum = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/metadata/metadatum/{metaname}
-customer|service-subscription|service-instance|allotted-resource|tunnel-xconnect = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources/allotted-resource/{id}/tunnel-xconnects/tunnel-xconnect/{id}
-customer|service-subscription|service-instance|allotted-resource = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources/allotted-resource/{id}
-customer|service-subscription|service-instance = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}
-customer|service-subscription = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}
+connector|metadata = /aai/v11/business/connectors/connector/{resource-instance-id}/metadata
+connector|metadatum = /aai/v11/business/connectors/connector/{resource-instance-id}/metadata/metadatum/{metaname}
+connectors = /aai/v11/business/connectors
customer = /aai/v11/business/customers/customer/{global-customer-id}
-vnf-image = /aai/v11/service-design-and-creation/vnf-images/vnf-image/{vnf-image-uuid}
-service = /aai/v11/service-design-and-creation/services/service/{service-id}
-service-capability = /aai/v11/service-design-and-creation/service-capabilities/service-capability/{service-type}/{vnf-type}
-model|model-ver|model-element|model-constraint|constrained-element-set|element-choice-set = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements/model-element/{model-element-uuid}/model-constraints/model-constraint/{model-constraint-uuid}/constrained-element-sets/constrained-element-set/{constrained-element-set-uuid}/element-choice-sets/element-choice-set/{element-choice-set-uuid}
-model|model-ver|model-element|model-constraint|constrained-element-set = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements/model-element/{model-element-uuid}/model-constraints/model-constraint/{model-constraint-uuid}/constrained-element-sets/constrained-element-set/{constrained-element-set-uuid}
-model|model-ver|model-element|model-constraint = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements/model-element/{model-element-uuid}/model-constraints/model-constraint/{model-constraint-uuid}
-model|model-ver|model-element = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements/model-element/{model-element-uuid}
-model|model-ver|metadatum = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/metadata/metadatum/{metaname}
-model|model-ver = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}
-model = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}
-named-query|named-query-element|related-lookup = /aai/v11/service-design-and-creation/named-queries/named-query/{named-query-uuid}/named-query-elements/named-query-element/{named-query-element-uuid}/related-lookups/related-lookup/{related-lookup-uuid}
-named-query|named-query-element|property-constraint = /aai/v11/service-design-and-creation/named-queries/named-query/{named-query-uuid}/named-query-elements/named-query-element/{named-query-element-uuid}/property-constraints/property-constraint/{property-constraint-uuid}
-named-query|named-query-element = /aai/v11/service-design-and-creation/named-queries/named-query/{named-query-uuid}/named-query-elements/named-query-element/{named-query-element-uuid}
-named-query = /aai/v11/service-design-and-creation/named-queries/named-query/{named-query-uuid}
-logical-link = /aai/v11/network/logical-links/logical-link/{link-name}
-site-pair-set|routing-instance|site-pair|class-of-service = /aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}/site-pairs/site-pair/{site-pair-id}/classes-of-service/class-of-service/{cos}
-site-pair-set|routing-instance|site-pair = /aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}/site-pairs/site-pair/{site-pair-id}
-site-pair-set|routing-instance = /aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}
-site-pair-set = /aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}
-vpn-binding|route-target = /aai/v11/network/vpn-bindings/vpn-binding/{vpn-id}/route-targets/route-target/{global-route-target}/{route-target-role}
-vpn-binding = /aai/v11/network/vpn-bindings/vpn-binding/{vpn-id}
-vpls-pe|p-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-vpls-pe|p-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-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}
-vpls-pe|p-interface|l-interface|vlan = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-vpls-pe|p-interface|l-interface|sriov-vf = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
-vpls-pe|p-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-vpls-pe|p-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-vpls-pe|p-interface|l-interface = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
-vpls-pe|p-interface = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}
-vpls-pe|lag-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/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}
-vpls-pe|lag-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-vpls-pe|lag-interface|l-interface|vlan = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-vpls-pe|lag-interface|l-interface|sriov-vf = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
-vpls-pe|lag-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-vpls-pe|lag-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-vpls-pe|lag-interface|l-interface = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
-vpls-pe|lag-interface = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}
-vpls-pe = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}
-multicast-configuration = /aai/v11/network/multicast-configurations/multicast-configuration/{multicast-configuration-id}
-vce|port-group|cvlan-tag-entry = /aai/v11/network/vces/vce/{vnf-id}/port-groups/port-group/{interface-id}/cvlan-tags/cvlan-tag-entry/{cvlan-tag}
-vce|port-group = /aai/v11/network/vces/vce/{vnf-id}/port-groups/port-group/{interface-id}
-vce|license = /aai/v11/network/vces/vce/{vnf-id}/licenses/license/{group-uuid}/{resource-uuid}
-vce|entitlement = /aai/v11/network/vces/vce/{vnf-id}/entitlements/entitlement/{group-uuid}/{resource-uuid}
-vce = /aai/v11/network/vces/vce/{vnf-id}
-vpe|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-vpe|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-vpe|l-interface|vlan = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-vpe|l-interface|sriov-vf = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
-vpe|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-vpe|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-vpe|l-interface = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}
-vpe|lag-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/vpes/vpe/{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}
-vpe|lag-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-vpe|lag-interface|l-interface|vlan = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-vpe|lag-interface|l-interface|sriov-vf = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
-vpe|lag-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-vpe|lag-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-vpe|lag-interface|l-interface = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
-vpe|lag-interface = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}
-vpe|license = /aai/v11/network/vpes/vpe/{vnf-id}/licenses/license/{group-uuid}/{resource-uuid}
-vpe|entitlement = /aai/v11/network/vpes/vpe/{vnf-id}/entitlements/entitlement/{group-uuid}/{resource-uuid}
-vpe = /aai/v11/network/vpes/vpe/{vnf-id}
-vnfc = /aai/v11/network/vnfcs/vnfc/{vnfc-name}
-l3-network|subnet = /aai/v11/network/l3-networks/l3-network/{network-id}/subnets/subnet/{subnet-id}
-l3-network|ctag-assignment = /aai/v11/network/l3-networks/l3-network/{network-id}/ctag-assignments/ctag-assignment/{vlan-id-inner}
-l3-network|segmentation-assignment = /aai/v11/network/l3-networks/l3-network/{network-id}/segmentation-assignments/segmentation-assignment/{segmentation-id}
-l3-network = /aai/v11/network/l3-networks/l3-network/{network-id}
-network-policy = /aai/v11/network/network-policies/network-policy/{network-policy-id}
-generic-vnf|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/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}
-generic-vnf|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-generic-vnf|l-interface|vlan = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-generic-vnf|l-interface|sriov-vf = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
-generic-vnf|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-generic-vnf|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-generic-vnf|l-interface = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}
-generic-vnf|lag-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/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}
-generic-vnf|lag-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/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-ipv6-address-list/{l3-interface-ipv6-address}
-generic-vnf|lag-interface|l-interface|vlan = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-generic-vnf|lag-interface|l-interface|sriov-vf = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+customers = /aai/v11/business/customers
+customer|service-subscription = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}
+customer|service-subscriptions = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions
+customer|service-subscription|service-instance = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}
+customer|service-subscription|service-instance|allotted-resource = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources/allotted-resource/{id}
+customer|service-subscription|service-instance|allotted-resources = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources
+customer|service-subscription|service-instance|allotted-resource|tunnel-xconnect = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources/allotted-resource/{id}/tunnel-xconnects/tunnel-xconnect/{id}
+customer|service-subscription|service-instance|allotted-resource|tunnel-xconnects = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources/allotted-resource/{id}/tunnel-xconnects
+customer|service-subscription|service-instance|metadata = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/metadata
+customer|service-subscription|service-instance|metadatum = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/metadata/metadatum/{metaname}
+customer|service-subscription|service-instances = /aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances
+generic-vnf = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}
+generic-vnf|entitlement = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/entitlements/entitlement/{group-uuid}/{resource-uuid}
+generic-vnf|entitlements = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/entitlements
+generic-vnf|lag-interface = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}
+generic-vnf|lag-interface|l-interface = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
generic-vnf|lag-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/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}
generic-vnf|lag-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-generic-vnf|lag-interface|l-interface = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
-generic-vnf|lag-interface = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}
-generic-vnf|vf-module = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/vf-modules/vf-module/{vf-module-id}
+generic-vnf|lag-interface|l-interfaces = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces
+generic-vnf|lag-interface|l-interface|sriov-vf = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+generic-vnf|lag-interface|l-interface|sriov-vfs = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs
+generic-vnf|lag-interface|l-interface|vlan = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+generic-vnf|lag-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/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}
+generic-vnf|lag-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/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-ipv6-address-list/{l3-interface-ipv6-address}
+generic-vnf|lag-interface|l-interface|vlans = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans
+generic-vnf|lag-interfaces = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces
generic-vnf|license = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/licenses/license/{group-uuid}/{resource-uuid}
-generic-vnf|entitlement = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/entitlements/entitlement/{group-uuid}/{resource-uuid}
-generic-vnf = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}
+generic-vnf|licenses = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/licenses
+generic-vnf|l-interface = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}
+generic-vnf|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+generic-vnf|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+generic-vnf|l-interfaces = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces
+generic-vnf|l-interface|sriov-vf = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+generic-vnf|l-interface|sriov-vfs = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/sriov-vfs
+generic-vnf|l-interface|vlan = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+generic-vnf|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/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}
+generic-vnf|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+generic-vnf|l-interface|vlans = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans
+generic-vnfs = /aai/v11/network/generic-vnfs
+generic-vnf|vf-module = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/vf-modules/vf-module/{vf-module-id}
+generic-vnf|vf-modules = /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/vf-modules
+instance-group = /aai/v11/network/instance-groups/instance-group/{id}
+instance-groups = /aai/v11/network/instance-groups
+ipsec-configuration = /aai/v11/network/ipsec-configurations/ipsec-configuration/{ipsec-configuration-id}
+ipsec-configurations = /aai/v11/network/ipsec-configurations
+ipsec-configuration|vig-server = /aai/v11/network/ipsec-configurations/ipsec-configuration/{ipsec-configuration-id}/vig-servers/vig-server/{vig-address-type}
+ipsec-configuration|vig-servers = /aai/v11/network/ipsec-configurations/ipsec-configuration/{ipsec-configuration-id}/vig-servers
+l3-network = /aai/v11/network/l3-networks/l3-network/{network-id}
+l3-network|ctag-assignment = /aai/v11/network/l3-networks/l3-network/{network-id}/ctag-assignments/ctag-assignment/{vlan-id-inner}
+l3-network|ctag-assignments = /aai/v11/network/l3-networks/l3-network/{network-id}/ctag-assignments
+l3-networks = /aai/v11/network/l3-networks
+l3-network|segmentation-assignment = /aai/v11/network/l3-networks/l3-network/{network-id}/segmentation-assignments/segmentation-assignment/{segmentation-id}
+l3-network|segmentation-assignments = /aai/v11/network/l3-networks/l3-network/{network-id}/segmentation-assignments
+l3-network|subnet = /aai/v11/network/l3-networks/l3-network/{network-id}/subnets/subnet/{subnet-id}
+l3-network|subnets = /aai/v11/network/l3-networks/l3-network/{network-id}/subnets
lag-link = /aai/v11/network/lag-links/lag-link/{link-name}
-newvce|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-newvce|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-newvce|l-interface|vlan = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-newvce|l-interface|sriov-vf = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+lag-links = /aai/v11/network/lag-links
+license-key-resource = /aai/v11/license-management/license-key-resources/license-key-resource/{att-uuid}
+license-key-resources = /aai/v11/license-management/license-key-resources
+logical-link = /aai/v11/network/logical-links/logical-link/{link-name}
+logical-links = /aai/v11/network/logical-links
+model = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}
+model|model-ver = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}
+model|model-ver|metadata = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/metadata
+model|model-ver|metadatum = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/metadata/metadatum/{metaname}
+model|model-ver|model-element = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements/model-element/{model-element-uuid}
+model|model-ver|model-element|model-constraint = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements/model-element/{model-element-uuid}/model-constraints/model-constraint/{model-constraint-uuid}
+model|model-ver|model-element|model-constraint|constrained-element-set = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements/model-element/{model-element-uuid}/model-constraints/model-constraint/{model-constraint-uuid}/constrained-element-sets/constrained-element-set/{constrained-element-set-uuid}
+model|model-ver|model-element|model-constraint|constrained-element-set|element-choice-set = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements/model-element/{model-element-uuid}/model-constraints/model-constraint/{model-constraint-uuid}/constrained-element-sets/constrained-element-set/{constrained-element-set-uuid}/element-choice-sets/element-choice-set/{element-choice-set-uuid}
+model|model-ver|model-element|model-constraint|constrained-element-set|element-choice-sets = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements/model-element/{model-element-uuid}/model-constraints/model-constraint/{model-constraint-uuid}/constrained-element-sets/constrained-element-set/{constrained-element-set-uuid}/element-choice-sets
+model|model-ver|model-element|model-constraint|constrained-element-sets = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements/model-element/{model-element-uuid}/model-constraints/model-constraint/{model-constraint-uuid}/constrained-element-sets
+model|model-ver|model-element|model-constraints = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements/model-element/{model-element-uuid}/model-constraints
+model|model-ver|model-elements = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}/model-elements
+model|model-vers = /aai/v11/service-design-and-creation/models/model/{model-invariant-id}/model-vers
+models = /aai/v11/service-design-and-creation/models
+multicast-configuration = /aai/v11/network/multicast-configurations/multicast-configuration/{multicast-configuration-id}
+multicast-configurations = /aai/v11/network/multicast-configurations
+named-queries = /aai/v11/service-design-and-creation/named-queries
+named-query = /aai/v11/service-design-and-creation/named-queries/named-query/{named-query-uuid}
+named-query|named-query-element = /aai/v11/service-design-and-creation/named-queries/named-query/{named-query-uuid}/named-query-elements/named-query-element/{named-query-element-uuid}
+named-query|named-query-element|property-constraint = /aai/v11/service-design-and-creation/named-queries/named-query/{named-query-uuid}/named-query-elements/named-query-element/{named-query-element-uuid}/property-constraints/property-constraint/{property-constraint-uuid}
+named-query|named-query-element|property-constraints = /aai/v11/service-design-and-creation/named-queries/named-query/{named-query-uuid}/named-query-elements/named-query-element/{named-query-element-uuid}/property-constraints
+named-query|named-query-element|related-lookup = /aai/v11/service-design-and-creation/named-queries/named-query/{named-query-uuid}/named-query-elements/named-query-element/{named-query-element-uuid}/related-lookups/related-lookup/{related-lookup-uuid}
+named-query|named-query-element|related-lookups = /aai/v11/service-design-and-creation/named-queries/named-query/{named-query-uuid}/named-query-elements/named-query-element/{named-query-element-uuid}/related-lookups
+named-query|named-query-elements = /aai/v11/service-design-and-creation/named-queries/named-query/{named-query-uuid}/named-query-elements
+network-policies = /aai/v11/network/network-policies
+network-policy = /aai/v11/network/network-policies/network-policy/{network-policy-id}
+network-profile = /aai/v11/cloud-infrastructure/network-profiles/network-profile/{nm-profile-name}
+network-profiles = /aai/v11/cloud-infrastructure/network-profiles
+newvce = /aai/v11/network/newvces/newvce/{vnf-id2}
+newvce|l-interface = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}
newvce|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
newvce|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-newvce|l-interface = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}
-newvce = /aai/v11/network/newvces/newvce/{vnf-id2}
-pnf|p-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-pnf|p-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/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}
-pnf|p-interface|l-interface|vlan = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-pnf|p-interface|l-interface|sriov-vf = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
-pnf|p-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-pnf|p-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/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}
-pnf|p-interface|l-interface = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
-pnf|p-interface = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}
-pnf|lag-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/pnfs/pnf/{pnf-name}/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}
-pnf|lag-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-pnf|lag-interface|l-interface|vlan = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
-pnf|lag-interface|l-interface|sriov-vf = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+newvce|l-interfaces = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces
+newvce|l-interface|sriov-vf = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+newvce|l-interface|sriov-vfs = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/sriov-vfs
+newvce|l-interface|vlan = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+newvce|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+newvce|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+newvce|l-interface|vlans = /aai/v11/network/newvces/newvce/{vnf-id2}/l-interfaces/l-interface/{interface-name}/vlans
+newvces = /aai/v11/network/newvces
+physical-link = /aai/v11/network/physical-links/physical-link/{link-name}
+physical-links = /aai/v11/network/physical-links
+pnf = /aai/v11/network/pnfs/pnf/{pnf-name}
+pnf|lag-interface = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}
+pnf|lag-interface|l-interface = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
pnf|lag-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
pnf|lag-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-pnf|lag-interface|l-interface = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
-pnf|lag-interface = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}
-pnf = /aai/v11/network/pnfs/pnf/{pnf-name}
-physical-link = /aai/v11/network/physical-links/physical-link/{link-name}
-ipsec-configuration|vig-server = /aai/v11/network/ipsec-configurations/ipsec-configuration/{ipsec-configuration-id}/vig-servers/vig-server/{vig-address-type}
-ipsec-configuration = /aai/v11/network/ipsec-configurations/ipsec-configuration/{ipsec-configuration-id}
+pnf|lag-interface|l-interfaces = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces
+pnf|lag-interface|l-interface|sriov-vf = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+pnf|lag-interface|l-interface|sriov-vfs = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs
+pnf|lag-interface|l-interface|vlan = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+pnf|lag-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/pnfs/pnf/{pnf-name}/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}
+pnf|lag-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+pnf|lag-interface|l-interface|vlans = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans
+pnf|lag-interfaces = /aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces
+pnf|p-interface = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}
+pnf|p-interface|l-interface = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
+pnf|p-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+pnf|p-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/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}
+pnf|p-interface|l-interfaces = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces
+pnf|p-interface|l-interface|sriov-vf = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+pnf|p-interface|l-interface|sriov-vfs = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs
+pnf|p-interface|l-interface|vlan = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+pnf|p-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+pnf|p-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/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}
+pnf|p-interface|l-interface|vlans = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans
+pnf|p-interfaces = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces
+pnf|p-interface|sriov-pf = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/sriov-pfs/sriov-pf/{pf-pci-id}
+pnf|p-interface|sriov-pfs = /aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{interface-name}/sriov-pfs
+pnfs = /aai/v11/network/pnfs
+pserver = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}
+pserver|lag-interface = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}
+pserver|lag-interface|l-interface = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
+pserver|lag-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+pserver|lag-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+pserver|lag-interface|l-interfaces = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces
+pserver|lag-interface|l-interface|sriov-vf = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+pserver|lag-interface|l-interface|sriov-vfs = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs
+pserver|lag-interface|l-interface|vlan = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+pserver|lag-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/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}
+pserver|lag-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+pserver|lag-interface|l-interface|vlans = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans
+pserver|lag-interfaces = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces
+pserver|p-interface = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}
+pserver|p-interface|l-interface = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
+pserver|p-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+pserver|p-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+pserver|p-interface|l-interfaces = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces
+pserver|p-interface|l-interface|sriov-vf = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+pserver|p-interface|l-interface|sriov-vfs = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs
+pserver|p-interface|l-interface|vlan = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+pserver|p-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+pserver|p-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/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}
+pserver|p-interface|l-interface|vlans = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans
+pserver|p-interfaces = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces
+pserver|p-interface|sriov-pf = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/sriov-pfs/sriov-pf/{pf-pci-id}
+pserver|p-interface|sriov-pfs = /aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}/sriov-pfs
+pservers = /aai/v11/cloud-infrastructure/pservers
route-table-reference = /aai/v11/network/route-table-references/route-table-reference/{route-table-reference-id}
-instance-group = /aai/v11/network/instance-groups/instance-group/{id}
+route-table-references = /aai/v11/network/route-table-references
+service = /aai/v11/service-design-and-creation/services/service/{service-id}
+service-capabilities = /aai/v11/service-design-and-creation/service-capabilities
+service-capability = /aai/v11/service-design-and-creation/service-capabilities/service-capability/{service-type}/{vnf-type}
+services = /aai/v11/service-design-and-creation/services
+site-pair-set = /aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}
+site-pair-set|routing-instance = /aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}
+site-pair-set|routing-instances = /aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances
+site-pair-set|routing-instance|site-pair = /aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}/site-pairs/site-pair/{site-pair-id}
+site-pair-set|routing-instance|site-pair|classes-of-service = /aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}/site-pairs/site-pair/{site-pair-id}/classes-of-service
+site-pair-set|routing-instance|site-pair|class-of-service = /aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}/site-pairs/site-pair/{site-pair-id}/classes-of-service/class-of-service/{cos}
+site-pair-set|routing-instance|site-pairs = /aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}/site-pairs
+site-pair-sets = /aai/v11/network/site-pair-sets
+vce = /aai/v11/network/vces/vce/{vnf-id}
+vce|entitlement = /aai/v11/network/vces/vce/{vnf-id}/entitlements/entitlement/{group-uuid}/{resource-uuid}
+vce|entitlements = /aai/v11/network/vces/vce/{vnf-id}/entitlements
+vce|license = /aai/v11/network/vces/vce/{vnf-id}/licenses/license/{group-uuid}/{resource-uuid}
+vce|licenses = /aai/v11/network/vces/vce/{vnf-id}/licenses
+vce|port-group = /aai/v11/network/vces/vce/{vnf-id}/port-groups/port-group/{interface-id}
+vce|port-group|cvlan-tag-entry = /aai/v11/network/vces/vce/{vnf-id}/port-groups/port-group/{interface-id}/cvlan-tags/cvlan-tag-entry/{cvlan-tag}
+vce|port-group|cvlan-tags = /aai/v11/network/vces/vce/{vnf-id}/port-groups/port-group/{interface-id}/cvlan-tags
+vce|port-groups = /aai/v11/network/vces/vce/{vnf-id}/port-groups
+vces = /aai/v11/network/vces
+virtual-data-center = /aai/v11/cloud-infrastructure/virtual-data-centers/virtual-data-center/{vdc-id}
+virtual-data-centers = /aai/v11/cloud-infrastructure/virtual-data-centers
+vnfc = /aai/v11/network/vnfcs/vnfc/{vnfc-name}
+vnfcs = /aai/v11/network/vnfcs
+vnf-image = /aai/v11/service-design-and-creation/vnf-images/vnf-image/{vnf-image-uuid}
+vnf-images = /aai/v11/service-design-and-creation/vnf-images
+vpe = /aai/v11/network/vpes/vpe/{vnf-id}
+vpe|entitlement = /aai/v11/network/vpes/vpe/{vnf-id}/entitlements/entitlement/{group-uuid}/{resource-uuid}
+vpe|lag-interface = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}
+vpe|lag-interface|l-interface = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
+vpe|lag-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+vpe|lag-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+vpe|lag-interface|l-interface|sriov-vf = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+vpe|lag-interface|l-interface|vlan = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+vpe|lag-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/vpes/vpe/{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}
+vpe|lag-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+vpe|license = /aai/v11/network/vpes/vpe/{vnf-id}/licenses/license/{group-uuid}/{resource-uuid}
+vpe|l-interface = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}
+vpe|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+vpe|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+vpe|l-interface|sriov-vf = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+vpe|l-interface|vlan = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+vpe|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+vpe|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/vpes/vpe/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+vpls-pe = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}
+vpls-pe|lag-interface = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}
+vpls-pe|lag-interface|l-interface = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
+vpls-pe|lag-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+vpls-pe|lag-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+vpls-pe|lag-interface|l-interfaces = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces
+vpls-pe|lag-interface|l-interface|sriov-vf = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+vpls-pe|lag-interface|l-interface|sriov-vfs = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs
+vpls-pe|lag-interface|l-interface|vlan = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+vpls-pe|lag-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/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}
+vpls-pe|lag-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+vpls-pe|lag-interface|l-interface|vlans = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans
+vpls-pe|lag-interfaces = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/lag-interfaces
+vpls-pe|p-interface = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}
+vpls-pe|p-interface|l-interface = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}
+vpls-pe|p-interface|l-interface|l3-interface-ipv4-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+vpls-pe|p-interface|l-interface|l3-interface-ipv6-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+vpls-pe|p-interface|l-interfaces = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces
+vpls-pe|p-interface|l-interface|sriov-vf = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs/sriov-vf/{pci-id}
+vpls-pe|p-interface|l-interface|sriov-vfs = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/sriov-vfs
+vpls-pe|p-interface|l-interface|vlan = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}
+vpls-pe|p-interface|l-interface|vlan|l3-interface-ipv4-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+vpls-pe|p-interface|l-interface|vlan|l3-interface-ipv6-address-list = /aai/v11/network/vpls-pes/vpls-pe/{equipment-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}
+vpls-pe|p-interface|l-interface|vlans = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans
+vpls-pe|p-interfaces = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces
+vpls-pe|p-interface|sriov-pf = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/sriov-pfs/sriov-pf/{pf-pci-id}
+vpls-pe|p-interface|sriov-pfs = /aai/v11/network/vpls-pes/vpls-pe/{equipment-name}/p-interfaces/p-interface/{interface-name}/sriov-pfs
+vpls-pes = /aai/v11/network/vpls-pes
+vpn-binding = /aai/v11/network/vpn-bindings/vpn-binding/{vpn-id}
+vpn-binding|route-target = /aai/v11/network/vpn-bindings/vpn-binding/{vpn-id}/route-targets/route-target/{global-route-target}/{route-target-role}
+vpn-binding|route-targets = /aai/v11/network/vpn-bindings/vpn-binding/{vpn-id}/route-targets
+vpn-bindings = /aai/v11/network/vpn-bindings
+zone = /aai/v11/network/zones/zone/{zone-id}
zone = /aai/v11/network/zones/zone/{zone-id}
+zones = /aai/v11/network/zones
diff --git a/aai-service/provider/src/main/resources/aai_schema_v11.xsd b/aai-service/provider/src/main/resources/aai_schema_v11.xsd
index 53b3acfa0..a202d7101 100755
--- a/aai-service/provider/src/main/resources/aai_schema_v11.xsd
+++ b/aai-service/provider/src/main/resources/aai_schema_v11.xsd
@@ -1712,6 +1712,170 @@ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
</xs:sequence>
</xs:complexType>
</xs:element>
+ <xs:element name="esr-system-info">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Persist common address information of external systems.",indexedProps="esr-system-info-id,system-name,system-type",searchable="esr-system-info-id,system-name,system-type",container="esr-system-info-list",dependentOn="cloud-region,esr-ems,esr-vnfm,esr-thirdparty-sdnc")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="esr-system-info-id" type="xs:string">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(isKey=true,description="Unique ID of esr system info.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="system-name" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="name of external system.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="type" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="type of external systems.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="vendor" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="vendor of external systems.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="version" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="version of external systems.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="service-url" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="url used to access external systems.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="user-name" type="xs:string">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="username used to access external systems.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="password" type="xs:string">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="password used to access external systems.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="system-type" type="xs:string">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="it could be vim/vnfm/thirdparty-sdnc/ems-resource/ems-performance/ems-alarm.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="protocol" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="protocol of third party SDNC, for example netconf/snmp.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="ssl-cacert" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ca file content if enabled ssl on auth-url.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="ssl-insecure" type="xs:boolean" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Whether to verify VIM's certificate.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="ip-address" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="service IP of ftp server.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="port" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="service port of ftp server.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="cloud-domain" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="domain info for authentication.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="default-tenant" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="default tenant of VIM.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="passive" type="xs:boolean" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="ftp passive mode or not.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="remote-path" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="resource or performance data file path.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="system-status" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="the status of external system.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="resource-version" type="xs:string" minOccurs="0">
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="field">@org.openecomp.aai.annotations.Metadata(description="Used for optimistic concurrency. Must be empty on create, valid on update and delete.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ </xs:element>
+ <xs:element ref="tns:relationship-list" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="esr-system-info-list">
+ <xs:complexType>
+ <xs:annotation>
+ <xs:appinfo>
+ <annox:annotate target="class">@org.openecomp.aai.annotations.Metadata(description="Collection of persistent block-level external system auth info.")</annox:annotate>
+ </xs:appinfo>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element ref="tns:esr-system-info" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
<xs:element name="cloud-region">
<xs:complexType>
<xs:annotation>
@@ -1800,6 +1964,7 @@ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
<xs:element ref="tns:oam-networks" minOccurs="0"/>
<xs:element ref="tns:availability-zones" minOccurs="0"/>
<xs:element ref="tns:relationship-list" minOccurs="0"/>
+ <xs:element ref="tns:esr-system-info-list" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -6892,6 +7057,7 @@ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
<xs:element ref="tns:tenant" minOccurs="0"/>
<xs:element ref="tns:cloud-region" minOccurs="0"/>
<xs:element ref="tns:service-instance" minOccurs="0"/>
+ <xs:element ref="tns:esr-system-info" minOccurs="0"/>
<xs:element name="model-name" type="xs:string" minOccurs="0"/>
<xs:element ref="tns:extra-properties" minOccurs="0"/>
<xs:element ref="tns:inventory-response-items" minOccurs="0"/>
diff --git a/aai-service/provider/src/test/resources/aaiclient.properties b/aai-service/provider/src/test/resources/aaiclient.properties
index bf0ab4e10..e615fc124 100644..100755
--- a/aai-service/provider/src/test/resources/aaiclient.properties
+++ b/aai-service/provider/src/test/resources/aaiclient.properties
@@ -27,9 +27,9 @@
# Certificate keystore and truststore
#
org.onap.ccsdk.sli.adaptors.aai.ssl.trust=/opt/bvc/tls-client/truststore.client.jks
-org.onap.ccsdk.sli.adaptors.aai.ssl.trust.psswd={truststore-password}
+org.onap.ccsdk.sli.adaptors.aai.ssl.trust.psswd=adminadmin
org.onap.ccsdk.sli.adaptors.aai.ssl.key=/opt/bvc/tls-client/keystore.client.jks
-org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd={keystore-password}
+org.onap.ccsdk.sli.adaptors.aai.ssl.key.psswd=adminadmin
org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore=true
org.onap.ccsdk.sli.adaptors.aai.client.name=SDNC
@@ -40,98 +40,98 @@ org.onap.ccsdk.sli.adaptors.aai.application=CCSDK
#
# Configuration file for A&AI Client
#
-org.onap.ccsdk.sli.adaptors.aai.uri=https://localhost:8443
-
+#org.onap.ccsdk.sli.adaptors.aai.uri=https://localhost:8443
+org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-int2.test.att.com:8443
# query
-org.onap.ccsdk.sli.adaptors.aai.path.query=/aai/v10/search/sdn-zone-query
-org.onap.ccsdk.sli.adaptors.aai.query.nodes=/aai/v10/search/nodes-query?search-node-type={node-type}&filter={entity-identifier}:EQUALS:{entity-name}
-org.onap.ccsdk.sli.adaptors.aai.query.generic=/aai/v10/search/generic-query?key={identifier}:{value}&start-node-type={start-node-type}&include=complex&depth=3
+org.onap.ccsdk.sli.adaptors.aai.path.query=/aai/v11/search/sdn-zone-query
+org.onap.ccsdk.sli.adaptors.aai.query.nodes=/aai/v11/search/nodes-query?search-node-type={node-type}&filter={entity-identifier}:EQUALS:{entity-name}
+org.onap.ccsdk.sli.adaptors.aai.query.generic=/aai/v11/search/generic-query?key={identifier}:{value}&start-node-type={start-node-type}&include=complex&depth=3
# named query
org.onap.ccsdk.sli.adaptors.aai.query.named=/aai/search/named-query
#update
-org.onap.ccsdk.sli.adaptors.aai.update=/aai/v10/actions/update
+org.onap.ccsdk.sli.adaptors.aai.update=/aai/v11/actions/update
# vce
-org.onap.ccsdk.sli.adaptors.aai.path.vce =/aai/v10/network/vces/vce/
-org.onap.ccsdk.sli.adaptors.aai.path.vces=/aai/v10/network/vces/
+org.onap.ccsdk.sli.adaptors.aai.path.vce =/aai/v11/network/vces/vce/
+org.onap.ccsdk.sli.adaptors.aai.path.vces=/aai/v11/network/vces/
# customer
-org.onap.ccsdk.sli.adaptors.aai.path.customer=/aai/v10/business/customers/customer/{customer-id}
+org.onap.ccsdk.sli.adaptors.aai.path.customer=/aai/v11/business/customers/customer/{customer-id}
# service subscription
-org.onap.ccsdk.sli.adaptors.aai.path.service.subscription=/aai/v10/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}
+org.onap.ccsdk.sli.adaptors.aai.path.service.subscription=/aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}
# service instance
-org.onap.ccsdk.sli.adaptors.aai.path.svcinst=/aai/v10/business/customers/customer/{customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances
-org.onap.ccsdk.sli.adaptors.aai.path.svcinst.query=/aai/v10/search/generic-query?key=service-instance.service-instance-id:{svc-instance-id}&start-node-type=service-instance&include=service-instance
-org.onap.ccsdk.sli.adaptors.aai.path.service.instance=/aai/v10/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}
+org.onap.ccsdk.sli.adaptors.aai.path.svcinst=/aai/v11/business/customers/customer/{customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances
+org.onap.ccsdk.sli.adaptors.aai.path.svcinst.query=/aai/v11/search/generic-query?key=service-instance.service-instance-id:{svc-instance-id}&start-node-type=service-instance&include=service-instance
+org.onap.ccsdk.sli.adaptors.aai.path.service.instance=/aai/v11/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}
# tenant
-org.onap.ccsdk.sli.adaptors.aai.path.tenant=/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}
-org.onap.ccsdk.sli.adaptors.aai.path.tenant.query=/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant?tenant-name={tenant-name}
+org.onap.ccsdk.sli.adaptors.aai.path.tenant=/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}
+org.onap.ccsdk.sli.adaptors.aai.path.tenant.query=/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant?tenant-name={tenant-name}
# vservers
-org.onap.ccsdk.sli.adaptors.aai.path.vservers=/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/
-org.onap.ccsdk.sli.adaptors.aai.path.vserver=/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}
+org.onap.ccsdk.sli.adaptors.aai.path.vservers=/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/
+org.onap.ccsdk.sli.adaptors.aai.path.vserver=/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-id}
# vpls-pe
-org.onap.ccsdk.sli.adaptors.aai.path.vpls.pes=/aai/v10/network/vpls-pes/
-org.onap.ccsdk.sli.adaptors.aai.path.vpls.pe =/aai/v10/network/vpls-pes/vpls-pe/
+org.onap.ccsdk.sli.adaptors.aai.path.vpls.pes=/aai/v11/network/vpls-pes/
+org.onap.ccsdk.sli.adaptors.aai.path.vpls.pe =/aai/v11/network/vpls-pes/vpls-pe/
# ctag-pool
-org.onap.ccsdk.sli.adaptors.aai.path.ctag.pools=/aai/v10/cloud-infrastructure/complexes/complex/{physical-location-id}/ctag-pools
-org.onap.ccsdk.sli.adaptors.aai.path.ctag.pool=/aai/v10/cloud-infrastructure/complexes/complex/{physical-location-id}/ctag-pools/ctag-pool/{target-pe}/{availability-zone-name}
+org.onap.ccsdk.sli.adaptors.aai.path.ctag.pools=/aai/v11/cloud-infrastructure/complexes/complex/{physical-location-id}/ctag-pools
+org.onap.ccsdk.sli.adaptors.aai.path.ctag.pool=/aai/v11/cloud-infrastructure/complexes/complex/{physical-location-id}/ctag-pools/ctag-pool/{target-pe}/{availability-zone-name}
#
#-------------- 1510 ----------------------
#
# pservers
-org.onap.ccsdk.sli.adaptors.aai.path.pservers=/aai/v10/cloud-infrastructure/pservers
-org.onap.ccsdk.sli.adaptors.aai.path.pserver=/aai/v10/cloud-infrastructure/pservers/pserver/{hostname}
+org.onap.ccsdk.sli.adaptors.aai.path.pservers=/aai/v11/cloud-infrastructure/pservers
+org.onap.ccsdk.sli.adaptors.aai.path.pserver=/aai/v11/cloud-infrastructure/pservers/pserver/{hostname}
# generic-vnf
-#org.onap.ccsdk.sli.adaptors.aai.path.generic.vnfs=/aai/v10/network/generic-vnfs
-#org.onap.ccsdk.sli.adaptors.aai.path.generic.vnf=/aai/v10/network/generic-vnfs/generic-vnf/{vnf-id}
+#org.onap.ccsdk.sli.adaptors.aai.path.generic.vnfs=/aai/v11/network/generic-vnfs
+#org.onap.ccsdk.sli.adaptors.aai.path.generic.vnf=/aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}
# dvs-switch
-org.onap.ccsdk.sli.adaptors.aai.path.dvsswitches=/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/dvs-switches
-org.onap.ccsdk.sli.adaptors.aai.path.dvsswitch=/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/dvs-switches/dvs-switch/{switch-name}
+org.onap.ccsdk.sli.adaptors.aai.path.dvsswitches=/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/dvs-switches
+org.onap.ccsdk.sli.adaptors.aai.path.dvsswitch=/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/dvs-switches/dvs-switch/{switch-name}
# L3 Networks
-org.onap.ccsdk.sli.adaptors.aai.path.l3networks=/aai/v10/network/l3-networks
-org.onap.ccsdk.sli.adaptors.aai.path.l3network=/aai/v10/network/l3-networks/l3-network/{network-id}
-org.onap.ccsdk.sli.adaptors.aai.path.l3network.query.name=/aai/v10/network/l3-networks/l3-network?network-name={network-name}
+org.onap.ccsdk.sli.adaptors.aai.path.l3networks=/aai/v11/network/l3-networks
+org.onap.ccsdk.sli.adaptors.aai.path.l3network=/aai/v11/network/l3-networks/l3-network/{network-id}
+org.onap.ccsdk.sli.adaptors.aai.path.l3network.query.name=/aai/v11/network/l3-networks/l3-network?network-name={network-name}
# P-Interfaces
-org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterfaces=/aai/v10/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces
-org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterface=/aai/v10/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}
+org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterfaces=/aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces
+org.onap.ccsdk.sli.adaptors.aai.path.pserver.pinterface=/aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}
# Physical Link
-org.onap.ccsdk.sli.adaptors.aai.path.physical.links=/aai/v10/network/physical-links
-org.onap.ccsdk.sli.adaptors.aai.path.physical.link=/aai/v10/network/physical-links/physical-link/{link-name}
+org.onap.ccsdk.sli.adaptors.aai.path.physical.links=/aai/v11/network/physical-links
+org.onap.ccsdk.sli.adaptors.aai.path.physical.link=/aai/v11/network/physical-links/physical-link/{link-name}
# VPN Bindings
-org.onap.ccsdk.sli.adaptors.aai.path.vpn.bindings=/aai/v10/network/vpn-bindings/
-org.onap.ccsdk.sli.adaptors.aai.path.vpn.binding=/aai/v10/network/vpn-bindings/vpn-binding/{vpn-id}
+org.onap.ccsdk.sli.adaptors.aai.path.vpn.bindings=/aai/v11/network/vpn-bindings/
+org.onap.ccsdk.sli.adaptors.aai.path.vpn.binding=/aai/v11/network/vpn-bindings/vpn-binding/{vpn-id}
# VNF IMAGES
-org.onap.ccsdk.sli.adaptors.aai.path.vnf.images=/aai/v10/service-design-and-creation/vnf-images
-org.onap.ccsdk.sli.adaptors.aai.path.vnf.image=/aai/v10/service-design-and-creation/vnf-images/vnf-image/{att-uuid}
-org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v10/service-design-and-creation/vnf-images/vnf-image?application={application_model}&application-vendor={application_vendor}
+org.onap.ccsdk.sli.adaptors.aai.path.vnf.images=/aai/v11/service-design-and-creation/vnf-images
+org.onap.ccsdk.sli.adaptors.aai.path.vnf.image=/aai/v11/service-design-and-creation/vnf-images/vnf-image/{att-uuid}
+org.onap.ccsdk.sli.adaptors.aai.path.vnf.image.query=/aai/v11/service-design-and-creation/vnf-images/vnf-image?application={application_model}&application-vendor={application_vendor}
# UBB Notify
-org.onap.ccsdk.sli.adaptors.aai.path.notify=/aai/v10/actions/notify
+org.onap.ccsdk.sli.adaptors.aai.path.notify=/aai/v11/actions/notify
org.onap.ccsdk.sli.adaptors.aai.notify.selflink.fqdn=https://sdncodl.it.us.aic.cip.att.com:8443/restconf/config/L3SDN-API:services/layer3-service-list/{service-instance-id}
org.onap.ccsdk.sli.adaptors.aai.notify.selflink.avpn=https://sdncodl-conexus.it.us.02.aic.cip.att.com:8543/restconf/config/L3AVPN-EVC-API:services/service-list/{service-instance-id}/service-data/avpn-logicalchannel-information
# Service
-org.onap.ccsdk.sli.adaptors.aai.path.service=/aai/v10/service-design-and-creation/services/service/{service-id}
-org.onap.ccsdk.sli.adaptors.aai.path.services=/aai/v10/service-design-and-creation/services
+org.onap.ccsdk.sli.adaptors.aai.path.service=/aai/v11/service-design-and-creation/services/service/{service-id}
+org.onap.ccsdk.sli.adaptors.aai.path.services=/aai/v11/service-design-and-creation/services
#
@@ -139,94 +139,94 @@ org.onap.ccsdk.sli.adaptors.aai.path.services=/aai/v10/service-design-and-creati
#
# VNFC
-org.onap.ccsdk.sli.adaptors.aai.path.vnfc=/aai/v10/network/vnfcs/vnfc/{vnfc-name}
+org.onap.ccsdk.sli.adaptors.aai.path.vnfc=/aai/v11/network/vnfcs/vnfc/{vnfc-name}
# site-pair
-org.onap.ccsdk.sli.adaptors.aai.path.site.pair=/aai/v10/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}/site-pairs/site-pair/{site-pair-id}
+org.onap.ccsdk.sli.adaptors.aai.path.site.pair=/aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}/site-pairs/site-pair/{site-pair-id}
# routing-instance
-org.onap.ccsdk.sli.adaptors.aai.path.routing.instance=/aai/v10/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}
+org.onap.ccsdk.sli.adaptors.aai.path.routing.instance=/aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}/routing-instances/routing-instance/{routing-instance-id}
# site-pair-set
-org.onap.ccsdk.sli.adaptors.aai.path.site.pair.set=/aai/v10/network/site-pair-sets/site-pair-set/{site-pair-set-id}
+org.onap.ccsdk.sli.adaptors.aai.path.site.pair.set=/aai/v11/network/site-pair-sets/site-pair-set/{site-pair-set-id}
# license key resource
-org.onap.ccsdk.sli.adaptors.aai.path.license.acquire=/aai/v10/actions/assignment/license-management/assignment-group-uuid/{assignment-group-uuid}
-org.onap.ccsdk.sli.adaptors.aai.path.license=/aai/v10/license-management/license-key-resources/license-key-resource/{att-uuid}
+org.onap.ccsdk.sli.adaptors.aai.path.license.acquire=/aai/v11/actions/assignment/license-management/assignment-group-uuid/{assignment-group-uuid}
+org.onap.ccsdk.sli.adaptors.aai.path.license=/aai/v11/license-management/license-key-resources/license-key-resource/{att-uuid}
# logical-link
-org.onap.ccsdk.sli.adaptors.aai.path.logical.link =/aai/v10/network/logical-links/logical-link/{link-name}
+org.onap.ccsdk.sli.adaptors.aai.path.logical.link =/aai/v11/network/logical-links/logical-link/{link-name}
# virtual-data-center
-org.onap.ccsdk.sli.adaptors.aai.path.virtual.data.center=/aai/v10/cloud-infrastructure/virtual-data-centers/virtual-data-center/{vdc-id}
+org.onap.ccsdk.sli.adaptors.aai.path.virtual.data.center=/aai/v11/cloud-infrastructure/virtual-data-centers/virtual-data-center/{vdc-id}
# wan-connector
-org.onap.ccsdk.sli.adaptors.aai.path.wan.connector=/aai/v10/business/connectors/connector/{resource-instance-id}
+org.onap.ccsdk.sli.adaptors.aai.path.wan.connector=/aai/v11/business/connectors/connector/{resource-instance-id}
# l-interface
-org.onap.ccsdk.sli.adaptors.aai.path.lag.interface.l.interface=/aai/v10/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{lag-interface.interface-name}/l-interfaces/l-interface/{interface-name}
-org.onap.ccsdk.sli.adaptors.aai.path.p.interface.l.interface=/aai/v10/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{p-interface.interface-name}/l-interfaces/l-interface/{interface-name}
+org.onap.ccsdk.sli.adaptors.aai.path.lag.interface.l.interface=/aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/lag-interfaces/lag-interface/{lag-interface.interface-name}/l-interfaces/l-interface/{interface-name}
+org.onap.ccsdk.sli.adaptors.aai.path.p.interface.l.interface=/aai/v11/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{p-interface.interface-name}/l-interfaces/l-interface/{interface-name}
# l-interface pnf
-org.onap.ccsdk.sli.adaptors.aai.path.lag.interface.l.interface.pnf=/aai/v10/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{lag-interface.interface-name}/l-interfaces/l-interface/{interface-name}
-org.onap.ccsdk.sli.adaptors.aai.path.p.interface.l.interface.pnf=/aai/v10/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{p-interface.interface-name}/l-interfaces/l-interface/{interface-name}
+org.onap.ccsdk.sli.adaptors.aai.path.lag.interface.l.interface.pnf=/aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{lag-interface.interface-name}/l-interfaces/l-interface/{interface-name}
+org.onap.ccsdk.sli.adaptors.aai.path.p.interface.l.interface.pnf=/aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{p-interface.interface-name}/l-interfaces/l-interface/{interface-name}
# subinterface
-org.onap.ccsdk.sli.adaptors.aai.path.pnf.lag.interface.subinterface=/aai/v10/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{lag-interface.interface-name}/l-interfaces/l-interface/{interface-name}
-org.onap.ccsdk.sli.adaptors.aai.path.pnf.p.interface.l.interface=/aai/v10/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{p-interface.interface-name}/l-interfaces/l-interface/{interface-name}
+org.onap.ccsdk.sli.adaptors.aai.path.pnf.lag.interface.subinterface=/aai/v11/network/pnfs/pnf/{pnf-name}/lag-interfaces/lag-interface/{lag-interface.interface-name}/l-interfaces/l-interface/{interface-name}
+org.onap.ccsdk.sli.adaptors.aai.path.pnf.p.interface.l.interface=/aai/v11/network/pnfs/pnf/{pnf-name}/p-interfaces/p-interface/{p-interface.interface-name}/l-interfaces/l-interface/{interface-name}
# l3-interface-ipv4-address-list
-org.onap.ccsdk.sli.adaptors.aai.path.l3.interface.ipv4.address.list=/aai/v10/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
-org.onap.ccsdk.sli.adaptors.aai.path.vlan.l3.interface.ipv4.address.list=/aai/v10/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}
+org.onap.ccsdk.sli.adaptors.aai.path.l3.interface.ipv4.address.list=/aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+org.onap.ccsdk.sli.adaptors.aai.path.vlan.l3.interface.ipv4.address.list=/aai/v11/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}
# l3-interface-ipv6-address-list
-org.onap.ccsdk.sli.adaptors.aai.path.l3.interface.ipv6.address.list=/aai/v10/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
-org.onap.ccsdk.sli.adaptors.aai.path.vlan.l3.interface.ipv6.address.list=/aai/v10/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+org.onap.ccsdk.sli.adaptors.aai.path.l3.interface.ipv6.address.list=/aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+org.onap.ccsdk.sli.adaptors.aai.path.vlan.l3.interface.ipv6.address.list=/aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
# ipsec-configuration
-org.onap.ccsdk.sli.adaptors.aai.path.ipsec.configuration=/aai/v10/network/ipsec-configurations/ipsec-configuration/{ipsec-configuration-id}
+org.onap.ccsdk.sli.adaptors.aai.path.ipsec.configuration=/aai/v11/network/ipsec-configurations/ipsec-configuration/{ipsec-configuration-id}
# vig server
-org.onap.ccsdk.sli.adaptors.aai.path.vig.server=/aai/v10/network/ipsec-configurations/ipsec-configuration/{ipsec-configuration-id}/vig-servers/vig-server/{vig-address-type}
+org.onap.ccsdk.sli.adaptors.aai.path.vig.server=/aai/v11/network/ipsec-configurations/ipsec-configuration/{ipsec-configuration-id}/vig-servers/vig-server/{vig-address-type}
# l3-network
-org.onap.ccsdk.sli.adaptors.aai.path.l3.network=/aai/v10/network/l3-networks/l3-network/{network-id}
+org.onap.ccsdk.sli.adaptors.aai.path.l3.network=/aai/v11/network/l3-networks/l3-network/{network-id}
# subnet
-org.onap.ccsdk.sli.adaptors.aai.path.subnet=/aai/v10/network/l3-networks/l3-network/{network-id}/subnets/subnet/{subnet-id}
+org.onap.ccsdk.sli.adaptors.aai.path.subnet=/aai/v11/network/l3-networks/l3-network/{network-id}/subnets/subnet/{subnet-id}
# multicast-configuration
-org.onap.ccsdk.sli.adaptors.aai.path.multicast.configuration=/aai/v10/network/multicast-configurations/multicast-configuration/{multicast-configuration-id}
+org.onap.ccsdk.sli.adaptors.aai.path.multicast.configuration=/aai/v11/network/multicast-configurations/multicast-configuration/{multicast-configuration-id}
# org.onap.ccsdk.sli.adaptors.aai.path.l.interface.ipv4.address.list
-org.onap.ccsdk.sli.adaptors.aai.path.l3-interface.ipv4.address.list=/aai/v10/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
+org.onap.ccsdk.sli.adaptors.aai.path.l3-interface.ipv4.address.list=/aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv4-address-list/{l3-interface-ipv4-address}
# org.onap.ccsdk.sli.adaptors.aai.path.l.interface.vlan.ipv4.address.list
-org.onap.ccsdk.sli.adaptors.aai.path.l3-interface.vlan.ipv4.address.list=/aai/v10/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}
+org.onap.ccsdk.sli.adaptors.aai.path.l3-interface.vlan.ipv4.address.list=/aai/v11/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}
# org.onap.ccsdk.sli.adaptors.aai.path.l.interface.ipv6.address.list
-org.onap.ccsdk.sli.adaptors.aai.path.l3-interface.ipv6.address.list=/aai/v10/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
+org.onap.ccsdk.sli.adaptors.aai.path.l3-interface.ipv6.address.list=/aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
# volume.group
-org.onap.ccsdk.sli.adaptors.aai.path.volume.group=/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/volume-groups/volume-group/{volume-group-id}
+org.onap.ccsdk.sli.adaptors.aai.path.volume.group=/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/volume-groups/volume-group/{volume-group-id}
#cloud region
-org.onap.ccsdk.sli.adaptors.aai.path.cloud.region=/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}
+org.onap.ccsdk.sli.adaptors.aai.path.cloud.region=/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}
# vf-module
-org.onap.ccsdk.sli.adaptors.aai.path.vf.module=/aai/v10/network/generic-vnfs/generic-vnf/{vnf-id}/vf-modules/vf-module/{vf-module-id}
+org.onap.ccsdk.sli.adaptors.aai.path.vf.module=/aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/vf-modules/vf-module/{vf-module-id}
# network-policy
-org.onap.ccsdk.sli.adaptors.aai.path.network.policy=/aai/v10/network/network-policies/network-policy/{network-policy-id}
+org.onap.ccsdk.sli.adaptors.aai.path.network.policy=/aai/v11/network/network-policies/network-policy/{network-policy-id}
# pnf
-org.onap.ccsdk.sli.adaptors.aai.path.pnf=/aai/v10/network/pnfs/pnf/{pnf-name}
+org.onap.ccsdk.sli.adaptors.aai.path.pnf=/aai/v11/network/pnfs/pnf/{pnf-name}
# oam-network
-org.onap.ccsdk.sli.adaptors.aai.path.oam.network=/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/oam-networks/oam-network/{network-uuid}
+org.onap.ccsdk.sli.adaptors.aai.path.oam.network=/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/oam-networks/oam-network/{network-uuid}
# route-table-reference
-org.onap.ccsdk.sli.adaptors.aai.path.route.table.reference=/aai/v10/network/route-table-references/route-table-reference/{route-table-reference-id}
+org.onap.ccsdk.sli.adaptors.aai.path.route.table.reference=/aai/v11/network/route-table-references/route-table-reference/{route-table-reference-id}
#
# Formatting