summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/aai
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/aai')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java489
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java58
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiGetVnfResponse.java39
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiResponse.java34
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/OperationalEnvironment.java107
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstance.java33
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstances.java14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstancesSearchResults.java14
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/ServiceSubscription.java20
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/ServiceSubscriptions.java17
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/Services.java24
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/SubscriberAaiResponse.java24
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/SubscriberData.java7
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/SubscriberFilteredResults.java29
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/SubscriberListWithFilterData.java31
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/SubscriberWithFilter.java21
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/exceptions/InvalidAAIResponseException.java7
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/exceptions/RoleParsingException.java7
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetAicZone/AicZones.java10
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetAicZone/Zone.java13
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentList.java30
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetPnfResponse.java42
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetPnfs/Pnf.java77
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetServicesRequestModel/GetServicesAAIRespone.java11
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetServicesRequestModel/Service.java21
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetTenatns/GetTenantsResponse.java33
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/AaiRelationResponse.java45
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/GetServiceModelsByDistributionStatusResponse.java29
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/LogicalLinkResponse.java72
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/Model.java61
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java84
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVers.java28
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/OwningEntity.java36
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/OwningEntityResponse.java28
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/PnfProperties.java51
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/PnfResult.java49
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/Project.java21
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ProjectResponse.java28
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/RelatedToProperty.java35
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/Relationship.java67
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipData.java30
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipList.java26
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/Result.java26
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstance.java26
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstances.java12
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceProperties.java113
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceRelationships.java102
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceSubscription.java17
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/Services.java24
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/VnfResult.java46
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/AAIProperties.java68
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java373
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/CustomJacksonJaxBJsonProvider.java73
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsAuthClient.java140
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsComponentsClient.java99
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/JettyObfuscationConversionCommandLineUtil.java78
56 files changed, 3099 insertions, 0 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
new file mode 100644
index 00000000..2b8cf3a0
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
@@ -0,0 +1,489 @@
+package org.onap.vid.aai;
+
+import org.apache.http.HttpStatus;
+import org.apache.http.client.utils.URIBuilder;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.onap.vid.aai.util.AAIRestInterface;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.onap.vid.aai.model.AaiGetAicZone.AicZones;
+import org.onap.vid.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;
+import org.onap.vid.aai.model.*;
+import org.onap.vid.aai.model.AaiGetPnfs.Pnf;
+import org.onap.vid.aai.model.AaiGetServicesRequestModel.GetServicesAAIRespone;
+import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
+import org.onap.vid.model.SubscriberList;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.util.UriUtils;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.BadRequestException;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+import java.io.File;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+
+/**
+
+ * Created by Oren on 7/4/17.
+ */
+public class AaiClient implements AaiClientInterface {
+
+ /**
+ * The Constant dateFormat.
+ */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+ protected String fromAppId = "VidAaiController";
+ @Autowired
+ ServletContext servletContext;
+ /**
+ * The logger
+ */
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AaiClient.class);
+ private final String getServiceModelsResponseBody = "{\"start\" : \"service-design-and-creation/models/\", \"query\" : \"query/serviceModels-byDistributionStatus?distributionStatus=DISTRIBUTION_COMPLETE_OK\"}";
+
+ public AaiClient() {
+ // certiPath = getCertificatesFile().getAbsolutePath();
+ // depth = "0";
+ }
+
+ public AaiClient(ServletContext context) {
+ servletContext = context;
+ }
+
+
+ private static String checkForNull(String local) {
+ if (local != null)
+ return local;
+ else
+ return "";
+
+ }
+
+ @Override
+ public AaiResponse getServicesByOwningEntityId(List<String> owningEntityIds){
+ File certiPath = getCertificatesFile();
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), getUrlFromLIst("business/owning-entities?", "owning-entity-id=", owningEntityIds), false);
+ AaiResponse aaiResponse = proccessAaiResponse(resp, OwningEntityResponse.class, null);
+
+ return aaiResponse;
+ }
+
+ @Override
+ public AaiResponse getServicesByProjectNames(List<String> projectNames){
+ File certiPath = getCertificatesFile();
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), getUrlFromLIst("business/projects?", "project-name=", projectNames), false);
+ AaiResponse aaiResponse = proccessAaiResponse(resp, ProjectResponse.class, null);
+
+ return aaiResponse;
+ }
+
+ @Override
+ public AaiResponse getServiceModelsByDistributionStatus() {
+ File certiPath = getCertificatesFile();
+ Response resp = doAaiPut(certiPath.getAbsolutePath(), "query?format=resource", getServiceModelsResponseBody, false);
+ AaiResponse aaiResponse = proccessAaiResponse(resp, GetServiceModelsByDistributionStatusResponse.class, null);
+
+ return aaiResponse;
+ }
+
+ @Override
+ public AaiResponse getPNFData(String globalCustomerId, String serviceType, String modelVersionId, String modelInvariantId, String cloudRegion, String equipVendor, String equipModel) {
+ String certiPath = getCertificatesFile().getAbsolutePath();
+ String siQuery = "/business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" + encodePathSegment(serviceType) + "/service-instances?model-version-id=" + modelVersionId + "&model-invariant-id=" + modelInvariantId;
+ String pnfQuery = "query/pnf-fromModel-byRegion?cloudRegionId=" + encodePathSegment(cloudRegion) + "&equipVendor=" + encodePathSegment(equipVendor) + "&equipModel=" + encodePathSegment(equipModel);
+ String payload = "{\"start\":\"" + siQuery + "\",\"query\":\"" + pnfQuery + "\"}";
+ Response resp = doAaiPut(certiPath, "query?format=simple", payload, false);
+ return proccessAaiResponse(resp, AaiGetPnfResponse.class, null);
+ }
+
+
+ @Override
+ public AaiResponse<Pnf> getSpecificPnf(String pnfId) {
+ File certiPath = getCertificatesFile();
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), "network/pnfs/pnf/"+pnfId, false);
+ AaiResponse aaiResponse = proccessAaiResponse(resp, Pnf.class, null);
+
+ return aaiResponse;
+ }
+
+ public AaiResponse getServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId) {
+ String certiPath = getCertificatesFile().getAbsolutePath();
+ String getServiceInstancePath = "business/customers/customer/"+globalCustomerId+"/service-subscriptions/service-subscription/"+serviceType+"/service-instances/service-instance/"+serviceInstanceId;
+ Response resp = doAaiGet(certiPath , getServiceInstancePath , false);
+ return proccessAaiResponse(resp, ServiceRelationships.class, null);
+ }
+
+ @Override
+ public AaiResponse getLogicalLink(String link) {
+ String certiPath = getCertificatesFile().getAbsolutePath();
+ Response resp = doAaiGet(certiPath , "network/logical-links/logical-link/" + link , false);
+ return proccessAaiResponse(resp, LogicalLinkResponse.class, null);
+ }
+
+ private String getUrlFromLIst(String url, String paramKey, List<String> params){
+ url.concat(paramKey);
+ int i = 0;
+ for(String param: params){
+ i ++;
+ url = url.concat(paramKey);
+ String encodedParam= param;
+ try {
+ encodedParam= URLEncoder.encode(param, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ String methodName = "getUrlFromList";
+ logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ }
+ url = url.concat(encodedParam);
+ if(i != params.size()){
+ url = url.concat("&");
+ }
+ }
+ return url;
+ }
+
+
+ @Override
+ public AaiResponse<SubscriberList> getAllSubscribers() {
+ String certiPath = getCertificatesFile().getAbsolutePath();
+ String depth = "0";
+ Response resp = doAaiGet(certiPath, "business/customers?subscriber-type=INFRA&depth=" + depth, false);
+ return proccessAaiResponse(resp, SubscriberList.class, null);
+ }
+
+
+ @Override
+ public AaiResponse getAllAicZones() {
+ String certiPath = getCertificatesFile().getAbsolutePath();
+ Response resp = doAaiGet(certiPath, "network/zones", false);
+ AaiResponse aaiAicZones = proccessAaiResponse(resp, AicZones.class, null);
+ return aaiAicZones;
+ }
+
+
+ @Override
+ public AaiResponse<String> getAicZoneForPnf(String globalCustomerId , String serviceType , String serviceId) {
+ String certiPath = getCertificatesFile().getAbsolutePath();
+ String aicZonePath = "business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId;
+ Response resp = doAaiGet(certiPath , aicZonePath , false);
+ AaiResponse<ServiceRelationships> aaiResponse = proccessAaiResponse(resp , ServiceRelationships.class , null);
+ ServiceRelationships serviceRelationships = (ServiceRelationships)aaiResponse.getT();
+ RelationshipList relationshipList = serviceRelationships.getRelationshipList();
+ Relationship relationship = relationshipList.getRelationship().get(0);
+ RelationshipData relationshipData= relationship.getRelationDataList().get(0);
+ String aicZone = relationshipData.getRelationshipValue();
+ AaiResponse<String> aaiAicZonaForPnfResponse = new AaiResponse(aicZone , null ,HttpStatus.SC_OK);
+ return aaiAicZonaForPnfResponse;
+ }
+
+
+ @Override
+ public AaiResponse getVNFData() {
+ String certiPath = getCertificatesFile().getAbsolutePath();
+ String payload = "{\"start\": [\"/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances/service-instance/3f93c7cb-2fd0-4557-9514-e189b7b04f9d\"], \"query\": \"query/vnf-topology-fromServiceInstance\"}";
+ Response resp = doAaiPut(certiPath, "query?format=simple", payload, false);
+ return proccessAaiResponse(resp, AaiGetVnfResponse.class, null);
+
+ }
+
+ @Override
+ public Response getVNFData(String globalSubscriberId, String serviceType) {
+ String certiPath = getCertificatesFile().getAbsolutePath();
+ String payload = "{\"start\": [\"business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/"+ encodePathSegment(serviceType) +"/service-instances\"]," +
+ "\"query\": \"query/vnf-topology-fromServiceInstance\"}";
+ return doAaiPut(certiPath, "query?format=simple", payload, false);
+
+ }
+
+ @Override
+ public AaiResponse getVNFData(String globalSubscriberId, String serviceType, String serviceInstanceId) {
+ String certiPath = getCertificatesFile().getAbsolutePath();
+ String payload = "{\"start\": [\"/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + encodePathSegment(serviceType) + "/service-instances/service-instance/" + serviceInstanceId + "\"], \"query\": \"query/vnf-topology-fromServiceInstance\"}";
+ Response resp = doAaiPut(certiPath, "query?format=simple", payload, false);
+ return proccessAaiResponse(resp, AaiGetVnfResponse.class, null);
+ }
+
+ @Override
+ public Response getVersionByInvariantId(List<String> modelInvariantId) {
+ File certiPath = getCertificatesFile();
+ StringBuilder sb = new StringBuilder();
+ for (String id : modelInvariantId){
+ sb.append("&model-invariant-id=");
+ sb.append(id);
+
+ }
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), "service-design-and-creation/models?depth=2"+ sb.toString(), false);
+ return resp;
+ }
+
+ @Override
+ public AaiResponse getSubscriberData(String subscriberId) {
+ File certiPath = getCertificatesFile();
+ String depth = "2";
+ AaiResponse subscriberDataResponse;
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + subscriberId + "?depth=" + depth, false);
+ subscriberDataResponse = proccessAaiResponse(resp, Services.class, null);
+ return subscriberDataResponse;
+ }
+
+ @Override
+ public AaiResponse getServices() {
+ File certiPath = getCertificatesFile();
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), "service-design-and-creation/services", false);
+ AaiResponse<GetServicesAAIRespone> getServicesResponse = proccessAaiResponse(resp, GetServicesAAIRespone.class, null);
+
+ return getServicesResponse;
+ }
+
+ @Override
+ public AaiResponse getOperationalEnvironments(String operationalEnvironmentType, String operationalEnvironmentStatus) {
+ File certiPath = getCertificatesFile();
+ String url = "cloud-infrastructure/operational-environments";
+ URIBuilder urlBuilder = new URIBuilder();
+ if (operationalEnvironmentType != null)
+ urlBuilder.addParameter("operational-environment-type", operationalEnvironmentType);
+ if (operationalEnvironmentStatus != null)
+ urlBuilder.addParameter("operational-environment-status", operationalEnvironmentStatus);
+ url += urlBuilder.toString();
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), url, false);
+ AaiResponse<OperationalEnvironmentList> getOperationalEnvironmentsResponse = proccessAaiResponse(resp, OperationalEnvironmentList.class, null);
+ return getOperationalEnvironmentsResponse;
+
+ }
+
+ @Override
+ public AaiResponse getTenants(String globalCustomerId, String serviceType) {
+ File certiPath = getCertificatesFile();
+ String url = "business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" + serviceType;
+
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), url, false);
+ String responseAsString = parseForTenantsByServiceSubscription(resp.readEntity(String.class));
+ if (responseAsString.equals("")){
+ AaiResponse aaiResponse = new AaiResponse<>(null, String.format("{\"statusText\":\" A&AI has no LCP Region & Tenants associated to subscriber '%s' and service type '%s'\"}", globalCustomerId, serviceType), HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ return aaiResponse;
+ }
+ else {
+ AaiResponse<GetTenantsResponse[]> getTenantsResponse = proccessAaiResponse(resp, GetTenantsResponse[].class, responseAsString);
+ return getTenantsResponse;
+ }
+
+ }
+
+ @Override
+ public AaiResponse getNodeTemplateInstances(String globalCustomerId, String serviceType, String modelVersionId, String modelInvariantId, String cloudRegion) {
+
+ String certiPath = getCertificatesFile().getAbsolutePath();
+
+ String siQuery = "/business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" + encodePathSegment(serviceType) + "/service-instances?model-version-id=" + modelVersionId + "&model-invariant-id=" + modelInvariantId;
+ String vnfQuery = "query/queryvnfFromModelbyRegion?cloudRegionId=" + encodePathSegment(cloudRegion);
+ String payload1 = "{\"start\":\"" + siQuery + "\",\"query\":\"" + vnfQuery + "\"}";
+
+ Response resp1 = doAaiPut(certiPath, "query?format=simple", payload1, false);
+ AaiResponse aaiResponse1 = proccessAaiResponse(resp1, AaiGetVnfResponse.class, null);
+ logger.debug(EELFLoggerDelegate.debugLogger, "getNodeTemplateInstances AAI's response: {}", aaiResponse1);
+ return aaiResponse1;
+ }
+
+ private AaiResponse proccessAaiResponse(Response resp, Class classType, String responseBody) {
+ AaiResponse subscriberDataResponse = null;
+ if (resp == null) {
+ subscriberDataResponse = new AaiResponse<>(null, null, HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "Invalid response from AAI");
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "getSubscribers() resp=" + resp.getStatusInfo().toString());
+ if (resp.getStatus() != HttpStatus.SC_OK) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "Invalid response from AAI");
+ subscriberDataResponse = new AaiResponse<>(null, resp.readEntity(String.class), resp.getStatus());
+ } else {
+ String finalResponse = null;
+ try {
+ if (responseBody != null) {
+ finalResponse = responseBody;
+ } else {
+ finalResponse = resp.readEntity(String.class);
+ }
+
+ subscriberDataResponse = new AaiResponse<>((new ObjectMapper().readValue(finalResponse, classType)), null, HttpStatus.SC_OK);
+
+ } catch(Exception e){
+ subscriberDataResponse = new AaiResponse<>(null, null, HttpStatus.SC_INTERNAL_SERVER_ERROR);
+ logger.error("Failed to parse aai response: \"{}\" to class {}", finalResponse, classType, e);
+ }
+ }
+ }
+ return subscriberDataResponse;
+ }
+
+ private File getCertificatesFile() {
+ if (servletContext != null)
+ return new File(servletContext.getRealPath("/WEB-INF/cert/"));
+ return null;
+ }
+
+ @SuppressWarnings("all")
+ public Response doAaiGet(String certiPath, String uri, boolean xml) {
+ String methodName = "doAaiGet";
+ String transId = UUID.randomUUID().toString();
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ Response resp = null;
+ try {
+
+ AAIRestInterface restContrller = new AAIRestInterface(certiPath);
+ resp = restContrller.RestGet(fromAppId, transId, uri, xml);
+
+ } catch (WebApplicationException e) {
+ final String message = ((BadRequestException) e).getResponse().readEntity(String.class);
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + message);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + message);
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ }
+
+ return resp;
+ }
+
+ private String parseForTenantsByServiceSubscription(String resp) {
+ String tenantList = "";
+
+ try {
+ JSONParser jsonParser = new JSONParser();
+
+ JSONObject jsonObject = (JSONObject) jsonParser.parse(resp);
+
+ return parseServiceSubscriptionObjectForTenants(jsonObject);
+ } catch (Exception ex) {
+
+ }
+
+ return tenantList;
+ }
+
+ protected Response doAaiPut(String certiPath, String uri, String payload, boolean xml) {
+ String methodName = "doAaiPut";
+ String transId = UUID.randomUUID().toString();
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ Response resp = null;
+ try {
+
+ AAIRestInterface restContrller = new AAIRestInterface(certiPath);
+ resp = restContrller.RestPut(fromAppId, transId, uri, payload, xml);
+
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ }
+
+ return resp;
+ }
+
+
+ public static String parseServiceSubscriptionObjectForTenants(JSONObject jsonObject) {
+
+ JSONArray tenantArray = new JSONArray();
+ boolean bconvert = false;
+
+ try {
+ JSONObject relationShipListsObj = (JSONObject) jsonObject.get("relationship-list");
+ if (relationShipListsObj != null) {
+ JSONArray rShipArray = (JSONArray) relationShipListsObj.get("relationship");
+ if (rShipArray != null) {
+ Iterator i1 = rShipArray.iterator();
+
+ while (i1.hasNext()) {
+
+ JSONObject inner1Obj = (JSONObject) i1.next();
+
+ if (inner1Obj == null)
+ continue;
+
+ String relatedTo = checkForNull((String) inner1Obj.get("related-to"));
+ if (relatedTo.equalsIgnoreCase("tenant")) {
+ JSONObject tenantNewObj = new JSONObject();
+
+ String relatedLink = checkForNull((String) inner1Obj.get("related-link"));
+ tenantNewObj.put("link", relatedLink);
+
+ JSONArray rDataArray = (JSONArray) inner1Obj.get("relationship-data");
+ if (rDataArray != null) {
+ Iterator i2 = rDataArray.iterator();
+
+ while (i2.hasNext()) {
+ JSONObject inner2Obj = (JSONObject) i2.next();
+
+ if (inner2Obj == null)
+ continue;
+
+ String rShipKey = checkForNull((String) inner2Obj.get("relationship-key"));
+ String rShipVal = checkForNull((String) inner2Obj.get("relationship-value"));
+ if (rShipKey.equalsIgnoreCase("cloud-region.cloud-owner")) {
+ tenantNewObj.put("cloudOwner", rShipVal);
+ } else if (rShipKey.equalsIgnoreCase("cloud-region.cloud-region-id")) {
+ tenantNewObj.put("cloudRegionID", rShipVal);
+ }
+
+ if (rShipKey.equalsIgnoreCase("tenant.tenant-id")) {
+ tenantNewObj.put("tenantID", rShipVal);
+ }
+ }
+ }
+
+ JSONArray relatedTPropArray = (JSONArray) inner1Obj.get("related-to-property");
+ if (relatedTPropArray != null) {
+ Iterator i3 = relatedTPropArray.iterator();
+
+ while (i3.hasNext()) {
+ JSONObject inner3Obj = (JSONObject) i3.next();
+
+ if (inner3Obj == null)
+ continue;
+
+ String propKey = checkForNull((String) inner3Obj.get("property-key"));
+ String propVal = checkForNull((String) inner3Obj.get("property-value"));
+ if (propKey.equalsIgnoreCase("tenant.tenant-name")) {
+ tenantNewObj.put("tenantName", propVal);
+ }
+ }
+ }
+ bconvert = true;
+ tenantArray.add(tenantNewObj);
+ }
+ }
+
+ }
+ }
+ } catch (NullPointerException ex) {
+
+
+ }
+
+ if (bconvert)
+ return tenantArray.toJSONString();
+ else
+ return "";
+
+ }
+
+ private static String encodePathSegment(String segmentToEncode) {
+ try {
+ return UriUtils.encodePathSegment(segmentToEncode, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException("URI encoding failed unexpectedly", e);
+ }
+ }
+
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
new file mode 100644
index 00000000..5095f48b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
@@ -0,0 +1,58 @@
+package org.onap.vid.aai;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.onap.vid.aai.model.AaiGetPnfs.Pnf;
+import org.onap.vid.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;
+import org.onap.vid.aai.model.AaiGetServicesRequestModel.GetServicesAAIRespone;
+import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
+import org.onap.vid.model.SubscriberList;
+
+import javax.ws.rs.core.Response;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Created by Oren on 7/4/17.
+ */
+public interface AaiClientInterface {
+
+ AaiResponse<SubscriberList> getAllSubscribers();
+
+ AaiResponse getSubscriberData(String subscriberId);
+
+ AaiResponse getServices();
+
+ AaiResponse getServicesByOwningEntityId(List<String> owningEntityIds);
+
+ AaiResponse<GetTenantsResponse[]> getTenants(String globalCustomerId, String serviceType);
+
+ AaiResponse<OperationalEnvironmentList> getOperationalEnvironments(String operationalEnvironmentType, String operationalEnvironmentStatus);
+
+ AaiResponse getAllAicZones();
+
+ AaiResponse getAicZoneForPnf(String globalCustomerId , String serviceType , String serviceId);
+
+ AaiResponse getVNFData();
+
+ Response getVNFData(String globalSubscriberId, String serviceType);
+
+ AaiResponse getVNFData(String globalSubscriberId, String serviceType, String serviceInstanceId);
+
+ AaiResponse getNodeTemplateInstances(String globalCustomerId, String serviceType, String modelVersionId, String modelInvariantId, String cloudRegion);
+
+ Response getVersionByInvariantId(List<String> modelInvariantId);
+
+ AaiResponse getServicesByProjectNames(List<String> projectNames);
+
+ AaiResponse getServiceModelsByDistributionStatus();
+
+ AaiResponse getPNFData(String globalCustomerId, String serviceType, String modelVersionId, String modelInvariantId, String cloudRegion, String equipVendor, String equipModel);
+
+ AaiResponse<Pnf> getSpecificPnf(String pnfId);
+
+ AaiResponse getServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId);
+
+ AaiResponse getLogicalLink(String link);
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiGetVnfResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiGetVnfResponse.java
new file mode 100644
index 00000000..14e8e5dc
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiGetVnfResponse.java
@@ -0,0 +1,39 @@
+package org.onap.vid.aai;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.google.common.base.MoreObjects;
+import org.codehaus.jackson.annotate.*;
+import org.onap.vid.aai.model.VnfResult;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "results"
+})
+public class AaiGetVnfResponse {
+ @JsonProperty("results")
+ public List<VnfResult> results = null;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("results", results)
+ .add("additionalProperties", additionalProperties)
+ .toString();
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiResponse.java
new file mode 100644
index 00000000..c4b19b13
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiResponse.java
@@ -0,0 +1,34 @@
+package org.onap.vid.aai;
+
+import com.google.common.base.MoreObjects;
+import org.onap.vid.model.ProxyResponse;
+
+/**
+ * Created by Oren on 7/10/17.
+ */
+public class AaiResponse<T> extends ProxyResponse{
+
+ T t;
+
+ public AaiResponse() {
+ }
+
+ public AaiResponse(T t, String errorMessage, int aaiHttpCode) {
+ this.t = t;
+ this.errorMessage = errorMessage;
+ this.httpCode = aaiHttpCode;
+ }
+
+ public T getT() {
+ return t;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("httpCode", httpCode)
+ .add("errorMessage", errorMessage)
+ .add("t", t)
+ .toString();
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/OperationalEnvironment.java b/vid-app-common/src/main/java/org/onap/vid/aai/OperationalEnvironment.java
new file mode 100644
index 00000000..10ad4e96
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/OperationalEnvironment.java
@@ -0,0 +1,107 @@
+package org.onap.vid.aai;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.onap.vid.aai.model.Relationship;
+import org.onap.vid.aai.model.RelationshipList;
+
+import java.util.List;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class OperationalEnvironment {
+
+ private String operationalEnvironmentId;
+ private String operationalEnvironmentName;
+ private String operationalEnvironmentType;
+ private String operationalEnvironmentStatus;
+ private String tenantContext;
+ private String workloadContext;
+ private String resourceVersion;
+ private RelationshipList relationshipList;
+
+ public OperationalEnvironment() {
+ }
+
+ public OperationalEnvironment(String operationalEnvironmentId, String operationalEnvironmentName, String operationalEnvironmentType, String operationalEnvironmentStatus, String tenantContext, String workloadContext, String resourceVersion, RelationshipList relationshipList) {
+ this.operationalEnvironmentId = operationalEnvironmentId;
+ this.operationalEnvironmentName = operationalEnvironmentName;
+ this.operationalEnvironmentType = operationalEnvironmentType;
+ this.operationalEnvironmentStatus = operationalEnvironmentStatus;
+ this.tenantContext = tenantContext;
+ this.workloadContext = workloadContext;
+ this.resourceVersion = resourceVersion;
+ this.relationshipList = relationshipList;
+ }
+
+ @JsonProperty("operational-environment-id")
+ public String getOperationalEnvironmentId() {
+ return operationalEnvironmentId;
+ }
+
+ public void setOperationalEnvironmentId(String operationalEnvironmentId) {
+ this.operationalEnvironmentId = operationalEnvironmentId;
+ }
+
+ @JsonProperty("operational-environment-name")
+ public String getOperationalEnvironmentName() {
+ return operationalEnvironmentName;
+ }
+
+ public void setOperationalEnvironmentName(String operationalEnvironmentName) {
+ this.operationalEnvironmentName = operationalEnvironmentName;
+ }
+
+ @JsonProperty("operational-environment-type")
+ public String getOperationalEnvironmentType() {
+ return operationalEnvironmentType;
+ }
+
+ public void setOperationalEnvironmentType(String operationalEnvironmentType) {
+ this.operationalEnvironmentType = operationalEnvironmentType;
+ }
+
+ @JsonProperty("operational-environment-status")
+ public String getOperationalEnvironmentStatus() {
+ return operationalEnvironmentStatus;
+ }
+
+ public void setOperationalEnvironmentStatus(String operationalEnvironmentStatus) {
+ this.operationalEnvironmentStatus = operationalEnvironmentStatus;
+ }
+
+ @JsonProperty("tenant-context")
+ public String getTenantContext() {
+ return tenantContext;
+ }
+
+ public void setTenantContext(String tenantContext) {
+ this.tenantContext = tenantContext;
+ }
+
+ @JsonProperty("workload-context")
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ @JsonProperty("resource-version")
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ @JsonProperty("relationship-list")
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstance.java b/vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstance.java
new file mode 100644
index 00000000..26f4a21e
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstance.java
@@ -0,0 +1,33 @@
+package org.onap.vid.aai;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ServiceInstance {
+
+ @JsonProperty("service-instance-id")
+ public String serviceInstanceId;
+
+ @JsonProperty("service-instance-name")
+ public String serviceInstanceName;
+
+ @JsonProperty("persona-model-id")
+ public String personaModelId;
+
+ @JsonProperty("persona-model-version")
+ public String personaModelVersion;
+
+ @JsonProperty("resource-version")
+ public String resourceVersion;
+
+ @JsonProperty("orchestration-status")
+ public String orchestrationStatus;
+
+ @JsonProperty("model-invariant-id")
+ public String modelInvariantId;
+
+ @JsonProperty("model-version-id")
+ public String modelVersionId;
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstances.java b/vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstances.java
new file mode 100644
index 00000000..c92a47a3
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstances.java
@@ -0,0 +1,14 @@
+package org.onap.vid.aai;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.List;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ServiceInstances {
+
+ @JsonProperty("service-instance")
+ public List<ServiceInstance> serviceInstance;
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstancesSearchResults.java b/vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstancesSearchResults.java
new file mode 100644
index 00000000..b32a83a1
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/ServiceInstancesSearchResults.java
@@ -0,0 +1,14 @@
+package org.onap.vid.aai;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.onap.vid.model.ServiceInstanceSearchResult;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ServiceInstancesSearchResults {
+ @JsonProperty("service-instances")
+ public List<ServiceInstanceSearchResult> serviceInstances;
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/ServiceSubscription.java b/vid-app-common/src/main/java/org/onap/vid/aai/ServiceSubscription.java
new file mode 100644
index 00000000..5dc9d526
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/ServiceSubscription.java
@@ -0,0 +1,20 @@
+package org.onap.vid.aai;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ServiceSubscription {
+
+ @JsonProperty("service-type")
+ public String serviceType;
+
+ @JsonProperty("resource-version")
+ public String resourceVersion;
+
+ @JsonProperty("service-instances")
+ public ServiceInstances serviceInstances;
+
+ @JsonProperty("is-permitted")
+ public boolean isPermitted =false;
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/ServiceSubscriptions.java b/vid-app-common/src/main/java/org/onap/vid/aai/ServiceSubscriptions.java
new file mode 100644
index 00000000..686dc7d6
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/ServiceSubscriptions.java
@@ -0,0 +1,17 @@
+package org.onap.vid.aai;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.List;
+
+/**
+ * Created by Oren on 7/9/17.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+
+public class ServiceSubscriptions {
+
+ @JsonProperty("service-subscription")
+ public List<ServiceSubscription> serviceSubscription;
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/Services.java b/vid-app-common/src/main/java/org/onap/vid/aai/Services.java
new file mode 100644
index 00000000..fe70de5a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/Services.java
@@ -0,0 +1,24 @@
+package org.onap.vid.aai;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Services {
+ @JsonProperty("global-customer-id")
+ public String globalCustomerId;
+
+ @JsonProperty("subscriber-name")
+ public String subscriberName;
+
+ @JsonProperty("subscriber-type")
+ public String subscriberType;
+
+ @JsonProperty("resource-version")
+ public String resourceVersion;
+
+ @JsonProperty("service-subscriptions")
+ public ServiceSubscriptions serviceSubscriptions;
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberAaiResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberAaiResponse.java
new file mode 100644
index 00000000..2dad75fd
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberAaiResponse.java
@@ -0,0 +1,24 @@
+package org.onap.vid.aai;
+
+import org.onap.vid.model.ProxyResponse;
+import org.onap.vid.model.SubscriberList;
+
+/**
+ * Created by Oren on 7/5/17.
+ */
+public class SubscriberAaiResponse extends ProxyResponse {
+
+
+ private SubscriberList subscriberList;
+
+ public SubscriberAaiResponse(SubscriberList subscriberList, String errorMessage, int aaiHttpCode) {
+ this.subscriberList = subscriberList;
+ this.errorMessage = errorMessage;
+ this.httpCode = aaiHttpCode;
+ }
+
+
+ public SubscriberList getSubscriberList() {
+ return subscriberList;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberData.java b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberData.java
new file mode 100644
index 00000000..1c93d97e
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberData.java
@@ -0,0 +1,7 @@
+package org.onap.vid.aai;
+
+/**
+ * Created by Oren on 7/10/17.
+ */
+public class SubscriberData {
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberFilteredResults.java b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberFilteredResults.java
new file mode 100644
index 00000000..2db98199
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberFilteredResults.java
@@ -0,0 +1,29 @@
+package org.onap.vid.aai;
+
+import org.onap.vid.model.ProxyResponse;
+import org.onap.vid.model.SubscriberList;
+import org.onap.vid.roles.RoleValidator;
+
+/**
+ * Created by Oren on 7/5/17.
+ */
+
+public class SubscriberFilteredResults extends ProxyResponse {
+
+ private SubscriberListWithFilterData subscriberList;
+
+ public SubscriberFilteredResults(RoleValidator roleValidator,SubscriberList subscribers, String errorMessage, int aaiHttpCode) {
+ this.subscriberList = new SubscriberListWithFilterData(subscribers,roleValidator);
+ this.errorMessage = errorMessage;
+ this.httpCode = aaiHttpCode;
+ }
+
+
+ public SubscriberListWithFilterData getSubscriberList() {
+ return subscriberList;
+ }
+
+ public void setSubscriberList(SubscriberListWithFilterData subscriberList) {
+ this.subscriberList = subscriberList;
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberListWithFilterData.java b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberListWithFilterData.java
new file mode 100644
index 00000000..0d4b4b7b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberListWithFilterData.java
@@ -0,0 +1,31 @@
+package org.onap.vid.aai;
+
+import org.onap.vid.model.Subscriber;
+import org.onap.vid.model.SubscriberList;
+import org.onap.vid.roles.RoleValidator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by Oren on 7/5/17.
+ */
+public class SubscriberListWithFilterData {
+
+ public SubscriberListWithFilterData(SubscriberList subscriberList, RoleValidator roleValidator){
+ List<Subscriber> subscribers = subscriberList.customer;
+ List<SubscriberWithFilter> subscribersWithFilter = new ArrayList<>();
+ for (Subscriber subscriber :subscribers){
+ SubscriberWithFilter subscriberWithFilter = new SubscriberWithFilter();
+ subscriberWithFilter.setIsPermitted(roleValidator.isSubscriberPermitted(subscriber.globalCustomerId));
+ subscriberWithFilter.subscriberType = subscriber.subscriberType;
+ subscriberWithFilter.resourceVersion = subscriber.resourceVersion;
+ subscriberWithFilter.subscriberName = subscriber.subscriberName;
+ subscriberWithFilter.globalCustomerId = subscriber.globalCustomerId;
+ subscribersWithFilter.add(subscriberWithFilter);
+ }
+ this.customer = subscribersWithFilter;
+ }
+
+ public List<SubscriberWithFilter> customer;
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberWithFilter.java b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberWithFilter.java
new file mode 100644
index 00000000..aaaa1445
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/SubscriberWithFilter.java
@@ -0,0 +1,21 @@
+package org.onap.vid.aai;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.onap.vid.model.Subscriber;
+
+/**
+ * Created by Oren on 7/5/17.
+ */
+public class SubscriberWithFilter extends Subscriber{
+
+ @JsonProperty("is-permitted")
+ private boolean isPermitted;
+
+ public boolean getIsPermitted() {
+ return isPermitted;
+ }
+
+ public void setIsPermitted(boolean isPermitted) {
+ this.isPermitted = isPermitted;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/exceptions/InvalidAAIResponseException.java b/vid-app-common/src/main/java/org/onap/vid/aai/exceptions/InvalidAAIResponseException.java
new file mode 100644
index 00000000..e6296488
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/exceptions/InvalidAAIResponseException.java
@@ -0,0 +1,7 @@
+package org.onap.vid.aai.exceptions;
+
+/**
+ * Created by Oren on 7/4/17.
+ */
+public class InvalidAAIResponseException extends Exception {
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/exceptions/RoleParsingException.java b/vid-app-common/src/main/java/org/onap/vid/aai/exceptions/RoleParsingException.java
new file mode 100644
index 00000000..1d838a1c
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/exceptions/RoleParsingException.java
@@ -0,0 +1,7 @@
+package org.onap.vid.aai.exceptions;
+
+/**
+ * Created by Oren on 12/16/17.
+ */
+public class RoleParsingException extends Exception {
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetAicZone/AicZones.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetAicZone/AicZones.java
new file mode 100644
index 00000000..c30aaeb8
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetAicZone/AicZones.java
@@ -0,0 +1,10 @@
+package org.onap.vid.aai.model.AaiGetAicZone;
+
+import java.util.List;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class AicZones {
+ @JsonProperty("zone")
+ public List<Zone> zones;
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetAicZone/Zone.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetAicZone/Zone.java
new file mode 100644
index 00000000..89400f20
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetAicZone/Zone.java
@@ -0,0 +1,13 @@
+package org.onap.vid.aai.model.AaiGetAicZone;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Zone {
+ @JsonProperty("zone-id")
+ public String zoneId;
+
+ @JsonProperty("zone-name")
+ public String zoneName;
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentList.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentList.java
new file mode 100644
index 00000000..1f31cfaa
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentList.java
@@ -0,0 +1,30 @@
+package org.onap.vid.aai.model.AaiGetOperationalEnvironments;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.onap.vid.aai.OperationalEnvironment;
+
+import java.util.List;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class OperationalEnvironmentList {
+
+ @JsonProperty("operational-environment")
+ public List<OperationalEnvironment> getOperationalEnvironment() {
+ return operationalEnvironment;
+ }
+
+ @JsonProperty("operational-environment")
+ public void setOperationalEnvironment(List<OperationalEnvironment> operationalEnvironment) {
+ this.operationalEnvironment = operationalEnvironment;
+ }
+
+ public OperationalEnvironmentList() {
+ }
+
+ public OperationalEnvironmentList(List<OperationalEnvironment> operationalEnvironment) {
+ this.operationalEnvironment = operationalEnvironment;
+ }
+
+ private List<OperationalEnvironment> operationalEnvironment;
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetPnfResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetPnfResponse.java
new file mode 100644
index 00000000..cd8cca8f
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetPnfResponse.java
@@ -0,0 +1,42 @@
+package org.onap.vid.aai.model;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.google.common.base.MoreObjects;
+import org.codehaus.jackson.annotate.JsonAnyGetter;
+import org.codehaus.jackson.annotate.JsonAnySetter;
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.annotate.JsonPropertyOrder;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "results"
+})
+public class AaiGetPnfResponse {
+ @JsonProperty("results")
+ public List<PnfResult> results = null;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("results", results)
+ .add("additionalProperties", additionalProperties)
+ .toString();
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetPnfs/Pnf.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetPnfs/Pnf.java
new file mode 100644
index 00000000..00a731a7
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetPnfs/Pnf.java
@@ -0,0 +1,77 @@
+package org.onap.vid.aai.model.AaiGetPnfs;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.onap.vid.aai.model.AaiRelationResponse;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Pnf extends AaiRelationResponse {
+
+ @JsonProperty("pnf-name")
+ public String pnfName;
+ @JsonProperty("pnf-name2")
+ public String pnfName2;
+ @JsonProperty("pnf-name2-source")
+ public String pnfName2Source;
+ @JsonProperty("pnf-id")
+ public String pnfId;
+ @JsonProperty("equip-type")
+ public String equipType;
+ @JsonProperty("equip-vendor")
+ public String equipVendor;
+ @JsonProperty("equip-model")
+ public String equipModel;
+
+ public String getPnfName() {
+ return pnfName;
+ }
+
+ public void setPnfName(String pnfName) {
+ this.pnfName = pnfName;
+ }
+
+ public String getEquipType() {
+ return equipType;
+ }
+
+ public void setEquipType(String equipType) {
+ this.equipType = equipType;
+ }
+
+ public String getEquipVendor() {
+ return equipVendor;
+ }
+
+ public void setEquipVendor(String equipVendor) {
+ this.equipVendor = equipVendor;
+ }
+
+ public String getPnfName2() {
+ return pnfName2;
+ }
+
+ public void setPnfName2(String pnfName2) {
+ this.pnfName2 = pnfName2;
+ }
+
+ public String getPnfId() {
+ return pnfId;
+ }
+
+ public void setPnfId(String pnfId) {
+ this.pnfId = pnfId;
+ }
+
+ public String getEquipModel() {
+ return equipModel;
+ }
+
+ public void setEquipModel(String equipModel) {
+ this.equipModel = equipModel;
+ }
+
+ public String getPnfName2Source() { return pnfName2Source; }
+
+ public void setPnfName2Source(String pnfName2Source) { this.pnfName2Source = pnfName2Source; }
+}
+
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetServicesRequestModel/GetServicesAAIRespone.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetServicesRequestModel/GetServicesAAIRespone.java
new file mode 100644
index 00000000..d3dd7d26
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetServicesRequestModel/GetServicesAAIRespone.java
@@ -0,0 +1,11 @@
+package org.onap.vid.aai.model.AaiGetServicesRequestModel;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.List;
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class GetServicesAAIRespone {
+
+ public List<Service> service;
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetServicesRequestModel/Service.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetServicesRequestModel/Service.java
new file mode 100644
index 00000000..367287e1
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetServicesRequestModel/Service.java
@@ -0,0 +1,21 @@
+package org.onap.vid.aai.model.AaiGetServicesRequestModel;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * Created by Oren on 7/17/17.
+ */
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Service {
+ @JsonProperty("service-id")
+ public String serviceId;
+ @JsonProperty("service-description")
+ public String serviceDescription;
+ @JsonProperty("resource-version")
+ public String resourceVersion;
+ @JsonProperty("is-permitted")
+ public boolean isPermitted;
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetTenatns/GetTenantsResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetTenatns/GetTenantsResponse.java
new file mode 100644
index 00000000..bee92440
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiGetTenatns/GetTenantsResponse.java
@@ -0,0 +1,33 @@
+package org.onap.vid.aai.model.AaiGetTenatns;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * Created by Oren on 7/18/17.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class GetTenantsResponse {
+
+ @JsonProperty("cloudRegionID")
+ public String cloudRegionId;
+
+ @JsonProperty("tenantName")
+ public String tenantName;
+
+ @JsonProperty("tenantID")
+ public String tenantID;
+
+ @JsonProperty("is-permitted")
+ public boolean isPermitted;
+
+ public GetTenantsResponse() {
+ }
+
+ public GetTenantsResponse(String cloudRegionId, String tenantName, String tenantID, boolean isPermitted) {
+ this.cloudRegionId = cloudRegionId;
+ this.tenantName = tenantName;
+ this.tenantID = tenantID;
+ this.isPermitted = isPermitted;
+ }
+} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiRelationResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiRelationResponse.java
new file mode 100644
index 00000000..7bc2e7a2
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/AaiRelationResponse.java
@@ -0,0 +1,45 @@
+package org.onap.vid.aai.model;
+
+
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Created by moriya1 on 08/10/2017.
+ */
+public class AaiRelationResponse {
+
+ @JsonProperty("resource-version")
+ private String resourceVersion;
+ @JsonProperty("relationship-list")
+ private RelationshipList relationshipList;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+
+ @JsonProperty("resource-version")
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ @JsonProperty("resource-version")
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ @JsonProperty("relationship-list")
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ @JsonProperty("relationship-list")
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/GetServiceModelsByDistributionStatusResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/GetServiceModelsByDistributionStatusResponse.java
new file mode 100644
index 00000000..5a6924dc
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/GetServiceModelsByDistributionStatusResponse.java
@@ -0,0 +1,29 @@
+package org.onap.vid.aai.model;
+
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.List;
+
+/**
+ * Created by moriya1 on 15/10/2017.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class GetServiceModelsByDistributionStatusResponse {
+ @JsonProperty("results")
+ private List<Result> results;
+
+
+ @JsonProperty("results")
+ public List<Result> getResults() {
+ return results;
+ }
+
+ @JsonProperty("results")
+ public void setResults(List<Result> results) {
+ this.results = results;
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/LogicalLinkResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/LogicalLinkResponse.java
new file mode 100644
index 00000000..6625957e
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/LogicalLinkResponse.java
@@ -0,0 +1,72 @@
+package org.onap.vid.aai.model;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class LogicalLinkResponse {
+
+ @JsonProperty("link-name")
+ public String linkName;
+
+ @JsonProperty("in-maint")
+ public Boolean inMaint;
+
+ @JsonProperty("link-type")
+ public String linkType;
+
+ @JsonProperty("resource-version")
+ public String resourceVersion;
+
+ @JsonProperty("purpose")
+ public String purpose;
+
+ @JsonProperty("relationship-list")
+ public RelationshipList relationshipList;
+
+ public String getLinkName() {
+ return linkName;
+ }
+
+ public void setLinkName(String linkName) {
+ this.linkName = linkName;
+ }
+
+ public Boolean getInMaint() {
+ return inMaint;
+ }
+
+ public void setInMaint(Boolean inMaint) {
+ this.inMaint = inMaint;
+ }
+
+ public String getLinkType() {
+ return linkType;
+ }
+
+ public void setLinkType(String linkType) {
+ this.linkType = linkType;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public String getPurpose() {
+ return purpose;
+ }
+
+ public void setPurpose(String purpose) {
+ this.purpose = purpose;
+ }
+
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/Model.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/Model.java
new file mode 100644
index 00000000..5f422f68
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/Model.java
@@ -0,0 +1,61 @@
+package org.onap.vid.aai.model;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * Created by moriya1 on 15/10/2017.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Model {
+
+ @JsonProperty("model-invariant-id")
+ private String modelInvariantId;
+ @JsonProperty("model-type")
+ private String modelType;
+ @JsonProperty("resource-version")
+ private String resourceVersion;
+ @JsonProperty("model-vers")
+ private ModelVers modelVers;
+
+ @JsonProperty("model-invariant-id")
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ @JsonProperty("model-invariant-id")
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ @JsonProperty("model-type")
+ public String getModelType() {
+ return modelType;
+ }
+
+ @JsonProperty("model-type")
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ @JsonProperty("resource-version")
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ @JsonProperty("resource-version")
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ @JsonProperty("model-vers")
+ public ModelVers getModelVers() {
+ return modelVers;
+ }
+
+ @JsonProperty("model-vers")
+ public void setModelVers(ModelVers modelVers) {
+ this.modelVers = modelVers;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java
new file mode 100644
index 00000000..f02bbacf
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVer.java
@@ -0,0 +1,84 @@
+package org.onap.vid.aai.model;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ModelVer {
+
+ @JsonProperty("model-version-id")
+ private String modelVersionId;
+ @JsonProperty("model-name")
+ private String modelName;
+ @JsonProperty("model-version")
+ private String modelVersion;
+ @JsonProperty("distribution-status")
+ private String distributionStatus;
+ @JsonProperty("resource-version")
+ private String resourceVersion;
+ @JsonProperty("model-description")
+ private String modelDescription;
+
+
+
+ @JsonProperty("model-version-id")
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ @JsonProperty("model-version-id")
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ @JsonProperty("model-name")
+ public String getModelName() {
+ return modelName;
+ }
+
+ @JsonProperty("model-name")
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ @JsonProperty("model-version")
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ @JsonProperty("model-version")
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ @JsonProperty("distribution-status")
+ public String getDistributionStatus() {
+ return distributionStatus;
+ }
+
+ @JsonProperty("distribution-status")
+ public void setDistributionStatus(String distributionStatus) {
+ this.distributionStatus = distributionStatus;
+ }
+
+ @JsonProperty("resource-version")
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ @JsonProperty("resource-version")
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ @JsonProperty("model-description")
+ public String getModelDescription() {
+ return modelDescription;
+ }
+
+ @JsonProperty("model-description")
+ public void setModelDescription(String modelDescription) {
+ this.modelDescription = modelDescription;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVers.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVers.java
new file mode 100644
index 00000000..f352158f
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/ModelVers.java
@@ -0,0 +1,28 @@
+package org.onap.vid.aai.model;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.List;
+
+/**
+ * Created by moriya1 on 15/10/2017.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class ModelVers {
+
+ @JsonProperty("model-ver")
+ private List<ModelVer> modelVer;
+
+ @JsonProperty("model-ver")
+ public List<ModelVer> getModelVer() {
+ return modelVer;
+ }
+
+ @JsonProperty("model-ver")
+ public void setModelVer(List<ModelVer> modelVer) {
+ this.modelVer = modelVer;
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/OwningEntity.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/OwningEntity.java
new file mode 100644
index 00000000..edf5242d
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/OwningEntity.java
@@ -0,0 +1,36 @@
+package org.onap.vid.aai.model;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * Created by moriya1 on 08/10/2017.
+ */
+public class OwningEntity extends AaiRelationResponse {
+ @JsonProperty("owning-entity-id")
+ private String owningEntityId;
+ @JsonProperty("owning-entity-name")
+ private String owningEntityName;
+
+ @JsonProperty("owning-entity-id")
+ public String getOwningEntityId() {
+ return owningEntityId;
+ }
+
+ @JsonProperty("owning-entity-id")
+ public void setOwningEntityId(String owningEntityId) {
+ this.owningEntityId = owningEntityId;
+ }
+
+ @JsonProperty("owning-entity-name")
+ public String getOwningEntityName() {
+ return owningEntityName;
+ }
+
+ @JsonProperty("owning-entity-name")
+ public void setOwningEntityName(String owningEntityName) {
+ this.owningEntityName = owningEntityName;
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/OwningEntityResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/OwningEntityResponse.java
new file mode 100644
index 00000000..3a571ea1
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/OwningEntityResponse.java
@@ -0,0 +1,28 @@
+package org.onap.vid.aai.model;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.List;
+
+/**
+ * Created by moriya1 on 08/10/2017.
+ */
+public class OwningEntityResponse {
+
+ @JsonProperty("owning-entity")
+ private List<OwningEntity> owningEntity;
+
+
+ @JsonProperty("owning-entity")
+ public List<OwningEntity> getOwningEntity() {
+ return owningEntity;
+ }
+
+ @JsonProperty("owning-entity")
+ public void setOwningEntity(List<OwningEntity> owningEntity) {
+ this.owningEntity = owningEntity;
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/PnfProperties.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/PnfProperties.java
new file mode 100644
index 00000000..3481d263
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/PnfProperties.java
@@ -0,0 +1,51 @@
+package org.onap.vid.aai.model;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({
+ "pnf-name",
+ "equip-type",
+ "equip-vendor",
+ "equip-model",
+ "in-maint",
+ "resource-version"
+})
+public class PnfProperties {
+
+ @JsonProperty("pnf-name")
+ public String pnfName;
+ @JsonProperty("equip-type")
+ public String equipType;
+ @JsonProperty("equip-vendor")
+ public String equipVendor;
+ @JsonProperty("equip-model")
+ public String equipModel;
+ @JsonProperty("in-maint")
+ public Boolean inMaint;
+ @JsonProperty("resource-version")
+ public String resourceVersion;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @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/vid-app-common/src/main/java/org/onap/vid/aai/model/PnfResult.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/PnfResult.java
new file mode 100644
index 00000000..a727d8f3
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/PnfResult.java
@@ -0,0 +1,49 @@
+package org.onap.vid.aai.model;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.onap.vid.RelatedTo;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "id",
+ "node-type",
+ "url",
+ "properties",
+ "related-to"
+})
+public class PnfResult {
+
+ @JsonProperty("id")
+ public String id;
+ @JsonProperty("node-type")
+ public String nodeType;
+ @JsonProperty("url")
+ public String url;
+ @JsonProperty("properties")
+ public PnfProperties properties;
+ @JsonProperty("related-to")
+ public List<RelatedTo> relatedTo;
+
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @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/vid-app-common/src/main/java/org/onap/vid/aai/model/Project.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/Project.java
new file mode 100644
index 00000000..5931bb97
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/Project.java
@@ -0,0 +1,21 @@
+package org.onap.vid.aai.model;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * Created by moriya1 on 08/10/2017.
+ */
+public class Project extends AaiRelationResponse {
+
+ @JsonProperty("project-name")
+ private String projectName;
+
+ @JsonProperty("project-name")
+ public String getProjectName() { return projectName; }
+
+ @JsonProperty("project-name")
+ public void setProjectName(String projectName) { this.projectName = projectName; }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ProjectResponse.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ProjectResponse.java
new file mode 100644
index 00000000..0ca35b0a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/ProjectResponse.java
@@ -0,0 +1,28 @@
+package org.onap.vid.aai.model;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.List;
+
+/**
+ * Created by moriya1 on 08/10/2017.
+ */
+public class ProjectResponse {
+
+ @JsonProperty("project")
+ private List<Project> project;
+
+
+ @JsonProperty("project")
+ public List<Project> getProject() {
+ return project;
+ }
+
+ @JsonProperty("project")
+ public void setProject(List<Project> project) {
+ this.project = project;
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/RelatedToProperty.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/RelatedToProperty.java
new file mode 100644
index 00000000..38003aec
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/RelatedToProperty.java
@@ -0,0 +1,35 @@
+package org.onap.vid.aai.model;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class RelatedToProperty {
+
+ public String getPropertyKey() {
+ return propertyKey;
+ }
+
+
+ public void setPropertyKey(String propertyKey) {
+ this.propertyKey = propertyKey;
+ }
+
+
+ public String getPropertyValue() {
+ return propertyValue;
+ }
+
+
+ public void setPropertyValue(String propertyValue) {
+ this.propertyValue = propertyValue;
+ }
+
+
+ @JsonProperty("property-key")
+ public String propertyKey;
+
+
+ @JsonProperty("property-value")
+ public String propertyValue;
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/Relationship.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/Relationship.java
new file mode 100644
index 00000000..c80d5b6b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/Relationship.java
@@ -0,0 +1,67 @@
+package org.onap.vid.aai.model;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.List;
+
+
+
+
+public class Relationship {
+
+ @JsonProperty("related-to")
+ public String relatedTo;
+
+ @JsonProperty("related-link")
+ public String relatedLink;
+
+ @JsonProperty("relationship-label")
+ public String relationshipLabel;
+
+ @JsonProperty("relationship-data")
+ public List<RelationshipData> relationshipData;
+
+ @JsonProperty("related-to-property")
+ public List<RelatedToProperty> relatedToProperty;
+
+
+ public String getRelatedTo() {
+ return relatedTo;
+ }
+
+ public void setRelatedTo(String relatedTo) {
+ this.relatedTo = relatedTo;
+ }
+
+ public String getRelatedLink() {
+ return relatedLink;
+ }
+
+ public void setRelatedLink(String relatedLink) {
+ this.relatedLink = relatedLink;
+ }
+
+ public List<RelationshipData> getRelationDataList() {
+ return relationshipData;
+ }
+
+ public void setRelationDataList(List<RelationshipData> relationDataList) {
+ this.relationshipData = relationDataList;
+ }
+
+ public List<RelatedToProperty> getRelatedToPropertyList() {
+ return relatedToProperty;
+ }
+
+ public void setRelatedToPropertyList(List<RelatedToProperty> relatedToPropertyList) {
+ this.relatedToProperty = relatedToPropertyList;
+ }
+
+ public String getRelationshipLabel() {
+ return relationshipLabel;
+ }
+
+ public void setRelationshipLabel(String relationshipLabel) {
+ this.relationshipLabel = relationshipLabel;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipData.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipData.java
new file mode 100644
index 00000000..5d2d4091
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipData.java
@@ -0,0 +1,30 @@
+package org.onap.vid.aai.model;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class RelationshipData {
+ @JsonProperty("relationship-key")
+ public String getRelationshipKey() {
+ return relationshipKey;
+ }
+ @JsonProperty("relationship-key")
+ public void setRelationshipKey(String relationshipKey) {
+ this.relationshipKey = relationshipKey;
+ }
+ @JsonProperty("relationship-value")
+ public String getRelationshipValue() {
+ return relationshipValue;
+ }
+ @JsonProperty("relationship-value")
+ public void setRelationshipValue(String relationshipValue) {
+ this.relationshipValue = relationshipValue;
+ }
+
+ @JsonProperty("relationship-key")
+ public String relationshipKey;
+
+ @JsonProperty("relationship-value")
+ public String relationshipValue;
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipList.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipList.java
new file mode 100644
index 00000000..43194fc7
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/RelationshipList.java
@@ -0,0 +1,26 @@
+package org.onap.vid.aai.model;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.List;
+
+
+public class RelationshipList {
+
+ @JsonProperty("relationship")
+ public List<Relationship> getRelationship() {
+ return relationship;
+ }
+
+ @JsonProperty("relationship")
+ public void setRelationship(List<Relationship> relationship) {
+ this.relationship = relationship;
+ }
+
+ @JsonProperty("relationship")
+ public List<Relationship> relationship;
+
+
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/Result.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/Result.java
new file mode 100644
index 00000000..1eb46be7
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/Result.java
@@ -0,0 +1,26 @@
+package org.onap.vid.aai.model;
+
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+/**
+ * Created by moriya1 on 15/10/2017.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Result {
+ @JsonProperty("model")
+ private Model model;
+
+ @JsonProperty("model")
+ public Model getModel() {
+ return model;
+ }
+
+ @JsonProperty("model")
+ public void setModel(Model model) {
+ this.model = model;
+ }
+
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstance.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstance.java
new file mode 100644
index 00000000..381f9bc2
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstance.java
@@ -0,0 +1,26 @@
+package org.onap.vid.aai.model;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class ServiceInstance {
+
+ @JsonProperty("service-instance-id")
+ public String serviceInstanceId;
+
+ @JsonProperty("service-instance-name")
+ public String serviceInstanceName;
+
+ @JsonProperty("persona-model-id")
+ public String personaModelId;
+
+ @JsonProperty("persona-model-version")
+ public String personaModelVersion;
+
+ @JsonProperty("resource-version")
+ public String resourceVersion;
+
+ @JsonProperty("orchestration-status")
+ public String orchestrationStatus;
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstances.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstances.java
new file mode 100644
index 00000000..0fced4c5
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceInstances.java
@@ -0,0 +1,12 @@
+package org.onap.vid.aai.model;
+
+import java.util.List;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class ServiceInstances {
+
+ @JsonProperty("service-instance")
+ public List<ServiceInstance> serviceInstance;
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceProperties.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceProperties.java
new file mode 100644
index 00000000..a76bcf8a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceProperties.java
@@ -0,0 +1,113 @@
+package org.onap.vid.aai.model;
+
+import com.fasterxml.jackson.annotation.*;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.annotate.JsonProperty;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({
+ "service-instance-id",
+ "service-instance-name",
+ "model-invariant-id",
+ "model-version-id",
+ "resource-version",
+ "orchestration-status",
+ "global-customer-id",
+ "subscriber-name",
+ "subscriber-type",
+ "vnf-id",
+ "vnf-name",
+ "vnf-type",
+ "service-id",
+ "prov-status",
+ "in-maint",
+ "is-closed-loop-disabled",
+ "model-customization-id",
+ "nf-type",
+ "nf-function",
+ "nf-role",
+ "nf-naming-code"
+})
+public class ServiceProperties {
+
+ @JsonProperty("service-instance-id")
+ @com.fasterxml.jackson.annotation.JsonProperty("service-instance-id")
+ public String serviceInstanceId;
+ @JsonProperty("service-instance-name")
+ @com.fasterxml.jackson.annotation.JsonProperty("service-instance-name")
+ public String serviceInstanceName;
+ @JsonProperty("model-invariant-id")
+ @com.fasterxml.jackson.annotation.JsonProperty("model-invariant-id")
+ public String modelInvariantId;
+ @JsonProperty("model-version-id")
+ @com.fasterxml.jackson.annotation.JsonProperty("model-version-id")
+ public String modelVersionId;
+ @JsonProperty("resource-version")
+ @com.fasterxml.jackson.annotation.JsonProperty("resource-version")
+ public String resourceVersion;
+ @JsonProperty("orchestration-status")
+ @com.fasterxml.jackson.annotation.JsonProperty("orchestration-status")
+ public String orchestrationStatus;
+ @JsonProperty("global-customer-id")
+ @com.fasterxml.jackson.annotation.JsonProperty("global-customer-id")
+ public String globalCustomerId;
+ @JsonProperty("subscriber-name")
+ @com.fasterxml.jackson.annotation.JsonProperty("subscriber-name")
+ public String subscriberName;
+ @JsonProperty("subscriber-type")
+ @com.fasterxml.jackson.annotation.JsonProperty("subscriber-type")
+ public String subscriberType;
+ @JsonProperty("vnf-id")
+ @com.fasterxml.jackson.annotation.JsonProperty("vnf-id")
+ public String vnfId;
+ @JsonProperty("vnf-name")
+ @com.fasterxml.jackson.annotation.JsonProperty("vnf-name")
+ public String vnfName;
+ @JsonProperty("vnf-type")
+ @com.fasterxml.jackson.annotation.JsonProperty("vnf-type")
+ public String vnfType;
+ @JsonProperty("service-id")
+ @com.fasterxml.jackson.annotation.JsonProperty("service-id")
+ public String serviceId;
+ @JsonProperty("prov-status")
+ @com.fasterxml.jackson.annotation.JsonProperty("prov-status")
+ public String provStatus;
+ @JsonProperty("in-maint")
+ @com.fasterxml.jackson.annotation.JsonProperty("in-maint")
+ public Boolean inMaint;
+ @JsonProperty("is-closed-loop-disabled")
+ @com.fasterxml.jackson.annotation.JsonProperty("is-closed-loop-disabled")
+ public Boolean isClosedLoopDisabled;
+ @JsonProperty("model-customization-id")
+ @com.fasterxml.jackson.annotation.JsonProperty("model-customization-id")
+ public String modelCustomizationId;
+ @JsonProperty("nf-type")
+ @com.fasterxml.jackson.annotation.JsonProperty("nf-type")
+ public String nfType;
+ @JsonProperty("nf-function")
+ @com.fasterxml.jackson.annotation.JsonProperty("nf-function")
+ public String nfFunction;
+ @JsonProperty("nf-role")
+ @com.fasterxml.jackson.annotation.JsonProperty("nf-role")
+ public String nfRole;
+ @JsonProperty("nf-naming-code")
+ @com.fasterxml.jackson.annotation.JsonProperty("nf-naming-code")
+ public String nfNamingCode;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @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/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceRelationships.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceRelationships.java
new file mode 100644
index 00000000..b8abc849
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceRelationships.java
@@ -0,0 +1,102 @@
+package org.onap.vid.aai.model;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class ServiceRelationships {
+
+ @JsonProperty("service-instance-id")
+ public String serviceInstanceId;
+
+ @JsonProperty("service-instance-name")
+ public String serviceInstanceName;
+
+ @JsonProperty("service-type")
+ public String serviceType;
+
+ @JsonProperty("service-role")
+ public String serviceRole;
+
+ @JsonProperty("environment-context")
+ public String environmentContext;
+
+ @JsonProperty("workload-context")
+ public String workloadContext;
+
+ @JsonProperty("model-invariant-id")
+ public String modelInvariantId;
+
+ @JsonProperty("model-version-id")
+ public String modelVersionId;
+
+ @JsonProperty("resource-version")
+ public String resourceVersion;
+
+ @JsonProperty("orchestration-status")
+ public String orchestrationStatus;
+
+ @JsonProperty("relationship-list")
+ public RelationshipList relationshipList;
+
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ public String getOrchestrationStatus() {
+ return orchestrationStatus;
+ }
+
+ public void setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ }
+
+ public RelationshipList getRelationshipList() {
+ return relationshipList;
+ }
+
+ public void setRelationshipList(RelationshipList relationshipList) {
+ this.relationshipList = relationshipList;
+ }
+
+
+
+
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceSubscription.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceSubscription.java
new file mode 100644
index 00000000..91582e81
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/ServiceSubscription.java
@@ -0,0 +1,17 @@
+package org.onap.vid.aai.model;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class ServiceSubscription {
+
+ @JsonProperty("service-type")
+ public String serviceType;
+
+ @JsonProperty("resource-version")
+ public String resourceVersion;
+
+ @JsonProperty("service-instances")
+ public ServiceInstances serviceInstances;
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/Services.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/Services.java
new file mode 100644
index 00000000..3ba4b22d
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/Services.java
@@ -0,0 +1,24 @@
+package org.onap.vid.aai.model;
+
+import java.util.List;
+
+import org.codehaus.jackson.annotate.JsonProperty;
+
+public class Services {
+ @JsonProperty("global-customer-id")
+ public String globalCustomerId;
+
+ @JsonProperty("subscriber-name")
+ public String subscriberName;
+
+ @JsonProperty("subscriber-type")
+ public String subscriberType;
+
+ @JsonProperty("resource-version")
+ public String resourceVersion;
+
+ @JsonProperty("service-subscriptions")
+ public List<ServiceSubscription> serviceSubscriptions;
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/VnfResult.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/VnfResult.java
new file mode 100644
index 00000000..e4f22849
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/VnfResult.java
@@ -0,0 +1,46 @@
+package org.onap.vid.aai.model;
+
+import com.fasterxml.jackson.annotation.*;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.onap.vid.RelatedTo;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "id",
+ "node-type",
+ "url",
+ "properties",
+ "related-to"
+})
+public class VnfResult {
+
+ @JsonProperty("id")
+ public String id;
+ @com.fasterxml.jackson.annotation.JsonProperty("node-type")
+ @JsonProperty("node-type")
+ public String nodeType;
+ @JsonProperty("url")
+ public String url;
+ @JsonProperty("properties")
+ public ServiceProperties properties;
+ @JsonProperty("related-to")
+ @com.fasterxml.jackson.annotation.JsonProperty("related-to")
+ public List<RelatedTo> relatedTo = null;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @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/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIProperties.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIProperties.java
new file mode 100644
index 00000000..254584ca
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIProperties.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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.vid.aai.util;
+
+
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+/**
+ * The Class AAIProperties.
+ */
+public class AAIProperties extends SystemProperties {
+
+ /** The Constant AAI_SERVER_URL_BASE. */
+ //VID Specific
+ public static final String AAI_SERVER_URL_BASE = "aai.server.url.base";
+
+ /** The Constant AAI_SERVER_URL. */
+ public static final String AAI_SERVER_URL = "aai.server.url";
+
+ /** The Constant AAI_OLDSERVER_URL_BASE. */
+ public static final String AAI_OLDSERVER_URL_BASE = "aai.oldserver.url.base";
+
+ /** The Constant AAI_OLDSERVER_URL. */
+ public static final String AAI_OLDSERVER_URL = "aai.oldserver.url";
+
+ /** The Constant AAI_TRUSTSTORE_FILENAME. */
+ public static final String AAI_TRUSTSTORE_FILENAME = "aai.truststore.filename";
+
+ /** The Constant AAI_TRUSTSTORE_PASSWD_X. */
+ public static final String AAI_TRUSTSTORE_PASSWD_X = "aai.truststore.passwd.x";
+
+ /** The Constant AAI_KEYSTORE_FILENAME. */
+ public static final String AAI_KEYSTORE_FILENAME = "aai.keystore.filename";
+
+ /** The Constant AAI_KEYSTORE_PASSWD_X. */
+ public static final String AAI_KEYSTORE_PASSWD_X = "aai.keystore.passwd.x";
+
+ /** The Constant AAI_VID_USERNAME. */
+ public static final String AAI_VID_USERNAME = "aai.vid.username";
+
+ /** The Constant AAI_VID_PASSWD_X. */
+ public static final String AAI_VID_PASSWD_X = "aai.vid.passwd.x";
+
+ /** The Constant FILESEPARTOR. */
+ public static final String FILESEPARTOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
+
+ /** The Constant AAI_USE_CLIENT_CERT */
+ public static final String AAI_USE_CLIENT_CERT = "aai.use.client.cert";
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java
new file mode 100644
index 00000000..13b7d30b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java
@@ -0,0 +1,373 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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.vid.aai.util;
+
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.security.KeyManagementException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Base64;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import com.att.eelf.configuration.EELFLogger;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.eclipse.jetty.util.security.Password;
+import org.onap.vid.utils.Logging;
+import org.springframework.http.HttpMethod;
+import static org.onap.vid.utils.Logging.getHttpServletRequest;
+import static org.onap.vid.utils.Logging.requestIdHeaderKey;
+
+
+/**
+ * The Class AAIRestInterface.
+ */
+public class AAIRestInterface {
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AAIRestInterface.class);
+
+ final private EELFLogger outgoingRequestsLogger = Logging.getRequestsLogger("aai");
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The client. */
+ private static Client client = null;
+
+ /** The rest srvr base URL. */
+ private String restSrvrBaseURL;
+
+ /** The certificate path. */
+ public String certificatePath = "";
+
+ private String START_STRING = " start";
+
+ private String TRANSACTION_ID_HEADER = "X-TransactionId";
+ private String FROM_APP_ID_HEADER = "X-FromAppId";
+ private String SUCCESSFUL_API_MESSAGE=" REST api POST was successful!";
+ private String URL_DECLERATION = ", url=";
+
+
+
+
+
+
+ /**
+ * Instantiates a new AAI rest interface.
+ *
+ * @param certPath the cert path
+ */
+ public AAIRestInterface(String certPath)
+ {
+ certificatePath = certPath;
+ }
+
+ /**
+ * Encode URL.
+ *
+ * @param nodeKey the node key
+ * @return the string
+ * @throws UnsupportedEncodingException the unsupported encoding exception
+ */
+ public String encodeURL (String nodeKey) throws UnsupportedEncodingException {
+ return URLEncoder.encode(nodeKey, "UTF-8").replaceAll("\\+", "%20");
+ }
+
+ /**
+ * Inits the rest client.
+ */
+ private void initRestClient()
+ {
+ String methodName = "initRestClient";
+
+ if (client == null) {
+ try {
+ client = HttpsAuthClient.getClient(certificatePath);
+ }
+ catch (KeyManagementException e){
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== KeyManagementException in " + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== KeyManagementException in " + methodName + e.toString());
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== Exception in REST call to DB in initRestClient" + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== Exception in REST call to DB : " + e.toString());
+ }
+ }
+ }
+
+ /**
+ * Sets the rest srvr base URL.
+ *
+ * @param baseURL the base URL
+ */
+ public void SetRestSrvrBaseURL(String baseURL)
+ {
+ if (baseURL == null)
+ {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== REST Server base URL cannot be null.");
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== REST Server base URL cannot be null.");
+ }
+
+ restSrvrBaseURL = baseURL;
+ }
+
+ /**
+ * Gets the rest srvr base URL.
+ *
+ * @return the rest srvr base URL
+ */
+ public String getRestSrvrBaseURL()
+ {
+ return restSrvrBaseURL;
+ }
+
+
+ /**
+ * Rest get.
+ *
+ * @param fromAppId the from app id
+ * @param transId the trans id
+ * @param requestUri the request uri
+ * @param xml the xml
+ * @return the string
+ * @throws UnsupportedEncodingException
+ */
+ public Response RestGet(String fromAppId, String transId, String requestUri, boolean xml) throws UnsupportedEncodingException {
+ String methodName = "RestGet";
+
+ String responseType = MediaType.APPLICATION_JSON;
+ if (xml)
+ responseType = MediaType.APPLICATION_XML;
+
+ initRestClient();
+
+ String clientCert = SystemProperties.getProperty(AAIProperties.AAI_USE_CLIENT_CERT);
+
+ boolean useClientCert = false;
+ if (clientCert != null &&
+ SystemProperties.getProperty(AAIProperties.AAI_USE_CLIENT_CERT).equalsIgnoreCase("true")) {
+ useClientCert = true;
+ }
+ String url = "";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START_STRING);
+
+ url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL) + requestUri;
+
+
+ logger.debug(dateFormat.format(new Date()) + "<== " + url + " for the get REST API");
+ Logging.logRequest(outgoingRequestsLogger, HttpMethod.GET, url);
+
+ final Response cres;
+ if (useClientCert == true) {
+ cres = client.target(url)
+ .request()
+ .accept(responseType)
+ .header(TRANSACTION_ID_HEADER, transId)
+ .header(FROM_APP_ID_HEADER, fromAppId)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .header(requestIdHeaderKey, getHttpServletRequest().getHeader(requestIdHeaderKey))
+ .get();
+ } else {
+
+ String vidUsername = SystemProperties.getProperty(AAIProperties.AAI_VID_USERNAME);
+ String vidPassword = Password.deobfuscate(SystemProperties.getProperty(AAIProperties.AAI_VID_PASSWD_X));
+ String encodeThis = vidUsername + ":" + vidPassword;
+
+ cres = client.target(url)
+ .request()
+ .accept(responseType)
+ .header(TRANSACTION_ID_HEADER, transId)
+ .header(FROM_APP_ID_HEADER, fromAppId)
+ .header("Content-Type", "application/json")
+ .header("Authorization", "Basic " + Base64.getEncoder().encodeToString(encodeThis.getBytes("utf-8")))
+ .header(requestIdHeaderKey, getHttpServletRequest().getHeader(requestIdHeaderKey))
+ .get();
+ }
+ Logging.logResponse(outgoingRequestsLogger, HttpMethod.GET, url, cres);
+// String r = cres.readEntity(String.class);
+ if (cres.getStatus() == 200) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + SUCCESSFUL_API_MESSAGE);
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + SUCCESSFUL_API_MESSAGE);
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +" with status="+cres.getStatus()+URL_DECLERATION+url);
+ }
+ return cres;
+// logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +" resp=" + r );
+// return r;
+ }
+
+
+ /**
+ * Delete.
+ *
+ * @param sourceID the source ID
+ * @param transId the trans id
+ * @param path the path
+ * @return true, if successful
+ */
+ public boolean Delete(String sourceID, String transId, String path) {
+ String methodName = "Delete";
+ String url="";
+ transId += ":" + UUID.randomUUID().toString();
+ logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START_STRING);
+
+ initRestClient();
+ String request = "{}";
+ url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL) + path;
+ Logging.logRequest(outgoingRequestsLogger, HttpMethod.DELETE, url);
+ final Response cres = client.target(url)
+ .request()
+ .accept(MediaType.APPLICATION_JSON)
+ .header(TRANSACTION_ID_HEADER, transId)
+ .header(FROM_APP_ID_HEADER, sourceID)
+ .header(requestIdHeaderKey, getHttpServletRequest().getHeader(requestIdHeaderKey))
+ //.entity(request)
+ .delete();
+ Logging.logResponse(outgoingRequestsLogger, HttpMethod.DELETE, url, cres);
+ if (cres.getStatus() == 404) { // resource not found
+ String msg = "Resource does not exist...: " + cres.getStatus()
+ + ":" + cres.readEntity(String.class);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + msg);
+ return false;
+ } else if (cres.getStatus() == 200 || cres.getStatus() == 204){
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted");
+ return true;
+ } else {
+ String msg = "Deleting Resource failed: " + cres.getStatus()
+ + ":" + cres.readEntity(String.class);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + msg);
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Rest put.
+ *
+ * @param fromAppId the from app id
+ * @param transId the trans id
+ * @param path the path
+ * @param payload the payload
+ * @param xml the xml
+ * @return the string
+ */
+ public Response RestPut(String fromAppId, String transId, String path, String payload, boolean xml) {
+ String methodName = "RestPut";
+ String url="";
+ transId = UUID.randomUUID().toString();
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START_STRING);
+
+ try {
+
+ String responseType = MediaType.APPLICATION_JSON;
+ if (xml)
+ responseType = "application/xml";
+
+ initRestClient();
+
+ url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL) + path;
+ Logging.logRequest(outgoingRequestsLogger, HttpMethod.PUT, url, payload);
+ final Response cres = client.target(url)
+ .request()
+ .accept(responseType)
+ .header(TRANSACTION_ID_HEADER, transId)
+ .header(FROM_APP_ID_HEADER, fromAppId)
+ .header(requestIdHeaderKey, getHttpServletRequest().getHeader(requestIdHeaderKey))
+ .put(Entity.entity(payload, MediaType.APPLICATION_JSON));
+ Logging.logResponse(outgoingRequestsLogger, HttpMethod.PUT, url, cres);
+
+ if (cres.getStatus() == 200 && cres.getStatus() <= 299) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + URL_DECLERATION);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + URL_DECLERATION);
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +" with status="+cres.getStatus()+URL_DECLERATION+url);
+ }
+ return cres;
+ } catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + URL_DECLERATION+url+ ", Exception: " + e.toString());
+ }
+ return null;
+ }
+
+
+
+ /**
+ * Rest post.
+ *
+ * @param fromAppId the from app id
+ * @param transId the trans id
+ * @param path the path
+ * @param payload the payload
+ * @param xml the xml
+ * @return the string
+ */
+ public Response RestPost(String fromAppId, String transId, String path, String payload, boolean xml) {
+ String methodName = "RestPost";
+ String url="";
+ transId = UUID.randomUUID().toString();
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START_STRING);
+
+ try {
+
+ String responseType = MediaType.APPLICATION_JSON;
+ if (xml)
+ responseType = "application/xml";
+
+ initRestClient();
+
+ url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL_BASE) + path;
+ String vidUsername = SystemProperties.getProperty(AAIProperties.AAI_VID_USERNAME);
+ String vidPassword = Password.deobfuscate(SystemProperties.getProperty(AAIProperties.AAI_VID_PASSWD_X));
+ String encodeThis = vidUsername + ":" + vidPassword;
+
+ Logging.logRequest(outgoingRequestsLogger, HttpMethod.POST, url, payload);
+ final Response cres = client.target(url)
+ .request()
+ .accept(responseType)
+ .header(TRANSACTION_ID_HEADER, transId)
+ .header(FROM_APP_ID_HEADER, fromAppId)
+ .header("Authorization", "Basic " + Base64.getEncoder().encodeToString(encodeThis.getBytes("utf-8")))
+ .header(requestIdHeaderKey, getHttpServletRequest().getHeader(requestIdHeaderKey))
+ .post(Entity.entity(payload, MediaType.APPLICATION_JSON));
+ Logging.logResponse(outgoingRequestsLogger, HttpMethod.POST, url, cres);
+
+ if (cres.getStatus() == 200 && cres.getStatus() <= 299) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + URL_DECLERATION);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + URL_DECLERATION);
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " with status="+cres.getStatus()+URL_DECLERATION+url);
+ }
+ return cres;
+ } catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + URL_DECLERATION+url+ ", Exception: " + e.toString());
+ }
+ return null;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/util/CustomJacksonJaxBJsonProvider.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/CustomJacksonJaxBJsonProvider.java
new file mode 100644
index 00000000..996341a9
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/CustomJacksonJaxBJsonProvider.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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.vid.aai.util;
+
+
+import javax.ws.rs.ext.Provider;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
+
+/**
+ * The Class CustomJacksonJaxBJsonProvider.
+ */
+@Provider
+public class CustomJacksonJaxBJsonProvider extends JacksonJaxbJsonProvider {
+
+ /** The common mapper. */
+ private static ObjectMapper commonMapper = null;
+
+ /**
+ * Instantiates a new custom jackson jax B json provider.
+ */
+ public CustomJacksonJaxBJsonProvider() {
+ if (commonMapper == null) {
+ ObjectMapper mapper = new ObjectMapper();
+
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+
+ mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+ mapper.configure(SerializationFeature.INDENT_OUTPUT, false);
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
+
+ mapper.registerModule(new JaxbAnnotationModule());
+
+ commonMapper = mapper;
+ }
+ super.setMapper(commonMapper);
+ }
+
+ /**
+ * Gets the mapper.
+ *
+ * @return the mapper
+ */
+ public ObjectMapper getMapper() {
+ return commonMapper;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsAuthClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsAuthClient.java
new file mode 100644
index 00000000..0cf32cd4
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsAuthClient.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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.vid.aai.util;
+
+
+import java.io.FileInputStream;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+
+import org.eclipse.jetty.util.security.Password;
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.client.HttpUrlConnectorProvider;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+/**
+ * The Class HttpsAuthClient.
+ */
+public class HttpsAuthClient{
+ /** The logger. */
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HttpsAuthClient.class);
+
+ /**
+ * Gets the client.
+ *
+ * @param certFilePath the cert file path
+ * @return the client
+ * @throws KeyManagementException the key management exception
+ */
+ public static Client getClient(String certFilePath) throws KeyManagementException {
+
+ ClientConfig config = new ClientConfig();
+ //config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
+ //config.getClasses().add(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
+
+ try {
+
+ config.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, Boolean.TRUE );
+
+ config.connectorProvider(new HttpUrlConnectorProvider().useSetMethodWorkaround());
+ String truststore_path = certFilePath + org.onap.vid.aai.util.AAIProperties.FILESEPARTOR + SystemProperties.getProperty(org.onap.vid.aai.util.AAIProperties.AAI_TRUSTSTORE_FILENAME);
+ String truststore_password = SystemProperties.getProperty(org.onap.vid.aai.util.AAIProperties.AAI_TRUSTSTORE_PASSWD_X);
+ String decrypted_truststore_password = Password.deobfuscate(truststore_password);
+
+ boolean useClientCert = false;
+
+ String keystore_path = certFilePath + org.onap.vid.aai.util.AAIProperties.FILESEPARTOR + SystemProperties.getProperty(org.onap.vid.aai.util.AAIProperties.AAI_KEYSTORE_FILENAME);
+ String keystore_password = SystemProperties.getProperty(org.onap.vid.aai.util.AAIProperties.AAI_KEYSTORE_PASSWD_X);
+ String decrypted_keystore_password = Password.deobfuscate(keystore_password);
+
+ String clientCert = SystemProperties.getProperty(org.onap.vid.aai.util.AAIProperties.AAI_USE_CLIENT_CERT);
+
+ if (clientCert != null &&
+ SystemProperties.getProperty(org.onap.vid.aai.util.AAIProperties.AAI_USE_CLIENT_CERT).equalsIgnoreCase("true")) {
+ useClientCert = true;
+ }
+
+ System.setProperty("javax.net.ssl.trustStore", truststore_path);
+ System.setProperty("javax.net.ssl.trustStorePassword", decrypted_truststore_password);
+ HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier(){
+ public boolean verify(String string,SSLSession ssls) {
+ return true;
+ }
+ });
+
+ final SSLContext ctx = SSLContext.getInstance("TLS");
+
+ KeyManagerFactory kmf = null;
+ if (useClientCert) {
+
+ try {
+ kmf = KeyManagerFactory.getInstance("SunX509");
+ FileInputStream fin = new FileInputStream(keystore_path);
+ KeyStore ks = KeyStore.getInstance("PKCS12");
+ char[] pwd = decrypted_keystore_password.toCharArray();
+ ks.load(fin, pwd);
+ kmf.init(ks, pwd);
+ } catch (Exception e) {
+ //System.out.println("Error setting up kmf: exiting");
+ logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up kmf: exiting");
+ e.printStackTrace();
+ return null;
+ }
+ ctx.init(kmf.getKeyManagers(), null, null);
+
+ return ClientBuilder.newBuilder()
+ .sslContext(ctx)
+ .hostnameVerifier(new HostnameVerifier() {
+ @Override
+ public boolean verify( String s, SSLSession sslSession ) {
+ return true;
+ }
+ }).withConfig(config)
+ .build()
+ .register(org.onap.vid.aai.util.CustomJacksonJaxBJsonProvider.class);
+ } else {
+ return ClientBuilder.newBuilder()
+ .hostnameVerifier(new HostnameVerifier() {
+ @Override
+ public boolean verify( String s, SSLSession sslSession ) {
+ return true;
+ }
+ }).withConfig(config)
+ .build()
+ .register(org.onap.vid.aai.util.CustomJacksonJaxBJsonProvider.class);
+ }
+ } catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up config: exiting");
+ //System.out.println("Error setting up config: exiting");
+ e.printStackTrace();
+ System.exit(1);
+ return null;
+ }
+ }
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsComponentsClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsComponentsClient.java
new file mode 100644
index 00000000..54d7f468
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/HttpsComponentsClient.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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.vid.aai.util;
+
+import java.io.FileInputStream;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+
+import javax.net.ssl.SSLContext;
+
+import org.apache.http.conn.ssl.SSLContextBuilder;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.HttpClients;
+import org.eclipse.jetty.util.security.Password;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+
+/**
+ * The Class HttpsComponentsClient.
+ */
+public class HttpsComponentsClient{
+
+ /**
+ * Gets the client.
+ *
+ * @param certFilePath the cert file path
+ * @return the client
+ * @throws KeyManagementException the key management exception
+ */
+ public static CloseableHttpClient getClient(String certFilePath) throws Exception {
+ CloseableHttpClient httpclient = null;
+ try {
+
+ String truststore_path = certFilePath + AAIProperties.FILESEPARTOR + SystemProperties.getProperty(AAIProperties.AAI_TRUSTSTORE_FILENAME);
+ String truststore_password = SystemProperties.getProperty(AAIProperties.AAI_TRUSTSTORE_PASSWD_X);
+ String decrypted_truststore_password = Password.deobfuscate(truststore_password);
+ String keystore_path = certFilePath + AAIProperties.FILESEPARTOR + SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_FILENAME);
+ String keystore_password = SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_PASSWD_X);
+ String decrypted_keystore_password = Password.deobfuscate(keystore_password);
+
+ SSLContextBuilder sslContextB = new SSLContextBuilder();
+
+ KeyStore ks = KeyStore.getInstance("PKCS12");
+ FileInputStream fin = new FileInputStream(keystore_path);
+ char[] pwd = decrypted_keystore_password.toCharArray();
+ ks.load(fin, pwd);
+
+ sslContextB.loadKeyMaterial(ks, pwd);
+
+ KeyStore ts = KeyStore.getInstance("JKS");
+ FileInputStream fin1 = new FileInputStream(truststore_path);
+ char[] pwd1 = decrypted_truststore_password.toCharArray();
+ ts.load(fin1, pwd1);
+
+ sslContextB.loadTrustMaterial(ts);
+ sslContextB.loadKeyMaterial(ks, pwd);
+ sslContextB.useTLS();
+
+ SSLContext sslcontext = sslContextB.build();
+
+ SSLConnectionSocketFactory sslFactory = new SSLConnectionSocketFactory(
+ sslcontext,
+ new String[] { "TLSv1.1", "TLSv1.2" },
+ null,
+ SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER );
+
+ httpclient = HttpClients.custom()
+ .setSSLSocketFactory(sslFactory)
+ .build();
+
+
+ } catch (Exception e) {
+ throw e;
+ }
+ return httpclient;
+ }
+
+
+
+}
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/util/JettyObfuscationConversionCommandLineUtil.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/JettyObfuscationConversionCommandLineUtil.java
new file mode 100644
index 00000000..8a3ba88f
--- /dev/null
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/JettyObfuscationConversionCommandLineUtil.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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.vid.aai.util;
+
+
+import org.apache.commons.cli.BasicParser;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.eclipse.jetty.util.security.Password;
+
+
+public class JettyObfuscationConversionCommandLineUtil {
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
+ public static void main(String[] args){
+ Options options = new Options();
+ options.addOption("e", true, "obfuscate the given string");
+ options.addOption("d", true, "deobfuscate the given string");
+
+ CommandLineParser parser = new BasicParser();
+
+ try {
+ CommandLine cmd = parser.parse(options, args);
+ String toProcess = null;
+
+ if (cmd.hasOption("e")){
+ toProcess = cmd.getOptionValue("e");
+ String encoded = Password.obfuscate(toProcess);
+ System.out.println(encoded);
+ } else if (cmd.hasOption("d")) {
+ toProcess = cmd.getOptionValue("d");
+ String decoded_str = Password.deobfuscate(toProcess);
+ System.out.println(decoded_str);
+ } else {
+ usage();
+ }
+ } catch (ParseException e) {
+ System.out.println("failed to parse input");
+ System.out.println(e.toString());
+ usage();
+ } catch (Exception e) {
+ System.out.println("exception:" + e.toString());
+ }
+ }
+
+ /**
+ * Usage.
+ */
+ private static void usage(){
+ System.out.println("usage:");;
+ System.out.println("-e [string] to obfuscate");
+ System.out.println("-d [string] to deobfuscate");
+ System.out.println("-h help");
+ }
+}