OSAM infra seed code - merge with osam-core side-by-side - fixed warnings in onap-enabler POMs

Change-Id: I0cd9ea39d4b7c1dc088ab0ecd6fb787c7f490e5e
Signed-off-by: Aharoni, Pavel (pa0916) <pavel.aharoni@intl.att.com>
diff --git a/onap-enabler-be/src/main/java/org/onap/osam/RelatedTo.java b/onap-enabler-be/src/main/java/org/onap/osam/RelatedTo.java
new file mode 100644
index 0000000..21fb8b8
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/RelatedTo.java
@@ -0,0 +1,59 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam;

+

+import com.fasterxml.jackson.annotation.*;

+import java.util.HashMap;

+import java.util.Map;

+

+@JsonInclude(JsonInclude.Include.NON_NULL)

+@JsonPropertyOrder({

+        "id",

+        "node-type",

+        "relationship-label",

+        "url"

+})

+public class RelatedTo {

+

+    @JsonProperty("id")

+    public String id;

+    @JsonProperty("node-type")

+    public String nodeType;

+    @JsonProperty("relationship-label")

+    public String relationshipLabel;

+    @JsonProperty("url")

+    public String url;

+    @JsonIgnore

+    private Map<String, Object> additionalProperties = new HashMap<>();

+

+    @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/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiClient.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiClient.java
new file mode 100644
index 0000000..e04301b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiClient.java
@@ -0,0 +1,652 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+import org.apache.commons.lang3.StringUtils;

+import org.apache.http.HttpStatus;

+import org.apache.http.client.utils.URIBuilder;

+import org.json.simple.JSONArray;

+import org.json.simple.JSONObject;

+import org.json.simple.parser.JSONParser;

+import org.onap.osam.aai.model.AaiGetAicZone.AicZones;

+import org.onap.osam.aai.model.AaiGetInstanceGroupsByCloudRegion;

+import org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.AaiGetNetworkCollectionDetails;

+import org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.AaiGetNetworkCollectionDetailsHelper;

+import org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.AaiGetRelatedInstanceGroupsByVnfId;

+import org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.InstanceGroup;

+import org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.Network;

+import org.onap.osam.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;

+import org.onap.osam.aai.model.AaiGetPnfResponse;

+import org.onap.osam.aai.model.AaiGetPnfs.Pnf;

+import org.onap.osam.aai.model.AaiGetPortMirroringSourcePorts;

+import org.onap.osam.aai.model.AaiGetServicesRequestModel.GetServicesAAIRespone;

+import org.onap.osam.aai.model.AaiGetTenatns.GetTenantsResponse;

+import org.onap.osam.aai.model.AaiNodeQueryResponse;

+import org.onap.osam.aai.model.GetServiceModelsByDistributionStatusResponse;

+import org.onap.osam.aai.model.LogicalLinkResponse;

+import org.onap.osam.aai.model.OwningEntityResponse;

+import org.onap.osam.aai.model.PortDetailsTranslator;

+import org.onap.osam.aai.model.ProjectResponse;

+import org.onap.osam.aai.model.Relationship;

+import org.onap.osam.aai.model.RelationshipData;

+import org.onap.osam.aai.model.RelationshipList;

+import org.onap.osam.aai.model.ResourceType;

+import org.onap.osam.aai.model.ServiceRelationships;

+import org.onap.osam.aai.util.AAIRestInterface;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.osam.model.SubscriberList;

+import org.onap.osam.model.probes.ErrorMetadata;

+import org.onap.osam.model.probes.ExternalComponentStatus;

+import org.onap.osam.model.probes.HttpRequestMetadata;

+import org.onap.osam.utils.Logging;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.springframework.web.util.UriUtils;

+

+import javax.inject.Inject;

+import javax.ws.rs.WebApplicationException;

+import javax.ws.rs.core.Response;

+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.LinkedHashMap;

+import java.util.List;

+import java.util.UUID;

+

+import static java.util.Collections.emptyList;

+import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;

+

+public class AaiClient implements AaiClientInterface {

+

+

+    public static final String QUERY_FORMAT_RESOURCE = "query?format=resource";

+    public static final String SERVICE_SUBSCRIPTIONS_PATH = "/service-subscriptions/service-subscription/";

+    public static final String MODEL_INVARIANT_ID = "&model-invariant-id=";

+    public static final String QUERY_FORMAT_SIMPLE = "query?format=simple";

+    public static final String BUSINESS_CUSTOMER = "/business/customers/customer/";

+    public static final String SERVICE_INSTANCE = "/service-instances/service-instance/";

+    public static final String BUSINESS_CUSTOMERS_CUSTOMER = "business/customers/customer/";

+

+    protected String fromAppId = "VidAaiController";

+

+    private PortDetailsTranslator portDetailsTranslator;

+

+    private final AAIRestInterface restController;

+

+    EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AaiClient.class);

+

+    /**

+     * The Constant dateFormat.

+     */

+    static final DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+

+    static final String GET_SERVICE_MODELS_RESPONSE_BODY = "{\"start\" : \"service-design-and-creation/models/\", \"query\" : \"query/serviceModels-byDistributionStatus?distributionStatus=DISTRIBUTION_COMPLETE_OK\"}";

+

+    @Inject

+    public AaiClient(AAIRestInterface restController, PortDetailsTranslator portDetailsTranslator) {

+        this.restController = restController;

+        this.portDetailsTranslator = portDetailsTranslator;

+    }

+

+

+    private static String checkForNull(String local) {

+        if (local != null)

+            return local;

+        else

+            return "";

+

+    }

+

+    @Override

+    public AaiResponse getServicesByOwningEntityId(List<String> owningEntityIds){

+        Response resp = doAaiGet(getUrlFromLIst("business/owning-entities?", "owning-entity-id=", owningEntityIds), false);

+        return processAaiResponse(resp, OwningEntityResponse.class, null);

+    }

+

+    @Override

+    public AaiResponse getServicesByProjectNames(List<String> projectNames){

+        Response resp = doAaiGet(getUrlFromLIst("business/projects?", "project-name=",  projectNames), false);

+        return processAaiResponse(resp, ProjectResponse.class, null);

+    }

+

+    @Override

+    public AaiResponse getServiceModelsByDistributionStatus() {

+        Response resp = doAaiPut(QUERY_FORMAT_RESOURCE, GET_SERVICE_MODELS_RESPONSE_BODY, false);

+        return processAaiResponse(resp, GetServiceModelsByDistributionStatusResponse.class, null);

+    }

+

+    @Override

+    public AaiResponse getNetworkCollectionDetails(String serviceInstanceId) {

+        Response resp = doAaiPut(QUERY_FORMAT_RESOURCE, "{\"start\": [\"nodes/service-instances/service-instance/" + serviceInstanceId + "\"],\"query\": \"query/network-collection-ByServiceInstance\"}\n", false);

+        AaiResponse<AaiGetNetworkCollectionDetailsHelper> aaiResponse = processAaiResponse(resp, AaiGetNetworkCollectionDetailsHelper.class, null);

+        return getNetworkCollectionDetailsResponse(aaiResponse);

+    }

+

+    @Override

+    public AaiResponse getInstanceGroupsByCloudRegion(String cloudOwner, String cloudRegionId, String networkFunction) {

+        Response resp = doAaiPut(QUERY_FORMAT_RESOURCE,

+                "{\"start\": [\"cloud-infrastructure/cloud-regions/cloud-region/" + cloudOwner + "/" + cloudRegionId + "\"]," +

+                        "\"query\": \"query/instance-group-byCloudRegion?type=L3-NETWORK&role=SUB-INTERFACE&function=" + networkFunction + "\"}\n", false);

+        return processAaiResponse(resp, AaiGetInstanceGroupsByCloudRegion.class, null);

+    }

+

+    private AaiResponse getNetworkCollectionDetailsResponse(AaiResponse<AaiGetNetworkCollectionDetailsHelper> aaiResponse){

+        if(aaiResponse.getHttpCode() == 200) {

+            com.fasterxml.jackson.databind.ObjectMapper om = new com.fasterxml.jackson.databind.ObjectMapper();

+            AaiGetNetworkCollectionDetails aaiGetNetworkCollectionDetails = new AaiGetNetworkCollectionDetails();

+            try {

+                for (int i = 0; i < aaiResponse.getT().getResults().size(); i++) {

+                    LinkedHashMap<String, Object> temp = ((LinkedHashMap) aaiResponse.getT().getResults().get(i));

+                    if (temp.get("service-instance") != null)

+                        aaiGetNetworkCollectionDetails.getResults().setServiceInstance(om.readValue(om.writeValueAsString(temp.get("service-instance")), org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.ServiceInstance.class));

+                    else if (temp.get("collection") != null)

+                        aaiGetNetworkCollectionDetails.getResults().setCollection(om.readValue(om.writeValueAsString(temp.get("collection")), org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.Collection.class));

+                    else if (temp.get("instance-group") != null)

+                        aaiGetNetworkCollectionDetails.getResults().setInstanceGroup(om.readValue(om.writeValueAsString(temp.get("instance-group")), InstanceGroup.class));

+                    else if (temp.get("l3-network") != null)

+                        aaiGetNetworkCollectionDetails.getResults().getNetworks().add(om.readValue(om.writeValueAsString(temp.get("l3-network")), Network.class));

+                }

+                return new AaiResponse(aaiGetNetworkCollectionDetails, null, HttpStatus.SC_OK);

+            }

+            catch (com.fasterxml.jackson.databind.JsonMappingException e) {

+                return new AaiResponse(e.getCause(), "AAI response parsing Error" , aaiResponse.getHttpCode());

+            }

+            catch (Exception e) {

+                return new AaiResponse(e.getCause(), "Got " + aaiResponse.getHttpCode() + " from a&ai" , aaiResponse.getHttpCode());

+            }

+        }

+        return aaiResponse;

+    }

+

+    @Override

+    public AaiResponse getPNFData(String globalCustomerId, String serviceType, String modelVersionId, String modelInvariantId, String cloudRegion, String equipVendor, String equipModel) {

+        String siQuery = BUSINESS_CUSTOMER + globalCustomerId + SERVICE_SUBSCRIPTIONS_PATH + 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(QUERY_FORMAT_SIMPLE, payload, false);

+        return processAaiResponse(resp, AaiGetPnfResponse.class, null);

+    }

+

+

+    @Override

+    public AaiResponse<Pnf> getSpecificPnf(String pnfId) {

+        Response resp = doAaiGet("network/pnfs/pnf/"+pnfId, false);

+        return processAaiResponse(resp, Pnf.class, null);

+    }

+

+

+    public AaiResponse getInstanceGroupsByVnfInstanceId(String vnfInstanceId){

+        Response resp = doAaiGet("network/generic-vnfs/generic-vnf/" + vnfInstanceId + "?depth=0", false);

+        return processAaiResponse(resp, AaiGetRelatedInstanceGroupsByVnfId.class , null);

+    }

+

+

+    @Override

+    public List<PortDetailsTranslator.PortDetails> getPortMirroringSourcePorts(String configurationID) {

+        String payload = "{\"start\":\"/network/configurations/configuration/" + configurationID + "\",\"query\":\"query/pserver-fromConfiguration\"}";

+        Response resp = doAaiPut(QUERY_FORMAT_SIMPLE, payload, false);

+        resp.bufferEntity(); // avoid later "Entity input stream has already been closed" problems

+        String rawPayload = resp.readEntity(String.class);

+        AaiResponse<AaiGetPortMirroringSourcePorts> aaiResponse = processAaiResponse(resp, AaiGetPortMirroringSourcePorts.class, rawPayload);

+        return portDetailsTranslator.extractPortDetails(aaiResponse, rawPayload);

+    }

+

+

+

+    public AaiResponse getServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId) {

+        String getServiceInstancePath = BUSINESS_CUSTOMERS_CUSTOMER + globalCustomerId+ SERVICE_SUBSCRIPTIONS_PATH +serviceType+ SERVICE_INSTANCE +serviceInstanceId;

+        Response resp = doAaiGet(getServiceInstancePath , false);

+        return processAaiResponse(resp, ServiceRelationships.class, null);

+    }

+

+    @Override

+    public AaiResponse getLogicalLink(String link) {

+        Response resp = doAaiGet("network/logical-links/logical-link/" + link , false);

+        return processAaiResponse(resp, LogicalLinkResponse.class, null);

+    }

+

+    @Override

+    public AaiResponse<AaiNodeQueryResponse> searchNodeTypeByName(String name, ResourceType type) {

+        String path = String.format(

+                "search/nodes-query?search-node-type=%s&filter=%s:EQUALS:%s",

+                type.getAaiFormat(),

+                type.getNameFilter(),

+                name

+        );

+        return typedAaiGet(path, AaiNodeQueryResponse.class);

+    }

+

+    private <T> AaiResponse<T> typedAaiGet(String path, Class<T> clz) {

+        Response resp = doAaiGet(path , false);

+        return processAaiResponse(resp, clz, null);

+    }

+

+

+

+    private String getUrlFromLIst(String url, String paramKey, List<String> params){

+        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() {

+        return getAllSubscribers(false).getAaiResponse();

+    }

+

+    AaiResponseWithRequestInfo<SubscriberList> getAllSubscribers(boolean propagateExceptions){

+        String depth = "0";

+        ResponseWithRequestInfo aaiGetResult = doAaiGet("business/customers?subscriber-type=INFRA&depth=" + depth, false, propagateExceptions);

+        AaiResponseWithRequestInfo<SubscriberList> responseWithRequestInfo = processAaiResponse(aaiGetResult, SubscriberList.class, propagateExceptions);

+        responseWithRequestInfo.setRequestedUrl(aaiGetResult.getRequestUrl());

+        responseWithRequestInfo.setHttpMethod(aaiGetResult.getRequestHttpMethod());

+        return responseWithRequestInfo;

+    }

+

+

+    @Override

+    public AaiResponse getAllAicZones() {

+        Response resp = doAaiGet("network/zones", false);

+        return processAaiResponse(resp, AicZones.class, null);

+    }

+

+

+    @Override

+    public AaiResponse<String> getAicZoneForPnf(String globalCustomerId , String serviceType , String serviceId) {

+        String aicZonePath = BUSINESS_CUSTOMERS_CUSTOMER + globalCustomerId + SERVICE_SUBSCRIPTIONS_PATH + serviceType + SERVICE_INSTANCE + serviceId;

+        Response resp = doAaiGet(aicZonePath , false);

+        AaiResponse<ServiceRelationships> aaiResponse = processAaiResponse(resp , ServiceRelationships.class , null);

+        ServiceRelationships serviceRelationships = aaiResponse.getT();

+        RelationshipList relationshipList = serviceRelationships.getRelationshipList();

+        Relationship relationship = relationshipList.getRelationship().get(0);

+        RelationshipData relationshipData=  relationship.getRelationDataList().get(0);

+        String aicZone = relationshipData.getRelationshipValue();

+        return new AaiResponse(aicZone , null ,HttpStatus.SC_OK);

+    }

+

+

+    @Override

+    public AaiResponse getVNFData() {

+        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(QUERY_FORMAT_SIMPLE, payload, false);

+        return processAaiResponse(resp, AaiGetVnfResponse.class, null);

+    }

+

+    @Override

+    public Response getVNFData(String globalSubscriberId, String serviceType) {

+        String payload = "{\"start\": [\"business/customers/customer/" + globalSubscriberId + SERVICE_SUBSCRIPTIONS_PATH + encodePathSegment(serviceType) +"/service-instances\"]," +

+                "\"query\": \"query/vnf-topology-fromServiceInstance\"}";

+        return doAaiPut(QUERY_FORMAT_SIMPLE, payload, false);

+    }

+

+    @Override

+    public AaiResponse getVNFData(String globalSubscriberId, String serviceType, String serviceInstanceId) {

+        String payload = "{\"start\": [\"/business/customers/customer/" + globalSubscriberId + SERVICE_SUBSCRIPTIONS_PATH + encodePathSegment(serviceType) + SERVICE_INSTANCE + serviceInstanceId + "\"],	\"query\": \"query/vnf-topology-fromServiceInstance\"}";

+        Response resp = doAaiPut(QUERY_FORMAT_SIMPLE, payload, false);

+        return processAaiResponse(resp, AaiGetVnfResponse.class, null);

+    }

+

+    @Override

+    public Response getVersionByInvariantId(List<String> modelInvariantId) {

+        StringBuilder sb = new StringBuilder();

+        for (String id : modelInvariantId){

+            sb.append(MODEL_INVARIANT_ID);

+            sb.append(id);

+

+        }

+        return doAaiGet("service-design-and-creation/models?depth=2"+ sb.toString(), false);

+    }

+

+    @Override

+    public AaiResponse getSubscriberData(String subscriberId) {

+        String depth = "2";

+        AaiResponse subscriberDataResponse;

+        Response resp = doAaiGet(BUSINESS_CUSTOMERS_CUSTOMER + subscriberId + "?depth=" + depth, false);

+        subscriberDataResponse = processAaiResponse(resp, Services.class, null);

+        return subscriberDataResponse;

+    }

+

+    @Override

+    public AaiResponse getServices() {

+        Response resp = doAaiGet("service-design-and-creation/services", false);

+        return processAaiResponse(resp, GetServicesAAIRespone.class, null);

+    }

+

+    @Override

+    public AaiResponse getOperationalEnvironments(String operationalEnvironmentType, String operationalEnvironmentStatus) {

+        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(url, false);

+        return processAaiResponse(resp, OperationalEnvironmentList.class, null);

+    }

+

+    @Override

+    public AaiResponse getTenants(String globalCustomerId, String serviceType) {

+        AaiResponse aaiResponse;

+

+        if ((globalCustomerId == null || globalCustomerId.isEmpty()) || ((serviceType == null) || (serviceType.isEmpty())) ){

+            aaiResponse = new AaiResponse<>(null, "{\"statusText\":\" Failed to retrieve LCP Region & Tenants from A&AI, Subscriber ID or Service Type is missing.\"}", HttpStatus.SC_INTERNAL_SERVER_ERROR);

+            return  aaiResponse;

+        }

+

+        String url = BUSINESS_CUSTOMERS_CUSTOMER + globalCustomerId + SERVICE_SUBSCRIPTIONS_PATH + serviceType;

+

+        Response resp = doAaiGet(url, false);

+        String responseAsString = parseForTenantsByServiceSubscription(resp.readEntity(String.class));

+        if (responseAsString.equals("")){

+            return 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);

+        }

+        else {

+            return processAaiResponse(resp, GetTenantsResponse[].class, responseAsString);

+        }

+    }

+

+    @Override

+    public AaiResponse getNodeTemplateInstances(String globalCustomerId, String serviceType, String modelVersionId, String modelInvariantId, String cloudRegion) {

+

+        String siQuery = BUSINESS_CUSTOMER + globalCustomerId + SERVICE_SUBSCRIPTIONS_PATH + 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(QUERY_FORMAT_SIMPLE, payload1, false);

+        AaiResponse aaiResponse1 = processAaiResponse(resp1, AaiGetVnfResponse.class, null);

+        logger.debug(EELFLoggerDelegate.debugLogger, "getNodeTemplateInstances AAI's response: {}", aaiResponse1);

+        return aaiResponse1;

+    }

+

+    private <T> AaiResponseWithRequestInfo<T> processAaiResponse(ResponseWithRequestInfo responseWithRequestInfo, Class<? extends T> classType, boolean propagateExceptions) {

+        String responseBody = null;

+        Integer responseHttpCode = null;

+        try {

+            Response response = responseWithRequestInfo.getResponse();

+            responseHttpCode = (response != null) ? response.getStatus() : null;

+            responseBody = (response != null) ? response.readEntity(String.class) : null;

+            AaiResponse<T> processedAaiResponse = processAaiResponse(response, classType, responseBody, propagateExceptions);

+            return new AaiResponseWithRequestInfo<>(responseWithRequestInfo.getRequestHttpMethod(), responseWithRequestInfo.getRequestUrl(), processedAaiResponse,

+                    responseBody);

+        } catch (Exception e) {

+            throw new ExceptionWithRequestInfo(responseWithRequestInfo.getRequestHttpMethod(),

+                    responseWithRequestInfo.getRequestUrl(), responseBody, responseHttpCode, e);

+        }

+    }

+

+    private AaiResponse processAaiResponse(Response resp, Class classType, String responseBody) {

+        return processAaiResponse(resp, classType, responseBody, false);

+    }

+

+    private AaiResponse processAaiResponse(Response resp, Class classType, String responseBody, boolean propagateExceptions) {

+        AaiResponse subscriberDataResponse;

+        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");

+                String rawData = resp.readEntity(String.class);

+                subscriberDataResponse = new AaiResponse<>(null, rawData, resp.getStatus());

+            } else {

+                subscriberDataResponse = processOkResponse(resp, classType, responseBody, propagateExceptions);

+            }

+        }

+        return subscriberDataResponse;

+    }

+

+    private AaiResponse processOkResponse(Response resp, Class classType, String responseBody, boolean propagateExceptions) {

+        AaiResponse subscriberDataResponse;

+        String finalResponse = null;

+        try {

+            if (responseBody != null) {

+                finalResponse = responseBody;

+            } else {

+                finalResponse = resp.readEntity(String.class);

+            }

+

+        subscriberDataResponse = parseFasterXmlObject(classType, finalResponse);

+

+        } catch(Exception e){

+            if (propagateExceptions) {

+                throw new GenericUncheckedException(e);

+            } else {

+                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 AaiResponse parseFasterXmlObject(Class classType, String finalResponse) throws IOException {

+        ObjectMapper objectMapper = new ObjectMapper();

+        return new AaiResponse<>((objectMapper.readValue(finalResponse, classType)), null, HttpStatus.SC_OK);

+    }

+

+    public Response doAaiGet(String uri, boolean xml) {

+        return doAaiGet(uri, xml, false).getResponse();

+    }

+

+

+    public ResponseWithRequestInfo doAaiGet(String uri, boolean xml, boolean propagateExceptions) {

+        String methodName = "doAaiGet";

+        String transId = UUID.randomUUID().toString();

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        ResponseWithRequestInfo resp;

+        try {

+            resp = restController.RestGet(fromAppId, transId, uri, xml, propagateExceptions);

+

+        } catch (Exception e) {

+            if (propagateExceptions) {

+                throw (e instanceof RuntimeException) ? (RuntimeException)e : new GenericUncheckedException(e);

+            } else {

+                final Exception actual =

+                        e instanceof ExceptionWithRequestInfo ? (Exception) e.getCause() : e;

+

+                final String message =

+                        actual instanceof WebApplicationException ? ((WebApplicationException) actual).getResponse().readEntity(String.class) : e.toString();

+

+                //ToDo: change parameter of requestUrl to real url from RestGet function

+                resp = new ResponseWithRequestInfo(null, null, org.springframework.http.HttpMethod.GET);

+                logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + message);

+                logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + message);

+            }

+        }

+        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) {

+            logger.debug(EELFLoggerDelegate.debugLogger, "parseForTenantsByServiceSubscription error while parsing tenants by service subscription", ex);

+        }

+        return tenantList;

+    }

+

+    protected Response doAaiPut(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 {

+

+            resp = restController.RestPut(fromAppId, 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;

+    }

+

+

+    private 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");

+                for (Object innerObj : defaultIfNull(rShipArray, emptyList())) {

+                    if (innerObj != null) {

+                        bconvert = parseTenant(tenantArray, bconvert, (JSONObject) innerObj);

+                    }

+                }

+            }

+        } catch (NullPointerException ex) {

+            logger.debug(EELFLoggerDelegate.debugLogger, "parseServiceSubscriptionObjectForTenants. error while parsing service subscription object for tenants", ex);

+        }

+

+        if (bconvert)

+            return tenantArray.toJSONString();

+        else

+            return "";

+

+    }

+

+    private static boolean parseTenant(JSONArray tenantArray, boolean bconvert, JSONObject inner1Obj) {

+        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");

+            for (Object innerObj : defaultIfNull(rDataArray, emptyList())) {

+                parseRelationShip(tenantNewObj, (JSONObject) innerObj);

+            }

+

+            JSONArray relatedTPropArray = (JSONArray) inner1Obj.get("related-to-property");

+            for (Object innerObj : defaultIfNull(relatedTPropArray, emptyList())) {

+                parseRelatedTProp(tenantNewObj, (JSONObject) innerObj);

+            }

+            bconvert = true;

+            tenantArray.add(tenantNewObj);

+        }

+        return bconvert;

+    }

+

+    private static void parseRelatedTProp(JSONObject tenantNewObj, JSONObject innerObj) {

+        if (innerObj == null)

+            return;

+

+        String propKey = checkForNull((String) innerObj.get("property-key"));

+        String propVal = checkForNull((String) innerObj.get("property-value"));

+        if (propKey.equalsIgnoreCase("tenant.tenant-name")) {

+            tenantNewObj.put("tenantName", propVal);

+        }

+    }

+

+    private static void parseRelationShip(JSONObject tenantNewObj, JSONObject inner2Obj) {

+        if (inner2Obj == null)

+            return;

+

+        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);

+        }

+    }

+

+    private static String encodePathSegment(String segmentToEncode) {

+        try {

+            return UriUtils.encodePathSegment(segmentToEncode, "UTF-8");

+        } catch (UnsupportedEncodingException e) {

+            throw new GenericUncheckedException("URI encoding failed unexpectedly", e);

+        }

+    }

+

+    @Override

+    public ExternalComponentStatus probeAaiGetAllSubscribers(){

+        long startTime = System.currentTimeMillis();

+        try {

+            AaiResponseWithRequestInfo<SubscriberList> responseWithRequestInfo = getAllSubscribers(true);

+            AaiResponse<SubscriberList> aaiResponse = responseWithRequestInfo.getAaiResponse();

+            long duration = System.currentTimeMillis() - startTime;

+

+            SubscriberList subscribersList = (aaiResponse != null) ? aaiResponse.getT() : null;

+            boolean isAvailable = subscribersList != null && subscribersList.customer != null && !subscribersList.customer.isEmpty();

+

+            HttpRequestMetadata metadata = new HttpRequestMetadata(

+                    responseWithRequestInfo.getHttpMethod(),

+                    (aaiResponse != null) ? aaiResponse.getHttpCode() : 0,

+                    responseWithRequestInfo.getRequestedUrl(),

+                    StringUtils.substring(responseWithRequestInfo.getRawData(), 0, 500),

+                    isAvailable ? "OK" : "No subscriber received",

+                    duration

+            );

+            return new ExternalComponentStatus(ExternalComponentStatus.Component.AAI, isAvailable, metadata);

+

+        } catch (ExceptionWithRequestInfo e) {

+            long duration = System.currentTimeMillis() - startTime;

+            return new ExternalComponentStatus(ExternalComponentStatus.Component.AAI, false,

+                    new HttpRequestMetadata(

+                            e.getHttpMethod(),

+                            defaultIfNull(e.getHttpCode(), 0),

+                            e.getRequestedUrl(),

+                            e.getRawData(),

+                            Logging.exceptionToDescription(e.getCause()), duration));

+        } catch (Exception e) {

+            long duration = System.currentTimeMillis() - startTime;

+            return new ExternalComponentStatus(ExternalComponentStatus.Component.AAI, false,

+                    new ErrorMetadata(Logging.exceptionToDescription(e), duration));

+        }

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiClientInterface.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiClientInterface.java
new file mode 100644
index 0000000..d39dbb1
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiClientInterface.java
@@ -0,0 +1,88 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import org.onap.osam.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;

+import org.onap.osam.aai.model.AaiGetPnfs.Pnf;

+import org.onap.osam.aai.model.AaiGetTenatns.GetTenantsResponse;

+import org.onap.osam.aai.model.AaiNodeQueryResponse;

+import org.onap.osam.aai.model.PortDetailsTranslator;

+import org.onap.osam.aai.model.ResourceType;

+import org.onap.osam.model.SubscriberList;

+import org.onap.osam.model.probes.ExternalComponentStatus;

+

+import javax.ws.rs.core.Response;

+import java.util.List;

+

+public interface AaiClientInterface {

+

+    AaiResponse<AaiNodeQueryResponse> searchNodeTypeByName(String name, ResourceType type);

+

+    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();

+

+    AaiResponse getNetworkCollectionDetails(String serviceInstanceId);

+

+    AaiResponse getInstanceGroupsByCloudRegion(String cloudOwner, String cloudRegionId, String networkFunction);

+

+    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);

+

+    List<PortDetailsTranslator.PortDetails> getPortMirroringSourcePorts(String configurationID);

+

+    AaiResponse getInstanceGroupsByVnfInstanceId(String vnfInstanceId);

+

+    ExternalComponentStatus probeAaiGetAllSubscribers();

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiGetVnfResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiGetVnfResponse.java
new file mode 100644
index 0000000..74bad6a
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiGetVnfResponse.java
@@ -0,0 +1,65 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import com.fasterxml.jackson.annotation.JsonAnyGetter;

+import com.fasterxml.jackson.annotation.JsonAnySetter;

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+import com.google.common.base.MoreObjects;

+import org.onap.osam.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<>();

+

+    @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/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiResponse.java
new file mode 100644
index 0000000..50ded45
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiResponse.java
@@ -0,0 +1,53 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import com.google.common.base.MoreObjects;

+import org.onap.osam.model.ProxyResponse;

+

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiResponseWithRequestInfo.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiResponseWithRequestInfo.java
new file mode 100644
index 0000000..73ed78c
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/AaiResponseWithRequestInfo.java
@@ -0,0 +1,66 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+

+import org.springframework.http.HttpMethod;

+

+import java.io.Serializable;

+

+public class AaiResponseWithRequestInfo<T> implements Serializable {

+    private AaiResponse<T> aaiResponse;

+    private String requestedUrl;

+    private String rawData;

+    private HttpMethod httpMethod;

+

+    public AaiResponseWithRequestInfo(HttpMethod httpMethod, String requestedUrl, AaiResponse<T> aaiResponse, String rawData) {

+        this.aaiResponse = aaiResponse;

+        this.requestedUrl = requestedUrl;

+        this.rawData = rawData;

+        this.httpMethod = httpMethod;

+    }

+

+    public void setRequestedUrl(String requestedUrl) {

+        this.requestedUrl = requestedUrl;

+    }

+

+    public void setHttpMethod(HttpMethod httpMethod) {

+        this.httpMethod = httpMethod;

+    }

+

+    public AaiResponse<T> getAaiResponse() {

+        return aaiResponse;

+    }

+

+    public String getRequestedUrl() {

+        return requestedUrl;

+    }

+

+    public String getRawData() {

+        return rawData;

+    }

+

+    public HttpMethod getHttpMethod() {

+        return httpMethod;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/ExceptionWithRequestInfo.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/ExceptionWithRequestInfo.java
new file mode 100644
index 0000000..8b1ff6f
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/ExceptionWithRequestInfo.java
@@ -0,0 +1,76 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import org.apache.commons.lang3.StringUtils;

+import org.springframework.http.HttpMethod;

+

+import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;

+

+public class ExceptionWithRequestInfo extends RuntimeException {

+

+    private final HttpMethod httpMethod;

+    private final String requestedUrl;

+    private final Integer httpCode;

+    private final String rawData;

+

+    public ExceptionWithRequestInfo(HttpMethod httpMethod, String requestedUrl, String rawData, Integer httpCode, Throwable cause) {

+        super(toMessage(httpMethod, requestedUrl, cause), cause);

+        this.httpMethod = httpMethod;

+        this.requestedUrl = requestedUrl;

+        this.rawData = rawData;

+        this.httpCode = httpCode;

+    }

+

+    public ExceptionWithRequestInfo(HttpMethod httpMethod, String requestedUrl, Throwable cause) {

+        this(httpMethod, requestedUrl, null, null, cause);

+    }

+

+    public String getRequestedUrl() {

+        return requestedUrl;

+    }

+

+    public String getRawData() {

+        return rawData;

+    }

+

+    public HttpMethod getHttpMethod() {

+        return httpMethod;

+    }

+

+    public Integer getHttpCode() {

+        return httpCode;

+    }

+

+    private static String toMessage(HttpMethod httpMethod, String requestedUrl, Throwable cause) {

+        if (StringUtils.isEmpty(requestedUrl)) {

+            return cause.toString();

+        } else {

+            return "" +

+                    "Exception while handling " +

+                    defaultIfNull(httpMethod, "request").toString() +

+                    " " + requestedUrl +

+                    ": " + cause.toString();

+        }

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/OperationalEnvironment.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/OperationalEnvironment.java
new file mode 100644
index 0000000..a96df31
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/OperationalEnvironment.java
@@ -0,0 +1,126 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import org.onap.osam.aai.model.RelationshipList;

+

+@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/onap-enabler-be/src/main/java/org/onap/osam/aai/PombaClientImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/PombaClientImpl.java
new file mode 100644
index 0000000..0c51e17
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/PombaClientImpl.java
@@ -0,0 +1,72 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+import org.onap.osam.model.PombaInstance.PombaRequest;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.springframework.beans.factory.annotation.Autowired;

+

+import javax.servlet.ServletContext;

+import javax.ws.rs.core.Response;

+import java.io.File;

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.Date;

+

+public class PombaClientImpl implements PombaClientInterface {

+

+    final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+    protected String fromAppId = "VidAaiController";

+    EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AaiClient.class);

+

+    @Autowired

+    ServletContext servletContext;

+

+    @Autowired

+    PombaRestInterface pombaRestInterface;

+

+

+    @Override

+    public void verify(PombaRequest request) {

+        String methodName = "doAaiPost";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+        String uri = SystemProperties.getProperty("pomba.server.url");

+

+

+        try {

+            Response response = pombaRestInterface.RestPost(fromAppId, uri, new ObjectMapper().writeValueAsString(request));

+        } 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());

+        }

+    }

+

+

+    private File getCertificatesFile() {

+        if (servletContext != null)

+            return new File(servletContext.getRealPath("/WEB-INF/cert/"));

+        return null;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/PombaClientInterface.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/PombaClientInterface.java
new file mode 100644
index 0000000..c5f5fbb
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/PombaClientInterface.java
@@ -0,0 +1,29 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import org.onap.osam.model.PombaInstance.PombaRequest;

+

+public interface PombaClientInterface {

+    void verify(PombaRequest request);

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/PombaRestInterface.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/PombaRestInterface.java
new file mode 100644
index 0000000..c5dd171
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/PombaRestInterface.java
@@ -0,0 +1,90 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.osam.aai.util.*;

+import org.onap.osam.utils.Logging;

+import org.springframework.http.HttpMethod;

+

+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 java.util.UUID;

+

+import static org.onap.osam.utils.Logging.REQUEST_ID_HEADER_KEY;

+

+public class PombaRestInterface extends AAIRestInterface {

+

+    public PombaRestInterface (HttpsAuthClient httpsAuthClientFactory, ServletRequestHelper servletRequestHelper, SystemPropertyHelper systemPropertyHelper) {

+        super(httpsAuthClientFactory, servletRequestHelper, systemPropertyHelper);

+    }

+

+    private Client client = null;

+

+    private void initRestClient()

+    {

+        if (client == null) {

+            try {

+                client = httpsAuthClientFactory.getClient(HttpClientMode.UNSECURE);

+            }

+            catch (Exception e) {

+                logger.info(EELFLoggerDelegate.errorLogger, "Exception in REST call to DB in initRestClient" + e.toString());

+                logger.debug(EELFLoggerDelegate.debugLogger, "Exception in REST call to DB : " + e.toString());

+            }

+        }

+    }

+

+

+    public Response RestPost(String fromAppId, String url, String payload) {

+        String methodName = "RestPost";

+        String transId = UUID.randomUUID().toString();

+        try {

+            initRestClient();

+

+            Logging.logRequest(outgoingRequestsLogger, HttpMethod.POST, url, payload);

+            final Response cres = client.target(url)

+                    .request()

+                    .accept(MediaType.APPLICATION_JSON)

+                    .header(TRANSACTION_ID_HEADER, transId)

+                    .header(FROM_APP_ID_HEADER,  fromAppId)

+                    .header(REQUEST_ID_HEADER_KEY, extractOrGenerateRequestId())

+                    .post(Entity.entity(payload, MediaType.APPLICATION_JSON));

+            Logging.logResponse(outgoingRequestsLogger, HttpMethod.POST, url, cres);

+

+            if (cres.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {

+                logger.info(EELFLoggerDelegate.errorLogger, getValidResponseLogMessage(methodName));

+                logger.debug(EELFLoggerDelegate.debugLogger, getValidResponseLogMessage(methodName));

+            } else {

+                logger.debug(EELFLoggerDelegate.debugLogger, getInvalidResponseLogMessage(url, methodName, cres));

+            }

+        } catch (Exception e) {

+            logger.debug(EELFLoggerDelegate.debugLogger, getFailedResponseLogMessage(url, methodName, e));

+        }

+        return null;

+    }

+

+}

+

+

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/ResponseWithRequestInfo.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/ResponseWithRequestInfo.java
new file mode 100644
index 0000000..27804a3
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/ResponseWithRequestInfo.java
@@ -0,0 +1,51 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import org.springframework.http.HttpMethod;

+

+import javax.ws.rs.core.Response;

+

+public class ResponseWithRequestInfo {

+    private String requestUrl;

+    private HttpMethod requestHttpMethod;

+    private Response response;

+

+    public ResponseWithRequestInfo(Response response, String requestUrl, HttpMethod requestHttpMethod) {

+        this.response = response;

+        this.requestUrl = requestUrl;

+        this.requestHttpMethod = requestHttpMethod;

+    }

+

+    public String getRequestUrl() {

+        return requestUrl;

+    }

+

+    public HttpMethod getRequestHttpMethod() {

+        return requestHttpMethod;

+    }

+

+    public Response getResponse() {

+        return response;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceInstance.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceInstance.java
new file mode 100644
index 0000000..0610969
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceInstance.java
@@ -0,0 +1,56 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.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/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceInstances.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceInstances.java
new file mode 100644
index 0000000..1e51e4b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceInstances.java
@@ -0,0 +1,37 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class ServiceInstances {

+	

+	@JsonProperty("service-instance")

+	public List<ServiceInstance> serviceInstance;

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceInstancesSearchResults.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceInstancesSearchResults.java
new file mode 100644
index 0000000..6fd8859
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceInstancesSearchResults.java
@@ -0,0 +1,35 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import org.onap.osam.model.ServiceInstanceSearchResult;

+

+import java.util.List;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class ServiceInstancesSearchResults {

+    @JsonProperty("service-instances")

+    public List<ServiceInstanceSearchResult> serviceInstances;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceSubscription.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceSubscription.java
new file mode 100644
index 0000000..6234b99
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceSubscription.java
@@ -0,0 +1,43 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.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/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceSubscriptions.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceSubscriptions.java
new file mode 100644
index 0000000..ed20dc0
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/ServiceSubscriptions.java
@@ -0,0 +1,36 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+

+public class ServiceSubscriptions {

+

+    @JsonProperty("service-subscription")

+    public List<ServiceSubscription> serviceSubscription;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/Services.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/Services.java
new file mode 100644
index 0000000..eb268ab
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/Services.java
@@ -0,0 +1,46 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.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/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberAaiResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberAaiResponse.java
new file mode 100644
index 0000000..5c0104b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberAaiResponse.java
@@ -0,0 +1,43 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import org.onap.osam.model.ProxyResponse;

+import org.onap.osam.model.SubscriberList;

+

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberData.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberData.java
new file mode 100644
index 0000000..cb3132b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberData.java
@@ -0,0 +1,26 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+public class SubscriberData {

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberFilteredResults.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberFilteredResults.java
new file mode 100644
index 0000000..20f1201
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberFilteredResults.java
@@ -0,0 +1,48 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import org.onap.osam.model.ProxyResponse;

+import org.onap.osam.model.SubscriberList;

+import org.onap.osam.roles.RoleValidator;

+

+

+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;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberListWithFilterData.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberListWithFilterData.java
new file mode 100644
index 0000000..3784256
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberListWithFilterData.java
@@ -0,0 +1,50 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import org.onap.osam.model.Subscriber;

+import org.onap.osam.model.SubscriberList;

+import org.onap.osam.roles.RoleValidator;

+

+import java.util.ArrayList;

+import java.util.List;

+

+public class SubscriberListWithFilterData {

+

+    public SubscriberListWithFilterData(SubscriberList subscriberList, RoleValidator roleValidator){

+        List<Subscriber> subscribers = subscriberList != null ? subscriberList.customer : new ArrayList<>();

+        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/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberWithFilter.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberWithFilter.java
new file mode 100644
index 0000000..c71b0d3
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/SubscriberWithFilter.java
@@ -0,0 +1,40 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai;

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+import org.onap.osam.model.Subscriber;

+

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/HttpClientBuilderException.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/HttpClientBuilderException.java
new file mode 100644
index 0000000..dab5a34
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/HttpClientBuilderException.java
@@ -0,0 +1,30 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.exceptions;

+

+public class HttpClientBuilderException extends RuntimeException {

+

+    public HttpClientBuilderException(Throwable cause) {

+        super(cause);

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/InvalidAAIResponseException.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/InvalidAAIResponseException.java
new file mode 100644
index 0000000..c033d9c
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/InvalidAAIResponseException.java
@@ -0,0 +1,32 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.exceptions;

+

+import org.onap.osam.aai.AaiResponse;

+import org.onap.osam.exceptions.GenericUncheckedException;

+

+public class InvalidAAIResponseException extends GenericUncheckedException {

+    public InvalidAAIResponseException(AaiResponse aaiResponse) {

+        super(String.format("errorCode: %d, raw: %s", aaiResponse.getHttpCode(), aaiResponse.getErrorMessage()));

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/InvalidPropertyException.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/InvalidPropertyException.java
new file mode 100644
index 0000000..0d3e5b1
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/InvalidPropertyException.java
@@ -0,0 +1,26 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.exceptions;

+

+public class InvalidPropertyException extends Exception {

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/RoleParsingException.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/RoleParsingException.java
new file mode 100644
index 0000000..5ab442b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/exceptions/RoleParsingException.java
@@ -0,0 +1,26 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.exceptions;

+

+public class RoleParsingException extends Exception {

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetAicZone/AicZones.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetAicZone/AicZones.java
new file mode 100644
index 0000000..34a16fc
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetAicZone/AicZones.java
@@ -0,0 +1,32 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetAicZone;

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+public class AicZones {

+	@JsonProperty("zone")

+	public List<Zone> zones;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetAicZone/Zone.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetAicZone/Zone.java
new file mode 100644
index 0000000..e3bdc69
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetAicZone/Zone.java
@@ -0,0 +1,36 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetAicZone;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class Zone {

+    @JsonProperty("zone-id")

+    public String zoneId;

+    

+    @JsonProperty("zone-name")

+    public String zoneName;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetInstanceGroupsByCloudRegion.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetInstanceGroupsByCloudRegion.java
new file mode 100644
index 0000000..a576ae2
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetInstanceGroupsByCloudRegion.java
@@ -0,0 +1,42 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class AaiGetInstanceGroupsByCloudRegion {

+

+    private final List<InstanceGroupWrapper> results;

+

+    public AaiGetInstanceGroupsByCloudRegion(@JsonProperty("results") List<InstanceGroupWrapper> results) {

+        this.results = results;

+    }

+

+    public List<InstanceGroupWrapper> getResults() {

+        return results;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/AaiGetNetworkCollectionDetails.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/AaiGetNetworkCollectionDetails.java
new file mode 100644
index 0000000..290cc0e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/AaiGetNetworkCollectionDetails.java
@@ -0,0 +1,45 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+public class AaiGetNetworkCollectionDetails {

+

+    public AaiGetNetworkCollectionDetails(){

+        results = new Result();

+    }

+    @JsonProperty("results")

+    private Result results = null;

+

+    @JsonProperty("results")

+    public Result getResults() {

+        return results;

+    }

+

+    @JsonProperty("results")

+    public void setResults(Result results) {

+        this.results = results;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/AaiGetNetworkCollectionDetailsHelper.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/AaiGetNetworkCollectionDetailsHelper.java
new file mode 100644
index 0000000..daade03
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/AaiGetNetworkCollectionDetailsHelper.java
@@ -0,0 +1,60 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+

+import com.fasterxml.jackson.annotation.JsonAnyGetter;

+import com.fasterxml.jackson.annotation.JsonAnySetter;

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.HashMap;

+import java.util.List;

+import java.util.Map;

+

+public class AaiGetNetworkCollectionDetailsHelper {

+    @JsonProperty("results")

+    private List<Object> results = null;

+    @JsonIgnore

+    private Map<String, Object> additionalProperties = new HashMap<>();

+

+    @JsonProperty("results")

+    public List<Object> getResults() {

+        return results;

+    }

+

+    @JsonProperty("results")

+    public void setResults(List<Object> results) {

+        this.results = results;

+    }

+

+    @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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/AaiGetRelatedInstanceGroupsByVnfId.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/AaiGetRelatedInstanceGroupsByVnfId.java
new file mode 100644
index 0000000..a1c7b44
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/AaiGetRelatedInstanceGroupsByVnfId.java
@@ -0,0 +1,203 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class AaiGetRelatedInstanceGroupsByVnfId {

+

+    @JsonProperty("vnf-id")

+    private String vnfId;

+    @JsonProperty("vnf-name")

+    private String vnfName;

+    @JsonProperty("vnf-type")

+    private String vnfType;

+    @JsonProperty("prov-status")

+    private String provStatus;

+    @JsonProperty("operational-status")

+    private String operationalStatus;

+    @JsonProperty("equipment-role")

+    private String equipmentRole;

+    @JsonProperty("in-maint")

+    private Boolean inMaint;

+    @JsonProperty("is-closed-loop-disabled")

+    private Boolean isClosedLoopDisabled;

+    @JsonProperty("resource-version")

+    private String resourceVersion;

+    @JsonProperty("model-invariant-id")

+    private String modelInvariantId;

+    @JsonProperty("model-version-id")

+    private String modelVersionId;

+    @JsonProperty("model-customization-id")

+    private String modelCustomizationId;

+    @JsonProperty("selflink")

+    private String selflink;

+    @JsonProperty("relationship-list")

+    private RelationshipList relationshipList;

+

+

+    @JsonProperty("vnf-id")

+    public String getVnfId() {

+        return vnfId;

+    }

+

+    @JsonProperty("vnf-id")

+    public void setVnfId(String vnfId) {

+        this.vnfId = vnfId;

+    }

+

+    @JsonProperty("vnf-name")

+    public String getVnfName() {

+        return vnfName;

+    }

+

+    @JsonProperty("vnf-name")

+    public void setVnfName(String vnfName) {

+        this.vnfName = vnfName;

+    }

+

+    @JsonProperty("vnf-type")

+    public String getVnfType() {

+        return vnfType;

+    }

+

+    @JsonProperty("vnf-type")

+    public void setVnfType(String vnfType) {

+        this.vnfType = vnfType;

+    }

+

+    @JsonProperty("prov-status")

+    public String getProvStatus() {

+        return provStatus;

+    }

+

+    @JsonProperty("prov-status")

+    public void setProvStatus(String provStatus) {

+        this.provStatus = provStatus;

+    }

+

+    @JsonProperty("operational-status")

+    public String getOperationalStatus() {

+        return operationalStatus;

+    }

+

+    @JsonProperty("operational-status")

+    public void setOperationalStatus(String operationalStatus) {

+        this.operationalStatus = operationalStatus;

+    }

+

+    @JsonProperty("equipment-role")

+    public String getEquipmentRole() {

+        return equipmentRole;

+    }

+

+    @JsonProperty("equipment-role")

+    public void setEquipmentRole(String equipmentRole) {

+        this.equipmentRole = equipmentRole;

+    }

+

+    @JsonProperty("in-maint")

+    public Boolean getInMaint() {

+        return inMaint;

+    }

+

+    @JsonProperty("in-maint")

+    public void setInMaint(Boolean inMaint) {

+        this.inMaint = inMaint;

+    }

+

+    @JsonProperty("is-closed-loop-disabled")

+    public Boolean getIsClosedLoopDisabled() {

+        return isClosedLoopDisabled;

+    }

+

+    @JsonProperty("is-closed-loop-disabled")

+    public void setIsClosedLoopDisabled(Boolean isClosedLoopDisabled) {

+        this.isClosedLoopDisabled = isClosedLoopDisabled;

+    }

+

+    @JsonProperty("resource-version")

+    public String getResourceVersion() {

+        return resourceVersion;

+    }

+

+    @JsonProperty("resource-version")

+    public void setResourceVersion(String resourceVersion) {

+        this.resourceVersion = resourceVersion;

+    }

+

+    @JsonProperty("model-invariant-id")

+    public String getModelInvariantId() {

+        return modelInvariantId;

+    }

+

+    @JsonProperty("model-invariant-id")

+    public void setModelInvariantId(String modelInvariantId) {

+        this.modelInvariantId = modelInvariantId;

+    }

+

+    @JsonProperty("model-version-id")

+    public String getModelVersionId() {

+        return modelVersionId;

+    }

+

+    @JsonProperty("model-version-id")

+    public void setModelVersionId(String modelVersionId) {

+        this.modelVersionId = modelVersionId;

+    }

+

+    @JsonProperty("model-customization-id")

+    public String getModelCustomizationId() {

+        return modelCustomizationId;

+    }

+

+    @JsonProperty("model-customization-id")

+    public void setModelCustomizationId(String modelCustomizationId) {

+        this.modelCustomizationId = modelCustomizationId;

+    }

+

+    @JsonProperty("selflink")

+    public String getSelflink() {

+        return selflink;

+    }

+

+    @JsonProperty("selflink")

+    public void setSelflink(String selflink) {

+        this.selflink = selflink;

+    }

+

+    @JsonProperty("relationship-list")

+    public RelationshipList getRelationshipList() {

+        return relationshipList;

+    }

+

+    @JsonProperty("relationship-list")

+    public void setRelationshipList(RelationshipList relationshipList) {

+        this.relationshipList = relationshipList;

+    }

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Collection.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Collection.java
new file mode 100644
index 0000000..1d392f5
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Collection.java
@@ -0,0 +1,152 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class Collection {

+    @JsonProperty("collection-id")

+    private String collectionId;

+    @JsonProperty("model-invariant-id")

+    private String modelInvariantId;

+    @JsonProperty("model-version-id")

+    private String modelVersionId;

+    @JsonProperty("collection-name")

+    private String collectionName;

+    @JsonProperty("collection-type")

+    private String collectionType;

+    @JsonProperty("collection-role")

+    private String collectionRole;

+    @JsonProperty("collection-function")

+    private String collectionFunction;

+    @JsonProperty("collection-customization-id")

+    private String collectionCustomizationId;

+    @JsonProperty("relationship-list")

+    private RelationshipList relationshipList;

+    @JsonProperty("resource-version")

+    private String resourceVersion;

+

+    @JsonProperty("collection-id")

+    public String getCollectionId() {

+        return collectionId;

+    }

+

+    @JsonProperty("collection-id")

+    public void setCollectionId(String collectionId) {

+        this.collectionId = collectionId;

+    }

+

+    @JsonProperty("model-invariant-id")

+    public String getModelInvariantId() {

+        return modelInvariantId;

+    }

+

+    @JsonProperty("model-invariant-id")

+    public void setModelInvariantId(String modelInvariantId) {

+        this.modelInvariantId = modelInvariantId;

+    }

+

+    @JsonProperty("model-version-id")

+    public String getModelVersionId() {

+        return modelVersionId;

+    }

+

+    @JsonProperty("model-version-id")

+    public void setModelVersionId(String modelVersionId) {

+        this.modelVersionId = modelVersionId;

+    }

+

+    @JsonProperty("collection-name")

+    public String getCollectionName() {

+        return collectionName;

+    }

+

+    @JsonProperty("collection-name")

+    public void setCollectionName(String collectionName) {

+        this.collectionName = collectionName;

+    }

+

+    @JsonProperty("collection-type")

+    public String getCollectionType() {

+        return collectionType;

+    }

+

+    @JsonProperty("collection-type")

+    public void setCollectionType(String collectionType) {

+        this.collectionType = collectionType;

+    }

+

+    @JsonProperty("collection-role")

+    public String getCollectionRole() {

+        return collectionRole;

+    }

+

+    @JsonProperty("collection-role")

+    public void setCollectionRole(String collectionRole) {

+        this.collectionRole = collectionRole;

+    }

+

+    @JsonProperty("collection-function")

+    public String getCollectionFunction() {

+        return collectionFunction;

+    }

+

+    @JsonProperty("collection-function")

+    public void setCollectionFunction(String collectionFunction) {

+        this.collectionFunction = collectionFunction;

+    }

+

+    @JsonProperty("collection-customization-id")

+    public String getCollectionCustomizationId() {

+        return collectionCustomizationId;

+    }

+

+    @JsonProperty("collection-customization-id")

+    public void setCollectionCustomizationId(String collectionCustomizationId) {

+        this.collectionCustomizationId = collectionCustomizationId;

+    }

+

+    @JsonProperty("relationship-list")

+    public RelationshipList getRelationshipList() {

+        return relationshipList;

+    }

+

+    @JsonProperty("relationship-list")

+    public void setRelationshipList(RelationshipList relationshipList) {

+        this.relationshipList = relationshipList;

+    }

+

+    @JsonProperty("resource-version")

+    public String getResourceVersion() {

+        return resourceVersion;

+    }

+

+    @JsonProperty("resource-version")

+    public void setResourceVersion(String resourceVersion) {

+        this.resourceVersion = resourceVersion;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/InstanceGroup.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/InstanceGroup.java
new file mode 100644
index 0000000..3bc6742
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/InstanceGroup.java
@@ -0,0 +1,127 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class InstanceGroup {

+    @JsonProperty("instance-group-role")

+    private String instanceGroupRole;

+    @JsonProperty("model-invariant-id")

+    private String modelInvariantId;

+    @JsonProperty("model-version-id")

+    private String modelVersionId;

+    private String id;

+    private String description;

+    @JsonProperty("instance-group-type")

+    private String instanceGroupType;

+    @JsonProperty("resource-version")

+    private String resourceVersion;

+    @JsonProperty("instance-group-name")

+    private String instanceGroupName;

+    @JsonProperty("instance-group-function")

+    private String instanceGroupFunction;

+    @JsonProperty("relationship-list")

+    private RelationshipList relationshipList;

+

+    public InstanceGroup(){

+        super();

+    }

+    

+    @JsonIgnoreProperties(ignoreUnknown = true)

+    public InstanceGroup(

+                        @JsonProperty("instance-group-role")

+                        String instanceGroupRole,

+                        @JsonProperty("model-invariant-id")

+                        String modelInvariantId,

+                        @JsonProperty("model-version-id")

+                        String modelVersionId,

+                        @JsonProperty(value = "id", required = true)

+                        String id,

+                        @JsonProperty(value = "description", required = true)

+                        String description,

+                        @JsonProperty(value = "instance-group-type", required = true)

+                        String instanceGroupType,

+                        @JsonProperty("resource-version")

+                        String resourceVersion,

+                        @JsonProperty("instance-group-name")

+                        String instanceGroupName,

+                        @JsonProperty("instance-group-function")

+                        String instanceGroupFunction,

+                        @JsonProperty("relationship-list")

+                        RelationshipList relationshipList) {

+        this.instanceGroupRole = instanceGroupRole;

+        this.modelInvariantId = modelInvariantId;

+        this.modelVersionId = modelVersionId;

+        this.id = id;

+        this.description = description;

+        this.instanceGroupType = instanceGroupType;

+        this.resourceVersion = resourceVersion;

+        this.instanceGroupName = instanceGroupName;

+        this.instanceGroupFunction = instanceGroupFunction;

+        this.relationshipList = relationshipList;

+    }

+

+    public String getInstanceGroupRole() {

+        return instanceGroupRole;

+    }

+

+    public String getModelInvariantId() {

+        return modelInvariantId;

+    }

+

+    public String getModelVersionId() {

+        return modelVersionId;

+    }

+

+    public String getId() {

+        return id;

+    }

+

+    public String getDescription() {

+        return description;

+    }

+

+    public String getInstanceGroupType() {

+        return instanceGroupType;

+    }

+

+    public String getResourceVersion() {

+        return resourceVersion;

+    }

+

+    public String getInstanceGroupName() {

+        return instanceGroupName;

+    }

+

+    public String getInstanceGroupFunction() {

+        return instanceGroupFunction;

+    }

+

+    public RelationshipList getRelationshipList() {

+        return relationshipList;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Network.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Network.java
new file mode 100644
index 0000000..6527438
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Network.java
@@ -0,0 +1,164 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class Network {

+    @JsonProperty("network-id")

+    private String networkId;

+    @JsonProperty("network-name")

+    private String networkName;

+    @JsonProperty("network-type")

+    private String networkType;

+    @JsonProperty("network-role")

+    private String networkRole;

+    @JsonProperty("network-technology")

+    private String networkTechnology;

+    @JsonProperty("is-bound-to-vpn")

+    private Boolean isBoundToVpn;

+    @JsonProperty("resource-version")

+    private String resourceVersion;

+    @JsonProperty("is-provider-network")

+    private Boolean isProviderNetwork;

+    @JsonProperty("is-shared-network")

+    private Boolean isSharedNetwork;

+    @JsonProperty("is-external-network")

+    private Boolean isExternalNetwork;

+    @JsonProperty("relationship-list")

+    private RelationshipList relationshipList;

+

+

+    @JsonProperty("network-id")

+    public String getNetworkId() {

+        return networkId;

+    }

+

+    @JsonProperty("network-id")

+    public void setNetworkId(String networkId) {

+        this.networkId = networkId;

+    }

+

+    @JsonProperty("network-name")

+    public String getNetworkName() {

+        return networkName;

+    }

+

+    @JsonProperty("network-name")

+    public void setNetworkName(String networkName) {

+        this.networkName = networkName;

+    }

+

+    @JsonProperty("network-type")

+    public String getNetworkType() {

+        return networkType;

+    }

+

+    @JsonProperty("network-type")

+    public void setNetworkType(String networkType) {

+        this.networkType = networkType;

+    }

+

+    @JsonProperty("network-role")

+    public String getNetworkRole() {

+        return networkRole;

+    }

+

+    @JsonProperty("network-role")

+    public void setNetworkRole(String networkRole) {

+        this.networkRole = networkRole;

+    }

+

+    @JsonProperty("network-technology")

+    public String getNetworkTechnology() {

+        return networkTechnology;

+    }

+

+    @JsonProperty("network-technology")

+    public void setNetworkTechnology(String networkTechnology) {

+        this.networkTechnology = networkTechnology;

+    }

+

+    @JsonProperty("is-bound-to-vpn")

+    public Boolean getIsBoundToVpn() {

+        return isBoundToVpn;

+    }

+

+    @JsonProperty("is-bound-to-vpn")

+    public void setIsBoundToVpn(Boolean isBoundToVpn) {

+        this.isBoundToVpn = isBoundToVpn;

+    }

+

+    @JsonProperty("resource-version")

+    public String getResourceVersion() {

+        return resourceVersion;

+    }

+

+    @JsonProperty("resource-version")

+    public void setResourceVersion(String resourceVersion) {

+        this.resourceVersion = resourceVersion;

+    }

+

+    @JsonProperty("is-provider-network")

+    public Boolean getIsProviderNetwork() {

+        return isProviderNetwork;

+    }

+

+    @JsonProperty("is-provider-network")

+    public void setIsProviderNetwork(Boolean isProviderNetwork) {

+        this.isProviderNetwork = isProviderNetwork;

+    }

+

+    @JsonProperty("is-shared-network")

+    public Boolean getIsSharedNetwork() {

+        return isSharedNetwork;

+    }

+

+    @JsonProperty("is-shared-network")

+    public void setIsSharedNetwork(Boolean isSharedNetwork) {

+        this.isSharedNetwork = isSharedNetwork;

+    }

+

+    @JsonProperty("is-external-network")

+    public Boolean getIsExternalNetwork() {

+        return isExternalNetwork;

+    }

+

+    @JsonProperty("is-external-network")

+    public void setIsExternalNetwork(Boolean isExternalNetwork) {

+        this.isExternalNetwork = isExternalNetwork;

+    }

+

+    @JsonProperty("relationship-list")

+    public RelationshipList getRelationshipList() {

+        return relationshipList;

+    }

+

+    @JsonProperty("relationship-list")

+    public void setRelationshipList(RelationshipList relationshipList) {

+        this.relationshipList = relationshipList;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/RelatedToProperty.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/RelatedToProperty.java
new file mode 100644
index 0000000..d201559
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/RelatedToProperty.java
@@ -0,0 +1,59 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Relationship.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Relationship.java
new file mode 100644
index 0000000..fb3497c
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Relationship.java
@@ -0,0 +1,89 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/RelationshipData.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/RelationshipData.java
new file mode 100644
index 0000000..15a5aef
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/RelationshipData.java
@@ -0,0 +1,51 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+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;

+	}

+

+	public String relationshipKey;

+	

+	public String relationshipValue;

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/RelationshipList.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/RelationshipList.java
new file mode 100644
index 0000000..16521df
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/RelationshipList.java
@@ -0,0 +1,47 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import java.util.List;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class RelationshipList {

+	

+	@JsonProperty("relationship")

+	public List<Relationship> getRelationship() {

+		return relationship;

+	}

+

+	@JsonProperty("relationship")

+	public void setRelationship(List<Relationship> relationship) {

+		this.relationship = relationship;

+	}

+

+	public List<Relationship> relationship;

+	

+	

+	

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Result.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Result.java
new file mode 100644
index 0000000..d5f6bc7
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/Result.java
@@ -0,0 +1,86 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.ArrayList;

+import java.util.List;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class Result {

+

+    @JsonProperty("service-instance")

+    private ServiceInstance serviceInstance;

+    @JsonProperty("collection")

+    private Collection collection;

+    @JsonProperty("instance-group")

+    private InstanceGroup instanceGroup;

+    @JsonProperty("networks")

+    private List<Network> networks;

+

+    public Result(){

+        this.networks = new ArrayList<>();

+    }

+

+

+    @JsonProperty("service-instance")

+    public ServiceInstance getServiceInstance() {

+        return serviceInstance;

+    }

+

+    @JsonProperty("service-instance")

+    public void setServiceInstance(ServiceInstance serviceInstance) {

+        this.serviceInstance = serviceInstance;

+    }

+

+    @JsonProperty("collection")

+    public Collection getCollection() {

+        return collection;

+    }

+

+    @JsonProperty("collection")

+    public void setCollection(Collection collection) {

+        this.collection = collection;

+    }

+

+    @JsonProperty("instance-group")

+    public InstanceGroup getInstanceGroup() {

+        return instanceGroup;

+    }

+

+    @JsonProperty("instance-group")

+    public void setInstanceGroup(InstanceGroup instanceGroup) {

+        this.instanceGroup = instanceGroup;

+    }

+

+    @JsonProperty("networks")

+    public List<Network> getNetworks() { return networks; }

+

+    @JsonProperty("networks")

+    public void setNetworks(List<Network> networks) { this.networks = networks; }

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/ServiceInstance.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/ServiceInstance.java
new file mode 100644
index 0000000..efc038f
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetNetworkCollectionDetails/ServiceInstance.java
@@ -0,0 +1,39 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetNetworkCollectionDetails;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class ServiceInstance {

+

+    @JsonProperty("service-instance-id")

+    public String serviceInstanceId;

+

+    @JsonProperty("resource-version")

+    public String resourceVersion;

+

+    @JsonProperty("relationship-list")

+    public RelationshipList relationshipList;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentList.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentList.java
new file mode 100644
index 0000000..a6416ae
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetOperationalEnvironments/OperationalEnvironmentList.java
@@ -0,0 +1,52 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetOperationalEnvironments;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import org.onap.osam.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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetPnfResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetPnfResponse.java
new file mode 100644
index 0000000..f60f3ad
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetPnfResponse.java
@@ -0,0 +1,63 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.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.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+import com.google.common.base.MoreObjects;

+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<>();

+

+    @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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetPnfs/Pnf.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetPnfs/Pnf.java
new file mode 100644
index 0000000..517111a
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetPnfs/Pnf.java
@@ -0,0 +1,99 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetPnfs;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import org.onap.osam.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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetPortMirroringSourcePorts.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetPortMirroringSourcePorts.java
new file mode 100644
index 0000000..2ce6dca
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetPortMirroringSourcePorts.java
@@ -0,0 +1,41 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+public class AaiGetPortMirroringSourcePorts {

+

+    private final List<SimpleResult> results;

+

+    public AaiGetPortMirroringSourcePorts(@JsonProperty("results") List<SimpleResult> results) {

+        this.results = results;

+    }

+

+    public List<SimpleResult> getResults() {

+        return results;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetServicesRequestModel/GetServicesAAIRespone.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetServicesRequestModel/GetServicesAAIRespone.java
new file mode 100644
index 0000000..a79ba9e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetServicesRequestModel/GetServicesAAIRespone.java
@@ -0,0 +1,33 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetServicesRequestModel;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+

+import java.util.List;

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class GetServicesAAIRespone {

+

+    public List<Service> service;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetServicesRequestModel/Service.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetServicesRequestModel/Service.java
new file mode 100644
index 0000000..db4daeb
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetServicesRequestModel/Service.java
@@ -0,0 +1,41 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetServicesRequestModel;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+

+@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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetTenatns/GetTenantsResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetTenatns/GetTenantsResponse.java
new file mode 100644
index 0000000..5caa193
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiGetTenatns/GetTenantsResponse.java
@@ -0,0 +1,57 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model.AaiGetTenatns;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class GetTenantsResponse {

+

+    @JsonProperty("cloudRegionID")

+    public String cloudRegionId;

+

+    @JsonProperty("cloudOwner")

+    public String cloudOwner;

+    

+    @JsonProperty("tenantName")

+    public String tenantName;

+

+    @JsonProperty("tenantID")

+    public String tenantID;

+

+    @JsonProperty("is-permitted")

+    public boolean isPermitted;

+

+    public GetTenantsResponse() {

+    }

+

+    public GetTenantsResponse(String cloudRegionId, String cloudOwner, String tenantName, String tenantID, boolean isPermitted) {

+        this.cloudRegionId = cloudRegionId;

+        this.cloudOwner = cloudOwner;

+        this.tenantName = tenantName;

+        this.tenantID = tenantID;

+        this.isPermitted = isPermitted;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiNodeQueryResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiNodeQueryResponse.java
new file mode 100644
index 0000000..6e02979
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiNodeQueryResponse.java
@@ -0,0 +1,48 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+public class AaiNodeQueryResponse {

+

+    public static class ResultData {

+

+        public final ResourceType resourceType;

+        public final String resourceLink;

+

+        public ResultData(@JsonProperty("resource-type") ResourceType resourceType,

+                          @JsonProperty("resource-link") String resourceLink) {

+            this.resourceType = resourceType;

+            this.resourceLink = resourceLink;

+        }

+    }

+

+    public final List<ResultData> resultData;

+

+    public AaiNodeQueryResponse(@JsonProperty("result-data") List<ResultData> resultData) {

+        this.resultData = resultData;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiRelationResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiRelationResponse.java
new file mode 100644
index 0000000..5ead2f8
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/AaiRelationResponse.java
@@ -0,0 +1,65 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+

+

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.HashMap;

+import java.util.Map;

+

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/GetServiceModelsByDistributionStatusResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/GetServiceModelsByDistributionStatusResponse.java
new file mode 100644
index 0000000..028739a
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/GetServiceModelsByDistributionStatusResponse.java
@@ -0,0 +1,49 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+@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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/InstanceGroupInfo.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/InstanceGroupInfo.java
new file mode 100644
index 0000000..98600b8
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/InstanceGroupInfo.java
@@ -0,0 +1,54 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+public class InstanceGroupInfo {

+    public String getType() {

+        return type;

+    }

+

+    public void setType(String type) {

+        this.type = type;

+    }

+

+    private String type;

+    private String name;

+

+    public InstanceGroupInfo(String name){

+        this.name = name;

+        this.type = "instance-group";

+    }

+

+

+    public String getName() {

+        return name;

+    }

+

+    public void setName(String name) {

+        this.name = name;

+    }

+

+

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/InstanceGroupWrapper.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/InstanceGroupWrapper.java
new file mode 100644
index 0000000..d4076d7
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/InstanceGroupWrapper.java
@@ -0,0 +1,42 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.InstanceGroup;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class InstanceGroupWrapper {

+

+    private InstanceGroup instanceGroup;

+

+    @JsonProperty("instance-group")

+    public InstanceGroup getInstanceGroup() {

+        return instanceGroup;

+    }

+    @JsonProperty("instance-group")

+    public void setInstanceGroup(InstanceGroup instanceGroup) {

+        this.instanceGroup = instanceGroup;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/LogicalLinkResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/LogicalLinkResponse.java
new file mode 100644
index 0000000..e380978
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/LogicalLinkResponse.java
@@ -0,0 +1,94 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Model.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Model.java
new file mode 100644
index 0000000..03c6906
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Model.java
@@ -0,0 +1,81 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ModelVer.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ModelVer.java
new file mode 100644
index 0000000..925a875
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ModelVer.java
@@ -0,0 +1,107 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ModelVers.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ModelVers.java
new file mode 100644
index 0000000..f49c6fe
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ModelVers.java
@@ -0,0 +1,48 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+@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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/OwningEntity.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/OwningEntity.java
new file mode 100644
index 0000000..6484bad
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/OwningEntity.java
@@ -0,0 +1,55 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/OwningEntityResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/OwningEntityResponse.java
new file mode 100644
index 0000000..767a628
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/OwningEntityResponse.java
@@ -0,0 +1,47 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/PnfProperties.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/PnfProperties.java
new file mode 100644
index 0000000..4d6a6b0
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/PnfProperties.java
@@ -0,0 +1,73 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.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.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/PnfResult.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/PnfResult.java
new file mode 100644
index 0000000..3057019
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/PnfResult.java
@@ -0,0 +1,71 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.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.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+import org.onap.osam.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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/PortDetailsTranslator.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/PortDetailsTranslator.java
new file mode 100644
index 0000000..10612f8
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/PortDetailsTranslator.java
@@ -0,0 +1,160 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.google.common.collect.ImmutableList;

+import org.onap.osam.aai.AaiResponse;

+import org.onap.osam.properties.Features;

+import org.togglz.core.manager.FeatureManager;

+

+import javax.inject.Inject;

+import java.util.LinkedList;

+import java.util.List;

+import java.util.Optional;

+import java.util.function.Predicate;

+import java.util.stream.Collectors;

+

+public class PortDetailsTranslator {

+

+    @Inject

+    FeatureManager featureManager;

+

+    public static class PortDetailsOk extends PortDetails {

+

+        private final String interfaceId;

+        private final String interfaceName;

+        private final boolean isPortMirrored;

+

+        public PortDetailsOk(String interfaceId, String interfaceName, boolean isPortMirrored) {

+            this.interfaceId = interfaceId;

+            this.interfaceName = interfaceName;

+            this.isPortMirrored = isPortMirrored;

+        }

+

+        public String getInterfaceId() {

+            return interfaceId;

+        }

+

+        public String getInterfaceName() {

+            return interfaceName;

+        }

+

+        public boolean getIsPortMirrored() {

+            return isPortMirrored;

+        }

+    }

+

+    public abstract static class PortDetails {

+    }

+

+    public static class PortDetailsError extends PortDetails {

+        private final String errorDescription;

+        private final String rawAaiResponse;

+

+        public PortDetailsError(String errorDescription, String rawAaiResponse){

+           this.errorDescription = errorDescription;

+           this.rawAaiResponse = rawAaiResponse;

+        }

+

+        public String getErrorDescription() {

+            return errorDescription;

+        }

+

+        public String getRawAaiResponse() {

+            return rawAaiResponse;

+        }

+    }

+

+    public static PortDetails extractPortDetailsFromProperties(Properties properties, String rawPayload){

+        List<String> errorDescriptions = new LinkedList<>();

+        describeIfNullOrEmpty("interface-id", properties.getInterfaceId(), errorDescriptions);

+        describeIfNullOrEmpty("interface-name", properties.getInterfaceName(), errorDescriptions);

+        describeIfNullOrEmpty("is-port-mirrored", properties.getIsPortMirrored(), errorDescriptions);

+

+        if(errorDescriptions.isEmpty()){

+            return new PortDetailsOk(properties.getInterfaceId(), properties.getInterfaceName(), properties.getIsPortMirrored());

+        } else {

+            return new PortDetailsError(String.join(" ", errorDescriptions), rawPayload);

+        }

+    }

+

+    private static void describeIfNullOrEmpty(String name, Object value, List<String> errorDescriptions) {

+        if (value == null) {

+            errorDescriptions.add("Value of '" + name + "' is missing.");

+        } else if (value.toString().isEmpty()) {

+            errorDescriptions.add("Value of '" + name + "' is empty.");

+        }

+    }

+

+    private static Optional<List<PortDetails>> extractErrorResponseIfHttpError(AaiResponse aaiResponse, String rawPayload) {

+        if (aaiResponse.getHttpCode() != org.springframework.http.HttpStatus.OK.value()) {

+            final String errorMessage = aaiResponse.getErrorMessage();

+            return Optional.of(ImmutableList.of(new PortDetailsError(

+                    "Got " + aaiResponse.getHttpCode() + " from aai",

+                    errorMessage != null ? errorMessage.toString() : rawPayload)

+            ));

+        } else {

+            return Optional.empty();

+        }

+    }

+

+    public List<PortDetails> extractPortDetailsInternal(AaiGetPortMirroringSourcePorts aaiGetPortsResponse, String rawPayload){

+        List<SimpleResult> filteredResult = getFilteredPortList(aaiGetPortsResponse.getResults());

+

+        return filteredResult.stream()

+                .map(SimpleResult::getProperties)

+                .map(p -> extractPortDetailsFromProperties(p, rawPayload))

+                .collect(Collectors.toList());

+    }

+

+    public List<SimpleResult> getFilteredPortList(List<SimpleResult> results) {

+        String LINTERFACE = "l-interface";

+

+        final Predicate<SimpleResult> ifIsPort = (SimpleResult r) -> LINTERFACE.equals(r.getNodeType());

+        Predicate<SimpleResult> ifIsSource = getIsSourcePredicate();

+

+        return results.stream()

+                .filter(ifIsPort)

+                .filter(ifIsSource)

+                .collect(Collectors.toList());

+    }

+

+    private Predicate<SimpleResult> getIsSourcePredicate() {

+        boolean FLAG_ADVANCED_PORTS_FILTER = featureManager.isActive(Features.FLAG_ADVANCED_PORTS_FILTER);

+

+        if (FLAG_ADVANCED_PORTS_FILTER) {

+            String PORT_LABEL = "org.onap.relationships.inventory.Source";

+            return (SimpleResult r) -> r.getRelatedTo().stream()

+                    .anyMatch(relatedTo -> PORT_LABEL.equalsIgnoreCase(relatedTo.getRelationshipLabel()));

+        } else {

+            return (SimpleResult r) -> true;

+        }

+    }

+

+    public List<PortDetails> extractPortDetails(AaiResponse<AaiGetPortMirroringSourcePorts> aaiGetPortsResponse, String rawPayload){

+        return extractErrorResponseIfHttpError(aaiGetPortsResponse, rawPayload).orElseGet(() -> extractPortDetailsInternal(aaiGetPortsResponse.getT(), rawPayload));

+

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Project.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Project.java
new file mode 100644
index 0000000..dc6e219
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Project.java
@@ -0,0 +1,40 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ProjectResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ProjectResponse.java
new file mode 100644
index 0000000..1067bff
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ProjectResponse.java
@@ -0,0 +1,47 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Properties.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Properties.java
new file mode 100644
index 0000000..644c429
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Properties.java
@@ -0,0 +1,56 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class Properties {

+

+    private final String interfaceName;

+    private final String interfaceId;

+    private final Boolean isPortMirrored;

+

+    public Properties(

+            @JsonProperty("interface-name") String interfaceName,

+            @JsonProperty("interface-id") String interfaceId,

+            @JsonProperty("is-port-mirrored") Boolean isPortMirrored) {

+        this.interfaceName = interfaceName;

+        this.interfaceId = interfaceId;

+        this.isPortMirrored = isPortMirrored;

+    }

+

+    public String getInterfaceName() {

+        return interfaceName;

+    }

+

+    public String getInterfaceId() {

+        return interfaceId;

+    }

+

+    public Boolean getIsPortMirrored() {

+        return isPortMirrored;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelatedTo.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelatedTo.java
new file mode 100644
index 0000000..37d622e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelatedTo.java
@@ -0,0 +1,61 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class RelatedTo {

+    private final String id;

+    private final String relationshipLabel;

+    private final String nodeType;

+    private final String url;

+

+    public RelatedTo(

+            @JsonProperty("id") String id,

+            @JsonProperty("relationship-label") String relationshipLabel,

+            @JsonProperty("node-type") String nodeType,

+            @JsonProperty("url") String url) {

+        this.id = id;

+        this.relationshipLabel = relationshipLabel;

+        this.nodeType = nodeType;

+        this.url = url;

+    }

+

+    public String getId() {

+        return id;

+    }

+

+    public String getRelationshipLabel() {

+        return relationshipLabel;

+    }

+

+    public String getNodeType() {

+        return nodeType;

+    }

+

+    public String getUrl() {

+        return url;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelatedToProperty.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelatedToProperty.java
new file mode 100644
index 0000000..036a663
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelatedToProperty.java
@@ -0,0 +1,59 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Relationship.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Relationship.java
new file mode 100644
index 0000000..15f2e6a
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Relationship.java
@@ -0,0 +1,90 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelationshipData.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelationshipData.java
new file mode 100644
index 0000000..107ac3d
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelationshipData.java
@@ -0,0 +1,52 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+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;

+	}

+

+	public String relationshipKey;

+	

+	public String relationshipValue;

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelationshipList.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelationshipList.java
new file mode 100644
index 0000000..c2cd4be
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/RelationshipList.java
@@ -0,0 +1,48 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class RelationshipList {

+	

+	@JsonProperty("relationship")

+	public List<Relationship> getRelationship() {

+		return relationship;

+	}

+	

+	@JsonProperty("relationship")

+	public void setRelationship(List<Relationship> relationship) {

+		this.relationship = relationship;

+	}

+

+	public List<Relationship> relationship;

+	

+	

+	

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ResourceType.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ResourceType.java
new file mode 100644
index 0000000..bbe0ed5
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ResourceType.java
@@ -0,0 +1,66 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.JsonCreator;

+

+import java.util.Map;

+import java.util.Optional;

+import java.util.function.Function;

+import java.util.stream.Collectors;

+import java.util.stream.Stream;

+

+public enum ResourceType {

+

+    SERVICE_INSTANCE("service-instance", "service-instance-name"),

+    GENERIC_VNF("generic-vnf", "vnf-name"),

+    VF_MODULE("vf-module", "vf-module-name"),

+    VOLUME_GROUP("volume-group", "volume-group-name");

+

+    private static Map<String, ResourceType> AAI_FORMAT_MAP = Stream

+            .of(ResourceType.values())

+            .collect(Collectors.toMap(s -> s.aaiFormat, Function.identity()));

+

+    private final String aaiFormat;

+    private final String nameFilter;

+

+    ResourceType(String formatted, String nameFilter) {

+        this.aaiFormat = formatted;

+        this.nameFilter = nameFilter;

+    }

+

+    public String getAaiFormat() {

+        return aaiFormat;

+    }

+

+    public String getNameFilter() {

+        return nameFilter;

+    }

+

+    @JsonCreator

+    public static ResourceType fromString(String string) {

+        return Optional

+                .ofNullable(AAI_FORMAT_MAP.get(string))

+                .orElseThrow(() -> new IllegalArgumentException(string));

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Result.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Result.java
new file mode 100644
index 0000000..d50603f
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Result.java
@@ -0,0 +1,46 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+@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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceInstance.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceInstance.java
new file mode 100644
index 0000000..a6fbb50
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceInstance.java
@@ -0,0 +1,48 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceInstances.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceInstances.java
new file mode 100644
index 0000000..6c2de4a
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceInstances.java
@@ -0,0 +1,34 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+public class ServiceInstances {

+	

+	@JsonProperty("service-instance")

+	public List<ServiceInstance> serviceInstance;

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceProperties.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceProperties.java
new file mode 100644
index 0000000..bd8d26e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceProperties.java
@@ -0,0 +1,111 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.*;

+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")

+    public String serviceInstanceId;

+    @JsonProperty("service-instance-name")

+    public String serviceInstanceName;

+    @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("global-customer-id")

+    public String globalCustomerId;

+    @JsonProperty("subscriber-name")

+    public String subscriberName;

+    @JsonProperty("subscriber-type")

+    public String subscriberType;

+    @JsonProperty("vnf-id")

+    public String vnfId;

+    @JsonProperty("vnf-name")

+    public String vnfName;

+    @JsonProperty("vnf-type")

+    public String vnfType;

+    @JsonProperty("service-id")

+    public String serviceId;

+    @JsonProperty("prov-status")

+    public String provStatus;

+    @JsonProperty("in-maint")

+    public Boolean inMaint;

+    @JsonProperty("is-closed-loop-disabled")

+    public Boolean isClosedLoopDisabled;

+    @JsonProperty("model-customization-id")

+    public String modelCustomizationId;

+    @JsonProperty("nf-type")

+    public String nfType;

+    @JsonProperty("nf-function")

+    public String nfFunction;

+    @JsonProperty("nf-role")

+    public String nfRole;

+    @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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceRelationships.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceRelationships.java
new file mode 100644
index 0000000..e7c2fc1
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceRelationships.java
@@ -0,0 +1,124 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceSubscription.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceSubscription.java
new file mode 100644
index 0000000..077903d
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/ServiceSubscription.java
@@ -0,0 +1,40 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+

+import com.fasterxml.jackson.annotation.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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Services.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Services.java
new file mode 100644
index 0000000..367ee42
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/Services.java
@@ -0,0 +1,47 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+import java.util.List;

+

+

+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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/SimpleResult.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/SimpleResult.java
new file mode 100644
index 0000000..92189b0
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/SimpleResult.java
@@ -0,0 +1,108 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.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.JsonProperty;

+

+import java.util.HashMap;

+import java.util.List;

+import java.util.Map;

+

+public class SimpleResult {

+    @JsonProperty("id")

+    private String id;

+    @JsonProperty("node-type")

+    private String nodeType;

+    @JsonProperty("url")

+    private String url;

+    @JsonProperty("properties")

+    private Properties properties;

+    @JsonProperty("related-to")

+    private List<RelatedTo> relatedTo = null;

+    @JsonIgnore

+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

+

+    @JsonProperty("id")

+    public String getId() {

+        return id;

+    }

+

+    @JsonProperty("id")

+    public void setId(String id) {

+        this.id = id;

+    }

+

+    @JsonProperty("node-type")

+    public String getNodeType() {

+        return nodeType;

+    }

+

+    @JsonProperty("node-type")

+    public void setNodeType(String nodeType) {

+        this.nodeType = nodeType;

+    }

+

+    @JsonProperty("url")

+    public String getUrl() {

+        return url;

+    }

+

+    @JsonProperty("url")

+    public void setUrl(String url) {

+        this.url = url;

+    }

+

+    @JsonProperty("properties")

+    public Properties getProperties() {

+        return properties;

+    }

+

+    @JsonProperty("properties")

+    public void setProperties(Properties properties) {

+        this.properties = properties;

+    }

+

+    @JsonProperty("related-to")

+    public List<RelatedTo> getRelatedTo() {

+        return relatedTo;

+    }

+

+    @JsonProperty("related-to")

+    public void setRelatedTo(List<RelatedTo> relatedTo) {

+        this.relatedTo = relatedTo;

+    }

+

+    @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/onap-enabler-be/src/main/java/org/onap/osam/aai/model/VnfResult.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/VnfResult.java
new file mode 100644
index 0000000..9d4e0a2
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/model/VnfResult.java
@@ -0,0 +1,65 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.model;

+

+import com.fasterxml.jackson.annotation.*;

+import org.onap.osam.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;

+    @JsonProperty("node-type")

+    public String nodeType;

+    @JsonProperty("url")

+    public String url;

+    @JsonProperty("properties")

+    public ServiceProperties properties;

+    @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/onap-enabler-be/src/main/java/org/onap/osam/aai/util/AAIProperties.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/AAIProperties.java
new file mode 100644
index 0000000..cc5c1cf
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/AAIProperties.java
@@ -0,0 +1,66 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.util;

+

+

+import org.onap.portalsdk.core.util.SystemProperties;

+

+public class AAIProperties extends SystemProperties {

+

+	//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/onap-enabler-be/src/main/java/org/onap/osam/aai/util/AAIRestInterface.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/AAIRestInterface.java
new file mode 100644
index 0000000..8a69076
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/AAIRestInterface.java
@@ -0,0 +1,355 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.util;

+

+

+import com.att.eelf.configuration.EELFLogger;

+import org.apache.commons.lang3.exception.ExceptionUtils;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.osam.aai.ExceptionWithRequestInfo;

+import org.onap.osam.aai.ResponseWithRequestInfo;

+import org.onap.osam.aai.exceptions.InvalidPropertyException;

+import org.onap.osam.utils.Logging;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.HttpMethod;

+

+import javax.ws.rs.client.Client;

+import javax.ws.rs.client.Entity;

+import javax.ws.rs.client.Invocation;

+import javax.ws.rs.core.MediaType;

+import javax.ws.rs.core.Response;

+import java.io.UnsupportedEncodingException;

+import java.net.URLEncoder;

+import java.util.Optional;

+import java.util.UUID;

+

+import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;

+import static org.onap.osam.utils.Logging.REQUEST_ID_HEADER_KEY;

+

+

+public class AAIRestInterface {

+

+	protected EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AAIRestInterface.class);

+

+	protected final EELFLogger outgoingRequestsLogger = Logging.getRequestsLogger("aai");

+

+

+	/** The client. */

+	private Client client = null;

+

+	/** The rest srvr base URL. */

+	private String restSrvrBaseURL;

+

+	@Autowired

+	protected HttpsAuthClient httpsAuthClientFactory;

+	private final ServletRequestHelper servletRequestHelper;

+	private final SystemPropertyHelper systemPropertyHelper;

+

+	protected static final String START_STRING = " start";

+	protected static final String TRANSACTION_ID_HEADER = "X-TransactionId";

+	protected static final String FROM_APP_ID_HEADER = "X-FromAppId";

+	protected static final String SUCCESSFUL_API_MESSAGE = " REST api call was successful!";

+	protected static final String URL_DECLARATION = ", url=";

+

+	public AAIRestInterface(HttpsAuthClient httpsAuthClientFactory, ServletRequestHelper servletRequestHelper, SystemPropertyHelper systemPropertyHelper) {

+		this.httpsAuthClientFactory = httpsAuthClientFactory;

+		this.servletRequestHelper = servletRequestHelper;

+		this.systemPropertyHelper = systemPropertyHelper;

+		initRestClient();

+	}

+

+	/**

+	 * For testing purpose

+	 */

+	AAIRestInterface(Optional<Client> client,

+					 HttpsAuthClient httpsAuthClientFactory, ServletRequestHelper servletRequestHelper, SystemPropertyHelper systemPropertyHelper){

+		this.httpsAuthClientFactory = httpsAuthClientFactory;

+		this.servletRequestHelper = servletRequestHelper;

+		this.systemPropertyHelper = systemPropertyHelper;

+		if (client != null && client.isPresent()){

+			this.client = client.get();

+		}

+

+	}

+

+	/**

+	 * 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");

+	}

+

+    private void initRestClient() {

+        initRestClient(false);

+    }

+

+

+	private void initRestClient(boolean propagateExceptions) {

+		if (client == null) {

+			try {

+				client = httpsAuthClientFactory.getClient(HttpClientMode.WITH_KEYSTORE);

+			} catch (Exception e) {

+				logger.info(EELFLoggerDelegate.errorLogger, "Exception in REST call to DB in initRestClient" + e.toString());

+				logger.debug(EELFLoggerDelegate.debugLogger, "Exception in REST call to DB : " + e.toString());

+				if (propagateExceptions) {

+					ExceptionUtils.rethrow(e);

+				}

+			}

+		}

+	}

+

+

+

+	/**

+	 * Sets the rest srvr base URL.

+	 *

+	 * @param baseURL the base URL

+	 */

+	public void SetRestSrvrBaseURL(String baseURL)

+	{

+		if (baseURL == null) {

+			logger.info(EELFLoggerDelegate.errorLogger, "REST Server base URL cannot be null.");

+			logger.debug(EELFLoggerDelegate.debugLogger, "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

+	 */

+	public ResponseWithRequestInfo RestGet(String fromAppId, String transId, String requestUri, boolean xml) {

+		return RestGet(fromAppId, transId, requestUri, xml, false);

+	}

+

+	public ResponseWithRequestInfo RestGet(String fromAppId, String transId, String requestUri, boolean xml, boolean propagateExceptions) {

+        String methodName = "RestGet";

+		String url = systemPropertyHelper.getFullServicePath(requestUri);

+		try {

+			initRestClient(propagateExceptions);

+

+			logger.debug(EELFLoggerDelegate.debugLogger, methodName + START_STRING);

+			logger.debug(EELFLoggerDelegate.debugLogger, url + " for the get REST API");

+

+			Logging.logRequest(outgoingRequestsLogger, HttpMethod.GET, url);

+

+			final Response response;

+            Invocation.Builder requestBuilder = client.target(url)

+                    .request()

+                    .accept(xml ? MediaType.APPLICATION_XML : MediaType.APPLICATION_JSON)

+                    .header(TRANSACTION_ID_HEADER, transId)

+                    .header(FROM_APP_ID_HEADER, fromAppId)

+                    .header("Content-Type", MediaType.APPLICATION_JSON)

+                    .header(REQUEST_ID_HEADER_KEY, extractOrGenerateRequestId());

+            response = systemPropertyHelper.isClientCertEnabled() ?

+                    requestBuilder.get() : authenticateRequest(requestBuilder).get();

+			Logging.logResponse(outgoingRequestsLogger, HttpMethod.GET, url, response);

+

+			if (response.getStatusInfo().equals(Response.Status.OK)) {

+				logger.debug(EELFLoggerDelegate.debugLogger, methodName + SUCCESSFUL_API_MESSAGE);

+				logger.info(EELFLoggerDelegate.errorLogger, methodName + SUCCESSFUL_API_MESSAGE);

+			} else {

+				logger.debug(EELFLoggerDelegate.debugLogger, getInvalidResponseLogMessage(url, methodName, response));

+			}

+			return new ResponseWithRequestInfo(response, url, HttpMethod.GET);

+		} catch (Exception e) {

+			logger.debug(EELFLoggerDelegate.debugLogger, getFailedResponseLogMessage(url, methodName, e));

+			if (propagateExceptions) {

+                throw new ExceptionWithRequestInfo(HttpMethod.GET, defaultIfNull(url, requestUri), e);

+            } else {

+                return new ResponseWithRequestInfo(null, url, HttpMethod.GET);

+            }

+		}

+	}

+

+	protected String extractOrGenerateRequestId() {

+		return servletRequestHelper.extractOrGenerateRequestId();

+	}

+

+

+	/**

+	 * 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";

+		transId += ":" + UUID.randomUUID().toString();

+		logger.debug(methodName + START_STRING);

+		Boolean response = false;

+		String url = systemPropertyHelper.getFullServicePath(path);;

+		try {

+

+			initRestClient();

+			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(REQUEST_ID_HEADER_KEY, extractOrGenerateRequestId())

+					.delete();

+			Logging.logResponse(outgoingRequestsLogger, HttpMethod.DELETE, url, cres);

+			if (cres.getStatusInfo().equals(Response.Status.NOT_FOUND)) {

+				logger.debug(EELFLoggerDelegate.debugLogger, "Resource does not exist...: " + cres.getStatus()

+						+ ":" + cres.readEntity(String.class));

+				response = false;

+			} else if (cres.getStatusInfo().equals(Response.Status.OK) || cres.getStatusInfo().equals(Response.Status.NO_CONTENT)) {

+				logger.debug(EELFLoggerDelegate.debugLogger, "Resource " + url + " deleted");

+				logger.info(EELFLoggerDelegate.errorLogger, "Resource " + url + " deleted");

+				response = true;

+			} else {

+				logger.debug(EELFLoggerDelegate.debugLogger, "Deleting Resource failed: " + cres.getStatus()

+						+ ":" + cres.readEntity(String.class));

+				response = false;

+			}

+

+		} catch (Exception e) {

+			logger.debug(EELFLoggerDelegate.debugLogger, getFailedResponseLogMessage(url, methodName, e));

+		}

+		return response;

+	}

+

+

+	/**

+	 * Rest put.

+	 *

+	 * @param fromAppId the from app id

+	 * @param path the path

+	 * @param payload the payload

+	 * @param xml the xml

+	 * @return the string

+	 */

+	public Response RestPut(String fromAppId, String path, String payload, boolean xml) {

+		String methodName = "RestPut";

+		String url=systemPropertyHelper.getFullServicePath(path);

+		String transId = UUID.randomUUID().toString();

+		logger.debug(EELFLoggerDelegate.debugLogger, methodName + START_STRING);

+

+        Response response = null;

+		try {

+			initRestClient();

+			Logging.logRequest(outgoingRequestsLogger, HttpMethod.PUT, url, payload);

+			response = authenticateRequest(client.target(url)

+					.request()

+                    .accept(xml ? MediaType.APPLICATION_XML : MediaType.APPLICATION_JSON)

+					.header(TRANSACTION_ID_HEADER, transId)

+					.header(FROM_APP_ID_HEADER,  fromAppId))

+					.header(REQUEST_ID_HEADER_KEY, extractOrGenerateRequestId())

+					.put(Entity.entity(payload, MediaType.APPLICATION_JSON));

+			Logging.logResponse(outgoingRequestsLogger, HttpMethod.PUT, url, response);

+

+			if (response.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {

+				logger.info(EELFLoggerDelegate.errorLogger, getValidResponseLogMessage(methodName));

+				logger.debug(EELFLoggerDelegate.debugLogger, getValidResponseLogMessage(methodName));

+			} else {

+				logger.debug(EELFLoggerDelegate.debugLogger, getInvalidResponseLogMessage(url, methodName, response));

+			}

+		} catch (Exception e) {

+			logger.debug(EELFLoggerDelegate.debugLogger, getFailedResponseLogMessage(url, methodName, e));

+		}

+		return response;

+	}

+

+

+

+	/**

+	 * Rest post.

+	 *

+	 * @param fromAppId the from app id

+	 * @param path the path

+	 * @param payload the payload

+	 * @param xml the xml

+	 * @return the string

+	 */

+	public Response RestPost(String fromAppId, String path, String payload, boolean xml) {

+		String methodName = "RestPost";

+		String url=systemPropertyHelper.getServiceBasePath(path);

+		String transId = UUID.randomUUID().toString();

+		logger.debug(EELFLoggerDelegate.debugLogger, methodName + START_STRING);

+

+        Response response = null;

+		try {

+			initRestClient();

+			Logging.logRequest(outgoingRequestsLogger, HttpMethod.POST, url, payload);

+			response = authenticateRequest(client.target(systemPropertyHelper.getServiceBasePath(path))

+					.request()

+                    .accept(xml ? MediaType.APPLICATION_XML : MediaType.APPLICATION_JSON)

+					.header(TRANSACTION_ID_HEADER, transId)

+					.header(FROM_APP_ID_HEADER,  fromAppId))

+					.header(REQUEST_ID_HEADER_KEY, extractOrGenerateRequestId())

+					.post(Entity.entity(payload, MediaType.APPLICATION_JSON));

+			Logging.logResponse(outgoingRequestsLogger, HttpMethod.POST, url, response);

+

+			if (response.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)) {

+				logger.info(EELFLoggerDelegate.errorLogger, getValidResponseLogMessage(methodName));

+				logger.debug(EELFLoggerDelegate.debugLogger, getValidResponseLogMessage(methodName));

+			} else {

+				logger.debug(EELFLoggerDelegate.debugLogger, getInvalidResponseLogMessage(url, methodName, response));

+			}

+		} catch (Exception e) {

+			logger.debug(EELFLoggerDelegate.debugLogger, getFailedResponseLogMessage(url, methodName, e));

+		}

+		return response;

+	}

+

+	protected String getFailedResponseLogMessage(String path, String methodName, Exception e) {

+		return methodName + URL_DECLARATION + path + ", Exception: " + e.toString();

+	}

+

+	protected String getValidResponseLogMessage(String methodName) {

+		return methodName + URL_DECLARATION;

+	}

+

+	protected String getInvalidResponseLogMessage(String path, String methodName, Response cres) {

+		return methodName + " with status=" + cres.getStatus() + URL_DECLARATION + path;

+	}

+

+	private Invocation.Builder authenticateRequest(Invocation.Builder requestBuilder) throws InvalidPropertyException, UnsupportedEncodingException {

+		return requestBuilder

+				.header("Authorization", "Basic " + systemPropertyHelper.getEncodedCredentials());

+	}

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/util/CustomJacksonJaxBJsonProvider.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/CustomJacksonJaxBJsonProvider.java
new file mode 100644
index 0000000..19c8f6b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/CustomJacksonJaxBJsonProvider.java
@@ -0,0 +1,71 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.util;

+

+

+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;

+

+import javax.ws.rs.ext.Provider;

+

+@Provider

+public class CustomJacksonJaxBJsonProvider extends JacksonJaxbJsonProvider {

+

+    	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/onap-enabler-be/src/main/java/org/onap/osam/aai/util/HttpClientMode.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/HttpClientMode.java
new file mode 100644
index 0000000..fb68947
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/HttpClientMode.java
@@ -0,0 +1,31 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.util;

+

+public enum HttpClientMode {

+

+    WITH_KEYSTORE,

+    WITHOUT_KEYSTORE(),

+    UNSECURE,

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/util/HttpsAuthClient.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/HttpsAuthClient.java
new file mode 100644
index 0000000..bbac7e4
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/HttpsAuthClient.java
@@ -0,0 +1,123 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.util;

+

+

+import org.glassfish.jersey.client.ClientConfig;

+import org.glassfish.jersey.client.HttpUrlConnectorProvider;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.osam.aai.exceptions.HttpClientBuilderException;

+

+import javax.net.ssl.HttpsURLConnection;

+import javax.ws.rs.client.Client;

+import javax.ws.rs.client.ClientBuilder;

+import java.io.IOException;

+import java.nio.file.FileSystems;

+import java.security.GeneralSecurityException;

+

+import static org.onap.osam.aai.util.HttpClientMode.WITH_KEYSTORE;

+

+public class HttpsAuthClient {

+

+    private static final String SSL_TRUST_STORE = "javax.net.ssl.trustStore";

+    private static final String SSL_TRUST_STORE_PASS_WORD = "javax.net.ssl.trustStorePassword";

+

+    private final SystemPropertyHelper systemPropertyHelper;

+    private final SSLContextProvider sslContextProvider;

+

+    public HttpsAuthClient(String certFilePath, SystemPropertyHelper systemPropertyHelper, SSLContextProvider sslContextProvider) {

+        this.certFilePath = certFilePath;

+        this.systemPropertyHelper = systemPropertyHelper;

+        this.sslContextProvider = sslContextProvider;

+    }

+

+    private final String certFilePath;

+

+    static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HttpsAuthClient.class);

+

+

+    /**

+     * Gets the client.

+     *

+     * @return the client

+     */

+    public Client getClient(HttpClientMode mode) throws GeneralSecurityException, IOException {

+        ClientConfig config = prepareClientConfig(mode);

+

+        try {

+            setSystemProperties();

+

+            ignoreHostname();

+

+            return systemPropertyHelper.isClientCertEnabled() ?

+                    getTrustedClient(config, getKeystorePath(), systemPropertyHelper.getDecryptedKeystorePassword(), mode)

+                    : getUntrustedClient(config);

+

+        } catch (Exception e) {

+            logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up config", e);

+            throw e;

+        }

+

+    }

+

+    private void ignoreHostname() {

+        HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true);

+    }

+

+    private Client getUntrustedClient(ClientConfig config) {

+        return ClientBuilder.newBuilder().withConfig(config).build().register(CustomJacksonJaxBJsonProvider.class);

+    }

+

+    private Client getTrustedClient(ClientConfig config, String keystorePath, String keystorePassword, HttpClientMode httpClientMode) throws HttpClientBuilderException {

+        return ClientBuilder.newBuilder()

+                .sslContext(sslContextProvider.getSslContext(keystorePath, keystorePassword, httpClientMode))

+                .hostnameVerifier((s, sslSession) -> true)

+                .withConfig(config)

+                .build()

+                .register(CustomJacksonJaxBJsonProvider.class);

+    }

+

+    private String getKeystorePath() {

+        return getCertificatesPath() + FileSystems.getDefault().getSeparator() + systemPropertyHelper.getAAIKeystoreFilename();

+    }

+

+    private void setSystemProperties() {

+        System.setProperty(SSL_TRUST_STORE, getCertificatesPath() + FileSystems.getDefault().getSeparator() +

+                systemPropertyHelper.getAAITruststoreFilename().orElse(""));

+        System.setProperty(SSL_TRUST_STORE_PASS_WORD, systemPropertyHelper.getDecryptedTruststorePassword());

+    }

+

+    private ClientConfig prepareClientConfig(HttpClientMode mode) {

+        ClientConfig config = new ClientConfig();

+        if (mode.equals(WITH_KEYSTORE)) {

+            config.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, Boolean.TRUE);

+            config.connectorProvider(new HttpUrlConnectorProvider().useSetMethodWorkaround());

+        }

+        return config;

+    }

+

+    private String getCertificatesPath() {

+        return certFilePath;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/util/HttpsComponentsClient.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/HttpsComponentsClient.java
new file mode 100644
index 0000000..9e7e3d6
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/HttpsComponentsClient.java
@@ -0,0 +1,109 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.util;

+

+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;

+import org.apache.http.conn.ssl.SSLContextBuilder;

+import org.apache.http.impl.client.CloseableHttpClient;

+import org.apache.http.impl.client.HttpClients;

+import org.eclipse.jetty.util.security.Password;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+

+import javax.net.ssl.SSLContext;

+import java.io.FileInputStream;

+import java.security.GeneralSecurityException;

+import java.security.KeyManagementException;

+import java.security.KeyStore;

+

+

+public class HttpsComponentsClient{

+

+	static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HttpsComponentsClient.class);

+

+	public static CloseableHttpClient getClient(String certFilePath) {

+		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");

+			char[] pwd = decrypted_keystore_password.toCharArray();

+

+			try(FileInputStream fin = new FileInputStream(keystore_path)) {

+				ks.load(fin, pwd);

+			}

+			catch (Exception e) {

+				logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up keystore");

+				logger.error(EELFLoggerDelegate.errorLogger, "Error loading  keystore materials: (keystore path: {}, obfuascated keystore password: {})", keystore_path, keystore_password);

+				throw new GenericUncheckedException(e);

+			}

+

+			sslContextB.loadKeyMaterial(ks, pwd);

+			

+			KeyStore ts = KeyStore.getInstance("JKS");

+			char[] pwd1 = decrypted_truststore_password.toCharArray();

+

+			try(FileInputStream fin1 = new FileInputStream(truststore_path)) {

+				ts.load(fin1, pwd1);

+			}

+			catch (Exception e) {

+				logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up truststore");

+				logger.error(EELFLoggerDelegate.errorLogger, "Error loading  truststore materials: (truststore path: {}, obfuascated truststore password: {})", truststore_path, truststore_password);

+				throw new GenericUncheckedException(e);

+			}

+

+			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 (GeneralSecurityException e) {

+			throw new GenericUncheckedException(e);

+		}

+		return httpclient;

+	}

+

+

+	

+}  

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/util/JettyObfuscationConversionCommandLineUtil.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/JettyObfuscationConversionCommandLineUtil.java
new file mode 100644
index 0000000..05e3f80
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/JettyObfuscationConversionCommandLineUtil.java
@@ -0,0 +1,68 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.util;

+

+

+import org.apache.commons.cli.*;

+import org.eclipse.jetty.util.security.Password;

+

+

+public class JettyObfuscationConversionCommandLineUtil {

+	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());

+		}

+	}

+	

+	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");

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/util/SSLContextProvider.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/SSLContextProvider.java
new file mode 100644
index 0000000..3706456
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/SSLContextProvider.java
@@ -0,0 +1,100 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.util;

+

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.osam.aai.exceptions.HttpClientBuilderException;

+

+import javax.net.ssl.*;

+import java.io.FileInputStream;

+import java.io.IOException;

+import java.security.GeneralSecurityException;

+import java.security.KeyStore;

+import java.security.cert.X509Certificate;

+

+public class SSLContextProvider {

+

+    private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SSLContextProvider.class);

+

+    public SSLContext getSslContext(String keystorePath, String keystorePassword, HttpClientMode httpClientMode) throws HttpClientBuilderException {

+        try {

+            final SSLContext ctx = SSLContext.getInstance("TLSv1.2");

+            KeyManager[] keyManagers = getKeyManagerFactory(keystorePath, keystorePassword, httpClientMode);

+            ctx.init(keyManagers, getTrustManager(httpClientMode), null);

+            return ctx;

+        } catch (IOException | GeneralSecurityException e) {

+            logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up ssl context.");

+            throw new HttpClientBuilderException(e);

+        }

+    }

+

+    private KeyManager[] getKeyManagerFactory(String keystorePath, String keystorePassword, HttpClientMode httpClientMode) throws IOException, GeneralSecurityException {

+        switch (httpClientMode) {

+            case WITH_KEYSTORE:

+                final KeyManagerFactory kmf;

+                try (FileInputStream fin = new FileInputStream(keystorePath)) {

+                    kmf = KeyManagerFactory.getInstance("SunX509");

+                    KeyStore ks = KeyStore.getInstance("PKCS12");

+                    char[] pwd = keystorePassword.toCharArray();

+                    ks.load(fin, pwd);

+                    kmf.init(ks, pwd);

+                } catch (Exception e) {

+                    logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up kmf");

+                    logger.error(EELFLoggerDelegate.errorLogger, "Error setting up kmf (keystore path: {}, deobfuascated keystore password: {})", keystorePath, keystorePassword, e);

+                    throw e;

+                }

+                return kmf.getKeyManagers();

+

+            case WITHOUT_KEYSTORE:

+                return null;

+

+            default:

+                logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up getKeyManagerFactory. HttpClientMode is " + httpClientMode);

+                throw new IllegalStateException("Error setting up getKeyManagerFactory. HttpClientMode is " + httpClientMode);

+        }

+    }

+

+    private TrustManager[] getTrustManager(HttpClientMode httpClientMode) {

+        //Creating a trustManager that will accept all certificates.

+        //TODO - remove this one the POMBA certificate is added to the tomcat_keystore file

+        TrustManager[] trustAllCerts = null;

+        if (httpClientMode == HttpClientMode.UNSECURE) {

+

+            trustAllCerts = new TrustManager[]{new X509TrustManager() {

+                public java.security.cert.X509Certificate[] getAcceptedIssuers() {

+                    return new java.security.cert.X509Certificate[]{};

+                }

+

+                public void checkClientTrusted(X509Certificate[] certs, String authType) {

+                    // trust all

+                }

+

+                public void checkServerTrusted(X509Certificate[] certs, String authType) {

+                    // trust all

+                }

+            }};

+        }

+        return trustAllCerts;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/util/ServletRequestHelper.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/ServletRequestHelper.java
new file mode 100644
index 0000000..20f0040
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/ServletRequestHelper.java
@@ -0,0 +1,32 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.util;

+

+import org.onap.osam.utils.Logging;

+

+public class ServletRequestHelper {

+

+    public String extractOrGenerateRequestId() {

+        return Logging.extractOrGenerateRequestId();

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/aai/util/SystemPropertyHelper.java b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/SystemPropertyHelper.java
new file mode 100644
index 0000000..34d7bcc
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/aai/util/SystemPropertyHelper.java
@@ -0,0 +1,100 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.aai.util;

+

+import org.eclipse.jetty.util.security.Password;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.onap.osam.aai.exceptions.InvalidPropertyException;

+

+import java.io.UnsupportedEncodingException;

+import java.util.Base64;

+import java.util.Optional;

+

+public class SystemPropertyHelper {

+

+    public Optional<String> getAAIUseClientCert(){

+        return getSystemProperty(AAIProperties.AAI_USE_CLIENT_CERT);

+    }

+

+    public Optional<String> getAAIServerUrl(){

+        return getSystemProperty(AAIProperties.AAI_SERVER_URL);

+    }

+

+    public Optional<String> getAAIServerBaseUrl(){

+        return getSystemProperty(AAIProperties.AAI_SERVER_URL_BASE);

+    }

+

+    public Optional<String> getAAIVIDUsername(){

+        return getSystemProperty(AAIProperties.AAI_VID_USERNAME);

+    }

+

+    public Optional<String> getAAIVIDPasswd(){

+        return getSystemProperty(AAIProperties.AAI_VID_PASSWD_X);

+    }

+

+    public Optional<String> getAAITruststorePasswd(){

+        return getSystemProperty(AAIProperties.AAI_TRUSTSTORE_PASSWD_X);

+    }

+

+    public Optional<String> getAAITruststoreFilename(){

+        return getSystemProperty(AAIProperties.AAI_TRUSTSTORE_FILENAME);

+    }

+

+    public Optional<String> getAAIKeystoreFilename(){

+        return getSystemProperty(AAIProperties.AAI_KEYSTORE_FILENAME);

+    }

+

+    public Optional<String> getAAIKeystorePasswd(){

+        return getSystemProperty(AAIProperties.AAI_KEYSTORE_PASSWD_X);

+    }

+

+    public boolean isClientCertEnabled() {

+        return getAAIUseClientCert().orElse("false").equalsIgnoreCase("true");

+    }

+

+    public String getFullServicePath(String path) {

+        return getAAIServerUrl().orElse("") + path;

+    }

+

+    public String getServiceBasePath(String path) {

+        return getAAIServerBaseUrl().orElse("") + path;

+    }

+

+    public String getEncodedCredentials() throws InvalidPropertyException, UnsupportedEncodingException {

+        String vidUsername = getAAIVIDUsername().orElseThrow(InvalidPropertyException::new);

+        String vidPassword = Password.deobfuscate(getAAIVIDPasswd().orElseThrow(InvalidPropertyException::new));

+        return Base64.getEncoder().encodeToString((vidUsername + ":" + vidPassword).getBytes("utf-8"));

+    }

+

+    public String getDecryptedTruststorePassword(){

+        return Password.deobfuscate(getAAITruststorePasswd().orElse(""));

+    }

+

+    public String getDecryptedKeystorePassword(){

+        return Password.deobfuscate(getAAIKeystorePasswd().orElse(""));

+    }

+

+    private Optional<String> getSystemProperty(String propertyKey){

+        return Optional.ofNullable(SystemProperties.getProperty(propertyKey));

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/client/HttpBasicClient.java b/onap-enabler-be/src/main/java/org/onap/osam/client/HttpBasicClient.java
new file mode 100644
index 0000000..171d2f0
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/client/HttpBasicClient.java
@@ -0,0 +1,63 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.client;

+

+

+import org.glassfish.jersey.client.ClientConfig;

+import org.glassfish.jersey.client.ClientProperties;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.springframework.beans.factory.annotation.Autowired;

+

+import javax.servlet.ServletContext;

+import javax.ws.rs.client.Client;

+import javax.ws.rs.client.ClientBuilder;

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+

+

+public class HttpBasicClient{

+	

+	@Autowired 

+	private ServletContext servletContext;

+	

+	/** The logger. */

+	EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HttpBasicClient.class);

+	

+	/** The Constant dateFormat. */

+	final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+	

+	/**

+	 * Obtain a basic HTTP client .

+	 *

+	 * @return Client client object

+	 * @throws Exception the exception

+	 */

+	public static Client getClient() {

+		

+		ClientConfig config = new ClientConfig();

+		config.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);

+		

+		return ClientBuilder.newClient(config)

+				.register(org.onap.osam.aai.util.CustomJacksonJaxBJsonProvider.class);

+	}	

+}  

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/client/HttpsBasicClient.java b/onap-enabler-be/src/main/java/org/onap/osam/client/HttpsBasicClient.java
new file mode 100644
index 0000000..b0fceb7
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/client/HttpsBasicClient.java
@@ -0,0 +1,109 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.client;

+

+import org.eclipse.jetty.util.security.Password;

+import org.glassfish.jersey.client.ClientConfig;

+import org.glassfish.jersey.client.ClientProperties;

+import org.onap.osam.properties.VidProperties;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+

+import javax.net.ssl.HostnameVerifier;

+import javax.net.ssl.HttpsURLConnection;

+import javax.net.ssl.SSLContext;

+import javax.net.ssl.SSLSession;

+import javax.ws.rs.client.Client;

+import javax.ws.rs.client.ClientBuilder;

+import java.io.File;

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.Date;

+

+ 

+public class HttpsBasicClient{

+	

+	static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HttpsBasicClient.class);

+	

+	/** The Constant dateFormat. */

+	final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+	

+	/**

+	 * Retrieve an SSL client.

+	 *

+	 * @return Client The SSL client

+	 * @throws Exception the exception

+	 */

+	public static Client getClient() {

+		String methodName = "getClient";

+		ClientConfig config = new ClientConfig();

+

+		SSLContext ctx = null;

+		

+		try {

+			

+			config.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);

+			

+			String truststore_path = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_FILENAME);

+			logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + " " + methodName + " truststore_path=" + truststore_path);

+			String truststore_password = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_PASSWD_X);

+			

+			

+			String decrypted_truststore_password = Password.deobfuscate(truststore_password);

+			//logger.debug(dateFormat.format(new Date()) + " " + methodName + " decrypted_truststore_password=" + decrypted_truststore_password);

+			

+			File tr = new File (truststore_path);

+			logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + " " + methodName + " absolute truststore path=" + tr.getAbsolutePath());

+			

+		    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;

+			    }

+			});

+	

+			//May need to make the algorithm a parameter. MSO requires TLSv1.1	or TLSv1.2

+			ctx = SSLContext.getInstance("TLSv1.2");

+

+			ctx.init(null, null, null);

+			//config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,

+			//							new HTTPSProperties( , ctx));

+			

+			return ClientBuilder.newBuilder()

+				.sslContext(ctx)

+				.hostnameVerifier(new HostnameVerifier() {

+					@Override

+					public boolean verify( String s, SSLSession sslSession ) {

+						return true;

+					}

+				}).withConfig(config)

+				.build()

+				.register(org.onap.osam.aai.util.CustomJacksonJaxBJsonProvider.class);

+			

+		} catch (Exception e) {

+			logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up config: exiting", e);

+			return null;

+		}

+	}

+}  

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/client/SyncRestClient.java b/onap-enabler-be/src/main/java/org/onap/osam/client/SyncRestClient.java
new file mode 100644
index 0000000..62d673c
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/client/SyncRestClient.java
@@ -0,0 +1,231 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.client;

+

+import io.joshworks.restclient.http.HttpResponse;

+import io.joshworks.restclient.http.JsonNode;

+import io.joshworks.restclient.http.RestClient;

+import io.joshworks.restclient.http.exceptions.RestClientException;

+import io.joshworks.restclient.http.mapper.ObjectMapper;

+import org.apache.http.impl.client.CloseableHttpClient;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;

+import org.apache.http.conn.ssl.TrustSelfSignedStrategy;

+import org.eclipse.jetty.util.security.Password;

+import org.apache.http.impl.client.HttpClients;

+import org.apache.http.conn.ssl.SSLContexts;

+import io.vavr.CheckedFunction1;

+import lombok.SneakyThrows;

+import lombok.val;

+

+import java.security.UnrecoverableKeyException;

+import java.security.NoSuchAlgorithmException;

+import java.security.KeyManagementException;

+import java.security.cert.CertificateException;

+import javax.net.ssl.SSLException;

+import java.security.KeyStoreException;

+import java.text.SimpleDateFormat;

+import javax.net.ssl.SSLContext;

+import java.io.FileInputStream;

+import java.security.KeyStore;

+import java.text.DateFormat;

+import java.io.InputStream;

+import java.io.IOException;

+import java.util.Date;

+import java.util.Map;

+import java.io.File;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.onap.osam.properties.VidProperties;

+

+public class SyncRestClient implements SyncRestClientInterface {

+

+    private static final String CANNOT_INITIALIZE_CUSTOM_HTTP_CLIENT = "Cannot initialize custom http client from current configuration. Using default one.";

+    private static final String TRY_TO_CALL_OVER_HTTP = "SSL Handshake problem occured. Will try to retry over Http.";

+    private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SyncRestClient.class);

+    private static final DateFormat DATE_FORMAT = new SimpleDateFormat("HH:mm:ss:SSSS");

+    private static final String[] SUPPORTED_SSL_VERSIONS = {"TLSv1", "TLSv1.2"};

+    private static final String HTTPS_SCHEMA = "https://";

+    private static final String HTTP_SCHEMA = "http://";

+

+    private RestClient restClient;

+

+    public SyncRestClient() {

+        restClient = RestClient.newClient().objectMapper(defaultObjectMapper()).httpClient(defaultHttpClient()).build();

+    }

+

+    public SyncRestClient(ObjectMapper objectMapper) {

+        restClient = RestClient.newClient().objectMapper(objectMapper).httpClient(defaultHttpClient()).build();

+    }

+

+    public SyncRestClient(CloseableHttpClient httpClient) {

+        restClient = RestClient.newClient().objectMapper(defaultObjectMapper()).httpClient(httpClient).build();

+    }

+

+    public SyncRestClient(CloseableHttpClient httpClient, ObjectMapper objectMapper) {

+        restClient = RestClient.newClient().objectMapper(objectMapper).httpClient(httpClient).build();

+    }

+

+    @Override

+    public HttpResponse<JsonNode> post(String url, Map<String, String> headers, Object body) {

+        return callWithRetryOverHttp(url, url2 -> restClient.post(url2).headers(headers).body(body).asJson());

+    }

+

+    @Override

+    public <T> HttpResponse<T> post(String url, Map<String, String> headers, Object body, Class<T> responseClass) {

+        return callWithRetryOverHttp(url,

+            url2 -> restClient.post(url2).headers(headers).body(body).asObject(responseClass));

+    }

+

+    @Override

+    public HttpResponse<JsonNode> get(String url, Map<String, String> headers, Map<String, String> routeParams) {

+        return callWithRetryOverHttp(url, url2 -> {

+            val getRequest = restClient.get(url2).headers(headers);

+            routeParams.forEach(getRequest::routeParam);

+            return getRequest.asJson();

+        });

+    }

+

+    @Override

+    public <T> HttpResponse<T> get(String url, Map<String, String> headers, Map<String, String> routeParams,

+        Class<T> responseClass) {

+        return callWithRetryOverHttp(url, url2 -> {

+            val getRequest = restClient.get(url2).headers(headers);

+            routeParams.forEach(getRequest::routeParam);

+            return getRequest.asObject(responseClass);

+        });

+    }

+

+    @Override

+    public HttpResponse<InputStream> getStream(String url, Map<String, String> headers,

+        Map<String, String> routeParams) {

+        return callWithRetryOverHttp(url, url2 -> {

+            val getRequest = restClient.get(url2).headers(headers);

+            routeParams.forEach(getRequest::routeParam);

+            return getRequest.asBinary();

+        });

+    }

+

+    @Override

+    public HttpResponse<JsonNode> put(String url, Map<String, String> headers, Object body) {

+        return callWithRetryOverHttp(url, url2 -> restClient.put(url2).headers(headers).body(body).asJson());

+    }

+

+    @Override

+    public <T> HttpResponse<T> put(String url, Map<String, String> headers, Object body, Class<T> responseClass) {

+        return callWithRetryOverHttp(url,

+            url2 -> restClient.put(url2).headers(headers).body(body).asObject(responseClass));

+    }

+

+    @Override

+    public <T> HttpResponse<T> delete(String url, Map<String, String> headers, Class<T> responseClass) {

+        return callWithRetryOverHttp(url, url2 -> restClient.delete(url2).headers(headers).asObject(responseClass));

+    }

+

+    @Override

+    public HttpResponse<JsonNode> delete(String url, Map<String, String> headers) {

+        return callWithRetryOverHttp(url, url2 -> restClient.delete(url2).headers(headers).asJson());

+    }

+

+    @Override

+    public void destroy() {

+        restClient.shutdown();

+    }

+

+    @SneakyThrows

+    private <T> HttpResponse<T> callWithRetryOverHttp(String url,

+                                                      CheckedFunction1<String, HttpResponse<T>> httpRequest) {

+        try {

+            return httpRequest.apply(url);

+        } catch (RestClientException e) {

+            if (e.getCause() instanceof SSLException) {

+                logger.warn(EELFLoggerDelegate.debugLogger,

+                        DATE_FORMAT.format(new Date()) + TRY_TO_CALL_OVER_HTTP, e);

+                return httpRequest.apply(url.replaceFirst(HTTPS_SCHEMA, HTTP_SCHEMA));

+            }

+            throw e;

+        }

+    }

+

+    private ObjectMapper defaultObjectMapper() {

+        val objectMapper = new com.fasterxml.jackson.databind.ObjectMapper();

+

+        return new ObjectMapper() {

+            @Override

+            @SneakyThrows

+            public <T> T readValue(String value, Class<T> aClass) {

+                return objectMapper.readValue(value, aClass);

+            }

+

+            @Override

+            @SneakyThrows

+            public String writeValue(Object value) {

+                return objectMapper.writeValueAsString(value);

+            }

+        };

+    }

+

+    private CloseableHttpClient defaultHttpClient() {

+        try {

+            val trustStorePath = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_FILENAME);

+            val trustStorePass = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_PASSWD_X);

+            val decryptedTrustStorePass = Password.deobfuscate(trustStorePass);

+

+            val trustStore = loadTruststore(trustStorePath, decryptedTrustStorePass);

+            val sslContext = trustOwnCACerts(decryptedTrustStorePass, trustStore);

+            val sslSf = allowTLSProtocols(sslContext);

+

+            return HttpClients.custom().setSSLSocketFactory(sslSf).build();

+        } catch (IOException | CertificateException | UnrecoverableKeyException | NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) {

+            logger.warn(EELFLoggerDelegate.debugLogger,

+                DATE_FORMAT.format(new Date()) + CANNOT_INITIALIZE_CUSTOM_HTTP_CLIENT, e);

+            return HttpClients.createDefault();

+        }

+    }

+

+    private SSLConnectionSocketFactory allowTLSProtocols(SSLContext sslcontext) {

+        return new SSLConnectionSocketFactory(

+            sslcontext,

+            SUPPORTED_SSL_VERSIONS,

+            null,

+            SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);

+    }

+

+    private SSLContext trustOwnCACerts(String trustStorePass, KeyStore trustStore)

+        throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException {

+        return SSLContexts.custom()

+            .useTLS()

+            .loadKeyMaterial(trustStore, trustStorePass.toCharArray())

+            .loadTrustMaterial(trustStore, new TrustSelfSignedStrategy())

+            .build();

+    }

+

+    private KeyStore loadTruststore(String trustStorePath, String trustStorePass)

+        throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {

+        val trustStore = KeyStore.getInstance(KeyStore.getDefaultType());

+        try (FileInputStream instream = new FileInputStream(new File(trustStorePath))) {

+            trustStore.load(instream, trustStorePass.toCharArray());

+        }

+        return trustStore;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/client/SyncRestClientInterface.java b/onap-enabler-be/src/main/java/org/onap/osam/client/SyncRestClientInterface.java
new file mode 100644
index 0000000..a7af206
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/client/SyncRestClientInterface.java
@@ -0,0 +1,58 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.client;

+

+import io.joshworks.restclient.http.HttpResponse;

+import io.joshworks.restclient.http.JsonNode;

+

+import java.io.InputStream;

+import java.util.Map;

+

+public interface SyncRestClientInterface {

+    class HEADERS {

+        public static final String CONTENT_TYPE = "Content-Type";

+        public static final String AUTHORIZATION = "Authorization";

+        public static final String X_ECOMP_INSTANCE_ID = "X-ECOMP-InstanceID";

+    }

+

+    HttpResponse<JsonNode> post(String url, Map<String, String> headers, Object body);

+

+    <T> HttpResponse<T> post(String url, Map<String, String> headers, Object body, Class<T> aClass);

+

+    HttpResponse<JsonNode> get(String url, Map<String, String> headers, Map<String, String> routeParams);

+

+    <T> HttpResponse<T> get(String url, Map<String, String> headers, Map<String, String> routeParams, Class<T> aClass);

+

+    HttpResponse<InputStream> getStream(String url, Map<String, String> headers, Map<String, String> routeParams);

+

+    HttpResponse<JsonNode> put(String url, Map<String, String> headers, Object body);

+

+    <T> HttpResponse<T> put(String url, Map<String, String> headers, Object body, Class<T> aClass);

+

+    <T> HttpResponse<T> delete(String url, Map<String, String> headers, Class<T> aClass);

+

+    HttpResponse<JsonNode> delete(String url, Map<String, String> headers);

+

+    void destroy();

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/AaiController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/AaiController.java
new file mode 100644
index 0000000..398b968
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/AaiController.java
@@ -0,0 +1,749 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+import org.apache.commons.lang3.tuple.ImmutablePair;

+import org.apache.commons.lang3.tuple.Pair;

+import org.onap.osam.aai.AaiResponse;

+import org.onap.osam.aai.ServiceInstancesSearchResults;

+import org.onap.osam.aai.SubscriberData;

+import org.onap.osam.aai.SubscriberFilteredResults;

+import org.onap.osam.aai.model.AaiGetInstanceGroupsByCloudRegion;

+import org.onap.osam.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;

+import org.onap.osam.aai.model.AaiGetPnfs.Pnf;

+import org.onap.osam.aai.model.AaiGetTenatns.GetTenantsResponse;

+import org.onap.osam.aai.util.AAIRestInterface;

+import org.onap.osam.model.VersionByInvariantIdsRequest;

+import org.onap.osam.roles.Role;

+import org.onap.osam.roles.RoleProvider;

+import org.onap.osam.roles.RoleValidator;

+import org.onap.osam.services.IAaiService;

+import org.onap.portalsdk.core.controller.RestrictedBaseController;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.HttpStatus;

+import org.springframework.http.MediaType;

+import org.springframework.http.ResponseEntity;

+import org.springframework.web.bind.annotation.*;

+import org.springframework.web.servlet.HandlerMapping;

+import org.springframework.web.servlet.ModelAndView;

+

+import javax.servlet.ServletContext;

+import javax.servlet.http.HttpServletRequest;

+import javax.ws.rs.DefaultValue;

+import javax.ws.rs.QueryParam;

+import javax.ws.rs.WebApplicationException;

+import javax.ws.rs.core.Response;

+import java.io.IOException;

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.*;

+import java.util.stream.Collectors;

+

+import static org.onap.osam.utils.Logging.getMethodName;

+

+

+@RestController

+public class AaiController extends RestrictedBaseController {

+    final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+    /**

+     * The from app id.

+     */

+    protected String fromAppId = "VidAaiController";

+    /**

+     * The logger.

+     */

+    private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(AaiController.class);

+    /**

+     * The model.

+     */

+    private Map<String, Object> model = new HashMap<String, Object>();

+    /**

+     * The servlet context.

+     */

+    @Autowired

+    private ServletContext servletContext;

+    /**

+     * aai service

+     */

+    @Autowired

+    private IAaiService aaiService;

+    @Autowired

+    private RoleProvider roleProvider;

+

+    @Autowired

+    private AAIRestInterface aaiRestInterface;

+

+    /**

+     * Welcome method.

+     *

+     * @param request the request

+     * @return ModelAndView The view

+     */

+    @RequestMapping(value = {"/subscriberSearch"}, method = RequestMethod.GET)

+    public ModelAndView welcome(HttpServletRequest request) {

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== AaiController welcome start");

+        return new ModelAndView(getViewName());

+    }

+

+   /* @RequestMapping(value = {"/aai_get_aic_zones"}, method = RequestMethod.GET)

+    public ResponseEntity<String> getAicZones(HttpServletRequest request) throws IOException {

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== getAicZones controller start");

+        AaiResponse response = aaiService.getAaiZones();

+        return aaiResponseToResponseEntity(response);

+    }*/

+

+    @RequestMapping(value = {"/aai_get_aic_zone_for_pnf/{globalCustomerId}/{serviceType}/{serviceId}"}, method = RequestMethod.GET)

+    public ResponseEntity<String> getAicZoneForPnf(@PathVariable("globalCustomerId") String globalCustomerId ,@PathVariable("serviceType") String serviceType , @PathVariable("serviceId") String serviceId ,HttpServletRequest request) throws IOException {

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== getAicZoneForPnf controller start");

+        AaiResponse response = aaiService.getAicZoneForPnf(globalCustomerId , serviceType , serviceId);

+        return aaiResponseToResponseEntity(response);

+    }

+

+    @RequestMapping(value = {"/aai_get_instance_groups_by_vnf_instance_id/{vnfInstanceId}"}, method = RequestMethod.GET)

+    public ResponseEntity<String> getInstanceGroupsByVnfInstanceId(@PathVariable("vnfInstanceId") String vnfInstanceId ,HttpServletRequest request) throws IOException {

+        AaiResponse response = aaiService.getInstanceGroupsByVnfInstanceId(vnfInstanceId);

+        return aaiResponseToResponseEntity(response);

+    }

+    /**

+     * Get services from a&ai.

+     *

+     * @return ResponseEntity<String> The response entity with the logged in user uuid.

+     * @throws IOException          Signals that an I/O exception has occurred.

+     */

+    @RequestMapping(value = {"/getuserID"}, method = RequestMethod.GET)

+    public ResponseEntity<String> getUserID(HttpServletRequest request) {

+

+        String userId = ControllersUtils.extractUserId(request);

+

+        return new ResponseEntity<String>(userId, HttpStatus.OK);

+    }

+

+    /**

+     * Get services from a&ai.

+     *

+     * @return ResponseEntity<String> The response entity

+     * @throws IOException          Signals that an I/O exception has occurred.

+     */

+    @RequestMapping(value = "/aai_get_services", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public ResponseEntity<String> doGetServices(HttpServletRequest request) throws IOException {

+        RoleValidator roleValidator = new RoleValidator(roleProvider.getUserRoles(request));

+

+        AaiResponse subscriberList = aaiService.getServices(roleValidator);

+        ResponseEntity<String> responseEntity = aaiResponseToResponseEntity(subscriberList);

+

+        return responseEntity;

+    }

+

+

+    @RequestMapping(value = {"/aai_get_version_by_invariant_id"}, method = RequestMethod.POST)

+    public ResponseEntity<String> getVersionByInvariantId(HttpServletRequest request, @RequestBody VersionByInvariantIdsRequest versions) {

+        ResponseEntity<String> responseEntity;

+        ObjectMapper objectMapper = new ObjectMapper();

+

+        Response result = aaiService.getVersionByInvariantId(versions.versions);

+

+        return new ResponseEntity<String>(result.readEntity(String.class), HttpStatus.OK);

+    }

+

+

+    private ResponseEntity<String> aaiResponseToResponseEntity(AaiResponse aaiResponseData)

+            throws IOException {

+        ResponseEntity<String> responseEntity;

+        ObjectMapper objectMapper = new ObjectMapper();

+        if (aaiResponseData.getHttpCode() == 200) {

+            responseEntity = new ResponseEntity<String>(objectMapper.writeValueAsString(aaiResponseData.getT()), HttpStatus.OK);

+        } else {

+            responseEntity = new ResponseEntity<String>(aaiResponseData.getErrorMessage(), HttpStatus.valueOf(aaiResponseData.getHttpCode()));

+        }

+        return responseEntity;

+    }

+

+    /**

+     * Lookup single service instance in a&ai.  Get the service-subscription and customer, too, i guess?

+     *

+     * @param serviceInstanceId the service instance Id

+     * @return ResponseEntity The response entity

+     * @throws IOException          Signals that an I/O exception has occurred.

+     */

+    @RequestMapping(value = "/aai_get_service_instance/{service-instance-id}/{service-instance-type}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public ResponseEntity<String> doGetServiceInstance(@PathVariable("service-instance-id") String serviceInstanceId, @PathVariable("service-instance-type") String serviceInstanceType) {

+        Response resp = null;

+

+        if (serviceInstanceType.equalsIgnoreCase("Service Instance Id")) {

+            resp = doAaiGet(

+                    "search/nodes-query?search-node-type=service-instance&filter=service-instance-id:EQUALS:"

+                            + serviceInstanceId, false);

+        } else {

+            resp = doAaiGet(

+                    "search/nodes-query?search-node-type=service-instance&filter=service-instance-name:EQUALS:"

+                            + serviceInstanceId, false);

+        }

+        return convertResponseToResponseEntity(resp);

+    }

+

+    /**

+     * Get services from a&ai.

+     *

+     * @param globalCustomerId      the global customer id

+     * @param serviceSubscriptionId the service subscription id

+     * @return ResponseEntity The response entity

+     * @throws IOException          Signals that an I/O exception has occurred.

+     */

+    @RequestMapping(value = "/aai_get_service_subscription/{global-customer-id}/{service-subscription-id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public ResponseEntity<String> doGetServices(@PathVariable("global-customer-id") String globalCustomerId,

+                                                @PathVariable("service-subscription-id") String serviceSubscriptionId) {

+        Response resp = doAaiGet("business/customers/customer/" + globalCustomerId

+                + "/service-subscriptions/service-subscription/" + serviceSubscriptionId + "?depth=0", false);

+        return convertResponseToResponseEntity(resp);

+    }

+

+    /**

+     * Obtain the subscriber list from a&ai.

+     *

+     * @param fullSet the full set

+     * @return ResponseEntity The response entity

+     * @throws IOException          Signals that an I/O exception has occurred.

+     */

+    @RequestMapping(value = "/aai_get_subscribers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public ResponseEntity<String> doGetSubscriberList(HttpServletRequest request, @DefaultValue("n") @QueryParam("fullSet") String fullSet) throws IOException {

+        return getFullSubscriberList(request);

+    }

+

+    /**

+     * Obtain the Target Prov Status from the System.Properties file.

+     *

+     * @return ResponseEntity The response entity

+     * @throws IOException          Signals that an I/O exception has occurred.

+     */

+    @RequestMapping(value = "/get_system_prop_vnf_prov_status", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public ResponseEntity<String> getTargetProvStatus() {

+        String p = SystemProperties.getProperty("aai.vnf.provstatus");

+        return new ResponseEntity<String>(p, HttpStatus.OK);

+    }

+

+

+    /**

+     * Obtain the Target Prov Status from the System.Properties file.

+     *

+     * @return ResponseEntity The response entity

+     * @throws IOException          Signals that an I/O exception has occurred.

+     */

+    @RequestMapping(value = "/get_operational_environments", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public AaiResponse<OperationalEnvironmentList> getOperationalEnvironments(@RequestParam(value="operationalEnvironmentType", required = false) String operationalEnvironmentType,

+                                                           @RequestParam(value="operationalEnvironmentStatus", required = false) String operationalEnvironmentStatus) {

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({}, {})", getMethodName(), operationalEnvironmentType, operationalEnvironmentStatus);

+        AaiResponse<OperationalEnvironmentList> response = aaiService.getOperationalEnvironments(operationalEnvironmentType,operationalEnvironmentStatus);

+        if (response.getHttpCode() != 200) {

+            String errorMessage = getAaiErrorMessage(response.getErrorMessage());

+            if(errorMessage != null) {

+                response = new AaiResponse<OperationalEnvironmentList>(response.getT(), errorMessage, response.getHttpCode());

+            }

+        }

+

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, "end {}() => {}", getMethodName(), response);

+        return response;

+    }

+

+    /**

+     * Obtain the full subscriber list from a&ai.

+     * <p>

+     * g @return ResponseEntity The response entity

+     *

+     * @throws IOException          Signals that an I/O exception has occurred.

+     */

+    @RequestMapping(value = "/aai_get_full_subscribers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public ResponseEntity<String> getFullSubscriberList(HttpServletRequest request) throws IOException {

+        ObjectMapper objectMapper = new ObjectMapper();

+        ResponseEntity<String> responseEntity;

+        RoleValidator roleValidator = new RoleValidator(roleProvider.getUserRoles(request));

+        SubscriberFilteredResults subscriberList = aaiService.getFullSubscriberList(roleValidator);

+        if (subscriberList.getHttpCode() == 200) {

+            responseEntity = new ResponseEntity<String>(objectMapper.writeValueAsString(subscriberList.getSubscriberList()), HttpStatus.OK);

+        } else {

+            responseEntity = new ResponseEntity<String>(subscriberList.getErrorMessage(), HttpStatus.valueOf(subscriberList.getHttpCode()));

+        }

+

+

+        return responseEntity;

+    }

+

+

+    @RequestMapping(value = "/get_vnf_data_by_globalid_and_service_type/{globalCustomerId}/{serviceType}",

+            method = RequestMethod.GET,

+            produces = MediaType.APPLICATION_JSON_VALUE)

+    public ResponseEntity<String> getVnfDataByGlobalIdAndServiceType(HttpServletRequest request,

+                                                                     @PathVariable("globalCustomerId") String globalCustomerId,

+                                                                     @PathVariable("serviceType") String serviceType) {

+

+        Response resp = aaiService.getVNFData(globalCustomerId, serviceType);

+        return convertResponseToResponseEntity(resp);

+    }

+

+

+    /**

+     * Refresh the subscriber list from a&ai.

+     *

+     * @return ResponseEntity The response entity

+     * @throws IOException Signals that an I/O exception has occurred.

+     */

+    @RequestMapping(value = "/aai_refresh_subscribers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public ResponseEntity<String> doRefreshSubscriberList() {

+        Response resp = getSubscribers(false);

+        return convertResponseToResponseEntity(resp);

+    }

+

+    /**

+     * Refresh the full subscriber list from a&ai.

+     *

+     * @return ResponseEntity The response entity

+     * @throws IOException Signals that an I/O exception has occurred.

+     */

+    @RequestMapping(value = "/aai_refresh_full_subscribers", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public ResponseEntity<String> doRefreshFullSubscriberList() {

+        Response resp = getSubscribers(false);

+        return convertResponseToResponseEntity(resp);

+    }

+

+    /**

+     * Get subscriber details from a&ai.

+     *

+     * @param subscriberId the subscriber id

+     * @return ResponseEntity The response entity

+     */

+    @RequestMapping(value = "/aai_sub_details/{subscriberId}", method = RequestMethod.GET)

+    public ResponseEntity<String> GetSubscriberDetails(HttpServletRequest request, @PathVariable("subscriberId") String subscriberId) throws IOException {

+        ObjectMapper objectMapper = new ObjectMapper();

+        ResponseEntity responseEntity;

+        List<Role> roles = roleProvider.getUserRoles(request);

+        RoleValidator roleValidator = new RoleValidator(roles);

+        AaiResponse<SubscriberData> subscriberData = aaiService.getSubscriberData(subscriberId, roleValidator);

+        String httpMessage = subscriberData.getT() != null ?

+                objectMapper.writeValueAsString(subscriberData.getT()) :

+                subscriberData.getErrorMessage();

+

+        responseEntity = new ResponseEntity<String>(httpMessage, HttpStatus.valueOf(subscriberData.getHttpCode()));

+        return responseEntity;

+    }

+

+    /**

+     * Get service instances that match the query from a&ai.

+     *

+     * @param subscriberId the subscriber id

+     * @param instanceIdentifier the service instance name or id.

+     * @param projects the projects that are related to the instance

+     * @param owningEntities the owningEntities that are related to the instance

+     * @return ResponseEntity The response entity

+     */

+    @RequestMapping(value = "/search_service_instances", method = RequestMethod.GET)

+    public ResponseEntity<String> SearchServiceInstances(HttpServletRequest request,

+                                                         @RequestParam(value="subscriberId", required = false) String subscriberId,

+                                                         @RequestParam(value="serviceInstanceIdentifier", required = false) String instanceIdentifier,

+                                                         @RequestParam(value="project", required = false) List<String> projects,

+                                                         @RequestParam(value="owningEntity", required = false) List<String> owningEntities) throws IOException {

+        ObjectMapper objectMapper = new ObjectMapper();

+        ResponseEntity responseEntity;

+

+        List<Role> roles = roleProvider.getUserRoles(request);

+        RoleValidator roleValidator = new RoleValidator(roles);

+

+        AaiResponse<ServiceInstancesSearchResults> searchResult = aaiService.getServiceInstanceSearchResults(subscriberId, instanceIdentifier, roleValidator, owningEntities, projects);

+

+        String httpMessage = searchResult.getT() != null ?

+                objectMapper.writeValueAsString(searchResult.getT()) :

+                searchResult.getErrorMessage();

+

+

+        if(searchResult.getT().serviceInstances.size() == 0){

+            responseEntity = new ResponseEntity<String>(httpMessage, HttpStatus.NOT_FOUND);

+

+        } else {

+            responseEntity = new ResponseEntity<String>(httpMessage, HttpStatus.valueOf(searchResult.getHttpCode()));

+

+        }

+        return responseEntity;

+    }

+

+

+

+    /**

+     * Issue a named query to a&ai.

+     *

+     * @param namedQueryId     the named query id

+     * @param globalCustomerId the global customer id

+     * @param serviceType      the service type

+     * @param serviceInstance  the service instance

+     * @return ResponseEntity The response entity

+     */

+    @RequestMapping(value = "/aai_sub_viewedit/{namedQueryId}/{globalCustomerId}/{serviceType}/{serviceInstance}", method = RequestMethod.GET)

+    public ResponseEntity<String> viewEditGetComponentList(

+            @PathVariable("namedQueryId") String namedQueryId,

+            @PathVariable("globalCustomerId") String globalCustomerId,

+            @PathVariable("serviceType") String serviceType,

+            @PathVariable("serviceInstance") String serviceInstance) {

+

+        String componentListPayload = getComponentListPutPayload(namedQueryId, globalCustomerId, serviceType, serviceInstance);

+

+        Response resp = doAaiPost("search/named-query", componentListPayload, false);

+        return convertResponseToResponseEntity(resp);

+    }

+

+    @RequestMapping(value = "/aai_get_vnf_data/{globalCustomerId}/{serviceType}/{serviceInstanceId}", method = RequestMethod.GET)

+    public AaiResponse<String> getVnfData(

+            @PathVariable("globalCustomerId") String globalCustomerId,

+            @PathVariable("serviceType") String serviceType,

+            @PathVariable("serviceInstanceId") String serviceInstanceId) {

+

+        return aaiService.getVNFData(globalCustomerId, serviceType, serviceInstanceId);

+

+    }

+

+

+    /**

+     * Issue a named query to a&ai.

+     *

+     * @param namedQueryId     the named query id

+     * @param globalCustomerId the global customer id

+     * @param serviceType      the service type

+     * @return ResponseEntity The response entity

+     */

+    @RequestMapping(value = "/aai_get_models_by_service_type/{namedQueryId}/{globalCustomerId}/{serviceType}", method = RequestMethod.GET)

+    public ResponseEntity<String> viewEditGetComponentList(

+            @PathVariable("namedQueryId") String namedQueryId,

+            @PathVariable("globalCustomerId") String globalCustomerId,

+            @PathVariable("serviceType") String serviceType) {

+

+        String componentListPayload = getModelsByServiceTypePayload(namedQueryId, globalCustomerId, serviceType);

+

+        Response resp = doAaiPost("search/named-query", componentListPayload, false);

+        return convertResponseToResponseEntity(resp);

+    }

+

+    @RequestMapping(value = "/aai_get_vnf_instances/{globalCustomerId}/{serviceType}/{modelVersionId}/{modelInvariantId}/{cloudRegion}", method = RequestMethod.GET)

+    public ResponseEntity<String> getNodeTemplateInstances(

+            @PathVariable("globalCustomerId") String globalCustomerId,

+            @PathVariable("serviceType") String serviceType,

+            @PathVariable("modelVersionId") String modelVersionId,

+            @PathVariable("modelInvariantId") String modelInvariantId,

+            @PathVariable("cloudRegion") String cloudRegion) {

+

+        AaiResponse<String> resp = aaiService.getNodeTemplateInstances(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion);

+        return new ResponseEntity<String>(resp.getT(), HttpStatus.valueOf(resp.getHttpCode()));

+    }

+

+    @RequestMapping(value = "/aai_get_network_collection_details/{serviceInstanceId}", method = RequestMethod.GET)

+    public ResponseEntity<String> getNetworkCollectionDetails(@PathVariable("serviceInstanceId") String serviceInstanceId) throws IOException {

+        com.fasterxml.jackson.databind.ObjectMapper objectMapper = new com.fasterxml.jackson.databind.ObjectMapper();

+        AaiResponse<String> resp = aaiService.getNetworkCollectionDetails(serviceInstanceId);

+

+        String httpMessage = resp.getT() != null ?

+                objectMapper.writeValueAsString(resp.getT()) :

+                resp.getErrorMessage();

+        return new ResponseEntity<String>(httpMessage, HttpStatus.valueOf(resp.getHttpCode()));

+    }

+

+    @RequestMapping(value = "/aai_get_instance_groups_by_cloudregion/{cloudOwner}/{cloudRegionId}/{networkFunction}", method = RequestMethod.GET)

+    public ResponseEntity<String> getInstanceGroupsByCloudRegion(@PathVariable("cloudOwner") String cloudOwner,

+                                                                 @PathVariable("cloudRegionId") String cloudRegionId,

+                                                                 @PathVariable("networkFunction") String networkFunction) throws IOException {

+        com.fasterxml.jackson.databind.ObjectMapper objectMapper = new com.fasterxml.jackson.databind.ObjectMapper();

+        AaiResponse<AaiGetInstanceGroupsByCloudRegion> resp = aaiService.getInstanceGroupsByCloudRegion(cloudOwner, cloudRegionId, networkFunction);

+

+        String httpMessage = resp.getT() != null ?

+                objectMapper.writeValueAsString(resp.getT()) :

+                resp.getErrorMessage();

+        return new ResponseEntity<String>(httpMessage, HttpStatus.valueOf(resp.getHttpCode()));

+    }

+

+    @RequestMapping(value = "/aai_get_by_uri/**", method = RequestMethod.GET)

+    public ResponseEntity<String> getByUri(HttpServletRequest request) {

+

+        String restOfTheUrl = (String) request.getAttribute(

+                HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);

+        String formattedUri = restOfTheUrl.replaceFirst("/aai_get_by_uri/", "").replaceFirst("^aai/v[\\d]+/", "");

+

+        Response resp = doAaiGet(formattedUri, false);

+

+        return convertResponseToResponseEntity(resp);

+    }

+

+

+

+    @RequestMapping(value = "/aai_get_configuration/{configuration_id}", method = RequestMethod.GET)

+    public ResponseEntity<String> getSpecificConfiguration(@PathVariable("configuration_id") String configurationId) {

+

+        Response resp = doAaiGet("network/configurations/configuration/"+configurationId, false);

+

+        return convertResponseToResponseEntity(resp);

+    }

+

+    @RequestMapping(value = "/aai_get_service_instance_pnfs/{globalCustomerId}/{serviceType}/{serviceInstanceId}", method = RequestMethod.GET)

+    public List<String> getServiceInstanceAssociatedPnfs(

+            @PathVariable("globalCustomerId") String globalCustomerId,

+            @PathVariable("serviceType") String serviceType,

+            @PathVariable("serviceInstanceId") String serviceInstanceId) {

+

+        return aaiService.getServiceInstanceAssociatedPnfs(globalCustomerId, serviceType, serviceInstanceId);

+    }

+

+    /**

+     * PNF section

+     */

+    @RequestMapping(value = "/aai_get_pnfs/pnf/{pnf_id}", method = RequestMethod.GET)

+    public ResponseEntity getSpecificPnf(@PathVariable("pnf_id") String pnfId) {

+        //logger.trace(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), pnfId);

+        AaiResponse<Pnf> resp;

+        ResponseEntity<Pnf> re;

+        try {

+            resp = aaiService.getSpecificPnf(pnfId);

+            re = new ResponseEntity<Pnf>(resp.getT(), HttpStatus.valueOf(resp.getHttpCode()));

+        } catch (Exception e){

+            return new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);

+        }

+        //logger.trace(EELFLoggerDelegate.debugLogger, "end {}() => {}", getMethodName(), resp.getHttpCode());

+        return re;

+    }

+

+

+    /**

+     * Obtain tenants for a given service type.

+     *

+     * @param globalCustomerId the global customer id

+     * @param serviceType      the service type

+     * @return ResponseEntity The response entity

+     */

+    @RequestMapping(value = "/aai_get_tenants/{global-customer-id}/{service-type}", method = RequestMethod.GET)

+    public ResponseEntity<String> viewEditGetTenantsFromServiceType(HttpServletRequest request,

+                                                                    @PathVariable("global-customer-id") String globalCustomerId, @PathVariable("service-type") String serviceType) {

+

+        ResponseEntity responseEntity;

+        try {

+            ObjectMapper objectMapper = new ObjectMapper();

+            List<Role> roles = roleProvider.getUserRoles(request);

+            RoleValidator roleValidator = new RoleValidator(roles);

+            AaiResponse<GetTenantsResponse[]> response = aaiService.getTenants(globalCustomerId, serviceType, roleValidator);

+            if (response.getHttpCode() == 200) {

+                responseEntity = new ResponseEntity<String>(objectMapper.writeValueAsString(response.getT()), HttpStatus.OK);

+            } else {

+                responseEntity = new ResponseEntity<String>(response.getErrorMessage(), HttpStatus.valueOf(response.getHttpCode()));

+            }

+        } catch (Exception e) {

+            responseEntity = new ResponseEntity<String>("Unable to proccess getTenants reponse", HttpStatus.INTERNAL_SERVER_ERROR);

+        }

+        return responseEntity;

+    }

+

+    @RequestMapping(value = "/aai_get_pnf_instances/{globalCustomerId}/{serviceType}/{modelVersionId}/{modelInvariantId}/{cloudRegion}/{equipVendor}/{equipModel}", method = RequestMethod.GET)

+    public ResponseEntity<String> getPnfInstances(

+            @PathVariable("globalCustomerId") String globalCustomerId,

+            @PathVariable("serviceType") String serviceType,

+            @PathVariable("modelVersionId") String modelVersionId,

+            @PathVariable("modelInvariantId") String modelInvariantId,

+            @PathVariable("cloudRegion") String cloudRegion,

+            @PathVariable("equipVendor") String equipVendor,

+            @PathVariable("equipModel") String equipModel) {

+

+        AaiResponse<String> resp = aaiService.getPNFData(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion, equipVendor, equipModel);

+        return new ResponseEntity<String>(resp.getT(), HttpStatus.valueOf(resp.getHttpCode()));

+    }

+

+    @RequestMapping(value = "/aai_getPortMirroringSourcePorts", method = RequestMethod.GET)

+    public Map<String, Object> getPortMirroringSourcePorts(

+            @RequestParam ("configurationIds") List<String> configurationIds) {

+

+        return configurationIds.stream()

+                .map(id -> ImmutablePair.of(id, aaiService.getPortMirroringSourcePorts(id)))

+                .collect(Collectors.toMap(Pair::getKey, Pair::getValue));

+    }

+

+    private ResponseEntity<String> convertResponseToResponseEntity(Response resp) {

+        ResponseEntity<String> respEnt;

+        ObjectMapper objectMapper = new ObjectMapper();

+        if (resp == null) {

+            respEnt = new ResponseEntity<String>("Failed to fetch data from A&AI, check server logs for details.", HttpStatus.INTERNAL_SERVER_ERROR);

+        } else {

+            respEnt = new ResponseEntity<String>(resp.readEntity(String.class), HttpStatus.valueOf(resp.getStatus()));

+        }

+        return respEnt;

+    }

+

+    /**

+     * Gets the subscribers.

+     *

+     * @param isFullSet the is full set

+     * @return the subscribers

+     */

+    private Response getSubscribers(boolean isFullSet) {

+

+        String depth = "0";

+

+        Response resp = doAaiGet("business/customers?subscriber-type=INFRA&depth=" + depth, false);

+        if (resp != null) {

+            LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "getSubscribers() resp=" + resp.getStatusInfo().toString());

+        }

+        return resp;

+    }

+

+    /**

+     * Gets the subscriber details.

+     *

+     * @param subscriberId the subscriber id

+     * @return the subscriber details

+     */

+    private Response getSubscriberDetails(String subscriberId) {

+        Response resp = doAaiGet("business/customers/customer/" + subscriberId + "?depth=2", false);

+        //String resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + subscriberId, false);

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "getSubscriberDetails() resp=" + resp.getStatusInfo().toString());

+        return resp;

+    }

+

+    /**

+     * Send a GET request to a&ai.

+     *

+     * @param uri       the uri

+     * @param xml       the xml

+     * @return String The response

+     */

+    protected Response doAaiGet(String uri, boolean xml) {

+        String methodName = "getSubscriberList";

+        String transId = UUID.randomUUID().toString();

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        Response resp = null;

+        try {

+

+

+            resp = aaiRestInterface.RestGet(fromAppId, transId, uri, xml).getResponse();

+

+        } catch (WebApplicationException e) {

+            final String message = 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;

+    }

+

+    /**

+     * Send a POST request to a&ai.

+     *

+     * @param uri       the uri

+     * @param payload   the payload

+     * @param xml       the xml

+     * @return String The response

+     */

+    protected Response doAaiPost(String uri, String payload, boolean xml) {

+        String methodName = "getSubscriberList";

+        String transId = UUID.randomUUID().toString();

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        Response resp = null;

+        try {

+

+            resp = aaiRestInterface.RestPost(fromAppId, 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;

+    }

+

+    /**

+     * Gets the component list put payload.

+     *

+     * @param namedQueryId     the named query id

+     * @param globalCustomerId the global customer id

+     * @param serviceType      the service type

+     * @param serviceInstance  the service instance

+     * @return the component list put payload

+     */

+    private String getComponentListPutPayload(String namedQueryId, String globalCustomerId, String serviceType, String serviceInstance) {

+        return

+                "		{" +

+                        "    \"instance-filters\": {" +

+                        "        \"instance-filter\": [" +

+                        "            {" +

+                        "                \"customer\": {" +

+                        "                    \"global-customer-id\": \"" + globalCustomerId + "\"" +

+                        "                }," +

+                        "                \"service-instance\": {" +

+                        "                    \"service-instance-id\": \"" + serviceInstance + "\"" +

+                        "                }," +

+                        "                \"service-subscription\": {" +

+                        "                    \"service-type\": \"" + serviceType + "\"" +

+                        "                }" +

+                        "            }" +

+                        "        ]" +

+                        "    }," +

+                        "    \"query-parameters\": {" +

+                        "        \"named-query\": {" +

+                        "            \"named-query-uuid\": \"" + namedQueryId + "\"" +

+                        "        }" +

+                        "    }" +

+                        "}";

+

+    }

+

+    private String getModelsByServiceTypePayload(String namedQueryId, String globalCustomerId, String serviceType) {

+        // TODO Auto-generated method stub

+        return "		{" +

+                "    \"instance-filters\": {" +

+                "        \"instance-filter\": [" +

+                "            {" +

+                "                \"customer\": {" +

+                "                    \"global-customer-id\": \"" + globalCustomerId + "\"" +

+                "                }," +

+                "                \"service-subscription\": {" +

+                "                    \"service-type\": \"" + serviceType + "\"" +

+                "                }" +

+                "            }" +

+                "        ]" +

+                "    }," +

+                "    \"query-parameters\": {" +

+                "        \"named-query\": {" +

+                "            \"named-query-uuid\": \"" + namedQueryId + "\"" +

+                "        }" +

+                "    }" +

+                "}";

+

+    }

+

+    private String getAaiErrorMessage(String message) {

+        try {

+            org.json.JSONObject json = new org.json.JSONObject(message);

+            json = json.getJSONObject("requestError").getJSONObject("serviceException");

+

+            return json.getString("messageId") + ": " + json.getString("text");

+

+        } catch (Exception e) {

+            return null;

+        }

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/AsyncControllerForTests.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/AsyncControllerForTests.java
new file mode 100644
index 0000000..cfc8f48
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/AsyncControllerForTests.java
@@ -0,0 +1,77 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.osam.model.ExceptionResponse;

+import org.onap.osam.model.JobBulk;

+import org.onap.osam.model.JobModel;

+import org.onap.osam.services.IBulkInstantiationService;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.ResponseEntity;

+import org.springframework.web.bind.annotation.*;

+

+import javax.ws.rs.WebApplicationException;

+import java.util.Map;

+import java.util.UUID;

+

+import static org.springframework.http.HttpStatus.BAD_REQUEST;

+

+@RestController

+@RequestMapping("asyncForTests")

+public class AsyncControllerForTests extends OsamCoreRestrictedBaseController {

+

+    private IBulkInstantiationService bulkInstantiationService;

+

+    @Autowired

+    public AsyncControllerForTests(IBulkInstantiationService bulkInstantiationService) {

+        this.bulkInstantiationService = bulkInstantiationService;

+    }

+

+    @RequestMapping(method = RequestMethod.POST)

+    public JobBulk createAsyncJob(@RequestBody Map<String, Object> body) {

+        return bulkInstantiationService.saveBulk(body);

+    }

+

+    @RequestMapping(value = "/job/{uuid}", method = RequestMethod.GET)

+    public JobModel getJob(@PathVariable UUID uuid) {

+        return bulkInstantiationService.getJob(uuid);

+    }

+

+    @RequestMapping(value = "/error", method = RequestMethod.GET)

+    public void throwError() {

+        throw new GenericUncheckedException("dummy error");

+    }

+

+    @ExceptionHandler({IllegalArgumentException.class})

+    @ResponseStatus(value=BAD_REQUEST)

+    private ExceptionResponse exceptionHandlerBadRequest(Exception e) {

+        return ControllersUtils.handleException(e, LOGGER);

+    }

+

+    @ExceptionHandler(WebApplicationException.class)

+    private ResponseEntity webApplicationExceptionHandler(WebApplicationException e) {

+        return ControllersUtils.handleWebApplicationException(e, LOGGER);

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/AsyncInstantiationController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/AsyncInstantiationController.java
new file mode 100644
index 0000000..7296c20
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/AsyncInstantiationController.java
@@ -0,0 +1,92 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+

+import org.onap.osam.exceptions.OperationNotAllowedException;

+import org.onap.osam.model.ExceptionResponse;

+

+import org.onap.osam.model.JobAuditStatus;

+import org.onap.osam.model.ServiceInfo;

+import org.onap.osam.model.serviceInstantiation.ServiceInstantiation;

+import org.onap.osam.mso.MsoResponseWrapper2;

+import org.onap.osam.services.IAsyncInstantiationBusinessLogic;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.web.bind.annotation.*;

+import javax.servlet.http.HttpServletRequest;

+import java.util.List;

+import java.util.UUID;

+import static org.springframework.http.HttpStatus.METHOD_NOT_ALLOWED;

+

+

+@RestController

+@RequestMapping(AsyncInstantiationController.ASYNC_INSTANTIATION)

+public class AsyncInstantiationController extends OsamCoreRestrictedBaseController {

+

+    public static final String ASYNC_INSTANTIATION = "asyncInstantiation";

+

+    protected final IAsyncInstantiationBusinessLogic asyncInstantiationBL;

+

+    @Autowired

+    public AsyncInstantiationController(IAsyncInstantiationBusinessLogic asyncInstantiationBL) {

+        this.asyncInstantiationBL = asyncInstantiationBL;

+    }

+

+    @ExceptionHandler(OperationNotAllowedException.class)

+    @ResponseStatus(value=METHOD_NOT_ALLOWED)

+    public ExceptionResponse illegalStateExceptionHandler(Exception e) {

+        return ControllersUtils.handleException(e, LOGGER);

+    }

+

+    @RequestMapping(method = RequestMethod.GET)

+    public List<ServiceInfo> getServicesInfo(HttpServletRequest request) {

+        return asyncInstantiationBL.getAllServicesInfo();

+    }

+

+    @RequestMapping(value = "bulk", method = RequestMethod.POST)

+    public MsoResponseWrapper2<List<String>> createBulkOfServices(@RequestBody ServiceInstantiation request, HttpServletRequest httpServletRequest) {

+        //Push to DB according the model

+

+        String userId = ControllersUtils.extractUserId(httpServletRequest);

+        List<UUID> uuids =  asyncInstantiationBL.pushBulkJob(request, userId);

+

+        return new MsoResponseWrapper2(200, uuids);

+    }

+

+    @RequestMapping(value = "job/{jobId}", method = RequestMethod.DELETE)

+    public void deleteServiceInfo(@PathVariable("jobId") UUID jobId) {

+        asyncInstantiationBL.deleteJob(jobId);

+    }

+

+    @RequestMapping(value = "hide/{jobId}", method = RequestMethod.POST)

+    public void hideServiceInfo(@PathVariable("jobId") UUID jobId) {

+        asyncInstantiationBL.hideServiceInfo(jobId);

+    }

+

+    @RequestMapping(value = "auditStatus/{jobId}", method = RequestMethod.GET)

+    public List<JobAuditStatus> getJobAuditStatus(HttpServletRequest request, @PathVariable(value="jobId") UUID jobId, @RequestParam(value="source") JobAuditStatus.SourceStatus source){

+        return asyncInstantiationBL.getAuditStatuses(jobId, source);

+    }

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/ControllersUtils.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/ControllersUtils.java
new file mode 100644
index 0000000..4aaff2e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/ControllersUtils.java
@@ -0,0 +1,67 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+import org.apache.commons.lang3.exception.ExceptionUtils;

+import org.onap.portalsdk.core.domain.User;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.onap.osam.model.ExceptionResponse;

+import org.springframework.http.ResponseEntity;

+

+import javax.servlet.http.HttpServletRequest;

+import javax.servlet.http.HttpSession;

+import javax.ws.rs.WebApplicationException;

+

+import static org.onap.osam.utils.Logging.getMethodName;

+

+public class ControllersUtils {

+

+

+    public static String extractUserId(HttpServletRequest request) {

+        String userId = "";

+        HttpSession session = request.getSession();

+        if (session != null) {

+            User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME));

+            if (user != null) {

+                //userId = user.getHrid();

+                userId = user.getLoginId();

+                if (userId == null)

+                    userId = user.getOrgUserId();

+            }

+        }

+        return userId;

+    }

+

+    public static ExceptionResponse handleException(Exception e, EELFLoggerDelegate logger) {

+        logger.error(EELFLoggerDelegate.errorLogger, "{}: {}", getMethodName(), ExceptionUtils.getMessage(e), e);

+

+        ExceptionResponse exceptionResponse = new ExceptionResponse(e);

+        return exceptionResponse;

+    }

+

+    public static ResponseEntity handleWebApplicationException(WebApplicationException e, EELFLoggerDelegate logger) {

+        return ResponseEntity.status(e.getResponse().getStatus()).body(ControllersUtils.handleException(e, logger));

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/FeatureTogglingController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/FeatureTogglingController.java
new file mode 100644
index 0000000..f145a49
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/FeatureTogglingController.java
@@ -0,0 +1,51 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+import org.onap.osam.properties.Features;

+import org.onap.portalsdk.core.controller.RestrictedBaseController;

+import org.springframework.http.MediaType;

+import org.springframework.web.bind.annotation.RequestMapping;

+import org.springframework.web.bind.annotation.RequestMethod;

+import org.springframework.web.bind.annotation.ResponseBody;

+import org.springframework.web.bind.annotation.RestController;

+

+import java.util.HashMap;

+import java.util.Map;

+

+@RestController

+@RequestMapping("flags")

+public class FeatureTogglingController extends RestrictedBaseController {

+

+    @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public @ResponseBody Map<String,Boolean> getFeatureToggles()

+    {

+        HashMap<String,Boolean> flags = new HashMap <String, Boolean>();

+        for(Features flag : Features.values()){

+            flags.put(flag.name(), flag.isActive());

+        }

+        return flags;

+

+

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/LoggerController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/LoggerController.java
new file mode 100644
index 0000000..e3c273b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/LoggerController.java
@@ -0,0 +1,132 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+import ch.qos.logback.classic.LoggerContext;

+import ch.qos.logback.core.Appender;

+import ch.qos.logback.core.FileAppender;

+import ch.qos.logback.core.spi.AppenderAttachable;

+import org.apache.commons.io.input.ReversedLinesFileReader;

+import org.apache.commons.lang3.StringUtils;

+import org.onap.portalsdk.core.controller.RestrictedBaseController;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.osam.model.ExceptionResponse;

+import org.onap.osam.roles.Role;

+import org.onap.osam.roles.RoleProvider;

+import org.onap.osam.utils.Streams;

+import org.slf4j.LoggerFactory;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.HttpStatus;

+import org.springframework.web.bind.annotation.*;

+

+import javax.servlet.http.HttpServletRequest;

+import javax.ws.rs.InternalServerErrorException;

+import javax.ws.rs.NotAuthorizedException;

+import java.io.File;

+import java.io.IOException;

+import java.util.List;

+import java.util.Objects;

+import java.util.function.Supplier;

+import java.util.stream.Collectors;

+import java.util.stream.Stream;

+

+import static com.att.eelf.configuration.Configuration.GENERAL_LOGGER_NAME;

+

+

+@RestController

+@RequestMapping("logger")

+public class LoggerController extends RestrictedBaseController {

+

+    private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(LoggerController.class);

+

+    @Autowired

+    RoleProvider roleProvider;

+

+    @RequestMapping(value = "/{loggerName:audit|error|metrics}", method = RequestMethod.GET)

+    public String getLog(@PathVariable String loggerName, HttpServletRequest request,

+                         @RequestParam(value="limit", defaultValue = "5000") Integer limit) throws IOException {

+

+        List<Role> roles = roleProvider.getUserRoles(request);

+        boolean userPermitted = roleProvider.userPermissionIsReadLogs(roles);

+        if (!userPermitted) {

+            throw new NotAuthorizedException("User not authorized to get logs");

+        }

+

+        String logfilePath = getLogfilePath(loggerName);

+

+        try (final ReversedLinesFileReader reader = new ReversedLinesFileReader(new File(logfilePath))) {

+            Supplier<String> reverseLinesSupplier = () -> {

+                try {

+                    return reader.readLine();

+                } catch (NullPointerException e) {

+                    // EOF Reached

+                    return null;

+                } catch (IOException e) {

+                    throw new InternalServerErrorException("error while reading " + logfilePath, e);

+                }

+            };

+

+            return Streams.takeWhile(

+                    Stream.generate(reverseLinesSupplier),

+                    line -> !StringUtils.contains(line, "Logging is started"))

+                    .limit(limit)

+                    .limit(5_000)

+                    .filter(Objects::nonNull)

+                    .collect(Collectors.joining("\n"));

+        }

+    }

+

+    private String getLogfilePath(String loggerName) {

+        LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();

+        return context.getLoggerList().stream()

+                .filter(logger -> logger.getName().equals(GENERAL_LOGGER_NAME + "." + loggerName))

+                .flatMap(this::pullSubAppenders)

+                .flatMap(appender -> {

+                    // Appender might be "attachable", if so - roll-up its sub-appenders

+                    return (appender instanceof AppenderAttachable) ?

+                            pullSubAppenders((AppenderAttachable<?>) appender) : Stream.of(appender);

+                })

+                .filter(appender -> appender instanceof FileAppender)

+                .map(appender -> (FileAppender<?>) appender)

+                .map(FileAppender::getFile)

+                .findFirst()

+                .orElseThrow(() -> new InternalServerErrorException("logfile for " + loggerName + " not found"));

+    }

+

+    private <T> Stream<Appender<T>> pullSubAppenders(AppenderAttachable<T> logger) {

+        return Streams.fromIterator(logger.iteratorForAppenders());

+    }

+

+    @ExceptionHandler({ NotAuthorizedException.class })

+    @ResponseStatus(HttpStatus.UNAUTHORIZED)

+    public String notAuthorizedHandler(NotAuthorizedException e) {

+        return "UNAUTHORIZED";

+    }

+

+    @ExceptionHandler({ IOException.class, InternalServerErrorException.class })

+    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)

+    public ExceptionResponse ioExceptionHandler(Exception e) {

+        return org.onap.osam.controllers.ControllersUtils.handleException(e, LOGGER);

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/MsoConfig.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/MsoConfig.java
new file mode 100644
index 0000000..fd19f0e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/MsoConfig.java
@@ -0,0 +1,64 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+import org.onap.portalsdk.core.util.SystemProperties;

+

+import org.onap.osam.client.SyncRestClient;

+import org.onap.osam.factories.MsoRequestFactory;

+import org.onap.osam.mso.MsoBusinessLogic;

+import org.onap.osam.mso.MsoBusinessLogicImpl;

+import org.onap.osam.mso.MsoInterface;

+import org.onap.osam.mso.MsoProperties;

+import org.onap.osam.mso.rest.MsoRestClientNew;

+import org.springframework.context.annotation.Bean;

+import org.springframework.context.annotation.Configuration;

+import org.togglz.core.manager.FeatureManager;

+

+

+@Configuration

+public class MsoConfig {

+

+    @Bean

+    public ObjectMapper getObjectMapper() {

+        return new ObjectMapper();

+    }

+

+    @Bean

+    public MsoRequestFactory createRequestDetailsFactory(){

+        return new MsoRequestFactory();

+    }

+

+    @Bean

+    public MsoInterface getMsoClient(){

+        return new MsoRestClientNew(new SyncRestClient(MsoInterface.objectMapper()), SystemProperties.getProperty(

+            MsoProperties.MSO_SERVER_URL));

+    }

+

+    @Bean

+    public MsoBusinessLogic getMsoBusinessLogic(MsoInterface msoClient, FeatureManager featureManager){

+        return new MsoBusinessLogicImpl(msoClient, featureManager);

+    }

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/MsoController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/MsoController.java
new file mode 100644
index 0000000..53cdde7
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/MsoController.java
@@ -0,0 +1,689 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+import org.onap.osam.model.ExceptionResponse;

+import org.onap.osam.mso.MsoBusinessLogic;

+import org.onap.osam.mso.MsoResponseWrapper;

+import org.onap.osam.mso.rest.Request;

+import org.onap.osam.mso.rest.RequestDetails;

+import org.onap.osam.mso.rest.RequestDetailsWrapper;

+import org.onap.osam.mso.rest.Task;

+import org.onap.portalsdk.core.controller.RestrictedBaseController;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.HttpStatus;

+import org.springframework.http.ResponseEntity;

+import org.springframework.web.bind.annotation.*;

+

+import javax.servlet.http.HttpServletRequest;

+import javax.servlet.http.HttpServletResponse;

+import java.io.IOException;

+import java.io.PrintWriter;

+import java.io.StringWriter;

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.Date;

+import java.util.LinkedHashMap;

+import java.util.List;

+

+import static org.onap.osam.utils.Logging.getMethodName;

+

+//import java.util.UUID;

+//import org.springframework.http.ResponseEntity;

+//import org.springframework.http.RequestEntity;

+

+@RestController

+@RequestMapping("mso")

+public class MsoController extends RestrictedBaseController {

+

+    private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(MsoController.class);

+

+    /**

+     * The Constant dateFormat.

+     */

+    private final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+

+    /**

+     * The Constant SVC_INSTANCE_ID.

+     */

+    public final static String SVC_INSTANCE_ID = "<service_instance_id>";

+    public final static String REQUEST_TYPE = "<request_type>";

+

+    /**

+     * The Constant CONFIGURATION_ID

+     */

+    public final static String CONFIGURATION_ID = "<configuration_id>";

+

+    /**

+     * The Constant VNF_INSTANCE_ID.

+     */

+    public final static String VNF_INSTANCE_ID = "<vnf_instance_id>";

+

+    private final MsoBusinessLogic msoBusinessLogic;

+

+    @Autowired

+    public MsoController(MsoBusinessLogic msoBusinessLogic) {

+        this.msoBusinessLogic = msoBusinessLogic;

+    }

+

+    /**

+     * Creates the svc instance.

+     *

+     * @param request the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)

+    public ResponseEntity<String> createSvcInstance(HttpServletRequest request, @RequestBody RequestDetails mso_request) {

+        String methodName = "createSvcInstance";

+

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        // always return OK, the MSO status code is embedded in the body

+

+        MsoResponseWrapper w = msoBusinessLogic.createSvcInstance(mso_request);

+

+        return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));

+

+    }

+    

+    /**

+     * Creates the e2e svc instance.

+     *

+     * @param request the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_create_e2e_svc_instance", method = RequestMethod.POST)

+    public ResponseEntity<String> createE2eSvcInstance(HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> mso_request) {

+        String methodName = "createE2eSvcInstance";

+

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        // always return OK, the MSO status code is embedded in the body

+

+        MsoResponseWrapper w = msoBusinessLogic.createE2eSvcInstance(mso_request.get("requestDetails"));

+

+        return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));

+

+    }

+

+    /**

+     * Creates the vnf.

+     *

+     * @param serviceInstanceId the service instance id

+     * @param request           the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)

+    public ResponseEntity<String> createVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) {

+

+        MsoResponseWrapper w = msoBusinessLogic.createVnf(mso_request, serviceInstanceId);

+

+        // always return OK, the MSO status code is embedded in the body

+

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+

+    }

+

+    /**

+     * Creates the nw instance.

+     *

+     * @param serviceInstanceId the service instance id

+     * @param request           the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)

+    public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) {

+        String methodName = "createNwInstance";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start, serviceInstanceId = " + serviceInstanceId);

+

+        MsoResponseWrapper w = msoBusinessLogic.createNwInstance(mso_request, serviceInstanceId);

+

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+

+    }

+

+    /**

+     * Creates the volume group instance.

+     *

+     * @param serviceInstanceId the service instance id

+     * @param vnfInstanceId     the vnf instance id

+     * @param request           the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)

+    public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,

+                                                            HttpServletRequest request, @RequestBody RequestDetails mso_request) {

+        String methodName = "createVolumeGroupInstance";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w = msoBusinessLogic.createVolumeGroupInstance(mso_request, serviceInstanceId, vnfInstanceId);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Creates the vf module instance.

+     *

+     * @param serviceInstanceId the service instance id

+     * @param vnfInstanceId     the vnf instance id

+     * @param request           the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)

+    public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,

+                                                         @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) {

+        String methodName = "createVfModuleInstance";

+

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w = msoBusinessLogic.createVfModuleInstance(mso_request, serviceInstanceId, vnfInstanceId);

+

+        // always return OK, the MSO status code is embedded in the body

+

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Creates a configuration instance.

+     *

+     * @param serviceInstanceId the service instance id

+     * @param request           the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_create_configuration_instance/{serviceInstanceId}/configurations/", method = RequestMethod.POST)

+    public ResponseEntity<String> createConfigurationInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,

+                                                         HttpServletRequest request, @RequestBody RequestDetailsWrapper mso_request) {

+        String methodName = "createConfigurationInstance";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w = msoBusinessLogic.createConfigurationInstance(mso_request, serviceInstanceId);

+

+        // always return OK, the MSO status code is embedded in the body

+

+        return (new ResponseEntity<>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Delete E2e svc instance.

+     *

+     * @param serviceInstanceId the service instance id

+     * @param request           the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_delete_e2e_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)

+    public ResponseEntity<String> deleteE2eSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,

+                                                    HttpServletRequest request, @RequestBody LinkedHashMap<String, Object> mso_request) {

+

+        String methodName = "deleteE2eSvcInstance";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), mso_request);

+

+        MsoResponseWrapper w = msoBusinessLogic.deleteE2eSvcInstance(mso_request.get("requestDetails"), serviceInstanceId);

+

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());

+        // always return OK, the MSO status code is embedded in the body

+

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+

+    }

+    

+    /**

+     * Delete svc instance.

+     *

+     * @param serviceInstanceId the service instance id

+     * @param request           the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+

+    @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)

+    public String deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,

+                                                    HttpServletRequest request, @RequestBody RequestDetails mso_request,

+                                                    @RequestParam(value = "serviceStatus") String serviceStatus) {

+

+        String methodName = "deleteSvcInstance";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, "start {}({})", getMethodName(), mso_request);

+        MsoResponseWrapper w = msoBusinessLogic.deleteSvcInstance(mso_request, serviceInstanceId, serviceStatus);

+        // always return OK, the MSO status code is embedded in the body

+

+        return w.getResponse();

+    }

+

+    /**

+     * Delete vnf.

+     *

+     * @param serviceInstanceId the service instance id

+     * @param vnfInstanceId     the vnf instance id

+     * @param request           the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)

+

+    public ResponseEntity<String> deleteVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,

+                                            HttpServletRequest request, @RequestBody RequestDetails mso_request) {

+        String methodName = "deleteVnf";

+

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w = msoBusinessLogic.deleteVnf(mso_request, serviceInstanceId, vnfInstanceId);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+

+    }

+

+    /**

+     * Delete configuration instance

+     * @param serviceInstanceId the service instance id

+     * @param configurationId the configuration id

+     * @param mso_request the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "mso_delete_configuration/{serviceInstanceId}/configurations/{configurationId}",

+            method = RequestMethod.POST)

+    public ResponseEntity<String> deleteConfiguration(

+            @PathVariable("serviceInstanceId") String serviceInstanceId,

+            @PathVariable ("configurationId") String configurationId,

+            @RequestBody RequestDetailsWrapper mso_request) {

+

+        String methodName = "deleteConfiguration";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger,

+                dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w = msoBusinessLogic.deleteConfiguration(mso_request, serviceInstanceId, configurationId);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Activate configuration instance

+     * @param serviceInstanceId the service instace id

+     * @param configurationId the configuration id

+     * @param mso_request the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "mso_activate_configuration/{serviceInstanceId}/configurations/{configurationId}",

+            method = RequestMethod.POST)

+    public ResponseEntity<String> activateConfiguration(

+            @PathVariable("serviceInstanceId") String serviceInstanceId,

+            @PathVariable("configurationId") String configurationId,

+            @RequestBody RequestDetails mso_request) {

+

+        MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(mso_request, serviceInstanceId, configurationId, true);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Deactivate configuration instance

+     * @param serviceInstanceId the service instace id

+     * @param configurationId the configuration id

+     * @param mso_request the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "mso_deactivate_configuration/{serviceInstanceId}/configurations/{configurationId}",

+            method = RequestMethod.POST)

+    public ResponseEntity<String> deactivateConfiguration(

+            @PathVariable("serviceInstanceId") String serviceInstanceId,

+            @PathVariable("configurationId") String configurationId,

+            @RequestBody RequestDetails mso_request) {

+

+        MsoResponseWrapper w = msoBusinessLogic.setConfigurationActiveStatus(mso_request, serviceInstanceId, configurationId, false);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Disable port on configuration instance

+     * @param serviceInstanceId the service instance id

+     * @param configurationId the configuration instance id

+     * @param mso_request the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "mso_disable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",

+            method = RequestMethod.POST)

+    public ResponseEntity<String> disablePortOnConfiguration(

+            @PathVariable("serviceInstanceId") String serviceInstanceId,

+            @PathVariable("configurationId") String configurationId,

+            @RequestBody RequestDetails mso_request) {

+

+        MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(mso_request, serviceInstanceId, configurationId, false);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Enable port on configuration instance

+     * @param serviceInstanceId the service instance id

+     * @param configurationId the configuration instance id

+     * @param mso_request the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "mso_enable_port_configuration/{serviceInstanceId}/configurations/{configurationId}",

+            method = RequestMethod.POST)

+    public ResponseEntity<String> enablePortOnConfiguration(

+            @PathVariable("serviceInstanceId") String serviceInstanceId,

+            @PathVariable("configurationId") String configurationId,

+            @RequestBody RequestDetails mso_request) {

+

+        MsoResponseWrapper w = msoBusinessLogic.setPortOnConfigurationStatus(mso_request, serviceInstanceId, configurationId, true);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Delete vf module.

+     *

+     * @param serviceInstanceId the service instance id

+     * @param vnfInstanceId     the vnf instance id

+     * @param vfModuleId        the vf module id

+     * @param request           the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    //mso_delete_vf_module/bc305d54-75b4-431b-adb2-eb6b9e546014/vnfs/fe9000-0009-9999/vfmodules/abeeee-abeeee-abeeee

+    @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleId}", method = RequestMethod.POST)

+    public ResponseEntity<String> deleteVfModule(

+            @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,

+            @PathVariable("vfModuleId") String vfModuleId, HttpServletRequest request, @RequestBody RequestDetails mso_request) {

+

+        String methodName = "deleteVfModule";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w = msoBusinessLogic.deleteVfModule(mso_request, serviceInstanceId, vnfInstanceId, vfModuleId);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Delete volume group instance.

+     *

+     * @param serviceInstanceId the service instance id

+     * @param vnfInstanceId     the vnf instance id

+     * @param volumeGroupId     the volume group id

+     * @param request           the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupId}", method = RequestMethod.POST)

+    public ResponseEntity<String> deleteVolumeGroupInstance(

+            @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId, @PathVariable("volumeGroupId") String volumeGroupId,

+            HttpServletRequest request, @RequestBody RequestDetails mso_request) {

+        String methodName = "deleteVolumeGroupInstance";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w = msoBusinessLogic.deleteVolumeGroupInstance(mso_request, serviceInstanceId, vnfInstanceId, volumeGroupId);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Delete nw instance.

+     *

+     * @param serviceInstanceId the service instance id

+     * @param networkInstanceId the network instance id

+     * @param request           the request

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)

+    public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,

+                                                   @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) {

+        String methodName = "deleteNwInstance";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w = msoBusinessLogic.deleteNwInstance(mso_request, serviceInstanceId, networkInstanceId);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Gets the orchestration request.

+     *

+     * @param requestId the request id

+     * @param request   the request

+     * @return the orchestration request

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)

+    public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,

+                                                          HttpServletRequest request) {

+

+        String methodName = "getOrchestrationRequest";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+

+        MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequest(requestId);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * Gets the orchestration requests.

+     *

+     * @param filterString the filter string

+     * @param request      the request

+     * @return the orchestration requests

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)

+    public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,

+                                                           HttpServletRequest request) {

+

+        String methodName = "getOrchestrationRequests";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+

+        MsoResponseWrapper w = msoBusinessLogic.getOrchestrationRequests(filterString);

+

+        // always return OK, the MSO status code is embedded in the body

+        return (new ResponseEntity<String>(w.getResponse(), HttpStatus.OK));

+    }

+

+    /**

+     * activate to a pnf instance.

+     *

+     * @param serviceInstanceId the id of the service.

+     * @param requestDetails the body of the request.

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_activate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)

+    public ResponseEntity<String> activateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) {

+        String methodName = "activateServiceInstance";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, true);

+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);

+    }

+

+    /**

+     * deactivate a service instance.

+     *

+     * @param serviceInstanceId the id of the service.

+     * @param requestDetails the body of the request.

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_deactivate_service_instance/{serviceInstanceId}", method = RequestMethod.POST)

+    public ResponseEntity<String> deactivateServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @RequestBody RequestDetails requestDetails) {

+        String methodName = "deactivateServiceInstance";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w = msoBusinessLogic.setServiceInstanceStatus(requestDetails, serviceInstanceId, false);

+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);

+    }

+

+    /**

+     * Gets the orchestration requests for the dashboard.

+     *  currently its all the orchestration requests with RequestType updateInstance or replaceInstance.

+     * @return the orchestration requests

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_get_orch_reqs/dashboard", method = RequestMethod.GET)

+    public List<Request> getOrchestrationRequestsForDashboard() {

+

+        String methodName = "getOrchestrationRequestsForDashboard";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+

+        return msoBusinessLogic.getOrchestrationRequestsForDashboard();

+    }

+

+    /**

+     * Gets the Manual Tasks for the given request id.

+     *

+     * @param originalRequestId the id of the original request.

+     * @return the tasks

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_get_man_task/{originalRequestId}", method = RequestMethod.GET)

+    public List<Task> getManualTasksByRequestId(@PathVariable("originalRequestId") String originalRequestId) {

+

+        String methodName = "getManualTasksByRequestId";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        return  msoBusinessLogic.getManualTasksByRequestId(originalRequestId);

+    }

+

+    /**

+     * Complete the manual task.

+     *

+     * @param taskId the id of the task to complete.

+     * @param requestDetails the body of the request.

+     * @return the response entity

+     * @throws Exception the exception

+     */

+    @RequestMapping(value = "/mso_post_man_task/{taskId}", method = RequestMethod.POST)

+    public ResponseEntity<String> manualTaskComplete(@PathVariable("taskId") String taskId , @RequestBody RequestDetails requestDetails) {

+

+        String methodName = "manualTaskComplete";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w = msoBusinessLogic.completeManualTask(requestDetails, taskId);

+        return new ResponseEntity<String>(w.getResponse(), HttpStatus.OK);

+    }

+

+    @RequestMapping(value = "/mso_remove_relationship/{serviceInstanceId}", method = RequestMethod.POST)

+    public ResponseEntity<String> removeRelationshipFromServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,

+                                                                        @RequestBody RequestDetails requestDetails) {

+

+        String methodName = "removeRelationshipFromServiceInstance";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w;

+        try {

+            w = msoBusinessLogic.removeRelationshipFromServiceInstance(requestDetails, serviceInstanceId);

+        } catch (Exception e){

+            LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);

+            return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);

+        }

+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);

+    }

+

+    @RequestMapping(value = "/mso_add_relationship/{serviceInstanceId}", method = RequestMethod.POST)

+    public ResponseEntity<String> addRelationshipToServiceInstance(@PathVariable("serviceInstanceId") String serviceInstanceId ,

+                                                                        @RequestBody RequestDetails requestDetails) {

+

+        String methodName = "addRelationshipToServiceInstance";

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");

+

+        MsoResponseWrapper w;

+        try {

+            w = msoBusinessLogic.addRelationshipToServiceInstance(requestDetails, serviceInstanceId);

+        } catch (Exception e){

+            LOGGER.error("Internal error when calling MSO controller logic for {}", methodName, e);

+            return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);

+        }

+        return new ResponseEntity<>(w.getResponse(), HttpStatus.OK);

+    }

+

+    /**

+     * Exception handler.

+     *

+     * @param e        the e

+     * @param response the response

+     * @throws IOException Signals that an I/O exception has occurred.

+     */

+    @ExceptionHandler(Exception.class)

+    private void exceptionHandler(Exception e, HttpServletResponse response) throws IOException {

+

+		/*

+         * The following "logger.error" lines "should" be sufficient for logging the exception.

+		 * However, the console output in my Eclipse environment is NOT showing ANY of the

+		 * logger statements in this class. Thus the temporary "e.printStackTrace" statement

+		 * is also included.

+		 */

+

+        String methodName = "exceptionHandler";

+        LOGGER.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+        StringWriter sw = new StringWriter();

+        e.printStackTrace(new PrintWriter(sw));

+        LOGGER.error(EELFLoggerDelegate.errorLogger, sw.toString());

+

+		/*

+         *  Temporary - IF the above  mentioned "logger.error" glitch is resolved ...

+		 *  this statement could be removed since it would then likely result in duplicate

+		 *  trace output. 

+		 */

+        e.printStackTrace(System.err);

+

+        response.setContentType("application/json; charset=UTF-8");

+        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);

+

+        ExceptionResponse exceptionResponse = new ExceptionResponse();

+        exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));

+        exceptionResponse.setMessage(e.getMessage());

+

+        response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));

+

+        response.flushBuffer();

+

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/OsamCoreRestrictedBaseController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OsamCoreRestrictedBaseController.java
new file mode 100644
index 0000000..24dbbb5
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/OsamCoreRestrictedBaseController.java
@@ -0,0 +1,65 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+import org.apache.commons.lang.StringUtils;

+import org.apache.commons.lang.exception.ExceptionUtils;

+import org.onap.osam.model.ExceptionResponse;

+import org.onap.portalsdk.core.controller.RestrictedBaseController;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.springframework.http.HttpStatus;

+import org.springframework.http.ResponseEntity;

+import org.springframework.web.bind.annotation.ExceptionHandler;

+import org.springframework.web.bind.annotation.ResponseBody;

+import org.springframework.web.bind.annotation.ResponseStatus;

+import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;

+

+import static org.onap.osam.utils.Logging.getMethodCallerName;

+import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;

+

+public abstract class OsamCoreRestrictedBaseController extends RestrictedBaseController {

+

+    protected final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(this.getClass().getName());

+

+    @ExceptionHandler(MethodArgumentTypeMismatchException.class)

+    @ResponseBody

+    public ResponseEntity handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e) {

+        LOGGER.error(EELFLoggerDelegate.errorLogger, "{}: {}", getMethodCallerName(), ExceptionUtils.getMessage(e), e);

+        Class<?> type = e.getRequiredType();

+        String message;

+        if (type.isEnum()) {

+            message = "The parameter " + e.getName() + " must have a value among : " + StringUtils.join(type.getEnumConstants(), ", ");

+        }

+        else {

+            message = "The parameter " + e.getName() + " must be of type " + type.getTypeName();

+        }

+        ResponseEntity  response = new ResponseEntity<String>(message, HttpStatus.BAD_REQUEST);

+        return response;

+    }

+

+    @ExceptionHandler(Exception.class)

+    @ResponseStatus(value=INTERNAL_SERVER_ERROR)

+    public ExceptionResponse exceptionHandler(Exception e) {

+        return ControllersUtils.handleException(e, LOGGER);

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/PodDemoController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/PodDemoController.java
new file mode 100644
index 0000000..c401d32
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/PodDemoController.java
@@ -0,0 +1,187 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+import org.onap.osam.aai.AaiResponse;

+import org.onap.osam.services.IAaiService;

+import org.onap.portalsdk.core.controller.UnRestrictedBaseController;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.onap.osam.dao.FnAppDoaImpl;

+import org.onap.osam.model.GitRepositoryState;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.HttpStatus;

+import org.springframework.http.MediaType;

+import org.springframework.http.ResponseEntity;

+import org.springframework.web.bind.annotation.PathVariable;

+import org.springframework.web.bind.annotation.RequestMapping;

+import org.springframework.web.bind.annotation.RequestMethod;

+import org.springframework.web.bind.annotation.RestController;

+

+import javax.servlet.http.HttpServletRequest;

+import java.io.IOException;

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.Date;

+import java.util.Properties;

+

+@RestController

+@RequestMapping("/")

+public class PodDemoController extends UnRestrictedBaseController {

+

+    @Autowired

+    private IAaiService aaiService;

+

+    private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(PodDemoController.class);

+

+    final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+

+    private static final String HEALTH_CHECK_PATH = "/healthCheck";

+    private static final String GIT_PROPERTIES_FILENAME = "git.properties";

+

+    /**

+     * Model for JSON response with health-check results.

+     */

+    public class HealthStatus {

+        // Either 200 or 500

+        public int statusCode;

+

+        // Additional detail in case of error, empty in case of success.

+        public String message;

+

+        public String date;

+

+        public HealthStatus(int code, String msg) {

+            this.statusCode = code;

+            this.message = msg;

+        }

+

+        public HealthStatus(int code, String date, String msg) {

+            this.statusCode = code;

+            this.message = msg;

+            this.date = date;

+        }

+

+        public int getStatusCode() {

+            return statusCode;

+        }

+

+        public void setStatusCode(int code) {

+            this.statusCode = code;

+        }

+

+        public String getMessage() {

+            return message;

+        }

+

+        public void setMessage(String msg) {

+            this.message = msg;

+        }

+

+        public String getDate() {

+            return date;

+        }

+

+        public void setDate(String date) {

+            this.date = date;

+        }

+

+    }

+

+    @SuppressWarnings("unchecked")

+    public int getProfileCount(String driver, String URL, String username, String password) {

+        FnAppDoaImpl doa = new FnAppDoaImpl();

+        int count = doa.getProfileCount(driver, URL, username, password);

+        return count;

+    }

+

+

+    /**

+     * Obtain the HealthCheck Status from the System.Properties file.

+     * Used by IDNS for redundancy

+     *

+     * @return ResponseEntity The response entity

+     * @throws IOException Signals that an I/O exception has occurred.

+     */

+    @RequestMapping(value = "/healthCheck", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public HealthStatus gethealthCheckStatusforIDNS() {

+

+        String driver = SystemProperties.getProperty("db.driver");

+        String URL = SystemProperties.getProperty("db.connectionURL");

+        String username = SystemProperties.getProperty("db.userName");

+        String password = SystemProperties.getProperty("db.password");

+

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, "driver ::" + driver);

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, "URL::" + URL);

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, "username::" + username);

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, "password::" + password);

+

+

+        HealthStatus healthStatus = null;

+        try {

+            LOGGER.debug(EELFLoggerDelegate.debugLogger, "Performing health check");

+            int count = getProfileCount(driver, URL, username, password);

+            LOGGER.debug(EELFLoggerDelegate.debugLogger, "count:::" + count);

+            healthStatus = new HealthStatus(200, "health check succeeded");

+        } catch (Exception ex) {

+

+            LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to perform health check", ex);

+            healthStatus = new HealthStatus(500, "health check failed: " + ex.toString());

+        }

+        return healthStatus;

+    }

+

+    @RequestMapping(value = "/pods/getAndSaveAll", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public ResponseEntity<String> getAndSaveAllPods() {

+

+        return (new ResponseEntity<>("", HttpStatus.OK));

+    }

+

+    @RequestMapping(value = {"/aai_test"}, method = RequestMethod.GET)

+    public ResponseEntity<String> getAicZones(HttpServletRequest request) throws IOException {

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== getAicZones controller start");

+        AaiResponse response = aaiService.getAaiZones();

+        return aaiResponseToResponseEntity(response);

+    }

+

+    private ResponseEntity<String> aaiResponseToResponseEntity(AaiResponse aaiResponseData)

+            throws IOException {

+        ResponseEntity<String> responseEntity;

+        ObjectMapper objectMapper = new ObjectMapper();

+        if (aaiResponseData.getHttpCode() == 200) {

+            responseEntity = new ResponseEntity<String>(objectMapper.writeValueAsString(aaiResponseData.getT()), HttpStatus.OK);

+        } else {

+            responseEntity = new ResponseEntity<String>(aaiResponseData.getErrorMessage(), HttpStatus.valueOf(aaiResponseData.getHttpCode()));

+        }

+        return responseEntity;

+    }

+

+    @RequestMapping(value = "/commitInfo", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

+    public GitRepositoryState getCommitInfo() throws IOException {

+        Properties properties = new Properties();

+        properties.load(getClass().getClassLoader().getResourceAsStream(GIT_PROPERTIES_FILENAME));

+        return new GitRepositoryState(properties);

+    }

+}

+

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/ViewLogController.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/ViewLogController.java
new file mode 100644
index 0000000..dc98503
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/ViewLogController.java
@@ -0,0 +1,63 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+import org.onap.portalsdk.core.controller.RestrictedBaseController;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.web.bind.annotation.RequestMapping;

+import org.springframework.web.bind.annotation.RequestMethod;

+import org.springframework.web.bind.annotation.RestController;

+import org.springframework.web.servlet.ModelAndView;

+

+import javax.servlet.ServletContext;

+import javax.servlet.http.HttpServletRequest;

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+

+

+@RestController

+public class ViewLogController extends RestrictedBaseController{

+	

+	private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(ViewLogController.class);

+	

+	/** The Constant dateFormat. */

+	final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+	

+	/** The servlet context. */

+	private @Autowired ServletContext servletContext;

+	

+	/**

+	 * Welcome.

+	 *

+	 * @param request the request

+	 * @return the model and view

+	 */

+	@RequestMapping(value = {"/viewlog" }, method = RequestMethod.GET)

+	public ModelAndView welcome(HttpServletRequest request) {

+		

+ 	return new ModelAndView(getViewName());		

+	}

+	

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/controllers/WebConfig.java b/onap-enabler-be/src/main/java/org/onap/osam/controllers/WebConfig.java
new file mode 100644
index 0000000..32e0510
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/controllers/WebConfig.java
@@ -0,0 +1,125 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.controllers;

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+import org.onap.osam.aai.AaiClient;

+import org.onap.osam.aai.AaiClientInterface;

+import org.onap.osam.aai.PombaClientImpl;

+import org.onap.osam.aai.PombaClientInterface;

+import org.onap.osam.aai.PombaRestInterface;

+import org.onap.osam.aai.model.PortDetailsTranslator;

+import org.onap.osam.aai.util.AAIRestInterface;

+import org.onap.osam.aai.util.HttpsAuthClient;

+import org.onap.osam.aai.util.SSLContextProvider;

+import org.onap.osam.aai.util.ServletRequestHelper;

+import org.onap.osam.aai.util.SystemPropertyHelper;

+import org.onap.osam.client.SyncRestClient;

+import org.onap.osam.client.SyncRestClientInterface;

+import org.onap.osam.scheduler.SchedulerRestInterface;

+import org.onap.osam.scheduler.SchedulerRestInterfaceIfc;

+import org.onap.osam.services.AaiServiceImpl;

+import org.onap.osam.services.IAaiService;

+import org.onap.osam.services.IPombaService;

+import org.onap.osam.services.PombaServiceImpl;

+import org.springframework.beans.factory.annotation.Qualifier;

+import org.springframework.context.annotation.Bean;

+import org.springframework.context.annotation.Configuration;

+

+import javax.servlet.ServletContext;

+import java.io.File;

+

+@Configuration

+public class WebConfig {

+

+    @Bean

+    public ObjectMapper getObjectMapper() {

+        return new ObjectMapper();

+    }

+

+    @Bean

+    public IAaiService getAaiService() {

+        return new AaiServiceImpl();

+    }

+

+    @Bean

+    public PortDetailsTranslator portDetailsTranslator() {

+        return new PortDetailsTranslator();

+    }

+

+    @Bean

+    public AaiClientInterface getAaiRestInterface(@Qualifier("aaiRestInterface") AAIRestInterface restController, PortDetailsTranslator portsDetailsTranslator) {

+        return new AaiClient(restController, portsDetailsTranslator);

+    }

+

+    @Bean(name = "aaiRestInterface")

+    public AAIRestInterface aaiRestInterface(HttpsAuthClient httpsAuthClientFactory, ServletRequestHelper servletRequestHelper, SystemPropertyHelper systemPropertyHelper) {

+        return new AAIRestInterface(httpsAuthClientFactory, servletRequestHelper, systemPropertyHelper);

+    }

+

+    @Bean

+    public PombaRestInterface getPombaRestInterface(HttpsAuthClient httpsAuthClientFactory, ServletRequestHelper servletRequestHelper, SystemPropertyHelper systemPropertyHelper) {

+        return new PombaRestInterface(httpsAuthClientFactory, servletRequestHelper, systemPropertyHelper);

+    }

+

+    @Bean

+    public SSLContextProvider sslContextProvider() {

+        return new SSLContextProvider();

+    }

+

+    @Bean

+    public SystemPropertyHelper systemPropertyHelper() {

+        return new SystemPropertyHelper();

+    }

+

+    @Bean

+    public ServletRequestHelper servletRequestHelper() {

+        return new ServletRequestHelper();

+    }

+

+    @Bean

+    public HttpsAuthClient httpsAuthClientFactory(ServletContext servletContext, SystemPropertyHelper systemPropertyHelper, SSLContextProvider sslContextProvider) {

+        final String certFilePath = new File(servletContext.getRealPath("/WEB-INF/cert/")).getAbsolutePath();

+        return new HttpsAuthClient(certFilePath, systemPropertyHelper, sslContextProvider);

+    }

+

+    @Bean

+    public SyncRestClientInterface syncRestClient() {

+        return new SyncRestClient();

+    }

+

+    @Bean

+    public IPombaService getVerifyServiceInstanceService() {

+        return new PombaServiceImpl();

+    }

+

+    @Bean

+    public PombaClientInterface getVerifyServiceInstanceClientInterface() {

+        return new PombaClientImpl();

+    }

+

+    @Bean

+    public SchedulerRestInterfaceIfc getSchedulerRestInterface(){

+        return new SchedulerRestInterface();

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/dao/FnAppDoaImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/dao/FnAppDoaImpl.java
new file mode 100644
index 0000000..1bb57d8
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/dao/FnAppDoaImpl.java
@@ -0,0 +1,115 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.dao;

+

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+

+import java.sql.*;

+

+

+public class FnAppDoaImpl {

+

+	static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnAppDoaImpl.class);

+		

+		public int getProfileCount(String driver, String URL, String username, String password) {

+			Connection dbc = null;

+			PreparedStatement pst = null;

+			ResultSet rs = null;

+			String q = null;

+			int count = 0;

+			try {

+				 	dbc = getConnection(URL,username,password);

+				   logger.debug(EELFLoggerDelegate.debugLogger, "getConnection:::"+ dbc);

+				q = "select count(*) from fn_app";

+					pst = dbc.prepareStatement(q);

+					rs = pst.executeQuery();

+					

+					if (rs.next())

+						count = rs.getInt(1);

+			} catch(Exception ex) {

+				logger.error(EELFLoggerDelegate.errorLogger, "Failed to perform health check", ex);

+			} finally {

+				cleanup(rs,pst,dbc);

+			}

+			logger.debug(EELFLoggerDelegate.debugLogger, "count:::"+ count);

+			return count;

+		}

+

+		public static Connection getConnection(String url, String username, String password) throws SQLException {

+			java.sql.Connection con=null;

+		

+			if( url!=null && username!=null && password!=null ){

+			    con = DriverManager.getConnection(url, username, password);

+			}

+

+			logger.info("Connection Successful");

+

+			return con;

+			

+		}

+		

+		public static void cleanup(ResultSet rs, PreparedStatement st, Connection c) {

+			if (rs != null) {

+				closeResultSet(rs);

+			}

+			if (st != null) {

+				closePreparedStatement(st);

+			}

+			if (c != null) {

+				rollbackAndCloseConnection(c);

+			}

+		}

+

+	private static void rollbackAndCloseConnection(Connection c) {

+		try {

+            c.rollback();

+        } catch (Exception e) {

+            if (logger != null)

+                logger.error("Error when trying to rollback connection", e);

+        }

+		try {

+            c.close();

+        } catch (Exception e) {

+            if (logger != null)

+                logger.error("Error when trying to close connection", e);

+        }

+	}

+

+	private static void closePreparedStatement(PreparedStatement st) {

+		try {

+            st.close();

+        } catch (Exception e) {

+            if (logger != null)

+                logger.error("Error when trying to close statement", e);

+        }

+	}

+

+	private static void closeResultSet(ResultSet rs) {

+		try {

+            rs.close();

+        } catch (Exception e) {

+            if (logger != null)

+                logger.error("Error when trying to close result set", e);

+        }

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/dao/ProfileDao.java b/onap-enabler-be/src/main/java/org/onap/osam/dao/ProfileDao.java
new file mode 100644
index 0000000..22afd2e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/dao/ProfileDao.java
@@ -0,0 +1,39 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.dao;

+

+import java.util.List;

+import org.onap.portalsdk.core.domain.Profile;

+

+public interface ProfileDao {

+	

+	List<Profile> findAll();

+	

+	/**

+	 * Gets the profile.

+	 *

+	 * @param id the id

+	 * @return the profile

+	 */

+	Profile getProfile(int id);

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/exceptions/DbFailureUncheckedException.java b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/DbFailureUncheckedException.java
new file mode 100644
index 0000000..084833e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/DbFailureUncheckedException.java
@@ -0,0 +1,39 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.exceptions;

+

+public class DbFailureUncheckedException extends GenericUncheckedException {

+

+

+    public DbFailureUncheckedException(String message) {

+        super(message);

+    }

+

+    public DbFailureUncheckedException(String message, Throwable cause) {

+        super(message, cause);

+    }

+

+    public DbFailureUncheckedException(Throwable cause) {

+        super(cause);

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/exceptions/GenericUncheckedException.java b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/GenericUncheckedException.java
new file mode 100644
index 0000000..b922b90
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/GenericUncheckedException.java
@@ -0,0 +1,37 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.exceptions;

+

+public class GenericUncheckedException extends RuntimeException {

+    public GenericUncheckedException(String message) {

+        super(message);

+    }

+

+    public GenericUncheckedException(String message, Throwable cause) {

+        super(message, cause);

+    }

+

+    public GenericUncheckedException(Throwable cause) {

+        super(cause);

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/exceptions/MaxRetriesException.java b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/MaxRetriesException.java
new file mode 100644
index 0000000..6b3a77c
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/MaxRetriesException.java
@@ -0,0 +1,30 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.exceptions;

+

+public class MaxRetriesException extends GenericUncheckedException {

+

+    public MaxRetriesException(String operationDetails, int numberOfRetries) {

+        super(String.format("Max retries for %s, retries: %d", operationDetails, numberOfRetries));

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/exceptions/NotFoundException.java b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/NotFoundException.java
new file mode 100644
index 0000000..9fa1ff2
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/NotFoundException.java
@@ -0,0 +1,34 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.exceptions;

+

+public class NotFoundException extends RuntimeException {

+

+     public NotFoundException(String message) {

+        super(message);

+    }

+

+    public NotFoundException(String message, Throwable cause) {

+        super(message, cause);

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/exceptions/OperationNotAllowedException.java b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/OperationNotAllowedException.java
new file mode 100644
index 0000000..c83c38d
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/OperationNotAllowedException.java
@@ -0,0 +1,29 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.exceptions;

+

+public class OperationNotAllowedException extends GenericUncheckedException {

+    public OperationNotAllowedException(String message) {

+        super(message);

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/exceptions/VidServiceUnavailableException.java b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/VidServiceUnavailableException.java
new file mode 100644
index 0000000..50432a1
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/exceptions/VidServiceUnavailableException.java
@@ -0,0 +1,67 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.exceptions;

+

+import org.springframework.http.HttpStatus;

+import org.springframework.web.bind.annotation.ResponseStatus;

+

+@ResponseStatus(value=HttpStatus.SERVICE_UNAVAILABLE)

+public class VidServiceUnavailableException extends Exception {

+

+	private static final long serialVersionUID = 1L;

+

+	/**

+	 * Instantiates a new vid service unavailable exception.

+	 */

+	public VidServiceUnavailableException() {

+		super();

+	}

+	

+	/**

+	 * Instantiates a new vid service unavailable exception.

+	 *

+	 * @param msg the msg

+	 */

+	public VidServiceUnavailableException(String msg) {

+		super(msg);

+	}

+	

+	/**

+	 * Instantiates a new vid service unavailable exception.

+	 *

+	 * @param t the t

+	 */

+	public VidServiceUnavailableException(Throwable t) {

+		super(t);

+	}

+	

+	/**

+	 * Instantiates a new vid service unavailable exception.

+	 *

+	 * @param msg the msg

+	 * @param t the t

+	 */

+	public VidServiceUnavailableException(String msg, Throwable t) {

+		super(msg, t);

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/factories/MsoRequestFactory.java b/onap-enabler-be/src/main/java/org/onap/osam/factories/MsoRequestFactory.java
new file mode 100644
index 0000000..0e6363a
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/factories/MsoRequestFactory.java
@@ -0,0 +1,34 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.factories;

+

+import org.onap.osam.mso.rest.RequestDetails;

+

+public class MsoRequestFactory {

+

+    public RequestDetails createMsoRequest(String path)

+    {

+        return null;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/filters/ClientCredentialsFilter.java b/onap-enabler-be/src/main/java/org/onap/osam/filters/ClientCredentialsFilter.java
new file mode 100644
index 0000000..210a289
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/filters/ClientCredentialsFilter.java
@@ -0,0 +1,81 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.filters;

+

+import org.apache.commons.lang3.StringUtils;

+import org.onap.osam.scheduler.SchedulerProperties;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.springframework.web.filter.GenericFilterBean;

+import javax.servlet.FilterChain;

+import javax.servlet.ServletException;

+import javax.servlet.ServletRequest;

+import javax.servlet.ServletResponse;

+import javax.servlet.annotation.WebFilter;

+import javax.servlet.http.HttpServletRequest;

+import javax.servlet.http.HttpServletResponse;

+import java.io.IOException;

+

+@WebFilter(urlPatterns = "/change-management/workflow/*")

+public class ClientCredentialsFilter  extends GenericFilterBean {

+

+    private final static EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(ClientCredentialsFilter.class);

+

+

+    @Override

+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

+

+        if (!(request instanceof HttpServletRequest) || !(response instanceof HttpServletResponse))

+            return;

+

+        String expectedAuthorization = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_BASIC_AUTH);

+        String actualAuthorization = ((HttpServletRequest)request).getHeader("Authorization");

+

+        if (verifyClientCredentials(actualAuthorization, expectedAuthorization)) {

+            LOGGER.warn(EELFLoggerDelegate.debugLogger,"Client credentials authenticated.");

+            chain.doFilter(request, response);

+            return;

+        }

+

+        LOGGER.warn(EELFLoggerDelegate.debugLogger,"Client did not provide the expected credentials.");

+        ((HttpServletResponse) response).sendError(401);

+    }

+

+    public boolean verifyClientCredentials(String actualAuthorization, String expectedAuthorization)

+    {

+        if (StringUtils.isEmpty(expectedAuthorization))

+        {

+            LOGGER.warn(EELFLoggerDelegate.debugLogger,String.format("Expected Authorization is not configured (key: %s)", SchedulerProperties.SCHEDULER_BASIC_AUTH));

+            return true;

+        }

+

+        if (StringUtils.isEmpty(actualAuthorization))

+        {

+            LOGGER.warn(EELFLoggerDelegate.debugLogger,"Authorization header is missing.");

+            return false;

+        }

+

+        return actualAuthorization.equals(expectedAuthorization);

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/filters/PromiseEcompRequestIdFilter.java b/onap-enabler-be/src/main/java/org/onap/osam/filters/PromiseEcompRequestIdFilter.java
new file mode 100644
index 0000000..9c3d918
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/filters/PromiseEcompRequestIdFilter.java
@@ -0,0 +1,116 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.filters;

+

+

+import com.google.common.collect.ImmutableList;

+import org.apache.commons.lang3.StringUtils;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.springframework.web.filter.GenericFilterBean;

+

+import javax.servlet.FilterChain;

+import javax.servlet.ServletException;

+import javax.servlet.ServletRequest;

+import javax.servlet.ServletResponse;

+import javax.servlet.annotation.WebFilter;

+import javax.servlet.http.HttpServletRequest;

+import javax.servlet.http.HttpServletRequestWrapper;

+import javax.servlet.http.HttpServletResponse;

+import java.io.IOException;

+import java.util.Collections;

+import java.util.Enumeration;

+import java.util.UUID;

+

+import static org.onap.portalsdk.core.util.SystemProperties.ECOMP_REQUEST_ID;

+

+@WebFilter(urlPatterns = "/*")

+public class PromiseEcompRequestIdFilter extends GenericFilterBean {

+

+    private final static EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(PromiseEcompRequestIdFilter.class);

+    private final static String REQUEST_ID_RESPONSE_HEADER = ECOMP_REQUEST_ID + "-echo";

+

+

+    @Override

+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)

+            throws IOException, ServletException {

+

+        if (request instanceof HttpServletRequest) {

+            request = wrapIfNeeded(request);

+

+            if (response instanceof HttpServletResponse) {

+                final String actualRequestId = ((HttpServletRequest) request).getHeader(ECOMP_REQUEST_ID);

+                ((HttpServletResponse) response).addHeader(REQUEST_ID_RESPONSE_HEADER, actualRequestId);

+            }

+        }

+

+        chain.doFilter(request, response);

+    }

+

+    public static ServletRequest wrapIfNeeded(ServletRequest request) {

+        final HttpServletRequest httpRequest = (HttpServletRequest) request;

+        final String originalRequestId = httpRequest.getHeader(ECOMP_REQUEST_ID);

+

+        if (StringUtils.isEmpty(originalRequestId)) {

+            request = new PromiseEcompRequestIdRequestWrapper(httpRequest);

+        }

+

+        return request;

+    }

+

+    private static class PromiseEcompRequestIdRequestWrapper extends HttpServletRequestWrapper {

+

+        private final UUID requestId;

+

+        PromiseEcompRequestIdRequestWrapper(HttpServletRequest request) {

+            super(request);

+            requestId = UUID.randomUUID();

+        }

+

+        @Override

+        public String getHeader(String name) {

+            return isRequestIdHeaderName(name) ?

+                    requestId.toString() : super.getHeader(name);

+        }

+

+        @Override

+        public Enumeration<String> getHeaders(String name) {

+            if (isRequestIdHeaderName(name)) {

+                return Collections.enumeration(Collections.singleton(requestId.toString()));

+            } else {

+                return super.getHeaders(name);

+            }

+        }

+

+        @Override

+        public Enumeration<String> getHeaderNames() {

+            return Collections.enumeration(ImmutableList.<String>builder()

+                    .add(ECOMP_REQUEST_ID)

+                    .addAll(Collections.list(super.getHeaderNames()))

+                    .build());

+        }

+

+        private boolean isRequestIdHeaderName(String name) {

+            return ECOMP_REQUEST_ID.equalsIgnoreCase(name);

+        }

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/filters/TempFilterForCORS.java b/onap-enabler-be/src/main/java/org/onap/osam/filters/TempFilterForCORS.java
new file mode 100644
index 0000000..5f76026
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/filters/TempFilterForCORS.java
@@ -0,0 +1,70 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.filters;

+

+import org.apache.commons.lang3.StringUtils;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.springframework.web.filter.GenericFilterBean;

+

+import javax.servlet.FilterChain;

+import javax.servlet.ServletException;

+import javax.servlet.ServletRequest;

+import javax.servlet.ServletResponse;

+import javax.servlet.annotation.WebFilter;

+import javax.servlet.http.HttpServletResponse;

+import java.io.IOException;

+

+@WebFilter(urlPatterns = "/*")

+public class TempFilterForCORS extends GenericFilterBean {

+

+    private static final String ENV_MODE = "env.mode";

+    private Boolean devMode = null;

+

+     //dev mode is initialized here since @WebFilter doesn't support @Autowired

+    //So we are sure that SystemProperties bean was initialed only after the first call to doFilter

+    private boolean isDevMode() {

+        if (devMode!=null) {

+            return devMode;

+        }

+        else {

+            if (!SystemProperties.containsProperty(ENV_MODE)) {

+                devMode = Boolean.FALSE;

+                return devMode;

+            }

+

+            String envMode = SystemProperties.getProperty(ENV_MODE);

+            devMode = StringUtils.equalsIgnoreCase(envMode, "dev") ;

+        }

+        return devMode;

+    }

+

+    @Override

+    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

+

+        if (isDevMode() && response instanceof HttpServletResponse) {

+            ((HttpServletResponse) response).addHeader("Access-Control-Allow-Origin", "http://localhost:3000");

+            ((HttpServletResponse) response).addHeader("Access-Control-Allow-Credentials", "true");

+        }

+        chain.doFilter(request, response);

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/Job.java b/onap-enabler-be/src/main/java/org/onap/osam/job/Job.java
new file mode 100644
index 0000000..8c4deed
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/Job.java
@@ -0,0 +1,69 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job;

+

+import com.fasterxml.jackson.annotation.JsonIgnore;

+

+import java.util.Map;

+import java.util.UUID;

+

+public interface Job {

+

+    UUID getUuid();

+

+    void setUuid(UUID uuid);

+

+    JobStatus getStatus();

+

+    void setStatus(JobStatus status);

+

+    @JsonIgnore

+    Map<String, Object> getData();

+

+    void setTypeAndData(JobType jobType, Map<String, Object> data);

+

+    UUID getTemplateId();

+

+    void setTemplateId(UUID templateId);

+

+    void setIndexInBulk(Integer indexInBulk);

+

+    JobType getType();

+

+    enum JobStatus {

+        COMPLETED(true),

+        FAILED(true),

+        IN_PROGRESS(false),

+        PAUSE(false),

+        PENDING(false),

+        STOPPED(true);

+

+        private final Boolean finalStatus;

+        public Boolean isFinal(){return finalStatus;}

+

+        JobStatus(Boolean finalStatus)

+        {

+            this.finalStatus = finalStatus ;

+        }

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/JobAdapter.java b/onap-enabler-be/src/main/java/org/onap/osam/job/JobAdapter.java
new file mode 100644
index 0000000..b7a732d
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/JobAdapter.java
@@ -0,0 +1,45 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job;

+

+import org.onap.osam.model.JobBulk;

+import org.onap.osam.model.JobModel;

+

+import java.util.List;

+import java.util.Map;

+import java.util.UUID;

+

+public interface JobAdapter {

+    JobModel toModel(Job job);

+

+    JobBulk toModelBulk(List<Job> jobList);

+

+    List<Job> createBulkOfJobs(Map<String, Object> bulkRequest);

+

+    Job createJob(JobType jobType, AsyncJobRequest request, UUID templateId, String userId, Integer indexInBulk);

+

+    // Marks types that are an AsyncJob payload

+    public interface AsyncJobRequest {

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/JobCommand.java b/onap-enabler-be/src/main/java/org/onap/osam/job/JobCommand.java
new file mode 100644
index 0000000..161461b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/JobCommand.java
@@ -0,0 +1,52 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job;

+

+import java.util.Map;

+import java.util.UUID;

+

+

+public interface JobCommand {

+

+    default JobCommand init(UUID jobUuid, Map<String, Object> data) {

+        return this;

+    }

+

+    /**

+     * @return Returns the inner state of the command. This state, once passed into init(), should

+     *         bring the command back to it's state.

+     */

+    Map<String, Object> getData();

+

+    /**

+     * Execute the command represented by this instance. Assumes the instance is already init().

+     * @return A NextCommand containing the next command in chain of commands, or null if chain

+     *         should be terminated. Might return itself (packed in a NextCommand).

+     */

+    NextCommand call();

+

+    default JobType getType() {

+        return JobType.jobTypeOf(this.getClass());

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/JobType.java b/onap-enabler-be/src/main/java/org/onap/osam/job/JobType.java
new file mode 100644
index 0000000..6b8f5b2
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/JobType.java
@@ -0,0 +1,53 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job;

+

+import org.onap.osam.job.command.*;

+

+import java.util.Map;

+import java.util.stream.Collectors;

+import java.util.stream.Stream;

+

+public enum JobType {

+

+    HttpCall(HttpCallCommand.class),

+    AggregateState(AggregateStateCommand.class),

+    InProgressStatus(InProgressStatusCommand.class),

+    NoOp(NoOpCommand.class),

+    ServiceInstantiation(ServiceInstantiationCommand.class);

+

+    private static final Map<Class, JobType> REVERSE_MAP = Stream.of(values()).collect(Collectors.toMap(t -> t.getCommandClass(), t -> t));

+

+    private final Class commandClass;

+

+    <T extends JobCommand> JobType(Class<T> commandClass) {

+        this.commandClass = commandClass;

+    }

+

+    public Class getCommandClass() {

+        return commandClass;

+    }

+    static JobType jobTypeOf(Class commandClass) {

+        return REVERSE_MAP.get(commandClass);

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/JobsBrokerService.java b/onap-enabler-be/src/main/java/org/onap/osam/job/JobsBrokerService.java
new file mode 100644
index 0000000..3554a08
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/JobsBrokerService.java
@@ -0,0 +1,43 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job;

+

+import java.util.Collection;

+import java.util.Optional;

+import java.util.UUID;

+

+public interface JobsBrokerService {

+

+    UUID add(Job job);

+

+    Optional<Job> pull(Job.JobStatus topic, String ownerId);

+

+    void pushBack(Job job);

+

+    Collection<Job> peek();

+

+    Job peek(UUID jobId);

+

+    void delete(UUID jobId);

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/NextCommand.java b/onap-enabler-be/src/main/java/org/onap/osam/job/NextCommand.java
new file mode 100644
index 0000000..4afb54a
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/NextCommand.java
@@ -0,0 +1,47 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job;

+

+public class NextCommand {

+    private final Job.JobStatus status;

+    private final JobCommand command;

+

+    public NextCommand(Job.JobStatus nextStatus, JobCommand nextCommand) {

+        this.status = nextStatus;

+        this.command = nextCommand;

+    }

+

+    public NextCommand(Job.JobStatus nextStatus) {

+        this.status = nextStatus;

+        this.command = null;

+    }

+

+    public Job.JobStatus getStatus() {

+        return status;

+    }

+

+    public JobCommand getCommand() {

+        return command;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/command/AggregateStateCommand.java b/onap-enabler-be/src/main/java/org/onap/osam/job/command/AggregateStateCommand.java
new file mode 100644
index 0000000..fbbb95e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/command/AggregateStateCommand.java
@@ -0,0 +1,48 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job.command;

+

+import org.onap.osam.job.JobCommand;

+import org.onap.osam.job.NextCommand;

+import org.springframework.beans.factory.config.ConfigurableBeanFactory;

+import org.springframework.context.annotation.Scope;

+import org.springframework.stereotype.Component;

+

+import java.util.Collections;

+import java.util.Map;

+

+@Component

+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)

+public class AggregateStateCommand implements JobCommand {

+

+    @Override

+    public NextCommand call() {

+        return null;

+    }

+

+    @Override

+    public Map<String, Object> getData() {

+        return Collections.emptyMap();

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/command/HttpCallCommand.java b/onap-enabler-be/src/main/java/org/onap/osam/job/command/HttpCallCommand.java
new file mode 100644
index 0000000..79d664f
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/command/HttpCallCommand.java
@@ -0,0 +1,74 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job.command;

+

+import com.google.common.collect.ImmutableMap;

+import org.onap.osam.job.Job;

+import org.onap.osam.job.JobCommand;

+import org.onap.osam.job.NextCommand;

+import org.springframework.beans.factory.config.ConfigurableBeanFactory;

+import org.springframework.context.annotation.Scope;

+import org.springframework.stereotype.Component;

+

+import javax.ws.rs.client.ClientBuilder;

+import javax.ws.rs.client.Entity;

+import javax.ws.rs.core.Response;

+import java.util.Map;

+import java.util.UUID;

+

+

+@Component

+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)

+public class HttpCallCommand implements JobCommand {

+    private String url;

+    private UUID uuid;

+

+    public HttpCallCommand() {

+    }

+

+    public HttpCallCommand(String url, UUID uuid) {

+        init(url, uuid);

+    }

+

+    @Override

+    public NextCommand call() {

+        final Response response = ClientBuilder.newClient().target(url).request().post(Entity.text(uuid.toString()));

+        return new NextCommand(Job.JobStatus.COMPLETED);

+    }

+

+    @Override

+    public HttpCallCommand init(UUID jobUuid, Map<String, Object> data) {

+        return init((String) data.get("url"), jobUuid);

+    }

+

+    private HttpCallCommand init(String url, UUID jobUuid) {

+        this.url = url;

+        this.uuid = jobUuid;

+        return this;

+    }

+

+    @Override

+    public Map<String, Object> getData() {

+        return ImmutableMap.of("url", url);

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/command/InProgressStatusCommand.java b/onap-enabler-be/src/main/java/org/onap/osam/job/command/InProgressStatusCommand.java
new file mode 100644
index 0000000..dc42136
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/command/InProgressStatusCommand.java
@@ -0,0 +1,133 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job.command;

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+import com.google.common.collect.ImmutableMap;

+import io.joshworks.restclient.http.HttpResponse;

+import org.onap.osam.job.Job.JobStatus;

+import org.onap.osam.job.JobCommand;

+import org.onap.osam.job.NextCommand;

+import org.onap.osam.mso.MsoInterface;

+import org.onap.osam.mso.rest.AsyncRequestStatus;

+import org.onap.osam.services.IAsyncInstantiationBusinessLogic;

+import org.onap.osam.services.IAuditService;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.springframework.beans.factory.config.ConfigurableBeanFactory;

+import org.springframework.context.annotation.Scope;

+import org.springframework.stereotype.Component;

+

+import javax.inject.Inject;

+import java.util.Map;

+import java.util.UUID;

+

+

+@Component

+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)

+public class InProgressStatusCommand implements JobCommand {

+

+    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

+

+    private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(InProgressStatusCommand.class);

+

+    @Inject

+    private IAsyncInstantiationBusinessLogic asyncInstantiationBL;

+

+    @Inject

+    private MsoInterface restMso;

+

+    @Inject

+    private IAuditService auditService;

+

+    private String requestId;

+

+    private UUID jobUuid;

+

+    public InProgressStatusCommand() {

+    }

+

+    InProgressStatusCommand(UUID jobUuid, String requestId) {

+        init(jobUuid, requestId);

+    }

+

+    @Override

+    public NextCommand call() {

+

+        try {

+            String path = asyncInstantiationBL.getOrchestrationRequestsPath()+"/"+requestId;

+            HttpResponse<AsyncRequestStatus> msoResponse = restMso.get(path, AsyncRequestStatus.class);

+

+

+            JobStatus jobStatus;

+            if (msoResponse.getStatus() >= 400 || msoResponse.getBody() == null) {

+                auditService.setFailedAuditStatusFromMso(jobUuid, requestId, msoResponse.getStatus(), msoResponse.getBody().toString());

+                LOGGER.error(EELFLoggerDelegate.errorLogger,

+                        "Failed to get orchestration status for {}. Status code: {},  Body: {}",

+                        requestId, msoResponse.getStatus(), msoResponse.getRawBody().toString());

+                return new NextCommand(JobStatus.IN_PROGRESS, this);

+            }

+            else {

+                jobStatus = asyncInstantiationBL.calcStatus(msoResponse.getBody());

+            }

+

+            asyncInstantiationBL.auditMsoStatus(jobUuid,msoResponse.getBody().request);

+

+

+            if (jobStatus == JobStatus.FAILED) {

+                asyncInstantiationBL.handleFailedInstantiation(jobUuid);

+            }

+            else {

+                asyncInstantiationBL.updateServiceInfoAndAuditStatus(jobUuid, jobStatus);

+            }

+            //in case of JobStatus.PAUSE we leave the job itself as IN_PROGRESS, for keep tracking job progress

+            if (jobStatus == JobStatus.PAUSE) {

+                return new NextCommand(JobStatus.IN_PROGRESS, this);

+            }

+            return new NextCommand(jobStatus, this);

+        } catch (javax.ws.rs.ProcessingException e) {

+            // Retry when we can't connect MSO during getStatus

+            LOGGER.error(EELFLoggerDelegate.errorLogger, "Cannot get orchestration status for {}, will retry: {}", requestId, e, e);

+            return new NextCommand(JobStatus.IN_PROGRESS, this);

+        } catch (RuntimeException e) {

+            LOGGER.error(EELFLoggerDelegate.errorLogger, "Cannot get orchestration status for {}, stopping: {}", requestId, e, e);

+            return new NextCommand(JobStatus.STOPPED, this);

+        }

+    }

+

+    @Override

+    public InProgressStatusCommand init(UUID jobUuid, Map<String, Object> data) {

+        return init(jobUuid, (String) data.get("requestId"));

+    }

+

+    private InProgressStatusCommand init(UUID jobUuid, String requestId) {

+        this.requestId = requestId;

+        this.jobUuid = jobUuid;

+        return this;

+    }

+

+    @Override

+    public Map<String, Object> getData() {

+        return ImmutableMap.of("requestId", requestId);

+    }

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/command/JobCommandFactory.java b/onap-enabler-be/src/main/java/org/onap/osam/job/command/JobCommandFactory.java
new file mode 100644
index 0000000..be430b8
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/command/JobCommandFactory.java
@@ -0,0 +1,65 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job.command;

+

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.osam.job.Job;

+import org.onap.osam.job.JobCommand;

+import org.springframework.context.ApplicationContext;

+import org.springframework.stereotype.Component;

+

+import javax.inject.Inject;

+import java.util.function.Function;

+

+@Component

+public class JobCommandFactory {

+

+    final Function<Class<? extends JobCommand>, JobCommand> jobFactory;

+

+    @Inject

+    public JobCommandFactory(ApplicationContext applicationContext) {

+        this.jobFactory = (jobType -> {

+            final Object commandBean = applicationContext.getBean(jobType);

+

+            if (!(commandBean instanceof JobCommand)) {

+                throw new GenericUncheckedException(commandBean.getClass() + " is not a JobCommand");

+            }

+

+            return (JobCommand) commandBean;

+        });

+    }

+

+    public JobCommandFactory(Function<Class<? extends JobCommand>, JobCommand> jobFactory) {

+        this.jobFactory = jobFactory;

+    }

+

+    public JobCommand toCommand(Job job) {

+

+        final JobCommand command = jobFactory.apply(job.getType().getCommandClass());

+        command.init(job.getUuid(), job.getData());

+

+        return command;

+    }

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/command/NoOpCommand.java b/onap-enabler-be/src/main/java/org/onap/osam/job/command/NoOpCommand.java
new file mode 100644
index 0000000..92619b0
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/command/NoOpCommand.java
@@ -0,0 +1,47 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job.command;

+

+import org.onap.osam.job.JobCommand;

+import org.onap.osam.job.NextCommand;

+import org.springframework.beans.factory.config.ConfigurableBeanFactory;

+import org.springframework.context.annotation.Scope;

+import org.springframework.stereotype.Component;

+

+import java.util.Collections;

+import java.util.Map;

+

+@Component

+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)

+public class NoOpCommand implements JobCommand {

+

+    @Override

+    public NextCommand call() {

+        return null;

+    }

+

+    @Override

+    public Map<String, Object> getData() {

+        return Collections.emptyMap();

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/command/ServiceInstantiationCommand.java b/onap-enabler-be/src/main/java/org/onap/osam/job/command/ServiceInstantiationCommand.java
new file mode 100644
index 0000000..1e03d4f
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/command/ServiceInstantiationCommand.java
@@ -0,0 +1,162 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job.command;

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+import com.google.common.collect.ImmutableMap;

+import io.joshworks.restclient.http.HttpResponse;

+import org.onap.osam.services.IAsyncInstantiationBusinessLogic;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.osam.aai.exceptions.InvalidAAIResponseException;

+import org.onap.osam.exceptions.MaxRetriesException;

+import org.onap.osam.job.Job;

+import org.onap.osam.job.JobCommand;

+import org.onap.osam.job.NextCommand;

+import org.onap.osam.model.RequestReferencesContainer;

+import org.onap.osam.model.serviceInstantiation.ServiceInstantiation;

+import org.onap.osam.mso.MsoInterface;

+import org.onap.osam.mso.rest.RequestDetailsWrapper;

+import org.onap.osam.services.IAuditService;

+import org.springframework.beans.factory.config.ConfigurableBeanFactory;

+import org.springframework.context.annotation.Scope;

+import org.springframework.stereotype.Component;

+

+import javax.inject.Inject;

+import java.util.Map;

+import java.util.UUID;

+

+

+@Component

+@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)

+public class ServiceInstantiationCommand implements JobCommand {

+

+    private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

+

+    private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(ServiceInstantiationCommand.class);

+

+    @Inject

+    private IAsyncInstantiationBusinessLogic asyncInstantiationBL;

+

+    @Inject

+    private IAuditService auditService;

+

+    @Inject

+    private MsoInterface restMso;

+

+    private UUID uuid;

+    private ServiceInstantiation serviceInstantiationRequest;

+    private String userId;

+

+    public ServiceInstantiationCommand() {

+    }

+

+    public ServiceInstantiationCommand(UUID uuid, ServiceInstantiation serviceInstantiationRequest, String userId) {

+        init(uuid, serviceInstantiationRequest, userId);

+    }

+

+    @Override

+    public NextCommand call() {

+        RequestDetailsWrapper requestDetailsWrapper = new RequestDetailsWrapper();

+        try {

+            /*requestDetailsWrapper = asyncInstantiationBL.generateServiceInstantiationRequest(

+                    uuid, serviceInstantiationRequest, userId

+            );*/

+        }

+

+        //Aai return bad response while checking names uniqueness

+        catch (InvalidAAIResponseException exception) {

+            LOGGER.error("Failed to check name uniqueness in AAI. VID will try again later", exception);

+            //put the job in_progress so we will keep trying to check name uniqueness in AAI

+            //And then send the request to MSO

+            return new NextCommand(Job.JobStatus.IN_PROGRESS, this);

+        }

+

+        //Vid reached to max retries while trying to find unique name in AAI

+        catch (MaxRetriesException exception) {

+            LOGGER.error("Failed to find unused name in AAI. Set the job to FAILED ", exception);

+            return handleCommandFailed();

+        }

+

+        String path = asyncInstantiationBL.getServiceInstantiationPath(serviceInstantiationRequest);

+

+        HttpResponse<RequestReferencesContainer> msoResponse = restMso.post(path,

+            requestDetailsWrapper, RequestReferencesContainer.class);

+

+

+        if (msoResponse.getStatus() >= 200 && msoResponse.getStatus() < 400) {

+            final Job.JobStatus jobStatus = Job.JobStatus.IN_PROGRESS;

+            final String requestId = msoResponse.getBody().getRequestReferences().getRequestId();

+            final String instanceId = msoResponse.getBody().getRequestReferences().getInstanceId();

+            asyncInstantiationBL.auditVidStatus(uuid, jobStatus);

+            setInitialRequestAuditStatusFromMso(requestId);

+            asyncInstantiationBL.updateServiceInfo(uuid, x-> {

+                x.setJobStatus(jobStatus);

+                x.setServiceInstanceId(instanceId);

+            });

+

+            return new NextCommand(jobStatus, new InProgressStatusCommand(uuid, requestId));

+        } else {

+            auditService.setFailedAuditStatusFromMso(uuid,null, msoResponse.getStatus(),

+                msoResponse.getBody().toString());

+            return handleCommandFailed();

+        }

+

+    }

+

+    private void setInitialRequestAuditStatusFromMso(String requestId){

+        final String initialMsoRequestStatus = "REQUESTED";

+        asyncInstantiationBL.auditMsoStatus(uuid,initialMsoRequestStatus,requestId,null);

+    }

+

+    protected NextCommand handleCommandFailed() {

+        asyncInstantiationBL.handleFailedInstantiation(uuid);

+        return new NextCommand(Job.JobStatus.FAILED);

+    }

+

+    @Override

+    public ServiceInstantiationCommand init(UUID jobUuid, Map<String, Object> data) {

+        final Object request = data.get("request");

+

+        return init(

+                jobUuid,

+                OBJECT_MAPPER.convertValue(request, ServiceInstantiation.class),

+                (String) data.get("userId")

+        );

+    }

+

+    private ServiceInstantiationCommand init(UUID jobUuid, ServiceInstantiation serviceInstantiationRequest, String userId) {

+        this.uuid = jobUuid;

+        this.serviceInstantiationRequest = serviceInstantiationRequest;

+        this.userId = userId;

+

+        return this;

+    }

+

+    @Override

+    public Map<String, Object> getData() {

+        return ImmutableMap.of(

+                "uuid", uuid,

+                "request", serviceInstantiationRequest,

+                "userId", userId

+        );

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobAdapterImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobAdapterImpl.java
new file mode 100644
index 0000000..280eb84
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobAdapterImpl.java
@@ -0,0 +1,94 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job.impl;

+

+import com.google.common.collect.ImmutableMap;

+import org.onap.osam.job.Job;

+import org.onap.osam.job.JobAdapter;

+import org.onap.osam.job.JobType;

+import org.onap.osam.model.JobBulk;

+import org.onap.osam.model.JobModel;

+import org.springframework.stereotype.Component;

+

+import javax.ws.rs.BadRequestException;

+import java.util.ArrayList;

+import java.util.List;

+import java.util.Map;

+import java.util.UUID;

+import java.util.stream.Collectors;

+

+@Component

+public class JobAdapterImpl implements JobAdapter {

+

+    @Override

+    public JobModel toModel(Job job) {

+        JobModel jobModel = new JobModel();

+        jobModel.setUuid(job.getUuid());

+        jobModel.setStatus(job.getStatus());

+        jobModel.setTemplateId(job.getTemplateId());

+        return jobModel;

+    }

+

+    @Override

+    public JobBulk toModelBulk(List<Job> jobList) {

+        return new JobBulk(jobList.stream().map(this::toModel).collect(Collectors.toList()));

+    }

+

+    @Override

+    public Job createJob(JobType jobType, AsyncJobRequest request, UUID templateId, String userId, Integer indexInBulk){

+        JobDaoImpl job = new JobDaoImpl();

+        job.setStatus(Job.JobStatus.PENDING);

+        job.setTypeAndData(jobType, ImmutableMap.of(

+                "request", request,

+                "userId", userId));

+        job.setTemplateId(templateId);

+        job.setIndexInBulk(indexInBulk);

+        job.setUserId(userId);

+        return job;

+    }

+

+    @Override

+    public List<Job> createBulkOfJobs(Map<String, Object> bulkRequest) {

+        int count;

+        JobType jobType;

+

+        try {

+            count = (Integer) bulkRequest.get("count");

+            jobType = JobType.valueOf((String) bulkRequest.get("type"));

+        } catch (Exception exception) {

+            throw new BadRequestException(exception);

+        }

+        List<Job> jobList = new ArrayList<>(count + 1);

+        UUID templateId = UUID.randomUUID();

+        for (int i = 0; i < count; i++) {

+            Job child = new JobDaoImpl();

+            child.setTypeAndData(jobType, bulkRequest);

+            child.setStatus(Job.JobStatus.PENDING);

+            child.setTemplateId(templateId);

+            child.setIndexInBulk(i);

+            jobList.add(child);

+        }

+        return jobList;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobDaoImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobDaoImpl.java
new file mode 100644
index 0000000..c1f6c61
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobDaoImpl.java
@@ -0,0 +1,214 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job.impl;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.core.JsonProcessingException;

+import com.fasterxml.jackson.core.type.TypeReference;

+import com.fasterxml.jackson.databind.ObjectMapper;

+import com.google.common.base.MoreObjects;

+import org.hibernate.annotations.Type;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.osam.job.Job;

+import org.onap.osam.job.JobType;

+import org.onap.osam.model.VidBaseEntity;

+

+import javax.persistence.*;

+import java.io.IOException;

+import java.util.*;

+

+@Entity

+@Table(name = "vid_job")

+public class JobDaoImpl extends VidBaseEntity implements Job {

+

+    private static ObjectMapper objectMapper = new ObjectMapper();

+    private Job.JobStatus status;

+    private JobType type;

+    private Map<JobType, Map<String, Object>> data = new TreeMap<>();

+    private UUID templateId;

+    private UUID uuid;

+    private String takenBy;

+    private String userId;

+    private Integer age = 0;

+    private Integer indexInBulk = 0;

+    private Date deletedAt;

+

+    @Id

+    @Column(name = "JOB_ID", columnDefinition = "CHAR(36)")

+    @Type(type="org.hibernate.type.UUIDCharType")

+    public UUID getUuid() {

+        return uuid;

+    }

+

+    public void setUuid(UUID uuid) {

+        this.uuid = uuid;

+    }

+

+    //we use uuid instead id. So making id Transient

+    @Override

+    @Transient

+    @JsonIgnore

+    public Long getId() {

+        return this.getUuid().getLeastSignificantBits();

+    }

+

+    @Column(name = "JOB_STATUS")

+    @Enumerated(EnumType.STRING)

+    public Job.JobStatus getStatus() {

+        return status;

+    }

+

+    public void setStatus(Job.JobStatus status) {

+        this.status = status;

+    }

+

+    @Enumerated(EnumType.STRING)

+    @Column(name = "JOB_TYPE")

+    public JobType getType() {

+        return type;

+    }

+

+    public void setType(JobType type) {

+        this.type = type;

+    }

+

+    //the columnDefinition is relevant only for UT

+    @Column(name = "JOB_DATA", columnDefinition = "VARCHAR(30000)")

+    public String getDataRaw() {

+        try {

+            return objectMapper.writeValueAsString(data);

+        } catch (JsonProcessingException e) {

+            throw new GenericUncheckedException(e);

+        }

+    }

+

+    public void setDataRaw(String data) {

+        try {

+            this.data = objectMapper.readValue(data, new TypeReference<Map<JobType, Map<String, Object>>>() {

+            });

+        } catch (IOException e) {

+            throw new GenericUncheckedException(e);

+        }

+    }

+

+    @Transient

+    public Map<String, Object> getData() {

+        return data.get(getType());

+    }

+

+    @Override

+    public void setTypeAndData(JobType jobType, Map<String, Object> data) {

+        // *add* the data to map,

+        // then change state to given type

+        this.type = jobType;

+        this.data.put(jobType, data);

+    }

+

+    @Column(name = "TAKEN_BY")

+    public String getTakenBy() {

+        return takenBy;

+    }

+

+    public void setTakenBy(String takenBy) {

+        this.takenBy = takenBy;

+    }

+

+    @Type(type="org.hibernate.type.UUIDCharType")

+    @Column(name = "TEMPLATE_ID", columnDefinition = "CHAR(36)")

+    public UUID getTemplateId() {

+        return templateId;

+    }

+

+    @Override

+    public void setTemplateId(UUID templateId) {

+        this.templateId = templateId;

+    }

+

+    @Column(name="INDEX_IN_BULK")

+    public Integer getIndexInBulk() {

+        return indexInBulk;

+    }

+

+    @Override

+    public void setIndexInBulk(Integer indexInBulk) {

+        this.indexInBulk = indexInBulk;

+    }

+

+    @Column(name="USER_ID")

+    public String getUserId() {

+        return userId;

+    }

+

+    public void setUserId(String userId) {

+        this.userId = userId;

+    }

+

+    @Column(name="AGE")

+    public Integer getAge() {

+        return age;

+    }

+

+    public void setAge(Integer age) {

+        this.age = age;

+    }

+

+    @Column(name="DELETED_AT")

+    public Date getDeletedAt() {

+        return deletedAt;

+    }

+

+    public void setDeletedAt(Date deletedAt) {

+        this.deletedAt = deletedAt;

+    }

+

+    @Override

+    public boolean equals(Object o) {

+        if (this == o) return true;

+        if (!(o instanceof JobDaoImpl)) return false;

+        JobDaoImpl daoJob = (JobDaoImpl) o;

+        return Objects.equals(getUuid(), daoJob.getUuid());

+    }

+

+    @Override

+    public int hashCode() {

+        return Objects.hash(getUuid());

+    }

+

+    @Override

+    public String toString() {

+        return MoreObjects.toStringHelper(this)

+                .add("status", status)

+                .add("type", type)

+                .add("templateId", templateId)

+                .add("uuid", uuid)

+                .add("takenBy", takenBy)

+                .add("userId", userId)

+                .add("age", age)

+                .add("created", created)

+                .add("modified", modified)

+                .add("deletedAt", deletedAt)

+                .add("data", data)

+                .toString();

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobSchedulerInitializer.java b/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobSchedulerInitializer.java
new file mode 100644
index 0000000..7a983c8
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobSchedulerInitializer.java
@@ -0,0 +1,98 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job.impl;

+

+import com.google.common.collect.ImmutableMap;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.osam.job.Job;

+import org.onap.osam.job.JobsBrokerService;

+import org.onap.osam.job.command.JobCommandFactory;

+import org.onap.osam.properties.Features;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.quartz.*;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.scheduling.quartz.SchedulerFactoryBean;

+import org.springframework.stereotype.Component;

+import org.togglz.core.manager.FeatureManager;

+

+import javax.annotation.PostConstruct;

+

+import static org.quartz.SimpleScheduleBuilder.simpleSchedule;

+

+@Component

+public class JobSchedulerInitializer {

+

+    private JobsBrokerService jobsBrokerService;

+    private SchedulerFactoryBean schedulerFactoryBean;

+    private FeatureManager featureManager;

+    private JobCommandFactory jobCommandFactory;

+    private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JobSchedulerInitializer.class);

+

+    @Autowired

+    public JobSchedulerInitializer(

+            JobsBrokerService jobsBrokerService,

+            SchedulerFactoryBean schedulerFactoryBean,

+            FeatureManager featureManager,

+            JobCommandFactory JobCommandFactory

+    ) {

+        this.jobsBrokerService = jobsBrokerService;

+        this.schedulerFactoryBean = schedulerFactoryBean;

+        this.featureManager = featureManager;

+        this.jobCommandFactory = JobCommandFactory;

+

+    }

+

+    @PostConstruct

+    public void init() {

+        if (!featureManager.isActive(Features.FLAG_ASYNC_JOBS)) {

+            return;

+        }

+        scheduleJobWorker(Job.JobStatus.PENDING, 1);

+        scheduleJobWorker(Job.JobStatus.IN_PROGRESS, 1);

+    }

+

+    private void scheduleJobWorker(Job.JobStatus topic, int intervalInSeconds) {

+        Scheduler scheduler = schedulerFactoryBean.getScheduler();

+        JobDetail jobDetail = JobBuilder.newJob().ofType(JobWorker.class)

+                .withIdentity("AsyncWorkersJob" + topic)

+                .withDescription("Job that run async worker for " + topic)

+                .setJobData(new JobDataMap(ImmutableMap.of(

+                        "jobsBrokerService", jobsBrokerService,

+                        "jobCommandFactory", jobCommandFactory,

+                        "featureManager", featureManager,

+                        "topic", topic

+                )))

+                .build();

+        Trigger asyncWorkerTrigger = TriggerBuilder.newTrigger().forJob(jobDetail)

+                .withIdentity("AsyncWorkersTrigger" + topic)

+                .withDescription("Trigger to run async worker for " + topic)

+                .withSchedule(simpleSchedule().repeatForever().withIntervalInSeconds(intervalInSeconds))

+                .build();

+        try {

+            scheduler.scheduleJob(jobDetail, asyncWorkerTrigger);

+        } catch (SchedulerException e) {

+            logger.error(EELFLoggerDelegate.errorLogger, "Failed to schedule trigger for async worker jobs: {}", e.getMessage());

+            throw new GenericUncheckedException(e);

+        }

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobWorker.java b/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobWorker.java
new file mode 100644
index 0000000..54899ec
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobWorker.java
@@ -0,0 +1,157 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job.impl;

+

+import org.apache.commons.lang3.StringUtils;

+import org.onap.osam.job.Job;

+import org.onap.osam.job.JobCommand;

+import org.onap.osam.job.JobsBrokerService;

+import org.onap.osam.job.NextCommand;

+import org.onap.osam.job.command.JobCommandFactory;

+import org.onap.osam.properties.Features;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.quartz.JobExecutionContext;

+import org.springframework.scheduling.quartz.QuartzJobBean;

+import org.springframework.stereotype.Component;

+import org.togglz.core.manager.FeatureManager;

+

+import java.util.Optional;

+import java.util.UUID;

+

+import static org.onap.osam.job.Job.JobStatus.FAILED;

+import static org.onap.osam.job.Job.JobStatus.STOPPED;

+

+@Component

+public class JobWorker extends QuartzJobBean {

+

+    private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(JobWorker.class);

+

+    private JobsBrokerService jobsBrokerService;

+    private FeatureManager featureManager;

+    private JobCommandFactory jobCommandFactory;

+    private Job.JobStatus topic;

+

+    @Override

+    protected void executeInternal(JobExecutionContext context) {

+        Optional<Job> job;

+

+        if (!isMsoNewApiActive()) {

+            return;

+        }

+

+        job = pullJob();

+

+        while (job.isPresent()) {

+            Job nextJob = executeJobAndGetNext(job.get());

+            pushBack(nextJob);

+

+            job = pullJob();

+        }

+    }

+

+    private Optional<Job> pullJob() {

+        try {

+            return jobsBrokerService.pull(topic, UUID.randomUUID().toString());

+        } catch (Exception e) {

+            LOGGER.error(EELFLoggerDelegate.errorLogger, "failed to pull job from queue, breaking: {}", e, e);

+            return Optional.empty();

+        }

+    }

+

+    private void pushBack(Job nextJob) {

+        try {

+            jobsBrokerService.pushBack(nextJob);

+        } catch (Exception e) {

+            LOGGER.error(EELFLoggerDelegate.errorLogger, "failed pushing back job to queue: {}", e, e);

+        }

+    }

+

+    protected Job executeJobAndGetNext(Job job) {

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, "going to execute job {} of {}: {}/{}",

+                StringUtils.substring(String.valueOf(job.getUuid()), 0, 8),

+                StringUtils.substring(String.valueOf(job.getTemplateId()), 0, 8),

+                job.getStatus(), job.getType());

+

+        NextCommand nextCommand = executeCommandAndGetNext(job);

+

+        Job nextJob = setNextCommandInJob(nextCommand, job);

+

+        return nextJob;

+    }

+

+    private NextCommand executeCommandAndGetNext(Job job) {

+        NextCommand nextCommand;

+        try {

+            final JobCommand jobCommand = jobCommandFactory.toCommand(job);

+            nextCommand = jobCommand.call();

+        } catch (Exception e) {

+            LOGGER.error(EELFLoggerDelegate.errorLogger, "error while executing job from queue: {}", e, e);

+            nextCommand = new NextCommand(FAILED);

+        }

+

+        if (nextCommand == null) {

+            nextCommand = new NextCommand(STOPPED);

+        }

+        return nextCommand;

+    }

+

+    private Job setNextCommandInJob(NextCommand nextCommand, Job job) {

+        LOGGER.debug(EELFLoggerDelegate.debugLogger, "transforming job {} of {}: {}/{} -> {}{}",

+                StringUtils.substring(String.valueOf(job.getUuid()), 0, 8),

+                StringUtils.substring(String.valueOf(job.getTemplateId()), 0, 8),

+                job.getStatus(), job.getType(),

+                nextCommand.getStatus(),

+                nextCommand.getCommand() != null ? ("/" + nextCommand.getCommand().getType()) : "");

+

+        job.setStatus(nextCommand.getStatus());

+

+        if (nextCommand.getCommand() != null) {

+            job.setTypeAndData(nextCommand.getCommand().getType(), nextCommand.getCommand().getData());

+        }

+

+        return job;

+    }

+

+    private boolean isMsoNewApiActive() {

+        return featureManager.isActive(Features.FLAG_ASYNC_INSTANTIATION);

+    }

+

+

+    //used by quartz to inject JobsBrokerService into the job

+    //see JobSchedulerInitializer

+    public void setJobsBrokerService(JobsBrokerService jobsBrokerService) {

+        this.jobsBrokerService = jobsBrokerService;

+    }

+

+    public void setFeatureManager(FeatureManager featureManager) {

+        this.featureManager = featureManager;

+    }

+

+    public void setJobCommandFactory(JobCommandFactory jobCommandFactory) {

+        this.jobCommandFactory = jobCommandFactory;

+    }

+

+    public void setTopic(Job.JobStatus topic) {

+        this.topic = topic;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobsBrokerServiceInDatabaseImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobsBrokerServiceInDatabaseImpl.java
new file mode 100644
index 0000000..672197c
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/job/impl/JobsBrokerServiceInDatabaseImpl.java
@@ -0,0 +1,258 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.job.impl;

+

+import org.apache.commons.lang3.StringUtils;

+import org.hibernate.SessionFactory;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.osam.exceptions.OperationNotAllowedException;

+import org.onap.osam.job.Job;

+import org.onap.osam.job.JobsBrokerService;

+import org.onap.osam.properties.VidProperties;

+import org.onap.osam.utils.DaoUtils;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.service.DataAccessService;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.beans.factory.annotation.Value;

+import org.springframework.stereotype.Service;

+

+import javax.annotation.PostConstruct;

+import java.nio.ByteBuffer;

+import java.sql.Timestamp;

+import java.time.LocalDateTime;

+import java.util.*;

+

+@Service

+public class JobsBrokerServiceInDatabaseImpl implements JobsBrokerService {

+

+    static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JobsBrokerServiceInDatabaseImpl.class);

+

+    private final DataAccessService dataAccessService;

+

+    private final SessionFactory sessionFactory;

+    private int maxOpenedInstantiationRequestsToMso;

+    private int pollingIntervalSeconds;

+

+    @Autowired

+    public JobsBrokerServiceInDatabaseImpl(DataAccessService dataAccessService, SessionFactory sessionFactory,

+                                           @Value("0") int maxOpenedInstantiationRequestsToMso,

+                                           @Value("10") int pollingIntervalSeconds) {

+        // tha @Value will inject conservative defaults; overridden in @PostConstruct from configuration

+        this.dataAccessService = dataAccessService;

+        this.sessionFactory = sessionFactory;

+        this.maxOpenedInstantiationRequestsToMso = maxOpenedInstantiationRequestsToMso;

+        this.pollingIntervalSeconds = pollingIntervalSeconds;

+    }

+

+    @PostConstruct

+    public void configure() {

+        maxOpenedInstantiationRequestsToMso = Integer.parseInt(SystemProperties.getProperty(VidProperties.MSO_MAX_OPENED_INSTANTIATION_REQUESTS));

+        pollingIntervalSeconds = Integer.parseInt(SystemProperties.getProperty(VidProperties.MSO_ASYNC_POLLING_INTERVAL_SECONDS));

+    }

+

+    public void deleteAll() {

+        dataAccessService.deleteDomainObjects(JobDaoImpl.class, "1=1", null);

+    }

+

+    @Override

+    public UUID add(Job job) {

+        final JobDaoImpl jobDao = castToJobDaoImpl(job);

+        jobDao.setUuid(UUID.randomUUID());

+        dataAccessService.saveDomainObject(jobDao, DaoUtils.getPropsMap());

+        return job.getUuid();

+    }

+

+    @Override

+    public Optional<Job> pull(Job.JobStatus topic, String ownerId) {

+        JobDaoImpl daoJob;

+        int updatedEntities;

+        do {

+            String query = sqlQueryForTopic(topic);

+            List<JobDaoImpl> jobs = dataAccessService.executeSQLQuery(query, JobDaoImpl.class, null);

+            if (jobs.isEmpty()) {

+                return Optional.empty();

+            }

+

+            daoJob = jobs.get(0);

+

+            final UUID uuid = daoJob.getUuid();

+            final Integer age = daoJob.getAge();

+

+            daoJob.setTakenBy(ownerId);

+

+            // It might become that daoJob was taken and pushed-back already, before we

+            // arrived here, so we're verifying the age was not pushed forward.

+            // Age is actually forwarded upon pushBack().

+            String hqlUpdate = "update JobDaoImpl job set job.takenBy = :takenBy where " +

+                    " job.id = :id" +

+                    " and job.age = :age" +

+                    " and takenBy is null";

+            updatedEntities = DaoUtils.tryWithSessionAndTransaction(sessionFactory, session ->

+                    session.createQuery(hqlUpdate)

+                            .setText("id", uuid.toString())

+                            .setInteger("age", age)

+                            .setText("takenBy", ownerId)

+                            .executeUpdate());

+

+        } while (updatedEntities == 0);

+

+        return Optional.ofNullable(daoJob);

+    }

+

+    private java.sql.Timestamp nowMinusInterval() {

+        return Timestamp.valueOf(LocalDateTime.now().minusSeconds(pollingIntervalSeconds));

+    }

+

+    private String sqlQueryForTopic(Job.JobStatus topic) {

+        switch (topic) {

+            case IN_PROGRESS:

+                return "" +

+                        "select * from VID_JOB" +

+                        " where" +

+                        // select only non-deleted in-progress jobs

+                        "    JOB_STATUS = 'IN_PROGRESS'" +

+                        "    and TAKEN_BY is null" +

+                        "    and DELETED_AT is null" +

+                        // give some breath, don't select jos that were recently reached

+                        "    and MODIFIED_DATE <= '" + nowMinusInterval() +

+                        // take the oldest handled one

+                        "' order by MODIFIED_DATE ASC" +

+                        // select only one result

+                        " limit 1";

+

+            case PENDING:

+                return "" +

+                        // select only pending jobs

+                        "select vid_job.* from VID_JOB " +

+                        // select users have in_progress jobs

+                        "left join \n" +

+                        " (select user_Id, 1 as has_any_in_progress_job from VID_JOB  where JOB_STATUS = 'IN_PROGRESS' or TAKEN_BY IS NOT NULL \n" +

+                        "group by user_id)  users_have_any_in_progress_job_tbl\n" +

+                        "on vid_job.user_id = users_have_any_in_progress_job_tbl.user_id " +

+                        "where JOB_STATUS = 'PENDING' and TAKEN_BY is null" +

+                        // job is not deleted

+                        "      AND DELETED_AT is null and (\n" +

+                        // limit in-progress to some amount

+                        "select sum(CASE WHEN JOB_STATUS='IN_PROGRESS' or (JOB_STATUS='PENDING' and TAKEN_BY IS NOT NULL) THEN 1 ELSE 0 END) as in_progress\n" +

+                        "from VID_JOB ) <" + maxOpenedInstantiationRequestsToMso + " \n " +

+                        // don't take jobs from templates that already in-progress/failed

+                        "and TEMPLATE_Id not in \n" +

+                        "(select TEMPLATE_Id from vid_job where" +

+                        "   (JOB_STATUS='FAILED' and DELETED_AT is null)" + // failed but not deleted

+                        "   or JOB_STATUS='IN_PROGRESS'" +

+                        "   or TAKEN_BY IS NOT NULL)" + " \n " +

+                        // prefer older jobs, but the earlier in each bulk

+                        "order by has_any_in_progress_job, CREATED_DATE, INDEX_IN_BULK " +

+                        // select only one result

+                        "limit 1";

+            default:

+                throw new GenericUncheckedException("Unsupported topic to pull from: " + topic);

+        }

+    }

+

+

+    private byte[] getUuidAsByteArray(UUID owner) {

+        ByteBuffer bb = ByteBuffer.wrap(new byte[16]);

+        bb.putLong(owner.getMostSignificantBits());

+        bb.putLong(owner.getLeastSignificantBits());

+        return bb.array();

+    }

+

+    @Override

+    public void pushBack(Job job) {

+        final JobDaoImpl remoteDaoJob = (JobDaoImpl) dataAccessService.getDomainObject(JobDaoImpl.class, job.getUuid(), null);

+

+        if (remoteDaoJob == null) {

+            throw new IllegalStateException("Can push back only pulled jobs. Add new jobs using add()");

+        }

+

+        if (remoteDaoJob.getTakenBy() == null) {

+            throw new IllegalStateException("Can push back only pulled jobs. This one already pushed back.");

+        }

+

+        final JobDaoImpl jobDao = castToJobDaoImpl(job);

+

+        jobDao.setTakenBy(null);

+

+        Integer age = jobDao.getAge();

+        jobDao.setAge(age + 1);

+

+        logger.debug(EELFLoggerDelegate.debugLogger, "{}/{}", jobDao.getStatus(), jobDao.getType());

+

+        dataAccessService.saveDomainObject(jobDao, DaoUtils.getPropsMap());

+    }

+

+    private JobDaoImpl castToJobDaoImpl(Job job) {

+        if (!(job instanceof JobDaoImpl)) {

+            throw new UnsupportedOperationException("Can't add " + job.getClass() + " to " + this.getClass());

+        }

+        return (JobDaoImpl) job;

+    }

+

+    @Override

+    public Collection<Job> peek() {

+        return dataAccessService.getList(JobDaoImpl.class, null);

+    }

+

+    @Override

+    public Job peek(UUID jobId) {

+        return (JobDaoImpl) dataAccessService.getDomainObject(JobDaoImpl.class, jobId, null);

+    }

+

+    @Override

+    public void delete(UUID jobId) {

+        int updatedEntities;

+        Date now = new Date();

+

+        String hqlUpdate = "update JobDaoImpl job set job.deletedAt = :now where " +

+                " job.id = :id" +

+                " and job.status in(:pending, :stopped)" +

+                " and takenBy is null";

+

+        updatedEntities = DaoUtils.tryWithSessionAndTransaction(sessionFactory, session ->

+                session.createQuery(hqlUpdate)

+                        .setTimestamp("now", now)

+                        .setText("id", jobId.toString())

+                        .setText("pending", Job.JobStatus.PENDING.toString())

+                        .setText("stopped", Job.JobStatus.STOPPED.toString())

+                        .executeUpdate());

+

+        if (updatedEntities == 0) {

+            final JobDaoImpl remoteDaoJob = (JobDaoImpl) dataAccessService.getDomainObject(JobDaoImpl.class, jobId, null);

+

+            if (remoteDaoJob == null || remoteDaoJob.getUuid() == null) {

+                logger.debug(EELFLoggerDelegate.debugLogger,"jobId {}: Service does not exist", jobId);

+                throw new OperationNotAllowedException("Service does not exist");

+            }

+

+            if (!remoteDaoJob.getStatus().equals(Job.JobStatus.PENDING) && !remoteDaoJob.getStatus().equals(Job.JobStatus.STOPPED) || !StringUtils.isEmpty(remoteDaoJob.getTakenBy()) ) {

+                logger.debug(EELFLoggerDelegate.debugLogger,"jobId {}: Service status does not allow deletion from the queue, status = {}", jobId, remoteDaoJob.getStatus() +

+                ", takenBy " + remoteDaoJob.getTakenBy());

+                throw new OperationNotAllowedException("Service status does not allow deletion from the queue");

+            }

+

+            throw new OperationNotAllowedException("Service deletion failed");

+        }

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/logging/VidLoggerAspect.java b/onap-enabler-be/src/main/java/org/onap/osam/logging/VidLoggerAspect.java
new file mode 100644
index 0000000..2847354
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/logging/VidLoggerAspect.java
@@ -0,0 +1,107 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.logging;

+

+import org.apache.commons.lang3.StringUtils;

+import org.aspectj.lang.ProceedingJoinPoint;

+import org.aspectj.lang.annotation.Around;

+import org.aspectj.lang.annotation.Aspect;

+import org.aspectj.lang.annotation.Pointcut;

+import org.onap.portalsdk.core.logging.aspect.EELFLoggerAdvice;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.springframework.beans.factory.annotation.Autowired;

+

+import java.net.InetAddress;

+import java.net.UnknownHostException;

+

+import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN;

+

+

+@Aspect

+@org.springframework.context.annotation.Configuration

+public class VidLoggerAspect {

+

+    private String canonicalHostName;

+    @Autowired

+    EELFLoggerAdvice advice;

+

+    public VidLoggerAspect() {

+        try {

+            final InetAddress localHost = InetAddress.getLocalHost();

+            canonicalHostName = localHost.getCanonicalHostName();

+        } catch (UnknownHostException e) {

+            // YOLO

+            canonicalHostName = null;

+        }

+    }

+

+    @Pointcut("execution(public * org.onap.osam.controller.*Controller.*(..))")

+    public void vidControllers() {}

+

+    @Around("vidControllers() && (" +

+            "  @within(org.onap.portalsdk.core.logging.aspect.AuditLog)" +

+            "  || @annotation(org.onap.portalsdk.core.logging.aspect.AuditLog)" +

+            "  || @annotation(org.springframework.web.bind.annotation.RequestMapping)" +

+            ")")

+    public Object logAuditMethodClassAround(ProceedingJoinPoint joinPoint) throws Throwable {

+        return logAroundMethod(joinPoint, SystemProperties.SecurityEventTypeEnum.INCOMING_REST_MESSAGE);

+    }

+

+    private Object logAroundMethod(ProceedingJoinPoint joinPoint, SystemProperties.SecurityEventTypeEnum securityEventType) throws Throwable {

+        //Before

+        Object[] passOnArgs = new Object[] {joinPoint.getSignature().getDeclaringType().getName(),joinPoint.getSignature().getName()};

+        Object[] returnArgs = advice.before(securityEventType, joinPoint.getArgs(), passOnArgs);

+

+        fixServerFqdnInMDC();

+

+        //Execute the actual method

+        Object result;

+        String restStatus = "COMPLETE";

+        try {

+            result = joinPoint.proceed();

+        } catch(Exception e) {

+            restStatus = "ERROR";

+            throw e;

+        } finally {

+            fixStatusCodeInMDC(restStatus);

+            advice.after(securityEventType, restStatus, joinPoint.getArgs(), returnArgs, passOnArgs);

+        }

+

+        return result;

+    }

+

+    // Set the status code into MDC *before* the metrics log is written by advice.after()

+    private void fixStatusCodeInMDC(String restStatus) {

+        EELFLoggerDelegate.mdcPut(SystemProperties.STATUS_CODE, restStatus);

+    }

+

+    // Override the non-canonical hostname set by EELFLoggerDelegate::setGlobalLoggingContext()

+    // that was invoked by advice.before() (and some other SDK cases)

+    private void fixServerFqdnInMDC() {

+        if (!StringUtils.isBlank(canonicalHostName)) {

+            EELFLoggerDelegate.mdcPut(MDC_SERVER_FQDN, canonicalHostName);

+        }

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/CategoryParameter.java b/onap-enabler-be/src/main/java/org/onap/osam/model/CategoryParameter.java
new file mode 100644
index 0000000..d05a75c
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/CategoryParameter.java
@@ -0,0 +1,97 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+//import org.hibernate.annotations.Table;

+

+import javax.persistence.*;

+import java.util.HashSet;

+import java.util.Set;

+

+//import javax.persistence.*;

+

+@Entity

+@Table(name = "vid_category_parameter", uniqueConstraints = @UniqueConstraint(columnNames = "name"))

+public class CategoryParameter extends VidBaseEntity {

+

+    public enum Family {

+        PARAMETER_STANDARDIZATION,

+        TENANT_ISOLATION

+    }

+

+    private String name;

+    private boolean idSupported;

+

+    @Column(name = "FAMILY")

+    @Enumerated(EnumType.STRING)

+    private String family;

+

+    public String getFamily() {

+        return family;

+    }

+

+    public void setFamily(String family) {

+        this.family = family;

+    }

+

+    private Set<CategoryParameterOption> options = new HashSet<>(0);

+

+    @Override

+    @Id

+    @GeneratedValue(strategy = GenerationType.IDENTITY)

+    @Column(name = "CATEGORY_ID")

+    public Long getId() {

+        return super.getId();

+    }

+

+    @Column(name = "NAME", unique = true, nullable = false, length=50)

+    public String getName() {

+        return name;

+    }

+

+    public void setName(String name) {

+        this.name = name;

+    }

+

+    @OneToMany(fetch = FetchType.EAGER, mappedBy = "categoryParameter")

+    public Set<CategoryParameterOption> getOptions() {

+        return options;

+    }

+

+    public void setOptions(Set<CategoryParameterOption> options) {

+        this.options = options;

+    }

+

+    public boolean addOption(CategoryParameterOption option) {

+        return options.add(option);

+    }

+

+    @Column(name = "ID_SUPPORTED")

+    public boolean isIdSupported() {

+        return idSupported;

+    }

+

+    public void setIdSupported(boolean idSupported) {

+        this.idSupported = idSupported;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/CategoryParameterOption.java b/onap-enabler-be/src/main/java/org/onap/osam/model/CategoryParameterOption.java
new file mode 100644
index 0000000..3a665b1
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/CategoryParameterOption.java
@@ -0,0 +1,156 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import org.onap.portalsdk.core.domain.support.DomainVo;

+

+import javax.persistence.*;

+import java.io.Serializable;

+import java.util.Date;

+import java.util.Set;

+

+@Entity

+@Table(name = "vid_category_parameter_option")

+public class CategoryParameterOption extends DomainVo {

+

+    private String appId;

+    private String name;

+

+    private CategoryParameter categoryParameter;

+

+    public CategoryParameterOption() {

+    }

+

+    public CategoryParameterOption(String appId, String name, CategoryParameter categoryParameter) {

+        setAppId(appId);

+        setName(name);

+        setCategoryParameter(categoryParameter);

+    }

+

+    @Id

+    @GeneratedValue(strategy = GenerationType.IDENTITY)

+    @Column(name = "CATEGORY_OPT_DB_ID")

+    public Long getId() {

+        return id;

+    }

+

+    @Column(name = "CATEGORY_OPT_APP_ID")

+    public String getAppId() {

+        return appId;

+    }

+

+    public void setAppId(String appId) {

+        this.appId = appId;

+    }

+

+    @Column(name = "NAME")

+    public String getName() {

+        return name;

+    }

+

+    public void setName(String name) {

+        this.name = name;

+    }

+

+    @ManyToOne

+    @JoinColumn(name="CATEGORY_ID", nullable=false)

+    public CategoryParameter getCategoryParameter() {

+        return categoryParameter;

+    }

+

+    public void setCategoryParameter(CategoryParameter categoryParameter) {

+        this.categoryParameter = categoryParameter;

+    }

+

+    @Override

+    @Column(name = "CREATED_DATE")

+    public Date getCreated() {

+        return super.getCreated();

+    }

+

+    @Override

+    @Column(name = "MODIFIED_DATE")

+    public Date getModified() {

+        return super.getModified();

+    }

+

+    @Override

+    @Transient

+    public Long getCreatedId() {

+        return super.getCreatedId();

+    }

+

+    @Override

+    @Transient

+    public Long getModifiedId() {

+        return super.getModifiedId();

+    }

+

+    @Override

+    @Transient

+    public Serializable getAuditUserId() {

+        return super.getAuditUserId();

+    }

+

+    @Override

+    @Transient

+    public Long getRowNum() {

+        return super.getRowNum();

+    }

+

+    @Override

+    @Transient

+    public Set getAuditTrail() {

+        return super.getAuditTrail();

+    }

+

+    @Override

+    public boolean equals(Object o) {

+        if (this == o) return true;

+        if (o == null || getClass() != o.getClass()) return false;

+

+        CategoryParameterOption that = (CategoryParameterOption) o;

+

+        if (getAppId() != null ? !getAppId().equals(that.getAppId()) : that.getAppId() != null) return false;

+        if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) return false;

+        return getCategoryParameter() != null ? getCategoryParameter().equals(that.getCategoryParameter()) : that.getCategoryParameter() == null;

+    }

+

+    @Override

+    public int hashCode() {

+        int result = getAppId() != null ? getAppId().hashCode() : 0;

+        result = 31 * result + (getName() != null ? getName().hashCode() : 0);

+        result = 31 * result + (getCategoryParameter() != null ? getCategoryParameter().hashCode() : 0);

+        return result;

+    }

+

+    @Override

+    public String toString() {

+        return "CategoryParameterOption{" +

+                "id=" + id +

+                ", key='" + appId + '\'' +

+                ", value='" + name + '\'' +

+                ", categoryParameterId=" + categoryParameter.getId() +

+                '}';

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/CommandProperty.java b/onap-enabler-be/src/main/java/org/onap/osam/model/CommandProperty.java
new file mode 100644
index 0000000..85c3f85
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/CommandProperty.java
@@ -0,0 +1,89 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+public class CommandProperty {

+	

+	private String displayName;

+	

+	/** The command, "get_input" */

+	private String command;

+	

+	/** The input name we refer to back under the inputs section */

+	private String inputName;

+

+	/**

+	 * Gets the display name.

+	 *

+	 * @return the displayName

+	 */

+	public String getDisplayName() {

+		return displayName;

+	}

+	/**

+	 * Gets the command.

+	 *

+	 * @return the command

+	 */

+	public String getCommand() {

+		return command;

+	}

+	/**

+	 * Gets the inputName.

+	 *

+	 * @return the inputName

+	 */

+	public String getInputName() {

+		return inputName;

+	}

+	/**

+	 * Sets the display name value.

+	 *

+	 * @param i the new get_input value

+	 */

+	public void setDisplayName(String i) {

+		this.displayName = i;

+	}

+	/**

+	 * Sets the command value.

+	 *

+	 * @param i the new command value

+	 */

+	public void setCommand(String i) {

+		this.command = i;

+	}

+	

+	/**

+	 * Sets the input name value.

+	 *

+	 * @param i the new input name value

+	 */

+	public void setInputName(String i) {

+		this.inputName=i;

+	}

+	

+	public String toString () {

+		String result = "displayName=" + displayName + " command=" + command + " inputName" + inputName;

+		return result;

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/ExceptionResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/model/ExceptionResponse.java
new file mode 100644
index 0000000..7d7db23
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/ExceptionResponse.java
@@ -0,0 +1,89 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import org.slf4j.MDC;

+

+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;

+

+public class ExceptionResponse {

+

+	public ExceptionResponse() {

+	}

+

+	private String exception;

+	

+	/** The message. */

+	private String message;

+

+	public ExceptionResponse(String exception, String message) {

+		this.exception = exception;

+		this.message = message;

+	}

+

+	public ExceptionResponse(Exception exception) {

+		setException(exception);

+	}

+

+	/**

+	 * Gets the exception.

+	 *

+	 * @return the exception

+	 */

+	public String getException() {

+		return exception;

+	}

+

+	/**

+	 * Sets the exception.

+	 *

+	 * @param exception the new exception

+	 */

+	public void setException(String exception) {

+		this.exception = exception;

+	}

+

+	public void setException(Exception exception) {

+		setException(exception.getClass().toString().replaceFirst("^.*[\\.$]", ""));

+		setMessage(exception.getMessage() + " (Request id: " + MDC.get(MDC_KEY_REQUEST_ID) + ")");

+	}

+

+	/**

+	 * Gets the message.

+	 *

+	 * @return the message

+	 */

+	public String getMessage() {

+		return message;

+	}

+

+	/**

+	 * Sets the message.

+	 *

+	 * @param message the new message

+	 */

+	public void setMessage(String message) {

+		this.message = message;

+	}

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/ExceptionTranslator.java b/onap-enabler-be/src/main/java/org/onap/osam/model/ExceptionTranslator.java
new file mode 100644
index 0000000..7ba9959
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/ExceptionTranslator.java
@@ -0,0 +1,60 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import org.apache.commons.lang.StringUtils;

+import org.apache.commons.lang3.exception.ExceptionUtils;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.springframework.web.bind.annotation.ControllerAdvice;

+import org.springframework.web.bind.annotation.ExceptionHandler;

+import org.springframework.web.bind.annotation.ResponseBody;

+import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;

+

+import static org.onap.osam.utils.Logging.getMethodCallerName;

+

+@ControllerAdvice

+public class ExceptionTranslator {

+

+    EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExceptionTranslator.class);

+

+    @ExceptionHandler(MethodArgumentTypeMismatchException.class)

+    @ResponseBody

+    public ExceptionResponse handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e) {

+        logger.error(EELFLoggerDelegate.errorLogger, "{}: {}", getMethodCallerName(), ExceptionUtils.getMessage(e), e);

+        Class<?> type = e.getRequiredType();

+        String message;

+        if (type.isEnum()) {

+            message = "The parameter " + e.getName() + " must have a value among : " + StringUtils.join(type.getEnumConstants(), ", ");

+        }

+        else {

+            message = "The parameter " + e.getName() + " must be of type " + type.getTypeName();

+        }

+        return new  ExceptionResponse(new ArgumentTypeMismatchException(message));

+    }

+

+    public static class ArgumentTypeMismatchException extends RuntimeException {

+        public ArgumentTypeMismatchException(String message) {

+            super(message);

+        }

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/GitRepositoryState.java b/onap-enabler-be/src/main/java/org/onap/osam/model/GitRepositoryState.java
new file mode 100644
index 0000000..bc07da7
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/GitRepositoryState.java
@@ -0,0 +1,50 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import java.util.Properties;

+

+public class GitRepositoryState {

+

+    private final String commitId;

+    private final String commitMessageShort;

+    private final String commitTime;

+

+    public GitRepositoryState(Properties properties) {

+        this.commitId = String.valueOf(properties.get("git.commit.id"));

+        this.commitMessageShort = String.valueOf(properties.get("git.commit.message.short"));

+        this.commitTime = String.valueOf(properties.get("git.commit.time"));

+    }

+

+    public String getCommitId() {

+        return commitId;

+    }

+

+    public String getCommitMessageShort() {

+        return commitMessageShort;

+    }

+

+    public String getCommitTime() {

+        return commitTime;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/GroupProperties.java b/onap-enabler-be/src/main/java/org/onap/osam/model/GroupProperties.java
new file mode 100644
index 0000000..55aa7f4
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/GroupProperties.java
@@ -0,0 +1,62 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+public class GroupProperties {

+    private Integer minCountInstances;

+    private Integer maxCountInstances;

+    private Integer initialCount;

+    private String vfModuleLabel;

+

+    public String getVfModuleLabel() {

+        return vfModuleLabel;

+    }

+

+    public void setVfModuleLabel(String vfModuleLabel) {

+        this.vfModuleLabel = vfModuleLabel;

+    }

+

+    public Integer getMinCountInstances() {

+        return minCountInstances;

+    }

+

+    public void setMinCountInstances(Integer minCountInstances) {

+        this.minCountInstances = minCountInstances;

+    }

+

+    public Integer getMaxCountInstances() {

+        return maxCountInstances;

+    }

+

+    public void setMaxCountInstances(Integer maxCountInstances) {

+        this.maxCountInstances = maxCountInstances;

+    }

+

+    public Integer getInitialCount() {

+        return initialCount;

+    }

+

+    public void setInitialCount(Integer initialCount) {

+        this.initialCount = initialCount;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/JobAuditStatus.java b/onap-enabler-be/src/main/java/org/onap/osam/model/JobAuditStatus.java
new file mode 100644
index 0000000..153851d
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/JobAuditStatus.java
@@ -0,0 +1,181 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import org.apache.commons.lang3.builder.EqualsBuilder;

+import org.apache.commons.lang3.builder.HashCodeBuilder;

+import org.hibernate.annotations.Type;

+import org.onap.osam.job.Job.JobStatus;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+

+import javax.persistence.*;

+import java.util.Date;

+import java.util.UUID;

+

+@Entity

+@Table(name = "vid_job_audit_status")

+public class JobAuditStatus extends VidBaseEntity {

+

+    static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(JobAuditStatus.class);

+

+    public JobAuditStatus(){}

+

+    public JobAuditStatus(UUID jobId, String jobStatus, SourceStatus source){

+        this.jobId = jobId;

+        this.jobStatus = jobStatus;

+        this.source = source;

+    }

+

+    public JobAuditStatus(UUID jobId, String jobStatus, SourceStatus source, Date date){

+        this(jobId, jobStatus, source);

+        this.created = date;

+    }

+

+    public JobAuditStatus(UUID jobId, String jobStatus, SourceStatus source, UUID requestId, String additionalInfo) {

+        this(jobId, jobStatus, source);

+        this.requestId = requestId;

+        this.additionalInfo = additionalInfo;

+    }

+

+    public JobAuditStatus(UUID jobId, String jobStatus, SourceStatus source, UUID requestId, String additionalInfo, Date date){

+        this(jobId, jobStatus, source, requestId, additionalInfo);

+        this.created = date;

+    }

+

+    @Override

+    public boolean equals(Object o) {

+        if (this == o) return true;

+

+        if (o == null || getClass() != o.getClass()) return false;

+

+        JobAuditStatus that = (JobAuditStatus) o;

+

+        return new EqualsBuilder()

+                .append(jobId, that.jobId)

+                .append(jobStatus, that.jobStatus)

+                .append(source, that.source)

+                .append(requestId, that.requestId)

+                .append(additionalInfo, that.additionalInfo)

+                .isEquals();

+    }

+

+    @Override

+    public int hashCode() {

+        return new HashCodeBuilder(17, 37)

+                .append(jobId)

+                .append(jobStatus)

+                .append(source)

+                .append(requestId)

+                .append(additionalInfo)

+                .toHashCode();

+    }

+

+    public enum SourceStatus {

+        MSO,

+        VID

+    }

+

+    private UUID jobId;

+    private String jobStatus;

+    private SourceStatus source;

+    private UUID requestId;

+    private String additionalInfo;

+

+    @Id

+    @GeneratedValue(strategy = GenerationType.IDENTITY)

+    @Override

+    @Column(name = "ID", columnDefinition = "INT(11)")

+    public Long getId() {

+        return this.id;

+    }

+

+    @Column(name = "JOB_ID", columnDefinition = "CHAR(36)")

+    @Type(type="org.hibernate.type.UUIDCharType")

+    public UUID getJobId() {

+        return jobId;

+    }

+

+    public void setJobId(UUID jobId) {

+        this.jobId = jobId;

+    }

+

+

+    @Column(name = "JOB_STATUS")

+    public String getJobStatus() {

+        return jobStatus;

+    }

+

+    public void setJobStatus(String jobStatus) {

+        this.jobStatus = jobStatus;

+    }

+

+

+    @Enumerated(EnumType.STRING)

+    @Column(name = "SOURCE")

+    public SourceStatus getSource() {

+        return source;

+    }

+

+    public void setSource(SourceStatus source) {

+        this.source = source;

+    }

+

+    @Column(name = "REQUEST_ID", columnDefinition = "CHAR(36)")

+    @Type(type="org.hibernate.type.UUIDCharType")

+    public UUID getRequestId() {

+        return requestId;

+    }

+

+    public void setRequestId(UUID requestId) {

+        this.requestId = requestId;

+    }

+

+    @Column(name = "ADDITIONAL_INFO")

+    public String getAdditionalInfo() {

+        return additionalInfo;

+    }

+

+    public void setAdditionalInfo(String additionalInfo) {

+        this.additionalInfo = additionalInfo;

+    }

+

+    @Transient

+    public Boolean isFinal(){

+        try {

+            if (getSource() == SourceStatus.VID) {

+                return JobStatus.valueOf(getJobStatus()).isFinal();

+            }

+        }

+        catch (IllegalArgumentException e){

+            logger.error("JobStatus: " + getJobStatus() + " from vid isn't a value of JobStatus enum" + e.getMessage());

+            return false;

+        }

+        return false;

+    }

+

+    @Transient

+    public Date getCreatedDate() {

+        return getCreated();

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/JobBulk.java b/onap-enabler-be/src/main/java/org/onap/osam/model/JobBulk.java
new file mode 100644
index 0000000..0c2637b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/JobBulk.java
@@ -0,0 +1,42 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import java.util.List;

+

+public class JobBulk {

+

+    private List<JobModel> jobs;

+

+    public JobBulk(List<JobModel> jobs) {

+        this.jobs = jobs;

+    }

+

+    public List<JobModel> getJobs() {

+        return jobs;

+    }

+

+    public void setJobs(List<JobModel> jobs) {

+        this.jobs = jobs;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/JobModel.java b/onap-enabler-be/src/main/java/org/onap/osam/model/JobModel.java
new file mode 100644
index 0000000..2520b01
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/JobModel.java
@@ -0,0 +1,69 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import org.onap.osam.job.Job;

+import org.onap.osam.job.JobType;

+

+import java.util.UUID;

+

+public class JobModel {

+

+    private UUID uuid;

+    private Job.JobStatus status;

+    private UUID templateId;

+    private JobType type;

+

+    public UUID getUuid() {

+        return uuid;

+    }

+

+    public void setUuid(UUID uuid) {

+        this.uuid = uuid;

+    }

+

+    public Job.JobStatus getStatus() {

+        return status;

+    }

+

+    public void setStatus(Job.JobStatus status) {

+        this.status = status;

+    }

+

+    public UUID getTemplateId() {

+        return templateId;

+    }

+

+    public void setTemplateId(UUID templateId) {

+        this.templateId = templateId;

+    }

+

+    public JobType getType() {

+        return type;

+    }

+

+    public void setType(JobType type) {

+        this.type = type;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/ListOfErrorsResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/model/ListOfErrorsResponse.java
new file mode 100644
index 0000000..5732389
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/ListOfErrorsResponse.java
@@ -0,0 +1,46 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import java.util.ArrayList;

+import java.util.List;

+

+public class ListOfErrorsResponse {

+    protected List<String> errors;

+

+    public ListOfErrorsResponse() {

+        this.errors = new ArrayList<>();

+    }

+

+    public ListOfErrorsResponse(List<String> errors) {

+        this.errors = errors;

+    }

+

+    public List<String> getErrors() {

+        return errors;

+    }

+

+    public void setErrors(List<String> errors) {

+        this.errors = errors;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/ModelConstants.java b/onap-enabler-be/src/main/java/org/onap/osam/model/ModelConstants.java
new file mode 100644
index 0000000..799e10d
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/ModelConstants.java
@@ -0,0 +1,42 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+public class ModelConstants {

+	

+	public final static String GET_INPUT_TAG = "get_input";

+	

+	public static final String ASDC_MODEL_NAMESPACE = "asdc.model.namespace";

+	public static final String ASDC_SVC_API_PATH = "sdc.svc.api.path";

+	public static final String ASDC_RESOURCE_API_PATH = "sdc.resource.api.path";

+	

+	public static final String DEFAULT_ASDC_MODEL_NAMESPACE = "org.onap.";

+	public static final String DEFAULT_ASDC_SVC_API_PATH = "sdc/v1/catalog/services";

+	public static final String DEFAULT_ASDC_RESOURCE_API_PATH = "sdc/v1/catalog/resources";

+	

+	public final static String VF_MODULE = "groups.VfModule";

+	public final static String VNF = "resource.vf";

+	public final static String NETWORK = "resource.vl";

+

+	public final static String ROLE_DELIMITER = "___";

+	

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/ModelUtil.java b/onap-enabler-be/src/main/java/org/onap/osam/model/ModelUtil.java
new file mode 100644
index 0000000..821d318
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/ModelUtil.java
@@ -0,0 +1,60 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+public class ModelUtil {

+	/**

+	 * Gets the tags for the given element according to the configured namespace

+	 * @param namespaces the namespace list from the configuration

+	 * @param constantValue the constant portion of the tag name, i.e. resource.vf...

+	 * @return the tags

+	 */

+	public static String[] getTags ( String[] namespaces, String constantValue ) {

+		String[] tags;

+		if ( namespaces == null || namespaces.length == 0 ) {

+			return null;

+		}

+		int le = namespaces.length;

+		tags = new String[le];

+		for ( int i = 0; i < le; i++ ) {

+			tags[i] = namespaces[i] + constantValue;

+		}

+		return (tags);

+	}

+	/**

+	 * Determine if a note template type matches a set of configurable tags

+	 * @param type the node template type

+	 * @param tags the model configurable namespaces

+	 * @return true if type starts with a tag in the array, false otherwise

+	 */

+	public static boolean isType ( String type, String[] tags ) {

+		if ( (tags != null) && (tags.length > 0) ) {

+			for ( int i = 0; i < tags.length; i++ ) {

+				if ( type.startsWith (tags[i]) ) {

+					return (true);

+				}

+			}

+		}

+		return (false);

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/MsoExceptionResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/model/MsoExceptionResponse.java
new file mode 100644
index 0000000..099f027
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/MsoExceptionResponse.java
@@ -0,0 +1,54 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+public class MsoExceptionResponse {

+

+    public static class ServiceException {

+

+        public ServiceException(String messageId, String text) {

+            this.messageId = messageId;

+            this.text = text;

+        }

+

+        public ServiceException() {

+        }

+

+        public String messageId;

+        public String text;

+    }

+

+    public ServiceException serviceException;

+

+    public MsoExceptionResponse() {

+    }

+

+    public MsoExceptionResponse(String messageId, String text) {

+        this.serviceException = new ServiceException(messageId, text);

+    }

+

+    public MsoExceptionResponse(Exception exception) {

+        ExceptionResponse exceptionResponse = new ExceptionResponse(exception);

+        this.serviceException = new ServiceException(exceptionResponse.getException(), exceptionResponse.getMessage());

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/NameCounter.java b/onap-enabler-be/src/main/java/org/onap/osam/model/NameCounter.java
new file mode 100644
index 0000000..5df0da4
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/NameCounter.java
@@ -0,0 +1,64 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+

+import javax.persistence.Column;

+import javax.persistence.Entity;

+import javax.persistence.Id;

+import javax.persistence.Table;

+

+@Entity

+@Table(name = "vid_name_counter")

+public class NameCounter {

+

+    private String name;

+    private Integer counter;

+

+    public NameCounter() {

+    }

+

+    public NameCounter(String name) {

+        this.name = name;

+        this.counter = 1;

+    }

+

+    @Id

+    @Column(name = "name", columnDefinition = "VARCHAR(100)")

+    public String getName() {

+        return name;

+    }

+

+    public void setName(String name) {

+        this.name = name;

+    }

+

+    @Column(name = "counter", columnDefinition = "INT")

+    public Integer getCounter() {

+        return counter;

+    }

+

+    public void setCounter(Integer counter) {

+        this.counter = counter;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/NetworkCollection.java b/onap-enabler-be/src/main/java/org/onap/osam/model/NetworkCollection.java
new file mode 100644
index 0000000..8804f25
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/NetworkCollection.java
@@ -0,0 +1,81 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+public class NetworkCollection {

+

+    private String uuid;

+

+    private String invariantUuid;

+

+    private String name;

+

+    private String version;

+

+    private NetworkCollectionProperties networkCollectionProperties;

+

+    public NetworkCollection(){

+        this.networkCollectionProperties = new NetworkCollectionProperties();

+    }

+

+    public String getUuid() {

+        return uuid;

+    }

+

+    public void setUuid(String uuid) {

+        this.uuid = uuid;

+    }

+

+    public String getInvariantUuid() {

+        return invariantUuid;

+    }

+

+    public void setInvariantUuid(String invariantUuid) {

+        this.invariantUuid = invariantUuid;

+    }

+

+    public String getName() {

+        return name;

+    }

+

+    public void setName(String name) {

+        this.name = name;

+    }

+

+    public String getVersion() {

+        return version;

+    }

+

+    public void setVersion(String version) {

+        this.version = version;

+    }

+

+    public NetworkCollectionProperties getNetworkCollectionProperties() {

+        return networkCollectionProperties;

+    }

+

+    public void setNetworkCollectionProperties(NetworkCollectionProperties networkCollectionProperties) {

+        this.networkCollectionProperties = networkCollectionProperties;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/NetworkCollectionProperties.java b/onap-enabler-be/src/main/java/org/onap/osam/model/NetworkCollectionProperties.java
new file mode 100644
index 0000000..78fc945
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/NetworkCollectionProperties.java
@@ -0,0 +1,44 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+public class NetworkCollectionProperties {

+    private String networkCollectionFunction;

+    private String networkCollectionDescription;

+

+    public String getNetworkCollectionFunction() {

+        return networkCollectionFunction;

+    }

+

+    public void setNetworkCollectionFunction(String networkCollectionFunction) {

+        this.networkCollectionFunction = networkCollectionFunction;

+    }

+

+    public String getNetworkCollectionDescription() {

+        return networkCollectionDescription;

+    }

+

+    public void setNetworkCollectionDescription(String networkCollectionDescription) {

+        this.networkCollectionDescription = networkCollectionDescription;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/PombaInstance/PombaRequest.java b/onap-enabler-be/src/main/java/org/onap/osam/model/PombaInstance/PombaRequest.java
new file mode 100644
index 0000000..6a7b887
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/PombaInstance/PombaRequest.java
@@ -0,0 +1,29 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model.PombaInstance;

+

+import java.util.List;

+

+public class PombaRequest {

+    public List<ServiceInstance> serviceInstanceList;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/PombaInstance/ServiceInstance.java b/onap-enabler-be/src/main/java/org/onap/osam/model/PombaInstance/ServiceInstance.java
new file mode 100644
index 0000000..c97a5cd
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/PombaInstance/ServiceInstance.java
@@ -0,0 +1,43 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model.PombaInstance;

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+public class ServiceInstance {

+

+    @JsonProperty

+    public String serviceInstanceId;

+

+    @JsonProperty

+    public String modelVersionId;

+

+    @JsonProperty

+    public String modelInvariantId;

+

+    @JsonProperty

+    public String customerId;

+

+    @JsonProperty

+    public String serviceType;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/ProxyResponse.java b/onap-enabler-be/src/main/java/org/onap/osam/model/ProxyResponse.java
new file mode 100644
index 0000000..e6b83e1
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/ProxyResponse.java
@@ -0,0 +1,49 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import com.google.common.base.MoreObjects;

+

+public class ProxyResponse {

+

+    protected String errorMessage;

+

+    protected int httpCode;

+

+    public String getErrorMessage() {

+        return errorMessage;

+    }

+

+

+    public int getHttpCode() {

+        return httpCode;

+    }

+

+    @Override

+    public String toString() {

+        return MoreObjects.toStringHelper(this)

+                .add("httpCode", httpCode)

+                .add("errorMessage", errorMessage)

+                .toString();

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/RequestReferencesContainer.java b/onap-enabler-be/src/main/java/org/onap/osam/model/RequestReferencesContainer.java
new file mode 100644
index 0000000..a4bc8f2
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/RequestReferencesContainer.java
@@ -0,0 +1,64 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import com.fasterxml.jackson.annotation.*;

+import com.google.common.base.MoreObjects;

+import org.onap.osam.domain.mso.RequestReferences;

+

+import java.util.HashMap;

+import java.util.Map;

+

+@JsonInclude(JsonInclude.Include.NON_NULL)

+public class RequestReferencesContainer {

+    private final RequestReferences requestReferences;

+

+    @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);

+    }

+

+    public RequestReferencesContainer(@JsonProperty("requestReferences") RequestReferences requestReferences) {

+        this.requestReferences = requestReferences;

+    }

+

+    public RequestReferences getRequestReferences() {

+        return requestReferences;

+    }

+

+    @Override

+    public String toString() {

+        return MoreObjects.toStringHelper(this)

+                .add("requestReferences", requestReferences)

+                .add("additionalProperties", additionalProperties)

+                .toString();

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/Resource.java b/onap-enabler-be/src/main/java/org/onap/osam/model/Resource.java
new file mode 100644
index 0000000..44e1855
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/Resource.java
@@ -0,0 +1,27 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+public class Resource {

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/Result.java b/onap-enabler-be/src/main/java/org/onap/osam/model/Result.java
new file mode 100644
index 0000000..ae8e480
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/Result.java
@@ -0,0 +1,56 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+public class Result {

+	

+	private String result;

+	

+	/**

+	 * Instantiates a new result.

+	 *

+	 * @param result the result

+	 */

+	public Result(String result) {

+		this.result = result;

+	}

+

+	/**

+	 * Gets the result.

+	 *

+	 * @return the result

+	 */

+	public String getResult() {

+		return result;

+	}

+

+	/**

+	 * Sets the result.

+	 *

+	 * @param result the new result

+	 */

+	public void setResult(String result) {

+		this.result = result;

+	}

+	

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/ServiceInfo.java b/onap-enabler-be/src/main/java/org/onap/osam/model/ServiceInfo.java
new file mode 100644
index 0000000..a39d75c
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/ServiceInfo.java
@@ -0,0 +1,417 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+

+ import org.hibernate.annotations.Type;

+ import org.onap.osam.job.Job;

+ import org.onap.portalsdk.core.domain.support.DomainVo;

+

+ import javax.persistence.*;

+ import java.io.Serializable;

+ import java.util.Date;

+ import java.util.Objects;

+ import java.util.Set;

+ import java.util.UUID;

+

+@Entity

+@Table(name = "vid_service_info")

+public class ServiceInfo extends DomainVo {

+

+    public void setUserId(String userId) {

+        this.userId = userId;

+    }

+

+    private UUID jobId;

+    private UUID templateId;

+    private String userId;

+    private Job.JobStatus jobStatus;

+    private Date statusModifiedDate;

+    private boolean hidden;

+    private boolean pause;

+    private Date deletedAt;

+    private String owningEntityId;

+    private String owningEntityName;

+    private String project;

+    private String aicZoneId;

+    private String aicZoneName;

+    private String tenantId;

+    private String tenantName;

+    private String regionId;

+    private String regionName;

+    private String serviceType;

+    private String subscriberName;

+    private String serviceInstanceId;

+    private String serviceInstanceName;

+    private String serviceModelId;

+    private String serviceModelName;

+    private String serviceModelVersion;

+    private Date createdBulkDate;

+

+    public ServiceInfo(){

+

+    }

+

+    public ServiceInfo(String userId, Job.JobStatus jobStatus, boolean pause, UUID jobId, UUID templateId, String owningEntityId, String owningEntityName, String project, String aicZoneId, String aicZoneName, String tenantId, String tenantName, String regionId, String regionName, String serviceType, String subscriberName, String serviceInstanceId, String serviceInstanceName, String serviceModelId, String serviceModelName, String serviceModelVersion, Date createdBulkDate) {

+        this.userId = userId;

+        this.jobStatus = jobStatus;

+        this.jobId = jobId;

+        this.templateId = templateId;

+        this.pause = pause;

+        this.owningEntityId = owningEntityId;

+        this.owningEntityName = owningEntityName;

+        this.project = project;

+        this.aicZoneId = aicZoneId;

+        this.aicZoneName = aicZoneName;

+        this.tenantId = tenantId;

+        this.tenantName = tenantName;

+        this.regionId = regionId;

+        this.regionName = regionName;

+        this.serviceType = serviceType;

+        this.subscriberName = subscriberName;

+        this.serviceInstanceId = serviceInstanceId;

+        this.serviceInstanceName = serviceInstanceName;

+        this.serviceModelId = serviceModelId;

+        this.serviceModelName = serviceModelName;

+        this.serviceModelVersion = serviceModelVersion;

+        this.createdBulkDate = createdBulkDate;

+    }

+

+    @Column(name = "JOB_ID", columnDefinition = "CHAR(36)")

+    @Type(type="org.hibernate.type.UUIDCharType")

+    public UUID getJobId() {

+        return jobId;

+    }

+

+    @Column(name = "TEMPLATE_ID", columnDefinition = "CHAR(36)")

+    @Type(type="org.hibernate.type.UUIDCharType")

+    public UUID getTemplateId() {

+        return templateId;

+    }

+

+    @Column(name="USER_ID")

+    public String getUserId() {

+        return userId;

+    }

+

+    @Column(name="JOB_STATUS")

+    @Enumerated(EnumType.STRING)

+    public Job.JobStatus getJobStatus() {

+        return jobStatus;

+    }

+

+    @Column(name="STATUS_MODIFIED_DATE")

+    public Date getStatusModifiedDate() {

+        return statusModifiedDate;

+    }

+

+    @Column(name="IS_HIDDEN")

+    public boolean isHidden() {

+        return hidden;

+    }

+

+    @Column(name="IS_PAUSE")

+    public boolean isPause() {

+        return pause;

+    }

+

+    @Column(name="OWNING_ENTITY_ID")

+    public String getOwningEntityId() {

+        return owningEntityId;

+    }

+

+    @Column(name="OWNING_ENTITY_NAME")

+    public String getOwningEntityName() {

+        return owningEntityName;

+    }

+

+    @Column(name="PROJECT")

+    public String getProject() {

+        return project;

+    }

+

+    @Column(name="AIC_ZONE_ID")

+    public String getAicZoneId() {

+        return aicZoneId;

+    }

+

+    @Column(name="AIC_ZONE_NAME")

+    public String getAicZoneName() {

+        return aicZoneName;

+    }

+

+    @Column(name="TENANT_ID")

+    public String getTenantId() {

+        return tenantId;

+    }

+

+    @Column(name="TENANT_NAME")

+    public String getTenantName() {

+        return tenantName;

+    }

+

+    @Column(name="REGION_ID")

+    public String getRegionId() {

+        return regionId;

+    }

+

+    @Column(name="REGION_NAME")

+    public String getRegionName() {

+        return regionName;

+    }

+

+    @Column(name="SERVICE_TYPE")

+    public String getServiceType() {

+        return serviceType;

+    }

+

+    @Column(name="SUBSCRIBER_NAME")

+    public String getSubscriberName() {

+        return subscriberName;

+    }

+

+    @Column(name="SERVICE_INSTANCE_ID")

+    public String getServiceInstanceId() {

+        return serviceInstanceId;

+    }

+

+    @Column(name="SERVICE_INSTANCE_NAME")

+    public String getServiceInstanceName() {

+        return serviceInstanceName;

+    }

+

+    @Column(name="SERVICE_MODEL_ID")

+    public String getServiceModelId() {

+        return serviceModelId;

+    }

+

+    @Column(name="SERVICE_MODEL_NAME")

+    public String getServiceModelName() {

+        return serviceModelName;

+    }

+

+    @Column(name="SERVICE_MODEL_VERSION")

+    public String getServiceModelVersion() {

+        return serviceModelVersion;

+    }

+

+    @Column(name="CREATED_BULK_DATE")

+    public Date getCreatedBulkDate() {

+        return createdBulkDate;

+    }

+

+    @Column(name="DELETED_AT")

+    public Date getDeletedAt() {

+         return deletedAt;

+     }

+

+    @Id

+    @GeneratedValue(strategy = GenerationType.IDENTITY)

+    @Override

+    @Column(name = "ID", columnDefinition = "INT(11)")

+    public Long getId() {

+        return this.id;

+    }

+

+    @Override

+    @Column(name = "CREATED_DATE")

+    public Date getCreated() {

+        return super.getCreated();

+    }

+

+    @Override

+    @Column(name = "MODIFIED_DATE")

+    public Date getModified() {

+        return super.getModified();

+    }

+

+    @Override

+    @Transient

+    public Long getCreatedId() {

+        return super.getCreatedId();

+    }

+

+    @Override

+    @Transient

+    public Long getModifiedId() {

+        return super.getModifiedId();

+    }

+

+    @Override

+    @Transient

+    public Serializable getAuditUserId() {

+        return super.getAuditUserId();

+    }

+

+    @Override

+    @Transient

+    public Long getRowNum() {

+        return super.getRowNum();

+    }

+

+    @Override

+    @Transient

+    public Set getAuditTrail() {

+        return super.getAuditTrail();

+    }

+

+    public void setJobId(UUID jobId) {

+        this.jobId = jobId;

+    }

+

+    public void setTemplateId(UUID templateId) {

+        this.templateId = templateId;

+    }

+

+    public void setJobStatus(Job.JobStatus jobStatus) {

+        this.jobStatus = jobStatus;

+    }

+

+    public void setStatusModifiedDate(Date statusModifiedDate) {

+        this.statusModifiedDate = statusModifiedDate;

+    }

+

+    public void setHidden(boolean isHidden) {

+        hidden = isHidden;

+    }

+

+    public void setPause(boolean pause) {

+        this.pause = pause;

+    }

+

+    public void setOwningEntityId(String owningEntityId) {

+        this.owningEntityId = owningEntityId;

+    }

+

+    public void setOwningEntityName(String owningEntityName) {

+        this.owningEntityName = owningEntityName;

+    }

+

+    public void setProject(String project) {

+        this.project = project;

+    }

+

+    public void setAicZoneId(String aicZoneId) {

+        this.aicZoneId = aicZoneId;

+    }

+

+    public void setAicZoneName(String aicZoneName) {

+        this.aicZoneName = aicZoneName;

+    }

+

+    public void setTenantId(String tenantId) {

+        this.tenantId = tenantId;

+    }

+

+    public void setTenantName(String tenantName) {

+        this.tenantName = tenantName;

+    }

+

+    public void setRegionId(String regionId) {

+        this.regionId = regionId;

+    }

+

+    public void setRegionName(String regionName) {

+        this.regionName = regionName;

+    }

+

+    public void setServiceType(String serviceType) {

+        this.serviceType = serviceType;

+    }

+

+    public void setSubscriberName(String subscriberName) {

+        this.subscriberName = subscriberName;

+    }

+

+    public void setServiceInstanceId(String serviceInstanceId) {

+        this.serviceInstanceId = serviceInstanceId;

+    }

+

+    public void setServiceInstanceName(String serviceInstanceName) {

+        this.serviceInstanceName = serviceInstanceName;

+    }

+

+    public void setServiceModelId(String serviceModelId) {

+        this.serviceModelId = serviceModelId;

+    }

+

+    public void setServiceModelName(String serviceModelName) {

+        this.serviceModelName = serviceModelName;

+    }

+

+    public void setServiceModelVersion(String serviceModelVersion) {

+        this.serviceModelVersion = serviceModelVersion;

+    }

+

+    public void setCreatedBulkDate(Date createdBulkDate) {

+        this.createdBulkDate = createdBulkDate;

+    }

+

+    public void setDeletedAt(Date deletedAt) {

+         this.deletedAt = deletedAt;

+     }

+

+

+     @Override

+     public boolean equals(Object o) {

+         if (this == o) return true;

+         if (!(o instanceof ServiceInfo)) return false;

+         ServiceInfo that = (ServiceInfo) o;

+         return isHidden() == that.isHidden() &&

+                 isPause() == that.isPause() &&

+                 Objects.equals(getDeletedAt(), that.getDeletedAt()) &&

+                 Objects.equals(getJobId(), that.getJobId()) &&

+                 Objects.equals(getTemplateId(), that.getTemplateId()) &&

+                 Objects.equals(getUserId(), that.getUserId()) &&

+                 getJobStatus() == that.getJobStatus() &&

+                 Objects.equals(getStatusModifiedDate(), that.getStatusModifiedDate()) &&

+                 Objects.equals(getOwningEntityId(), that.getOwningEntityId()) &&

+                 Objects.equals(getOwningEntityName(), that.getOwningEntityName()) &&

+                 Objects.equals(getProject(), that.getProject()) &&

+                 Objects.equals(getAicZoneId(), that.getAicZoneId()) &&

+                 Objects.equals(getAicZoneName(), that.getAicZoneName()) &&

+                 Objects.equals(getTenantId(), that.getTenantId()) &&

+                 Objects.equals(getTenantName(), that.getTenantName()) &&

+                 Objects.equals(getRegionId(), that.getRegionId()) &&

+                 Objects.equals(getRegionName(), that.getRegionName()) &&

+                 Objects.equals(getServiceType(), that.getServiceType()) &&

+                 Objects.equals(getSubscriberName(), that.getSubscriberName()) &&

+                 Objects.equals(getServiceInstanceId(), that.getServiceInstanceId()) &&

+                 Objects.equals(getServiceInstanceName(), that.getServiceInstanceName()) &&

+                 Objects.equals(getServiceModelId(), that.getServiceModelId()) &&

+                 Objects.equals(getServiceModelName(), that.getServiceModelName()) &&

+                 Objects.equals(getServiceModelVersion(), that.getServiceModelVersion()) &&

+                 Objects.equals(getCreatedBulkDate(), that.getCreatedBulkDate());

+     }

+

+     @Override

+     public int hashCode() {

+

+         return Objects.hash(getJobId(), getTemplateId(), getUserId(), getJobStatus(), getStatusModifiedDate(),

+                 isHidden(), isPause(), getDeletedAt(), getOwningEntityId(), getOwningEntityName(), getProject(),

+                 getAicZoneId(), getAicZoneName(), getTenantId(), getTenantName(), getRegionId(),

+                 getRegionName(), getServiceType(), getSubscriberName(), getServiceInstanceId(),

+                 getServiceInstanceName(), getServiceModelId(), getServiceModelName(),

+                 getServiceModelVersion(), getCreatedBulkDate());

+     }

+ }

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/ServiceInstanceSearchResult.java b/onap-enabler-be/src/main/java/org/onap/osam/model/ServiceInstanceSearchResult.java
new file mode 100644
index 0000000..c8aab29
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/ServiceInstanceSearchResult.java
@@ -0,0 +1,141 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+public class ServiceInstanceSearchResult {

+

+	private String serviceInstanceId;

+

+	private String globalCustomerId;

+

+	private String serviceType;

+

+	private String serviceInstanceName;

+

+	private String subscriberName;

+

+	private String aaiModelInvariantId;

+

+	private String aaiModelVersionId;

+

+	private boolean isPermitted;

+

+	public ServiceInstanceSearchResult(){

+

+	}

+	public ServiceInstanceSearchResult(String serviceInstanceId, String globalCustomerId, String serviceType,

+									   String serviceInstanceName, String subscriberName, String aaiModelInvariantId,

+									   String aaiModelVersionId, boolean isPermitted) {

+		this.serviceInstanceId = serviceInstanceId;

+		this.globalCustomerId = globalCustomerId;

+		this.serviceType = serviceType;

+		this.serviceInstanceName = serviceInstanceName;

+		this.subscriberName = subscriberName;

+		this.aaiModelInvariantId = aaiModelInvariantId;

+		this.aaiModelVersionId = aaiModelVersionId;

+		this.isPermitted = isPermitted;

+	}

+

+	public String getServiceInstanceId() {

+		return serviceInstanceId;

+	}

+

+	public void setServiceInstanceId(String serviceInstanceId) {

+		this.serviceInstanceId = serviceInstanceId;

+	}

+

+	public String getGlobalCustomerId() {

+		return globalCustomerId;

+	}

+

+	public void setGlobalCustomerId(String globalCustomerId) {

+		this.globalCustomerId = globalCustomerId;

+	}

+

+	public String getServiceType() {

+		return serviceType;

+	}

+

+	public void setServiceType(String serviceType) {

+		this.serviceType = serviceType;

+	}

+

+	public String getServiceInstanceName() {

+		return serviceInstanceName;

+	}

+

+	public void setServiceInstanceName(String serviceInstanceName) {

+		this.serviceInstanceName = serviceInstanceName;

+	}

+

+	public String getSubscriberName() {

+		return subscriberName;

+	}

+

+	public void setSubscriberName(String subscriberName) {

+		this.subscriberName = subscriberName;

+	}

+

+	public String getAaiModelInvariantId() {

+		return aaiModelInvariantId;

+	}

+

+	public void setAaiModelInvariantId(String aaiModelInvariantId) {

+		this.aaiModelInvariantId = aaiModelInvariantId;

+	}

+

+	public String getAaiModelVersionId() {

+		return aaiModelVersionId;

+	}

+

+	public void setAaiModelVersionId(String aaiModelVersionId) {

+		this.aaiModelVersionId = aaiModelVersionId;

+	}

+

+	public boolean getIsPermitted() {

+		return isPermitted;

+	}

+

+	public void setIsPermitted(boolean isPermitted) {

+		this.isPermitted = isPermitted;

+	}

+

+	@Override

+	public boolean equals(Object other){

+		if (other instanceof ServiceInstanceSearchResult) {

+			ServiceInstanceSearchResult serviceInstanceSearchResultOther = (ServiceInstanceSearchResult) other;

+			if (this.getServiceInstanceId().equals(serviceInstanceSearchResultOther.getServiceInstanceId())) {

+				return true;

+			}

+		}

+		return false;

+

+	}

+

+	@Override

+	public int hashCode() {

+		int result = 17;

+		result = 31 * result + serviceInstanceId.hashCode();

+		return result;

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/Subscriber.java b/onap-enabler-be/src/main/java/org/onap/osam/model/Subscriber.java
new file mode 100644
index 0000000..1afe8cc
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/Subscriber.java
@@ -0,0 +1,45 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+public class Subscriber {

+

+    @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;

+

+

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/SubscriberList.java b/onap-enabler-be/src/main/java/org/onap/osam/model/SubscriberList.java
new file mode 100644
index 0000000..8e4830e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/SubscriberList.java
@@ -0,0 +1,37 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import java.util.List;

+

+public class SubscriberList {

+    public SubscriberList(List<Subscriber> customer) {

+        this.customer = customer;

+    }

+

+    public SubscriberList(){}

+

+    public List<Subscriber> customer;

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/VNFDao.java b/onap-enabler-be/src/main/java/org/onap/osam/model/VNFDao.java
new file mode 100644
index 0000000..1f0d56d
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/VNFDao.java
@@ -0,0 +1,127 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import org.onap.portalsdk.core.domain.support.DomainVo;

+

+import javax.persistence.*;

+import java.io.Serializable;

+import java.util.Date;

+import java.util.HashSet;

+import java.util.Set;

+

+@Entity

+@Table(name = "vid_vnf")

+public class VNFDao extends DomainVo {

+

+    private String vnfUUID;

+    private String vnfInvariantUUID;

+    private Set<VidWorkflow> workflows = new HashSet<>(0);

+

+    @Id

+    @GeneratedValue(strategy = GenerationType.IDENTITY)

+    @Column(name = "VNF_DB_ID")

+    @JsonIgnore

+    public Long getId() {

+        return id;

+    }

+

+    @Override

+    @Column(name = "CREATED_DATE")

+    @JsonIgnore

+    public Date getCreated() {

+        return super.getCreated();

+    }

+

+    @Override

+    @Column(name = "MODIFIED_DATE")

+    @JsonIgnore

+    public Date getModified() {

+        return super.getModified();

+    }

+

+    @Override

+    @Transient

+    @JsonIgnore

+    public Long getCreatedId() {

+        return super.getCreatedId();

+    }

+

+    @Override

+    @Transient

+    @JsonIgnore

+    public Long getModifiedId() {

+        return super.getModifiedId();

+    }

+

+    @Override

+    @Transient

+    @JsonIgnore

+    public Serializable getAuditUserId() {

+        return super.getAuditUserId();

+    }

+

+    @Override

+    @Transient

+    @JsonIgnore

+    public Long getRowNum() {

+        return super.getRowNum();

+    }

+

+    @Override

+    @Transient

+    @JsonIgnore

+    public Set getAuditTrail() {

+        return super.getAuditTrail();

+    }

+

+    @Column(name = "VNF_APP_UUID")

+    public String getVnfUUID() {

+        return vnfUUID;

+    }

+    

+    @Column(name = "VNF_APP_INVARIANT_UUID")

+    public String getVnfInvariantUUID() {

+        return vnfInvariantUUID;

+    }

+    

+

+    public void setVnfUUID(String vnfUUID) {

+        this.vnfUUID = vnfUUID;

+    }

+    

+    public void setVnfInvariantUUID(String vnfInvariantUUID) {

+		this.vnfInvariantUUID = vnfInvariantUUID;

+	}

+

+    @ManyToMany(cascade = CascadeType.ALL, fetch =FetchType.EAGER )

+    @JoinTable(name = "vid_vnf_workflow", joinColumns = { @JoinColumn(name = "VNF_DB_ID") }, inverseJoinColumns = { @JoinColumn(name = "WORKFLOW_DB_ID") })

+    public Set<VidWorkflow> getWorkflows() {

+        return workflows;

+    }

+

+    public void setWorkflows(Set<VidWorkflow> workflows) {

+        this.workflows = workflows;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/VersionByInvariantIdsRequest.java b/onap-enabler-be/src/main/java/org/onap/osam/model/VersionByInvariantIdsRequest.java
new file mode 100644
index 0000000..9cde397
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/VersionByInvariantIdsRequest.java
@@ -0,0 +1,30 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import java.util.List;

+

+public class VersionByInvariantIdsRequest {

+

+    public List<String> versions;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/VfcInstanceGroup.java b/onap-enabler-be/src/main/java/org/onap/osam/model/VfcInstanceGroup.java
new file mode 100644
index 0000000..21e8593
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/VfcInstanceGroup.java
@@ -0,0 +1,77 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+public class VfcInstanceGroup {

+

+    private String uuid;

+    private String invariantUuid;

+    private String name;

+    private String version;

+    private VfcInstanceGroupProperties vfcInstanceGroupProperties;

+

+    public String getUuid() {

+        return uuid;

+    }

+

+    public void setUuid(String uuid) {

+        this.uuid = uuid;

+    }

+

+    public String getInvariantUuid() {

+        return invariantUuid;

+    }

+

+    public void setInvariantUuid(String invariantUuid) {

+        this.invariantUuid = invariantUuid;

+    }

+

+    public String getName() {

+        return name;

+    }

+

+    public void setName(String name) {

+        this.name = name;

+    }

+

+    public String getVersion() {

+        return version;

+    }

+

+    public void setVersion(String version) {

+        this.version = version;

+    }

+

+    public VfcInstanceGroupProperties getVfcInstanceGroupProperties() {

+        return vfcInstanceGroupProperties;

+    }

+

+    public void setVfcInstanceGroupProperties(VfcInstanceGroupProperties vfcInstanceGroupProperties) {

+        this.vfcInstanceGroupProperties = vfcInstanceGroupProperties;

+    }

+

+

+

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/VfcInstanceGroupProperties.java b/onap-enabler-be/src/main/java/org/onap/osam/model/VfcInstanceGroupProperties.java
new file mode 100644
index 0000000..0fb0e51
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/VfcInstanceGroupProperties.java
@@ -0,0 +1,66 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+public class VfcInstanceGroupProperties {

+

+    private String vfcParentPortRole;

+    private String networkCollectionFunction;

+    private String vfcInstanceGroupFunction;

+    private String subinterfaceRole;

+

+    public String getVfcParentPortRole() {

+        return vfcParentPortRole;

+    }

+

+    public void setVfcParentPortRole(String vfcParentPortRole) {

+        this.vfcParentPortRole = vfcParentPortRole;

+    }

+

+    public String getNetworkCollectionFunction() {

+        return networkCollectionFunction;

+    }

+

+    public void setNetworkCollectionFunction(String networkCollectionFunction) {

+        this.networkCollectionFunction = networkCollectionFunction;

+    }

+

+    public String getVfcInstanceGroupFunction() {

+        return vfcInstanceGroupFunction;

+    }

+

+    public void setVfcInstanceGroupFunction(String vfcInstanceGroupFunction) {

+        this.vfcInstanceGroupFunction = vfcInstanceGroupFunction;

+    }

+

+    public String getSubinterfaceRole() {

+        return subinterfaceRole;

+    }

+

+    public void setSubinterfaceRole(String subinterfaceRole) {

+        this.subinterfaceRole = subinterfaceRole;

+    }

+

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/VidBaseEntity.java b/onap-enabler-be/src/main/java/org/onap/osam/model/VidBaseEntity.java
new file mode 100644
index 0000000..1d511a3
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/VidBaseEntity.java
@@ -0,0 +1,86 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import org.onap.portalsdk.core.domain.support.DomainVo;

+

+import javax.persistence.Column;

+import javax.persistence.MappedSuperclass;

+import javax.persistence.Transient;

+import java.io.Serializable;

+import java.util.Date;

+import java.util.Set;

+

+@MappedSuperclass

+public class VidBaseEntity extends DomainVo {

+

+    @Override

+    @Column(name = "CREATED_DATE")

+    @JsonIgnore

+    public Date getCreated() {

+        return super.getCreated();

+    }

+

+    @Override

+    @Column(name = "MODIFIED_DATE")

+    @JsonIgnore

+    public Date getModified() {

+        return super.getModified();

+    }

+

+    @Override

+    @Transient

+    @JsonIgnore

+    public Long getCreatedId() {

+        return super.getCreatedId();

+    }

+

+    @Override

+    @Transient

+    @JsonIgnore

+    public Long getModifiedId() {

+        return super.getModifiedId();

+    }

+

+    @Override

+    @Transient

+    @JsonIgnore

+    public Serializable getAuditUserId() {

+        return super.getAuditUserId();

+    }

+

+    @Override

+    @Transient

+    @JsonIgnore

+    public Long getRowNum() {

+        return super.getRowNum();

+    }

+

+    @Override

+    @Transient

+    @JsonIgnore

+    public Set getAuditTrail() {

+        return super.getAuditTrail();

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/VidWorkflow.java b/onap-enabler-be/src/main/java/org/onap/osam/model/VidWorkflow.java
new file mode 100644
index 0000000..3bd93e7
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/VidWorkflow.java
@@ -0,0 +1,52 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnore;

+

+import javax.persistence.*;

+

+@Entity

+@Table(name = "vid_workflow")

+public class VidWorkflow extends VidBaseEntity {

+

+    private String wokflowName;

+

+    @Id

+    @GeneratedValue(strategy = GenerationType.IDENTITY)

+    @Column(name = "WORKFLOW_DB_ID")

+    @JsonIgnore

+    public Long getId() {

+        return id;

+    }

+

+    @Column(name = "WORKFLOW_APP_NAME")

+    public String getWokflowName() {

+        return wokflowName;

+    }

+

+    public void setWokflowName(String wokflowName) {

+        this.wokflowName = wokflowName;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/Workflow.java b/onap-enabler-be/src/main/java/org/onap/osam/model/Workflow.java
new file mode 100644
index 0000000..8ba781f
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/Workflow.java
@@ -0,0 +1,69 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model;

+

+

+import java.util.Collection;

+

+public class Workflow {

+    //Private members:

+    private int id;

+    private String workflowName;

+    private Collection<String> vnfNames;

+

+

+    //Constructors:

+    public Workflow() {}

+

+    public Workflow(int id, String workflowName, Collection<String> vnfNames) {

+        this.id = id;

+        this.workflowName = workflowName;

+        this.vnfNames = vnfNames;

+    }

+

+

+    //Setters and getters:

+    public int getId() {

+        return id;

+    }

+

+    public String getWorkflowName() {

+        return workflowName;

+    }

+

+    public Collection<String> getVnfNames() {

+        return this.vnfNames;

+    }

+

+    public void setId(int id) {

+        this.id = id;

+    }

+

+    public void setWorkflowName(String workflowName) {

+        this.workflowName = workflowName;

+    }

+

+    public void setVnfName(Collection<String> vnfNames) {

+        this.vnfNames = vnfNames;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/probes/ErrorMetadata.java b/onap-enabler-be/src/main/java/org/onap/osam/model/probes/ErrorMetadata.java
new file mode 100644
index 0000000..3fb8d58
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/probes/ErrorMetadata.java
@@ -0,0 +1,29 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model.probes;

+

+public class ErrorMetadata extends StatusMetadata {

+    public ErrorMetadata(String description, long duration) {

+        super(description, duration);

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/probes/ExternalComponentStatus.java b/onap-enabler-be/src/main/java/org/onap/osam/model/probes/ExternalComponentStatus.java
new file mode 100644
index 0000000..149bc79
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/probes/ExternalComponentStatus.java
@@ -0,0 +1,48 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model.probes;

+

+public class ExternalComponentStatus {

+    public enum Component {AAI, MSO}

+    private final Component component;

+    private final boolean available;

+    private final StatusMetadata metadata;

+

+    public ExternalComponentStatus(Component component, boolean isAvailable, StatusMetadata metadata) {

+        this.component = component;

+        this.available = isAvailable;

+        this.metadata = metadata;

+    }

+

+    public Component getComponent() {

+        return component;

+    }

+

+    public boolean isAvailable() {

+        return available;

+    }

+

+    public StatusMetadata getMetadata() {

+        return metadata;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/probes/HttpRequestMetadata.java b/onap-enabler-be/src/main/java/org/onap/osam/model/probes/HttpRequestMetadata.java
new file mode 100644
index 0000000..ba9c15f
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/probes/HttpRequestMetadata.java
@@ -0,0 +1,56 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model.probes;

+

+import org.springframework.http.HttpMethod;

+

+public class HttpRequestMetadata extends StatusMetadata {

+    private final HttpMethod httpMethod;

+    private final int httpCode;

+    private final String url;

+    private final String rawData;

+

+    public HttpRequestMetadata(HttpMethod httpMethod, int httpCode, String url, String rawData, String description, long duration) {

+        super(description, duration);

+        this.httpMethod = httpMethod;

+        this.url = url;

+        this.httpCode = httpCode;

+        this.rawData = rawData;

+    }

+

+    public HttpMethod getHttpMethod() {

+        return httpMethod;

+    }

+

+    public int getHttpCode() {

+        return httpCode;

+    }

+

+    public String getUrl() {

+        return url;

+    }

+

+    public String getRawData() {

+        return rawData;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/probes/StatusMetadata.java b/onap-enabler-be/src/main/java/org/onap/osam/model/probes/StatusMetadata.java
new file mode 100644
index 0000000..a2b8d90
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/probes/StatusMetadata.java
@@ -0,0 +1,41 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model.probes;

+

+public abstract class StatusMetadata {

+    protected final long duration;

+    protected final String description;

+

+    public StatusMetadata(String description, long duration) {

+        this.description = description;

+        this.duration = duration;

+    }

+

+    public long getDuration() {

+        return duration;

+    }

+

+    public String getDescription() {

+        return description;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/serviceInstantiation/ServiceInstantiation.java b/onap-enabler-be/src/main/java/org/onap/osam/model/serviceInstantiation/ServiceInstantiation.java
new file mode 100644
index 0000000..b1282a4
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/serviceInstantiation/ServiceInstantiation.java
@@ -0,0 +1,196 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model.serviceInstantiation;

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+import org.onap.osam.domain.mso.ModelInfo;

+import org.onap.osam.job.JobAdapter;

+

+import java.util.Collections;

+import java.util.List;

+import java.util.Map;

+

+public class ServiceInstantiation implements JobAdapter.AsyncJobRequest {

+

+    private final ModelInfo modelInfo;

+

+    private final String owningEntityId;

+

+    private final String owningEntityName;

+

+    private final String projectName;

+

+    private final String subscriberName;

+

+    private final String globalSubscriberId;

+

+    private final String productFamilyId;

+

+    private final String instanceName;

+

+    private final Boolean isUserProvidedNaming;

+

+    private final String subscriptionServiceType;

+

+    private final String lcpCloudRegionId;

+

+    private final String tenantId;

+

+    private final String tenantName;

+

+    private final String aicZoneId;

+

+    private final String aicZoneName;

+

+    private final Map<String, Vnf> vnfs;

+

+    private final List<Map<String,String>> instanceParams;

+

+    private final boolean isPause;

+

+    private final int bulkSize;

+

+    private final boolean rollbackOnFailure;

+

+    public ServiceInstantiation(@JsonProperty("modelInfo") ModelInfo modelInfo,

+                                @JsonProperty("owningEntityId") String owningEntityId,

+                                @JsonProperty("owningEntityName") String owningEntityName,

+                                @JsonProperty("projectName") String projectName,

+                                @JsonProperty("globalSubscriberId") String globalSubscriberId,

+                                @JsonProperty("subscriberName") String subscriberName,

+                                @JsonProperty("productFamilyId") String productFamilyId,

+                                @JsonProperty("instanceName") String instanceName,

+                                @JsonProperty("isUserProvidedNaming") Boolean isUserProvidedNaming,

+                                @JsonProperty("subscriptionServiceType") String subscriptionServiceType,

+                                @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,

+                                @JsonProperty("tenantId") String tenantId,

+                                @JsonProperty("tenantName") String tenantName,

+                                @JsonProperty("aicZoneId") String aicZoneId,

+                                @JsonProperty("aicZoneName") String aicZoneName,

+                                @JsonProperty("vnfs") Map<String, Vnf> vnfs,

+                                @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,

+                                @JsonProperty("pause") boolean isPause,

+                                @JsonProperty("bulkSize") int bulkSize,

+                                @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure

+                               ) {

+

+        this.modelInfo = modelInfo;

+        this.modelInfo.setModelType("service");

+        this.owningEntityId = owningEntityId;

+        this.owningEntityName = owningEntityName;

+        this.projectName = projectName;

+        this.globalSubscriberId = globalSubscriberId;

+        this.subscriberName = subscriberName;

+        this.productFamilyId = productFamilyId;

+        this.instanceName = instanceName;

+        this.isUserProvidedNaming = isUserProvidedNaming;

+        this.subscriptionServiceType = subscriptionServiceType;

+        this.lcpCloudRegionId = lcpCloudRegionId;

+        this.tenantId = tenantId;

+        this.tenantName = tenantName;

+        this.aicZoneId = aicZoneId;

+        this.aicZoneName = aicZoneName;

+        this.vnfs = vnfs;

+        this.instanceParams = instanceParams;

+        this.isPause = isPause;

+        this.bulkSize = bulkSize;

+        this.rollbackOnFailure = rollbackOnFailure;

+    }

+

+    public ModelInfo getModelInfo() {

+        return modelInfo;

+    }

+

+    public String getOwningEntityId() {

+        return owningEntityId;

+    }

+

+    public String getOwningEntityName() {

+        return owningEntityName;

+    }

+

+    public String getProjectName() {

+        return projectName;

+    }

+

+    public String getGlobalSubscriberId() {

+        return globalSubscriberId;

+    }

+

+    public String getSubscriberName() {

+        return subscriberName;

+    }

+

+    public String getProductFamilyId() {

+        return productFamilyId;

+    }

+

+    public String getInstanceName() {

+        return instanceName;

+    }

+

+    @JsonProperty("isUserProvidedNaming")

+    public Boolean isUserProvidedNaming() { return isUserProvidedNaming; }

+

+    public String getSubscriptionServiceType() {

+        return subscriptionServiceType;

+    }

+

+    public String getLcpCloudRegionId() {

+        return lcpCloudRegionId;

+    }

+

+    public String getTenantId() {

+        return tenantId;

+    }

+

+    public String getTenantName() {

+        return tenantName;

+    }

+

+    public String getAicZoneId() {

+        return aicZoneId;

+    }

+

+    public String getAicZoneName() {

+        return aicZoneName;

+    }

+

+    public Map<String, Vnf> getVnfs() {

+        return vnfs;

+    }

+

+    public List<Map<String, String>> getInstanceParams() {

+        return instanceParams == null ? Collections.emptyList() : instanceParams;

+    }

+

+    public boolean isPause() {

+        return isPause;

+    }

+

+    public int getBulkSize() { return bulkSize; }

+

+    public boolean isRollbackOnFailure() {

+        return rollbackOnFailure;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/serviceInstantiation/VfModule.java b/onap-enabler-be/src/main/java/org/onap/osam/model/serviceInstantiation/VfModule.java
new file mode 100644
index 0000000..dec47cd
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/serviceInstantiation/VfModule.java
@@ -0,0 +1,73 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model.serviceInstantiation;

+

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import org.onap.osam.domain.mso.ModelInfo;

+

+import java.util.Collections;

+import java.util.List;

+import java.util.Map;

+

+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;

+

+public class VfModule {

+

+

+

+	private final ModelInfo modelInfo;

+

+	@JsonInclude(NON_NULL) private final String instanceName;

+

+	private final List<Map<String, String>> instanceParams;

+	@JsonInclude(NON_NULL) private final String volumeGroupInstanceName;

+

+	public VfModule(@JsonProperty("modelInfo") ModelInfo modelInfo,

+					@JsonProperty("instanceName") String instanceName,

+					@JsonProperty(value = "volumeGroupName") String volumeGroupInstanceName,

+					@JsonProperty("instanceParams") List<Map<String, String>> instanceParams) {

+		this.modelInfo = modelInfo;

+		this.modelInfo.setModelType("vfModule");

+		this.instanceName = instanceName;

+		this.instanceParams = instanceParams;

+		this.volumeGroupInstanceName = volumeGroupInstanceName;

+	}

+

+	public ModelInfo getModelInfo() {

+		return modelInfo;

+	}

+

+	public String getInstanceName() {

+		return instanceName;

+	}

+

+	public String getVolumeGroupInstanceName() {

+		return volumeGroupInstanceName;

+	}

+

+	public List<Map<String, String>> getInstanceParams() {

+		return instanceParams == null ? Collections.emptyList() : instanceParams;

+	}

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/model/serviceInstantiation/Vnf.java b/onap-enabler-be/src/main/java/org/onap/osam/model/serviceInstantiation/Vnf.java
new file mode 100644
index 0000000..1fb61da
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/model/serviceInstantiation/Vnf.java
@@ -0,0 +1,118 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.model.serviceInstantiation;

+

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+import org.onap.osam.domain.mso.ModelInfo;

+

+import java.util.Collections;

+import java.util.List;

+import java.util.Map;

+

+public class Vnf  {

+	private final ModelInfo modelInfo;

+

+	private final String productFamilyId;

+

+	private final String instanceName;

+

+	private final String platformName;

+

+	private final String lcpCloudRegionId;

+

+	private final String tenantId;

+

+	private final Boolean isUserProvidedNaming;

+

+	private final List<Map<String, String>> instanceParams;

+

+	private final String lineOfBusiness;

+

+

+	private final Map<String, Map<String, VfModule>> vfModules;

+

+	public Vnf(@JsonProperty("modelInfo") ModelInfo modelInfo,

+			   @JsonProperty("productFamilyId") String productFamilyId,

+			   @JsonProperty("instanceName") String instanceName,

+			   @JsonProperty("isUserProvidedNaming") Boolean isUserProvidedNaming,

+			   @JsonProperty("platformName") String platformName,

+			   @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,

+			   @JsonProperty("tenantId") String tenantId,

+			   @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,

+			   @JsonProperty("lineOfBusinessName") String lineOfBusiness,

+			   @JsonProperty("vfModules") Map<String, Map<String, VfModule>> vfModules) {

+		this.modelInfo = modelInfo;

+		this.modelInfo.setModelType("vnf");

+		this.productFamilyId = productFamilyId;

+		this.instanceName = instanceName;

+		this.isUserProvidedNaming = isUserProvidedNaming;

+		this.platformName = platformName;

+		this.lcpCloudRegionId = lcpCloudRegionId;

+		this.tenantId = tenantId;

+		this.instanceParams = instanceParams;

+		this.vfModules = vfModules;

+		this.lineOfBusiness = lineOfBusiness;

+	}

+

+	public ModelInfo getModelInfo() {

+		return modelInfo;

+	}

+

+	public String getProductFamilyId() {

+		return productFamilyId;

+	}

+

+	public String getInstanceName() {

+		return instanceName;

+	}

+

+	@JsonProperty("isUserProvidedNaming")

+	public Boolean isUserProvidedNaming() {

+		return isUserProvidedNaming;

+	}

+

+	public String getPlatformName() {

+		return platformName;

+	}

+

+	public String getLcpCloudRegionId() {

+		return lcpCloudRegionId;

+	}

+

+	public String getTenantId() {

+		return tenantId;

+	}

+

+	public List<Map<String, String>> getInstanceParams() {

+		return instanceParams == null ? Collections.emptyList() : instanceParams;

+	}

+

+	public  Map<String, Map<String, VfModule>> getVfModules() {

+		return vfModules;

+	}

+

+	public String getLineOfBusiness() {

+		return lineOfBusiness;

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoBusinessLogic.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoBusinessLogic.java
new file mode 100644
index 0000000..d63f1e7
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoBusinessLogic.java
@@ -0,0 +1,111 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso;

+

+import org.onap.osam.mso.rest.Request;

+import org.onap.osam.mso.rest.RequestDetails;

+import org.onap.osam.mso.rest.RequestDetailsWrapper;

+import org.onap.osam.mso.rest.Task;

+

+import java.util.List;

+

+public interface MsoBusinessLogic {

+

+    // this function should get params from tosca and send them to instance at mso, then return success response.

+    MsoResponseWrapper createSvcInstance(RequestDetails msoRequest);

+

+    MsoResponseWrapper createE2eSvcInstance(Object msoRequest);

+    

+    MsoResponseWrapper deleteE2eSvcInstance(Object requestDetails, String serviceInstanceId);

+    

+    MsoResponseWrapper createVnf(RequestDetails requestDetails, String serviceInstanceId);

+

+    MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String serviceInstanceId);

+

+    MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId);

+

+    MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId);

+

+    MsoResponseWrapper scaleOutVfModuleInstance(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId);

+

+    MsoResponseWrapper createConfigurationInstance(org.onap.osam.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String serviceInstanceId);

+

+    MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String serviceInstanceId, String serviceStatus);

+

+    MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId);

+

+    MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId, String vfModuleId);

+

+    MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId, String volumeGroupId);

+

+    MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String serviceInstanceId, String networkInstanceId);

+

+    MsoResponseWrapper getOrchestrationRequest(String requestId);

+

+    MsoResponseWrapper getOrchestrationRequests(String filterString);

+

+    List<Request> getOrchestrationRequestsForDashboard();

+

+    List<Task> getManualTasksByRequestId(String originalRequestId);

+

+    MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String taskId);

+

+    MsoResponseWrapper activateServiceInstance(RequestDetails requestDetails, String serviceInstanceId);

+

+    //MsoResponseWrapperInterface updateVnf(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId);

+

+    //MsoResponseWrapperInterface replaceVnf(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId);

+

+    MsoResponseWrapperInterface updateVnfSoftware(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId);

+

+    MsoResponseWrapperInterface updateVnfConfig(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId);

+

+    MsoResponseWrapper deleteConfiguration(

+            org.onap.osam.mso.rest.RequestDetailsWrapper requestDetailsWrapper,

+            String serviceInstanceId,

+            String configurationId);

+

+    MsoResponseWrapper setConfigurationActiveStatus(

+            RequestDetails requestDetails,

+            String serviceInstanceId,

+            String configurationId,

+            boolean isActivate);

+

+    MsoResponseWrapper setPortOnConfigurationStatus(

+            RequestDetails requestDetails,

+            String serviceInstanceId,

+            String configurationId,

+            boolean isEnable);

+

+    String getCloudResourcesRequestsStatusPath(String requestId);

+

+    MsoResponseWrapper removeRelationshipFromServiceInstance(RequestDetails requestDetails, String serviceInstanceId);

+

+    MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String serviceInstanceId);

+

+    MsoResponseWrapper setServiceInstanceStatus(RequestDetails requestDetails , String serviceInstanceId, boolean isActivate);

+

+    RequestDetailsWrapper generateInPlaceMsoRequest(RequestDetails requestDetails);

+

+    RequestDetailsWrapper generateConfigMsoRequest(RequestDetails requestDetails);

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoBusinessLogicImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoBusinessLogicImpl.java
new file mode 100644
index 0000000..cfe0bad
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoBusinessLogicImpl.java
@@ -0,0 +1,799 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso;

+

+import com.fasterxml.jackson.annotation.JsonCreator;

+import com.fasterxml.jackson.annotation.JsonValue;

+import com.fasterxml.jackson.databind.DeserializationFeature;

+import com.fasterxml.jackson.databind.ObjectMapper;

+import com.google.common.collect.ImmutableList;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.osam.mso.rest.Request;

+import org.onap.osam.mso.rest.RequestDetails;

+import org.onap.osam.mso.rest.RequestDetailsWrapper;

+import org.onap.osam.mso.rest.RequestList;

+import org.onap.osam.mso.rest.RequestWrapper;

+import org.onap.osam.mso.rest.Task;

+import org.onap.osam.mso.rest.TaskList;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.togglz.core.manager.FeatureManager;

+

+import javax.ws.rs.BadRequestException;

+import java.io.IOException;

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.ArrayList;

+import java.util.Date;

+import java.util.HashMap;

+import java.util.List;

+import java.util.Map;

+import java.util.regex.Pattern;

+

+import static org.apache.commons.lang.StringUtils.upperCase;

+import static org.onap.osam.controllers.MsoController.*;

+import static org.onap.osam.mso.MsoProperties.*;

+import static org.onap.osam.properties.Features.FLAG_UNASSIGN_SERVICE;

+

+public class MsoBusinessLogicImpl implements MsoBusinessLogic {

+

+    public static final String START = " start";

+    public static final String RESOURCE_TYPE = "resourceType";

+    FeatureManager featureManager;

+

+    private static final DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+    private static final Pattern SOFTWARE_VERSION_PATTERN = Pattern.compile("^[A-Za-z0-9.\\-]+$");

+    private static final Pattern NUMBER_PATTERN = Pattern.compile("^[0-9]+$");

+    private static final String ACTIVATE = "/activate";

+    private static final String DEACTIVATE = "/deactivate";

+    private static final String ENABLE_PORT = "/enablePort";

+    private static final String DISABLE_PORT = "/disablePort";

+    private static final String RESOURCE_TYPE_OPERATIONAL_ENVIRONMENT = "operationalEnvironment";

+    private static final String SOURCE_OPERATIONAL_ENVIRONMENT = "VID";

+    private static final ObjectMapper objectMapper = new ObjectMapper();

+    private final MsoInterface msoClientInterface;

+

+    /**

+     * The logger.

+     */

+    private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoBusinessLogicImpl.class);

+    

+    @Autowired

+    public MsoBusinessLogicImpl(MsoInterface msoClientInterface, FeatureManager featureManager) {

+        this.msoClientInterface = msoClientInterface;

+        this.featureManager = featureManager;

+    }

+

+    public static String validateEndpointPath(String endpointEnvVariable) {

+        String endpoint = SystemProperties.getProperty(endpointEnvVariable);

+        if (endpoint == null || endpoint.isEmpty()) {

+            throw new GenericUncheckedException(endpointEnvVariable + " env variable is not defined");

+        }

+        return endpoint;

+    }

+

+    // this function should get params from tosca and send them to instance at mso, then return success response.

+    @Override

+    public MsoResponseWrapper createSvcInstance(RequestDetails msoRequest) {

+        String methodName = "createSvcInstance ";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+        endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_SVC_INSTANCE);

+

+        return msoClientInterface.createSvcInstance(msoRequest, endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper createE2eSvcInstance(Object msoRequest){

+        String methodName = "createE2eSvcInstance ";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+        endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_E2E_SVC_INSTANCE);

+

+

+        return msoClientInterface.createE2eSvcInstance(msoRequest, endpoint);

+    } 

+

+    @Override

+    public MsoResponseWrapper createVnf(RequestDetails requestDetails, String serviceInstanceId) {

+        String methodName = "createVnf";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+        endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_INSTANCE);

+

+        String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);

+        return msoClientInterface.createVnf(requestDetails, vnf_endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String serviceInstanceId) {

+        String methodName = "createNwInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+        endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);

+

+        String nw_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);

+        return msoClientInterface.createNwInstance(requestDetails, nw_endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) {

+        String methodName = "createVolumeGroupInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+        endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);

+

+        String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);

+        vnf_endpoint = vnf_endpoint.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);

+

+        return msoClientInterface.createVolumeGroupInstance(requestDetails, vnf_endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) {

+        String methodName = "createVfModuleInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+        endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);

+

+        String partial_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);

+        String vf_module_endpoint = partial_endpoint.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);

+

+        return msoClientInterface.createVfModuleInstance(requestDetails, vf_module_endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper scaleOutVfModuleInstance(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) {

+        String methodName = "scaleOutVfModuleInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+        endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VF_MODULE_SCALE_OUT);

+

+        String partial_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);

+        String vf_module_endpoint = partial_endpoint.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);

+        RequestDetailsWrapper wrapper = new RequestDetailsWrapper();

+        //requestDetails.setVnfName(null);

+        //requestDetails.setVnfInstanceId(null);

+        wrapper.requestDetails = requestDetails;

+

+        return msoClientInterface.scaleOutVFModuleInstance(wrapper, vf_module_endpoint);

+    }

+    @Override

+    public MsoResponseWrapper createConfigurationInstance(org.onap.osam.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String serviceInstanceId) {

+        String methodName = "createConfigurationInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_CONFIGURATIONS);

+        endpoint = endpoint.replace(SVC_INSTANCE_ID, serviceInstanceId);

+

+        return msoClientInterface.createConfigurationInstance(requestDetailsWrapper, endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper deleteE2eSvcInstance(Object requestDetails, String serviceInstanceId) {

+        String methodName = "deleteE2eSvcInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+	 	endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_E2E_SVC_INSTANCE) + "/" + serviceInstanceId;

+

+        return msoClientInterface.deleteE2eSvcInstance(requestDetails, endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String serviceInstanceId, String serviceStatus) {

+        String methodName = "deleteSvcInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String endpoint;

+

+        if (featureManager.isActive(FLAG_UNASSIGN_SERVICE)){

+            endpoint = validateEndpointPath(MsoProperties.MSO_DELETE_OR_UNASSIGN_REST_API_SVC_INSTANCE);

+            if (shouldUnassignService(serviceStatus)){

+                logger.debug(EELFLoggerDelegate.debugLogger, "unassign service");

+                String svc_endpoint = endpoint + "/" + serviceInstanceId + "/unassign";

+                return msoClientInterface.unassignSvcInstance(requestDetails, svc_endpoint);

+            }

+        } else {

+            endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_SVC_INSTANCE);

+        }

+

+        String svc_endpoint = endpoint + "/" + serviceInstanceId;

+        return msoClientInterface.deleteSvcInstance(requestDetails, svc_endpoint);

+    }

+

+    private boolean shouldUnassignService(String serviceStatus) {

+            return ImmutableList.of("created","pendingdelete","pending-delete", "assigned").contains(serviceStatus.toLowerCase());

+    }

+

+    @Override

+    public MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) {

+        String methodName = "deleteVnf";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+        endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_INSTANCE);

+        String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);

+        vnf_endpoint = vnf_endpoint + '/' + vnfInstanceId;

+

+        return msoClientInterface.deleteVnf(requestDetails, vnf_endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId, String vfModuleId) {

+        String methodName = "deleteVfModule";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+        endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);

+

+        String vf__modules_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId).replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);

+

+        String delete_vf_endpoint = vf__modules_endpoint + '/' + vfModuleId;

+

+        return msoClientInterface.deleteVfModule(requestDetails, delete_vf_endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId, String volumeGroupId) {

+        String methodName = "deleteVolumeGroupInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+        endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);

+

+        String svc_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);

+        String vnf_endpoint = svc_endpoint.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);

+        String delete_volume_group_endpoint = vnf_endpoint + "/" + volumeGroupId;

+

+        return msoClientInterface.deleteVolumeGroupInstance(requestDetails, delete_volume_group_endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String serviceInstanceId, String networkInstanceId) {

+        String methodName = "deleteNwInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint;

+        endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);

+

+        String svc_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);

+        String delete_nw_endpoint = svc_endpoint + "/" + networkInstanceId;

+

+        return msoClientInterface.deleteNwInstance(requestDetails, delete_nw_endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper getOrchestrationRequest(String requestId) {

+        String methodName = "getOrchestrationRequest";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        try {

+            String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQ);

+            String path = p + "/" + requestId;

+

+            return msoClientInterface.getOrchestrationRequest(path);

+

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+    }

+

+    @Override

+    public MsoResponseWrapper getOrchestrationRequests(String filterString) {

+        String methodName = "getOrchestrationRequest";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        try {

+            String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQS);

+            String path = p + filterString;

+

+            return msoClientInterface.getOrchestrationRequest(path);

+

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+    }

+

+    @Override

+    public List<Request> getOrchestrationRequestsForDashboard() {

+        String methodName = "getOrchestrationRequestsForDashboard";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        List<Request> filteredOrchestrationRequests = new ArrayList<>();

+        try {

+            String path = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQS);

+            path += "filter=modelType:EQUALS:vnf";

+            RestObject<String> restObjStr = new RestObject<>();

+            String str = new String();

+            restObjStr.set(str);

+

+            MsoResponseWrapper msoResponseWrapper = msoClientInterface.getOrchestrationRequestsForDashboard(str, "", path, restObjStr);

+            List<RequestWrapper> allOrchestrationRequests = deserializeOrchestrationRequestsJson(msoResponseWrapper.getEntity());

+

+            final ImmutableList<String> suppoertedRequestTypes = ImmutableList.of(

+                    RequestType.REPLACE_INSTANCE.toString().toUpperCase(),

+                    RequestType.UPDATE_INSTANCE.toString().toUpperCase(),

+                    RequestType.APPLY_UPDATED_CONFIG.toString().toUpperCase(),

+                    RequestType.IN_PLACE_SOFTWARE_UPDATE.toString().toUpperCase()

+            );

+

+            for (RequestWrapper currentRequest : allOrchestrationRequests) {

+                if (currentRequest.getRequest() != null

+                        && "vnf".equalsIgnoreCase(currentRequest.getRequest().getRequestScope())

+                        && suppoertedRequestTypes.contains(upperCase(currentRequest.getRequest().getRequestType()))

+                ) {

+                    filteredOrchestrationRequests.add(currentRequest.getRequest());

+                }

+            }

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+        }

+        return filteredOrchestrationRequests;

+    }

+

+    private List<RequestWrapper> deserializeOrchestrationRequestsJson(String orchestrationRequestsJson) {

+        String methodName = "deserializeOrchestrationRequestsJson";

+        logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        ObjectMapper mapper = new ObjectMapper();

+        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

+        mapper.configure(DeserializationFeature.READ_ENUMS_USING_TO_STRING, true);

+        RequestList requestList = null;

+        try {

+            requestList = mapper.readValue(orchestrationRequestsJson, RequestList.class);

+        } catch (IOException e) {

+            throw new GenericUncheckedException(e);

+        }

+        return requestList.getRequestList();

+    }

+

+

+    @Override

+    public List<Task> getManualTasksByRequestId(String originalRequestId) {

+        String methodName = "getManualTasksByRequestId";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        try {

+            String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_MAN_TASKS);

+            String path = p + "?originalRequestId=" + originalRequestId;

+

+            RestObject<String> restObjStr = new RestObject<>();

+            String str = new String();

+            restObjStr.set(str);

+

+            MsoResponseWrapper msoResponseWrapper = msoClientInterface.getManualTasksByRequestId(str, "", path, restObjStr);

+            return deserializeManualTasksJson(msoResponseWrapper.getEntity());

+

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+    }

+

+    private List<Task> deserializeManualTasksJson(String manualTasksJson) {

+        String methodName = "deserializeManualTasksJson";

+        logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        ObjectMapper mapper = new ObjectMapper();

+        try {

+            TaskList taskList = mapper.readValue(manualTasksJson, TaskList.class);

+            return taskList.getTaskList();

+        } catch (IOException e) {

+            throw new GenericUncheckedException(e);

+        }

+    }

+

+

+    @Override

+    public MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String taskId) {

+        String methodName = "completeManualTask";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        try {

+            String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_MAN_TASKS);

+            String path = p + "/" + taskId + "/complete";

+

+            RestObject<String> restObjStr = new RestObject<>();

+            String str = new String();

+            restObjStr.set(str);

+

+            msoClientInterface.completeManualTask(requestDetails, str, "", path, restObjStr);

+

+            return MsoUtil.wrapResponse(restObjStr);

+

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+    }

+

+    @Override

+    public MsoResponseWrapper activateServiceInstance(RequestDetails requestDetails, String serviceInstanceId) {

+        String methodName = "activateServiceInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        try {

+            String serviceEndpoint = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);

+            String activateServicePath = serviceEndpoint + "/" + serviceInstanceId + ACTIVATE;

+

+            RestObject<String> restObjStr = new RestObject<>();

+            String str = "";

+            restObjStr.set(str);

+

+            msoClientInterface.setServiceInstanceStatus(requestDetails, str, "", activateServicePath, restObjStr);

+

+            return MsoUtil.wrapResponse(restObjStr);

+

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+    }

+

+    public RequestDetailsWrapper generateInPlaceMsoRequest(RequestDetails requestDetails) {

+        validateUpdateVnfSoftwarePayload(requestDetails);

+        RequestDetails inPlaceSoftwareUpdateRequest = new RequestDetails();

+        inPlaceSoftwareUpdateRequest.setCloudConfiguration(requestDetails.getCloudConfiguration());

+        inPlaceSoftwareUpdateRequest.setRequestParameters(requestDetails.getRequestParameters());

+        inPlaceSoftwareUpdateRequest.setRequestInfo(requestDetails.getRequestInfo());

+        RequestDetailsWrapper requestDetailsWrapper = new RequestDetailsWrapper();

+        requestDetailsWrapper.requestDetails = inPlaceSoftwareUpdateRequest;

+        return requestDetailsWrapper;

+    }

+

+    @Override

+    public RequestDetailsWrapper generateConfigMsoRequest(RequestDetails requestDetails) {

+        validateUpdateVnfConfig(requestDetails);

+        RequestDetails ConfigUpdateRequest = new RequestDetails();

+        ConfigUpdateRequest.setRequestParameters(requestDetails.getRequestParameters());

+        ConfigUpdateRequest.setRequestInfo(requestDetails.getRequestInfo());

+        RequestDetailsWrapper requestDetailsWrapper = new RequestDetailsWrapper();

+        requestDetailsWrapper.requestDetails = ConfigUpdateRequest;

+        return requestDetailsWrapper;

+    }

+

+

+   @Override

+    public MsoResponseWrapperInterface updateVnfSoftware(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) {

+        String methodName = "updateVnfSoftware";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        //String vnf_endpoint = getChangeManagementEndpoint(serviceInstanceId, vnfInstanceId, MsoChangeManagementRequest.SOFTWARE_UPDATE); //workflow name in mso is different than workflow name in vid UI

+        String vnf_endpoint = "";

+

+        RequestDetailsWrapper finalRequestDetails = generateInPlaceMsoRequest(requestDetails);

+        return msoClientInterface.changeManagementUpdate(finalRequestDetails, vnf_endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapperInterface updateVnfConfig(RequestDetails requestDetails, String serviceInstanceId, String vnfInstanceId) {

+        String methodName = "updateVnfConfig";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        RequestDetailsWrapper finalRequestDetails = generateConfigMsoRequest(requestDetails);

+        //String vnf_endpoint = getChangeManagementEndpoint(serviceInstanceId, vnfInstanceId, MsoChangeManagementRequest.CONFIG_UPDATE);

+        String vnf_endpoint = "";

+

+

+        return msoClientInterface.changeManagementUpdate(finalRequestDetails, vnf_endpoint);

+    }

+

+    private String getChangeManagementEndpoint(String serviceInstanceId, String vnfInstanceId, String vnfRequestType) {

+        String endpoint  = validateEndpointPath(MsoProperties.MSO_REST_API_VNF_CHANGE_MANAGEMENT_INSTANCE);

+        String vnf_endpoint = endpoint.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);

+        vnf_endpoint = vnf_endpoint.replace(VNF_INSTANCE_ID, vnfInstanceId);

+        vnf_endpoint = vnf_endpoint.replace(REQUEST_TYPE, vnfRequestType);

+        return vnf_endpoint;

+    }

+

+    private Map getChangeManagementPayload(RequestDetails requestDetails, String message){

+        if(requestDetails.getRequestParameters()==null||requestDetails.getRequestParameters().getAdditionalProperties()==null){

+            throw new BadRequestException(message);

+        }

+        Object payloadRaw=requestDetails.getRequestParameters().getAdditionalProperties().get("payload");

+        try{

+            return objectMapper.readValue((String)payloadRaw,Map.class);

+        }

+        catch(Exception exception){

+            throw new BadRequestException(message);

+        }

+    }

+

+    private void validateUpdateVnfSoftwarePayload(RequestDetails requestDetails) {

+        //final String noValidPayloadMsg = "No valid payload in " + ChangeManagementRequest.VNF_IN_PLACE_SOFTWARE_UPDATE + " request";

+        final String noValidPayloadMsg = "";

+

+        Map payload = getChangeManagementPayload(requestDetails, noValidPayloadMsg);

+        validateUpdateVnfSoftwarePayloadProperty(payload, noValidPayloadMsg, "existing_software_version", SOFTWARE_VERSION_PATTERN);

+        validateUpdateVnfSoftwarePayloadProperty(payload, noValidPayloadMsg, "new_software_version", SOFTWARE_VERSION_PATTERN);

+

+        //if "operations_timeout" is not integer, trying to read it as String that represent a number

+        if (!(payload.get("operations_timeout") instanceof Integer)) {

+            validateUpdateVnfSoftwarePayloadProperty(payload, noValidPayloadMsg, "operations_timeout", NUMBER_PATTERN);

+        }

+    }

+

+    private void validateUpdateVnfSoftwarePayloadProperty(Map payload, String noValidPayloadMsg, String propertyName, Pattern pattern) {

+        Object forValidation = payload.get(propertyName);

+        final String noValidPayloadPropertyMsg = noValidPayloadMsg + ", " + propertyName + " property is not valid";

+        if (!(forValidation instanceof String)) {

+            throw new BadRequestException(noValidPayloadPropertyMsg);

+        }

+        if (!pattern.matcher((String) forValidation).matches()) {

+            throw new BadRequestException(noValidPayloadPropertyMsg);

+        }

+    }

+

+    private void validateUpdateVnfConfig(RequestDetails requestDetails) {

+        //final String noValidPayloadMsg = "No valid payload in " + ChangeManagementRequest.CONFIG_UPDATE + " request";

+        final String noValidPayloadMsg = "";

+

+        Map payload = getChangeManagementPayload(requestDetails, noValidPayloadMsg);

+        validateConfigUpdateVnfPayloadProperty(payload, noValidPayloadMsg, "request-parameters");

+        validateConfigUpdateVnfPayloadProperty(payload, noValidPayloadMsg, "configuration-parameters");

+    }

+

+    private void validateConfigUpdateVnfPayloadProperty(Map payload, String noValidPayloadMsg, String propertyName) {

+        final String noValidPayloadPropertyMsg = noValidPayloadMsg+ ", "+ propertyName + " property is not valid";

+        if(!payload.containsKey(propertyName)) {

+            throw new BadRequestException( noValidPayloadPropertyMsg);

+        }

+    }

+

+    @Override

+    public MsoResponseWrapper deleteConfiguration(

+            org.onap.osam.mso.rest.RequestDetailsWrapper requestDetailsWrapper,

+            String serviceInstanceId,

+            String configurationId) {

+

+        String methodName = "deleteConfiguration";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_CONFIGURATION_INSTANCE);

+        endpoint = endpoint.replace(SVC_INSTANCE_ID, serviceInstanceId);

+        endpoint = endpoint.replace(CONFIGURATION_ID, configurationId);

+

+        return msoClientInterface.deleteConfiguration(requestDetailsWrapper, endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper setConfigurationActiveStatus(

+            RequestDetails requestDetails,

+            String serviceInstanceId,

+            String configurationId,

+            boolean isActivate) {

+

+        String methodName = "setConfigurationActiveStatus";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_CONFIGURATION_INSTANCE);

+        endpoint = endpoint.replace(SVC_INSTANCE_ID, serviceInstanceId);

+        endpoint = endpoint.replace(CONFIGURATION_ID, configurationId);

+

+        String isActivateState = (isActivate ? ACTIVATE : DEACTIVATE);

+        endpoint = endpoint + isActivateState;

+

+        return msoClientInterface.setConfigurationActiveStatus(requestDetails, endpoint);

+    }

+

+    @Override

+    public MsoResponseWrapper setServiceInstanceStatus(RequestDetails requestDetails , String serviceInstanceId, boolean isActivate) {

+        String methodName = "setServiceInstanceStatus";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        try {

+            String serviceEndpoint = validateEndpointPath(MsoProperties.MSO_REST_API_SVC_INSTANCE);

+            String endpoint = serviceEndpoint + "/" + serviceInstanceId;

+

+            String isActivateState = (isActivate ? ACTIVATE : DEACTIVATE);

+            endpoint = endpoint + isActivateState;

+

+

+            RestObject<String> restObjStr = new RestObject<>();

+            String str = "";

+            restObjStr.set(str);

+

+            msoClientInterface.setServiceInstanceStatus(requestDetails , str, "", endpoint, restObjStr);

+

+            return MsoUtil.wrapResponse(restObjStr);

+

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+    }

+

+    @Override

+    public MsoResponseWrapper setPortOnConfigurationStatus(

+            RequestDetails requestDetails,

+            String serviceInstanceId,

+            String configurationId,

+            boolean isEnable) {

+        String methodName = "setPortOnConfigurationStatus";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String endpoint = validateEndpointPath(MsoProperties.MSO_REST_API_CONFIGURATION_INSTANCE);

+        endpoint = endpoint.replace(SVC_INSTANCE_ID, serviceInstanceId);

+        endpoint = endpoint.replace(CONFIGURATION_ID, configurationId);

+

+        String isEnablePortStatus = (isEnable ? ENABLE_PORT : DISABLE_PORT);

+        endpoint = endpoint + isEnablePortStatus;

+

+        return msoClientInterface.setPortOnConfigurationStatus(requestDetails, endpoint);

+    }

+

+

+   /* @Override

+    public  RequestDetailsWrapper<RequestDetails> createOperationalEnvironmentActivationRequestDetails(OperationalEnvironmentActivateInfo details) {

+        RequestDetails requestDetails = new RequestDetails();

+        RequestInfo requestInfo = new RequestInfo();

+        requestInfo.setAdditionalProperty(RESOURCE_TYPE, RESOURCE_TYPE_OPERATIONAL_ENVIRONMENT);

+        requestInfo.setSource(SOURCE_OPERATIONAL_ENVIRONMENT);

+        requestInfo.setRequestorId(details.getUserId());

+        requestDetails.setRequestInfo(requestInfo);

+

+        org.onap.vid.domain.mso.RelatedInstance relatedInstance = new org.onap.vid.domain.mso.RelatedInstance();

+        relatedInstance.setAdditionalProperty(RESOURCE_TYPE, RESOURCE_TYPE_OPERATIONAL_ENVIRONMENT);

+        relatedInstance.setInstanceId(details.getRelatedInstanceId());

+        relatedInstance.setInstanceName(details.getRelatedInstanceName());

+        requestDetails.setAdditionalProperty("relatedInstanceList", Collections.singletonList(ImmutableMap.of("relatedInstance", relatedInstance)));

+

+        org.onap.vid.domain.mso.RequestParameters requestParameters = new org.onap.vid.domain.mso.RequestParameters();

+        requestParameters.setUserParams(null);

+        requestParameters.setAdditionalProperty("operationalEnvironmentType", "VNF");

+        requestParameters.setAdditionalProperty("workloadContext", details.getWorkloadContext());

+        requestParameters.setAdditionalProperty("manifest", details.getManifest());

+        requestDetails.setRequestParameters(requestParameters);

+

+        RequestDetailsWrapper<RequestDetails> requestDetailsWrapper = new RequestDetailsWrapper<>(requestDetails);

+

+        debugRequestDetails(requestDetailsWrapper, logger);

+

+        return requestDetailsWrapper;

+    }*/

+

+   /* @Override

+    public RequestDetailsWrapper<RequestDetails> createOperationalEnvironmentDeactivationRequestDetails(OperationalEnvironmentDeactivateInfo details) {

+        RequestDetails requestDetails = new RequestDetails();

+

+        RequestInfo requestInfo = new RequestInfo();

+        requestInfo.setAdditionalProperty(RESOURCE_TYPE, RESOURCE_TYPE_OPERATIONAL_ENVIRONMENT);

+        requestInfo.setSource(SOURCE_OPERATIONAL_ENVIRONMENT);

+        requestInfo.setRequestorId(details.getUserId());

+        requestDetails.setRequestInfo(requestInfo);

+

+        org.onap.vid.domain.mso.RequestParameters requestParameters = new org.onap.vid.domain.mso.RequestParameters();

+        requestParameters.setUserParams(null);

+        requestParameters.setAdditionalProperty("operationalEnvironmentType", "VNF");

+        requestDetails.setRequestParameters(requestParameters);

+        RequestDetailsWrapper<RequestDetails> requestDetailsWrapper = new RequestDetailsWrapper<>(requestDetails);

+        debugRequestDetails(requestDetailsWrapper, logger);

+        return requestDetailsWrapper;

+    }*/

+

+    @Override

+    public String getCloudResourcesRequestsStatusPath(String requestId) {

+        String path = validateEndpointPath(MSO_REST_API_CLOUD_RESOURCES_REQUEST_STATUS);

+        path = path.replace("<request_id>", requestId);

+        return path;

+    }

+

+    /*@Override

+    public RequestDetailsWrapper<OperationEnvironmentRequestDetails> convertParametersToRequestDetails(OperationalEnvironmentController.OperationalEnvironmentCreateBody input, String userId) {

+        OperationEnvironmentRequestDetails.RequestInfo requestInfo = new OperationEnvironmentRequestDetails.RequestInfo(

+                RESOURCE_TYPE_OPERATIONAL_ENVIRONMENT,

+                input.getInstanceName(),

+                SOURCE_OPERATIONAL_ENVIRONMENT,

+                userId);

+

+        OperationEnvironmentRequestDetails.RelatedInstance relatedInstance = new OperationEnvironmentRequestDetails.RelatedInstance(

+                RESOURCE_TYPE_OPERATIONAL_ENVIRONMENT,

+                input.getEcompInstanceId(),

+                input.getEcompInstanceName());

+

+        List<OperationEnvironmentRequestDetails.RelatedInstance> relatedInstanceList = Collections.singletonList((relatedInstance));

+

+        OperationEnvironmentRequestDetails.RequestParameters requestParameters = new OperationEnvironmentRequestDetails.RequestParameters(

+                input.getOperationalEnvironmentType(),

+                input.getTenantContext(),

+                input.getWorkloadContext());

+

+        OperationEnvironmentRequestDetails requestDetails = new OperationEnvironmentRequestDetails(requestInfo, relatedInstanceList, requestParameters);

+        RequestDetailsWrapper<OperationEnvironmentRequestDetails> requestDetailsWrapper = new RequestDetailsWrapper<>(requestDetails);

+        debugRequestDetails(requestDetailsWrapper, logger);

+        return requestDetailsWrapper;

+    }*/

+

+    @Override

+    public MsoResponseWrapper removeRelationshipFromServiceInstance(RequestDetails requestDetails, String serviceInstanceId) {

+        String methodName = "removeRelationshipFromServiceInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String serviceEndpoint = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);

+        String removeRelationshipsPath = serviceEndpoint + "/" + serviceInstanceId + "/removeRelationships";

+

+        return msoClientInterface.removeRelationshipFromServiceInstance(requestDetails, removeRelationshipsPath);

+    }

+

+    @Override

+    public MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String serviceInstanceId) {

+        String methodName = "addRelationshipToServiceInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        String serviceEndpoint = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);

+        String addRelationshipsPath = serviceEndpoint + "/" + serviceInstanceId + "/addRelationships";

+

+        return msoClientInterface.addRelationshipToServiceInstance(requestDetails, addRelationshipsPath);

+    }

+

+

+    public enum RequestType {

+

+        CREATE_INSTANCE("createInstance"),

+        DELETE_INSTANCE("deleteInstance"),

+        REPLACE_INSTANCE("replaceInstance"),

+        UPDATE_INSTANCE("updateInstance"),

+        ACTIVATE_INSTANCE("activateInstance"),

+        DEACTIVATE_INSTANCE("deactivateInstance"),

+        APPLY_UPDATED_CONFIG("applyUpdatedConfig"),

+        IN_PLACE_SOFTWARE_UPDATE("inPlaceSoftwareUpdate"),

+        UNKNOWN("unknown"),

+        NOT_PROVIDED("not provided");

+        private final String value;

+        private static final Map<String, RequestType> CONSTANTS = new HashMap<>();

+

+        static {

+            for (RequestType c: values()) {

+                CONSTANTS.put(c.value, c);

+            }

+        }

+

+        RequestType(String value) {

+            this.value = value;

+        }

+

+        @JsonValue

+        @Override

+        public String toString() {

+            return this.value;

+        }

+

+        @JsonCreator

+        public static RequestType fromValue(String value) {

+            RequestType constant = CONSTANTS.get(value);

+            if (constant == null) {

+                throw new IllegalArgumentException(value);

+            } else {

+                return constant;

+            }

+        }

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoInterface.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoInterface.java
new file mode 100644
index 0000000..3e78814
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoInterface.java
@@ -0,0 +1,130 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso;

+

+import io.joshworks.restclient.http.HttpResponse;

+import io.joshworks.restclient.http.mapper.ObjectMapper;

+import lombok.SneakyThrows;

+import org.onap.osam.aai.util.CustomJacksonJaxBJsonProvider;

+import org.onap.osam.mso.rest.RequestDetails;

+import org.onap.osam.mso.rest.RequestDetailsWrapper;

+

+public interface MsoInterface {

+

+    MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint);

+    

+    //For VoLTE E2E services

+    MsoResponseWrapper createE2eSvcInstance(Object requestDetails, String endpoint);

+    MsoResponseWrapper deleteE2eSvcInstance(Object requestDetails, String endpoint);

+

+    /**

+     * will create a virtual network function using MSO service.

+     * @param requestDetails - information about the vnf to create

+     * @return - the response body recived from MSO

+     * @throws Exception

+     */

+    MsoResponseWrapper createVnf(RequestDetails requestDetails, String endpoint);

+

+    MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String endpoint);

+    /**

+     *

+     * @param requestDetails

+     * @param path

+     * @return

+     * @throws Exception

+     */

+    MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String path);

+

+    /**

+     *

+     * @param requestDetails

+     * @return

+     * @throws Exception

+     */

+    MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String endpoint);

+

+    MsoResponseWrapper createConfigurationInstance(org.onap.osam.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String endpoint);

+

+    MsoResponseWrapper scaleOutVFModuleInstance(RequestDetailsWrapper requestDetailsWrapper, String endpoint);

+

+    MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String endpoint);

+

+    MsoResponseWrapper unassignSvcInstance(RequestDetails requestDetails, String endpoint);

+

+    MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String endpoint);

+

+    MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String endpoint);

+

+    MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String endpoint);

+

+    MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String endpoint);

+

+    MsoResponseWrapper getOrchestrationRequest(String endpoint);

+

+    MsoResponseWrapper getOrchestrationRequestsForDashboard(String t , String sourceId , String endpoint , RestObject restObject);

+

+    MsoResponseWrapper getManualTasksByRequestId(String t , String sourceId , String endpoint , RestObject restObject);

+

+    MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject);

+

+	//MsoResponseWrapper updateVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String vnf_endpoint);

+

+	//MsoResponseWrapper replaceVnf(org.onap.vid.changeManagement.RequestDetails requestDetails, String vnf_endpoint);

+

+    MsoResponseWrapper deleteConfiguration(org.onap.osam.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String pmc_endpoint);

+

+    MsoResponseWrapper setConfigurationActiveStatus(RequestDetails requestDetails, String endpoint);

+

+    MsoResponseWrapper setPortOnConfigurationStatus(RequestDetails requestDetails, String endpoint);

+

+    void setServiceInstanceStatus(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject<String> restObject);

+

+    MsoResponseWrapperInterface changeManagementUpdate(RequestDetailsWrapper requestDetails, String endpoint);

+

+    MsoResponseWrapper removeRelationshipFromServiceInstance(RequestDetails requestDetails, String endpoint);

+

+    MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String addRelationshipsPath);

+

+    <T> HttpResponse<T> get(String path, Class<T> responseClass);

+

+    <T> HttpResponse<T> post(String path, RequestDetailsWrapper requestDetailsWrapper,

+      Class<T> responseClass);

+

+    static ObjectMapper objectMapper() {

+      return new ObjectMapper() {

+        CustomJacksonJaxBJsonProvider mapper = new CustomJacksonJaxBJsonProvider();

+

+        @SneakyThrows

+        @Override

+        public <T> T readValue(String s, Class<T> aClass) {

+          return mapper.getMapper().readValue(s, aClass);

+        }

+

+        @SneakyThrows

+        @Override

+        public String writeValue(Object o) {

+          return mapper.getMapper().writeValueAsString(o);

+        }

+      };

+    }

+}

+

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoProperties.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoProperties.java
new file mode 100644
index 0000000..674ac08
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoProperties.java
@@ -0,0 +1,125 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso;

+

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+

+public class MsoProperties extends SystemProperties {

+

+	//VID Properties related to MSO

+	public static final String MSO_SERVER_URL = "mso.server.url";

+

+	/** The Constant MSO_DME2_SERVER_URL. */

+	public static final String MSO_DME2_SERVER_URL = "mso.dme2.server.url";

+

+	/** The Constant MSO_DME2_CLIENT_TIMEOUT. */

+	public static final String MSO_DME2_CLIENT_TIMEOUT = "mso.dme2.client.timeout";

+	

+	/** The Constant MSO_DME2_CLIENT_READ_TIMEOUT. */

+	public static final String MSO_DME2_CLIENT_READ_TIMEOUT = "mso.dme2.client.read.timeout";

+	

+	/** The Constant MSO_SERVER_URL_DEFAULT. */

+	public static final String MSO_SERVER_URL_DEFAULT= "";

+	

+	/** The Constant MSO_POLLING_INTERVAL_MSECS. */

+	// number of msecs to wait between polling requests

+	public static final String MSO_POLLING_INTERVAL_MSECS = "mso.polling.interval.msecs";

+

+	/** The Constant MSO_POLLING_INTERVAL_MSECS_DEFAULT. */

+	public static final String MSO_POLLING_INTERVAL_MSECS_DEFAULT = "60000";

+	

+	/** The Constant MSO_DME2_ENABLED. */

+	public static final String MSO_DME2_ENABLED = "mso.dme2.enabled";

+	

+	/** The Constant MSO_MAX_POLLS. */

+	public static final String MSO_MAX_POLLS = "mso.max.polls";

+	

+	/** The Constant MSO_MAX_POLLS_DEFAULT. */

+	public static final String MSO_MAX_POLLS_DEFAULT = "10"; //10

+	

+	/** The Constant MSO_USER_NAME. */

+	public static final String MSO_USER_NAME = "mso.user.name"; //m03346

+	

+	/** The Constant MSO_PASSWORD. */

+	public static final String MSO_PASSWORD = "mso.password.x";

+	

+	/** The Constant MSO_REST_API_SVC_INSTANCE. */

+    public static final String MSO_REST_API_E2E_SVC_INSTANCE = "mso.restapi.svc.e2einstance"; // /e2eServiceInstances/v3

+	

+	/** The Constant MSO_REST_API_SVC_INSTANCE. */

+	public static final String MSO_REST_API_SVC_INSTANCE = "mso.restapi.svc.instance"; // /serviceInstances/v2

+

+	/** The Constant MSO_DELETE_OR_UNASSIGN_REST_API_SVC_INSTANCE. */

+	public static final String MSO_DELETE_OR_UNASSIGN_REST_API_SVC_INSTANCE = "mso.restapi.svc.instance.deleteAndUnassign";

+

+	/** The Constant MSO_REST_API_VNF_INSTANCE. */

+	public static final String MSO_REST_API_VNF_INSTANCE = "mso.restapi.vnf.instance"; // /serviceInstances/v2/{service_instance_id}/vnfs

+	

+	/** The Constant MSO_REST_API_VNF_CHANGE_MANAGEMENT_INSTANCE. */

+	public static final String MSO_REST_API_VNF_CHANGE_MANAGEMENT_INSTANCE = "mso.restapi.vnf.changemanagement.instance"; // /serviceInstances/v2/{service_instance_id}/vnfs/{request_type}

+	

+	/** The Constant MSO_REST_API_NETWORK_INSTANCE. */

+	public static final String MSO_REST_API_NETWORK_INSTANCE = "mso.restapi.network.instance"; // /serviceInstances/v2/{serviceInstanceId}/networks

+	

+	/** The Constant MSO_REST_API_GET_ORC_REQ. */

+	public static final String MSO_REST_API_GET_ORC_REQ = "mso.restapi.get.orc.req";

+	

+	/** The Constant MSO_REST_API_GET_ORC_REQS. */

+	public static final String MSO_REST_API_GET_ORC_REQS = "mso.restapi.get.orc.reqs";

+

+	/** The Constant MSO_REST_API_GET_MAN_TASK. */

+	public static final String MSO_REST_API_GET_MAN_TASKS = "mso.restapi.get.man.tasks";

+

+	/** The Constant MSO_REST_API_VF_MODULE_INSTANCE. */

+	public static final String MSO_REST_API_VF_MODULE_INSTANCE = "mso.restapi.vf.module.instance";

+

+	public static final String MSO_REST_API_VF_MODULE_SCALE_OUT = "mso.restapi.vf.module.scaleout";

+

+	/** The Constant MSO_REST_API_VOLUME_GROUP_INSTANCE. */

+	public static final String MSO_REST_API_VOLUME_GROUP_INSTANCE = "mso.restapi.volume.group.instance"; //serviceInstances/v2/{serviceInstanceId}/volumeGroups

+

+	/** The Constant MSO_REST_API_CONFIGURATION_INSTANCE. */

+	public static final String MSO_REST_API_CONFIGURATIONS = "mso.restapi.configurations"; //serviceInstances/v5/{serviceInstanceId}/configurations

+	public static final String MSO_REST_API_CONFIGURATION_INSTANCE = "mso.restapi.configuration.instance"; //serviceInstances/v5/{serviceInstanceId}/configurations/{configurationId}

+

+	/** The Constant MSO_REST_API_OPERATIONAL_ENVIRONMENT */

+	public static final String MSO_REST_API_OPERATIONAL_ENVIRONMENT_ACTIVATE = "mso.restapi.operationalEnvironment.activate";

+	public static final String MSO_REST_API_OPERATIONAL_ENVIRONMENT_DEACTIVATE = "mso.restapi.operationalEnvironment.deactivate";

+

+	/** The Constant MSO_REST_API_OPERATIONAL_ENVIRONMENT_CREATE */

+	public static final String MSO_REST_API_OPERATIONAL_ENVIRONMENT_CREATE = "mso.restapi.operationalEnvironment.create";

+

+	/** The Constant MSO_REST_API_CLOUD_RESOURCES_REQUEST_STATUS */

+	public static final String MSO_REST_API_CLOUD_RESOURCES_REQUEST_STATUS = "mso.restapi.operationalEnvironment.cloudResourcesRequests.status";

+

+	/** The logger. */

+	public EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoProperties.class);

+	

+	/** The Constant dateFormat. */

+	final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoResponseWrapper.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoResponseWrapper.java
new file mode 100644
index 0000000..1723c44
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoResponseWrapper.java
@@ -0,0 +1,127 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso;

+

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+import org.apache.commons.lang.builder.ToStringBuilder;

+

+import javax.ws.rs.core.Response;

+

+@JsonInclude(JsonInclude.Include.NON_NULL)

+@JsonPropertyOrder({

+	    "status",

+	    "entity"

+})

+

+public class MsoResponseWrapper implements MsoResponseWrapperInterface {

+

+

+    public MsoResponseWrapper() {

+    }

+

+    public MsoResponseWrapper(Response response) {

+        setEntity(response.readEntity(String.class));

+        setStatus(response.getStatus());

+    }

+

+

+	@JsonProperty("status")

+	private int status;

+	

+	/** The entity. */

+	@JsonProperty("entity")

+	private String entity;

+

+	/**

+	 * Gets the entity.

+	 *

+	 * @return the entity

+	 */

+	@Override

+	@JsonProperty("entity")

+    public String getEntity() {

+        return entity;

+    }

+

+	/**

+	 * Gets the status.

+	 *

+	 * @return the status

+	 */

+	@Override

+	@JsonProperty("status")

+    public int getStatus() {

+        return status;

+    }

+	

+	/**

+	 * Sets the status.

+	 *

+	 * @param v the new status

+	 */

+	@JsonProperty("status")

+    public void setStatus(int v) {

+        this.status = v;

+    }

+	

+	/**

+	 * Sets the entity.

+	 *

+	 * @param v the new entity

+	 */

+	@JsonProperty("entity")

+    public void setEntity(String v) {

+        this.entity = v;

+    }

+    

+    /* (non-Javadoc)

+     * @see java.lang.Object#toString()

+     */

+    @Override

+    public String toString() {

+        return ToStringBuilder.reflectionToString(this);

+    }

+    

+    /**

+     * Gets the response.

+     *

+     * @return the response

+     */

+    @JsonIgnore

+    public String getResponse () {

+    	

+    	StringBuilder b = new StringBuilder ("{ \"status\": ");

+        b.append(getStatus()).append(", \"entity\": " );

+        if (this.getEntity() == null || this.getEntity().isEmpty()) {

+        	b.append("\"\"");

+		} else {

+			b.append(this.getEntity());

+		}

+        b.append("}");

+        return (b.toString());

+    }

+    

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoResponseWrapper2.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoResponseWrapper2.java
new file mode 100644
index 0000000..f23fd42
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoResponseWrapper2.java
@@ -0,0 +1,83 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso;

+

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+import com.fasterxml.jackson.core.JsonProcessingException;

+import com.fasterxml.jackson.databind.ObjectMapper;

+import io.joshworks.restclient.http.HttpResponse;

+

+@JsonPropertyOrder({

+	    "status",

+	    "entity"

+})

+

+public class MsoResponseWrapper2<T> implements MsoResponseWrapperInterface {

+

+    final static ObjectMapper objectMapper = new ObjectMapper();

+

+	private final int status;

+	private final T entity;

+    private final String raw;

+

+    public MsoResponseWrapper2(RestObject<T> msoResponse) {

+        this.status = msoResponse.getStatusCode();

+        this.entity = msoResponse.get();

+        this.raw = msoResponse.getRaw();

+    }

+

+  public MsoResponseWrapper2(HttpResponse<T> msoResponse) {

+    this.status = msoResponse.getStatus();

+    this.entity = msoResponse.getBody();

+    this.raw = msoResponse.getBody().toString();

+  }

+

+    public MsoResponseWrapper2(

+            @JsonProperty(value = "status", required = true) int status,

+            @JsonProperty(value = "entity", required = true) T entity) {

+        this.status = status;

+        this.entity = entity;

+        this.raw = null;

+    }

+

+    public int getStatus() {

+		return status;

+	}

+

+    @Override

+    @JsonIgnore

+    public String getResponse() {

+        try {

+            return objectMapper.writeValueAsString(this);

+        } catch (JsonProcessingException e) {

+            return getEntity() != null ? getEntity().toString() : null;

+        }

+    }

+

+    @JsonProperty

+	public Object getEntity() {

+		return entity != null ? entity : raw;

+	}

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoResponseWrapperInterface.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoResponseWrapperInterface.java
new file mode 100644
index 0000000..e0b542b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoResponseWrapperInterface.java
@@ -0,0 +1,37 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso;

+

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+public interface MsoResponseWrapperInterface {

+    @JsonProperty("entity")

+    Object getEntity();

+

+    @JsonProperty("status")

+    int getStatus();

+

+    @JsonIgnore

+    String getResponse();

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoUtil.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoUtil.java
new file mode 100644
index 0000000..d4ec72e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/MsoUtil.java
@@ -0,0 +1,135 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso;

+

+import com.fasterxml.jackson.core.JsonProcessingException;

+import com.fasterxml.jackson.databind.ObjectMapper;

+import io.joshworks.restclient.http.HttpResponse;

+import org.apache.commons.lang3.ObjectUtils;

+import org.glassfish.jersey.client.ClientResponse;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+

+import static org.onap.osam.utils.Logging.getMethodName;

+

+public class MsoUtil {

+	

+	private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoUtil.class);

+	

+	/** The Constant dateFormat. */

+	final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+	

+	/**

+	 * Wrap response.

+	 *

+	 * @param body the body

+	 * @param statusCode the status code

+	 * @return the mso response wrapper

+	 */

+	public static MsoResponseWrapper wrapResponse ( String body, int statusCode ) {

+		

+		MsoResponseWrapper w = new MsoResponseWrapper();

+		w.setStatus (statusCode);

+		w.setEntity(body);

+		

+		return w;

+	}

+

+	/**

+	 * Wrap response.

+	 *

+	 * @param cres the cres

+	 * @return the mso response wrapper

+	 */

+	public static MsoResponseWrapper wrapResponse (ClientResponse cres) {	

+		String resp_str = "";

+		if ( cres != null ) {

+			resp_str = cres.readEntity(String.class);

+		}

+		int statuscode = cres.getStatus();

+		MsoResponseWrapper w = MsoUtil.wrapResponse ( resp_str, statuscode );

+		return (w);

+	}

+	

+	/**

+	 * Wrap response.

+	 *

+	 * @param rs the rs

+	 * @return the mso response wrapper

+	 */

+	public static MsoResponseWrapper wrapResponse (RestObject<String> rs) {

+		String resp_str = null;

+		int status = 0;

+		if ( rs != null ) {

+			resp_str = rs.get() != null ? rs.get() : rs.getRaw();

+			status = rs.getStatusCode();

+		}

+		MsoResponseWrapper w = MsoUtil.wrapResponse ( resp_str, status );

+		return (w);

+	}

+

+	public static <T> MsoResponseWrapper wrapResponse (HttpResponse<T> rs) {

+		MsoResponseWrapper w = new MsoResponseWrapper();

+		w.setStatus (rs.getStatus());

+		if(rs.getRawBody() != null) {

+			w.setEntity(ObjectUtils.toString(rs.getBody()));

+		}

+		return w;

+	}

+

+	/**

+	 * Convert pojo to string.

+	 *

+	 * @param <T> the generic type

+	 * @param t the t

+	 * @return the string

+	 * @throws JsonProcessingException the json processing exception

+	 */

+	public static <T> String convertPojoToString ( T t ) {

+		

+		String methodName = "convertPojoToString";

+		ObjectMapper mapper = new ObjectMapper();

+		String r_json_str = "";

+	    if ( t != null ) {

+		    try {

+		    	r_json_str = mapper.writeValueAsString(t);

+		    }

+		    catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {

+		    	logger.debug(EELFLoggerDelegate.debugLogger,getMethodName() + " Unable to parse object of type " + t.getClass().getName() + " as json", j);

+		    }

+	    }

+	    return (r_json_str);

+	}

+	

+	/**

+	 * The main method.

+	 *

+	 * @param args the arguments

+	 */

+	public static void main(String[] args) {

+		// TODO Auto-generated method stub

+

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/RestMsoImplementation.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/RestMsoImplementation.java
new file mode 100644
index 0000000..be9ff9b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/RestMsoImplementation.java
@@ -0,0 +1,406 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso;

+

+import com.att.eelf.configuration.EELFLogger;

+import com.fasterxml.jackson.databind.ObjectMapper;

+import org.apache.commons.codec.binary.Base64;

+import org.eclipse.jetty.util.security.Password;

+import org.onap.osam.aai.util.HttpClientMode;

+import org.onap.osam.aai.util.HttpsAuthClient;

+import org.onap.osam.client.HttpBasicClient;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.osam.mso.rest.RequestDetailsWrapper;

+import org.onap.osam.mso.rest.RestInterface;

+import org.onap.osam.utils.Logging;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.http.HttpMethod;

+

+import javax.ws.rs.client.Client;

+import javax.ws.rs.client.Entity;

+import javax.ws.rs.client.Invocation;

+import javax.ws.rs.core.MediaType;

+import javax.ws.rs.core.MultivaluedHashMap;

+import javax.ws.rs.core.Response;

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.Collections;

+import java.util.Date;

+import java.util.UUID;

+

+import static org.onap.osam.utils.Logging.*;

+

+public class RestMsoImplementation implements RestInterface {

+

+    public static final String START_LOG = " start";

+    public static final String APPLICATION_JSON = "application/json";

+    public static final String WITH_STATUS = " with status=";

+    public static final String URL_LOG = ", url=";

+    public static final String NO_RESPONSE_ENTITY_LOG = " No response entity, this is probably ok, e=";

+    public static final String WITH_URL_LOG = " with url=";

+    public static final String EXCEPTION_LOG = ", Exception: ";

+    public static final String REST_API_SUCCESSFULL_LOG = " REST api was successfull!";

+    public static final String REST_API_POST_WAS_SUCCESSFUL_LOG = " REST api POST was successful!";

+    EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RestMsoImplementation.class);

+    private final EELFLogger outgoingRequestsLogger = Logging.getRequestsLogger("mso");

+

+    /**

+     * The Constant dateFormat.

+     */

+    static final DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+

+    /** The client. */

+    private Client client = null;

+

+    @Autowired

+    HttpsAuthClient httpsAuthClient;

+

+    /** The common headers. */

+    /**

+     * Instantiates a new mso rest interface.

+     */

+

+    @SuppressWarnings("Duplicates")

+    @Override

+    public MultivaluedHashMap<String, Object> initMsoClient()

+    {

+        final String methodname = "initRestClient()";

+

+        final String username = SystemProperties.getProperty(MsoProperties.MSO_USER_NAME);

+        final String password = SystemProperties.getProperty(MsoProperties.MSO_PASSWORD);

+        final String mso_url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL);

+        final String decrypted_password = Password.deobfuscate(password);

+

+        String authString = username + ":" + decrypted_password;

+

+        byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());

+        String authStringEnc = new String(authEncBytes);

+

+        MultivaluedHashMap<String, Object> commonHeaders = new MultivaluedHashMap();

+        commonHeaders.put("Authorization",  Collections.singletonList(("Basic " + authStringEnc)));

+		//Pass calling application identifier to SO

+  		commonHeaders.put("X-FromAppId", Collections.singletonList(SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME)));

+        try {

+            commonHeaders.put(REQUEST_ID_HEADER_KEY, Collections.singletonList(Logging.extractOrGenerateRequestId()));

+        }

+        catch (IllegalStateException e){

+            //in async jobs we don't have any HttpServletRequest

+            commonHeaders.put(REQUEST_ID_HEADER_KEY, Collections.singletonList(UUID.randomUUID().toString()));

+        }

+

+

+        boolean useSsl = true;

+        if ( (mso_url != null) && ( !(mso_url.isEmpty()) ) ) {

+            useSsl = mso_url.startsWith("https");

+        }

+        if (client == null) {

+

+            try {

+                if ( useSsl ) {

+                    client = httpsAuthClient.getClient(HttpClientMode.WITHOUT_KEYSTORE);

+                }

+                else {

+                    client = HttpBasicClient.getClient();

+                }

+            } catch (Exception e) {

+                logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) +  methodname + " Unable to get the SSL client");

+            }

+        }

+

+        return commonHeaders;

+    }

+

+    public <T> void  Get (T t, String sourceId, String path, RestObject<T> restObject ) {

+        String methodName = "Get";

+

+        logger.debug(EELFLoggerDelegate.debugLogger, methodName + START_LOG);

+

+        String url="";

+        restObject.set(t);

+

+        url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;

+

+        MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();

+        Logging.logRequest(outgoingRequestsLogger, HttpMethod.GET, url);

+        final Response cres = client.target(url)

+                .request()

+                .accept(APPLICATION_JSON)

+                .headers(commonHeaders)

+                .get();

+        Logging.logResponse(outgoingRequestsLogger, HttpMethod.GET, url, cres);

+        int status = cres.getStatus();

+        restObject.setStatusCode (status);

+

+        if (status == 200 || status == 202) {

+            t = (T) cres.readEntity(t.getClass());

+            restObject.set(t);

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + REST_API_SUCCESSFULL_LOG);

+

+        } else {

+            throw new GenericUncheckedException(methodName + WITH_STATUS + status + ", url= " + url );

+        }

+

+        logger.debug(EELFLoggerDelegate.debugLogger,methodName + " received status=" + status );

+

+        return;

+    }

+

+    public <T> RestObject<T> GetForObject(String sourceID, String path, Class<T> clazz) {

+        final String methodName = getMethodName();

+        logger.debug(EELFLoggerDelegate.debugLogger, "start {}->{}({}, {}, {})", getMethodCallerName(), methodName, sourceID, path, clazz);

+

+        String url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " +  methodName + " sending request to url= " + url);

+

+        MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();

+        Logging.logRequest(outgoingRequestsLogger, HttpMethod.GET, url);

+        final Response cres = client.target(url)

+                .request()

+                .accept(APPLICATION_JSON)

+                .headers(commonHeaders)

+                .get();

+        Logging.logResponse(outgoingRequestsLogger, HttpMethod.GET, url, cres);

+        final RestObject<T> restObject = cresToRestObject(cres, clazz);

+        int status = cres.getStatus();

+

+        if (status == 200 || status == 202) {

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + REST_API_SUCCESSFULL_LOG);

+        } else {

+            logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_STATUS +status+ URL_LOG +url);

+        }

+

+        logger.debug(EELFLoggerDelegate.debugLogger,methodName + " received status=" + status );

+

+        return restObject;

+    }

+

+    @Override

+    public <T> void Delete(T t, Object r, String sourceID, String path, RestObject<T> restObject) {

+

+        String methodName = "Delete";

+        String url="";

+        Response cres = null;

+

+        logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " +  methodName + START_LOG);

+

+        try {

+            MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();

+

+            url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;

+            Logging.logRequest(outgoingRequestsLogger, HttpMethod.DELETE, url, r);

+            cres = client.target(url)

+                    .request()

+

+                    .accept(APPLICATION_JSON)

+                    .headers(commonHeaders)

+                    //.entity(r)

+                    .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)).invoke();

+            Logging.logResponse(outgoingRequestsLogger, HttpMethod.DELETE, url, cres);

+            int status = cres.getStatus();

+            restObject.setStatusCode (status);

+

+            if (status == 404) { // resource not found

+                String msg = "Resource does not exist...: " + cres.getStatus();

+                logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);

+            } else if (status == 200  || status == 204){

+                logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted");

+            } else if (status == 202) {

+                String msg = "Delete in progress: " + status;

+                logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);

+            }

+            else {

+                String msg = "Deleting Resource failed: " + status;

+                logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);

+            }

+

+            try {

+                t = (T) cres.readEntity(t.getClass());

+                restObject.set(t);

+            }

+            catch ( Exception e ) {

+                logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + NO_RESPONSE_ENTITY_LOG

+                        + e.getMessage());

+            }

+

+        }

+        catch (Exception e)

+        {

+            logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());

+            throw e;

+

+        }

+    }

+

+    public <T> RestObject<T> PostForObject(Object requestDetails, String sourceID, String path, Class<T> clazz) {

+        logger.debug(EELFLoggerDelegate.debugLogger, "start {}->{}({}, {}, {}, {})", getMethodCallerName(), getMethodName(), requestDetails, sourceID, path, clazz);

+        RestObject<T> restObject = new RestObject<>();

+        Post(clazz, requestDetails, path, restObject);

+        return restObject;

+    }

+

+    @Override

+    public <T> void Post(T t, Object r, String sourceID, String path, RestObject<T> restObject) {

+        logger.debug(EELFLoggerDelegate.debugLogger, "start {}->{}({}, {}, {}, {})", getMethodCallerName(), getMethodName(), t.getClass(), r, sourceID, path);

+        Post(t.getClass(), r, path, restObject);

+    }

+

+    public Invocation.Builder prepareClient(String path, String methodName) {

+        MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();

+

+        String url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;

+        logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " +  methodName + " sending request to url= " + url);

+        // Change the content length

+        return client.target(url)

+                .request()

+                .accept(APPLICATION_JSON)

+                .headers(commonHeaders);

+    }

+

+

+

+    public <T> void Post(Class<?> tClass, Object requestDetails, String path, RestObject<T> restObject)  {

+        String methodName = "Post";

+        String url="";

+

+        try {

+

+            MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();

+

+            url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;

+            Logging.logRequest(outgoingRequestsLogger, HttpMethod.POST, url, requestDetails);

+            // Change the content length

+            final Response cres = client.target(url)

+                    .request()

+                    .accept(APPLICATION_JSON)

+                    .headers(commonHeaders)

+                    .post(Entity.entity(requestDetails, MediaType.APPLICATION_JSON));

+            Logging.logResponse(outgoingRequestsLogger, HttpMethod.POST, url, cres);

+            final RestObject<T> cresToRestObject = cresToRestObject(cres, tClass);

+            restObject.set(cresToRestObject.get());

+            restObject.setStatusCode(cresToRestObject.getStatusCode());

+            restObject.setRaw(cresToRestObject.getRaw());

+

+            int status = cres.getStatus();

+            restObject.setStatusCode (status);

+

+            if ( status >= 200 && status <= 299 ) {

+                logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + REST_API_POST_WAS_SUCCESSFUL_LOG);

+                logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + REST_API_POST_WAS_SUCCESSFUL_LOG);

+

+            } else {

+                logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_STATUS +status+ URL_LOG +url);

+            }

+

+        } catch (Exception e)

+        {

+            logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());

+            throw e;

+

+        }

+

+        logger.debug(EELFLoggerDelegate.debugLogger, "end {}() => ({}){}", getMethodName(), tClass, restObject);

+    }

+

+    private <T> RestObject<T> cresToRestObject(Response cres, Class<?> tClass) {

+        RestObject<T> restObject = new RestObject<>();

+

+        String rawEntity = null;

+        try {

+            cres.bufferEntity();

+            rawEntity = cres.readEntity(String.class);

+            restObject.setRaw(rawEntity);

+            T t = (T) new ObjectMapper().readValue(rawEntity, tClass);

+            restObject.set(t);

+        }

+        catch ( Exception e ) {

+            try {

+                logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + getMethodCallerName() + " Error reading response entity as " + tClass + ": , e="

+                        + e.getMessage() + ", Entity=" + rawEntity);

+            } catch (Exception e2) {

+                logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + getMethodCallerName() + NO_RESPONSE_ENTITY_LOG

+                        + e.getMessage());

+            }

+        }

+

+        int status = cres.getStatus();

+        restObject.setStatusCode (status);

+

+        return restObject;

+

+    }

+

+    @Override

+    public <T> void Put(T t, RequestDetailsWrapper r, String sourceID, String path, RestObject<T> restObject) {

+

+        String methodName = "Put";

+        String url="";

+

+        logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " +  methodName + START_LOG);

+

+        try {

+

+            MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();

+

+            url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;

+            Logging.logRequest(outgoingRequestsLogger, HttpMethod.PUT, url, r);

+            // Change the content length

+            final Response cres = client.target(url)

+                    .request()

+                    .accept(APPLICATION_JSON)

+                    .headers(commonHeaders)

+                    //.header("content-length", 201)

+                    //.header("X-FromAppId",  sourceID)

+                    .put(Entity.entity(r, MediaType.APPLICATION_JSON));

+

+            Logging.logResponse(outgoingRequestsLogger, HttpMethod.PUT, url, cres);

+

+            try {

+                t = (T) cres.readEntity(t.getClass());

+                restObject.set(t);

+            }

+            catch ( Exception e ) {

+                logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + NO_RESPONSE_ENTITY_LOG

+                        + e.getMessage());

+            }

+

+            int status = cres.getStatus();

+            restObject.setStatusCode (status);

+

+            if ( status >= 200 && status <= 299 ) {

+                logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + REST_API_POST_WAS_SUCCESSFUL_LOG);

+                logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + REST_API_POST_WAS_SUCCESSFUL_LOG);

+

+            } else {

+                logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_STATUS +status+ URL_LOG +url);

+            }

+

+        } catch (Exception e)

+        {

+            logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());

+            throw e;

+

+        }

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/RestObject.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/RestObject.java
new file mode 100644
index 0000000..aa38226
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/RestObject.java
@@ -0,0 +1,124 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso;

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+import com.google.common.base.MoreObjects;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+

+import javax.ws.rs.core.Response;

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.Date;

+

+import static org.onap.osam.utils.Logging.getMethodCallerName;

+

+public class RestObject<T> {

+

+    final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+

+    final static ObjectMapper objectMapper = new ObjectMapper();

+

+    // T stands for "Type"

+    private T t;

+    

+    // The string source of t, if available

+    private String rawT;

+

+    /** The status code. */

+    private int statusCode= 0;

+

+    public RestObject() {

+    }

+

+    public RestObject(Response cres, Class<?> tClass, EELFLoggerDelegate logger) {

+

+        String rawEntity = null;

+        try {

+            cres.bufferEntity();

+            rawEntity = cres.readEntity(String.class);

+            T t = (T) objectMapper.readValue(rawEntity, tClass);

+            this.set(t);

+        }

+        catch ( Exception e ) {

+            try {

+                this.setRaw(rawEntity);

+                logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + getMethodCallerName() + " Error reading response entity as " + tClass + ": , e="

+                        + e.getMessage() + ", Entity=" + rawEntity);

+            } catch (Exception e2) {

+                logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + getMethodCallerName() + " No response entity, this is probably ok, e="

+                        + e.getMessage());

+            }

+        }

+

+        int status = cres.getStatus();

+        this.setStatusCode (status);

+    }

+

+

+    /**

+     * Sets the.

+     *

+     * @param t the t

+     */

+    public void set(T t) { this.t = t; }

+    

+    /**

+     * Gets the.

+     *

+     * @return the t

+     */

+    public T get() { return t; }

+	

+    /**

+     * Sets the status code.

+     *

+     * @param v the new status code

+     */

+    public void setStatusCode(int v) { this.statusCode = v; }

+    

+    /**

+     * Gets the status code.

+     *

+     * @return the status code

+     */

+    public int getStatusCode() { return this.statusCode; }

+

+    public String getRaw() {

+        return rawT;

+    }

+

+    public void setRaw(String rawT) {

+        this.rawT = rawT;

+    }

+

+    @Override

+    public String toString() {

+        return MoreObjects.toStringHelper(this)

+                .add("t", t)

+                .add("rawT", rawT)

+                .add("statusCode", statusCode)

+                .toString();

+    }

+}

+

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/model/ServiceInstantiationRequestDetails.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/model/ServiceInstantiationRequestDetails.java
new file mode 100644
index 0000000..cd67cbd
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/model/ServiceInstantiationRequestDetails.java
@@ -0,0 +1,187 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.model;

+

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonTypeInfo;

+import com.fasterxml.jackson.annotation.JsonTypeName;

+import org.onap.osam.domain.mso.CloudConfiguration;

+import org.onap.osam.domain.mso.ModelInfo;

+import org.onap.osam.domain.mso.SubscriberInfo;

+import org.onap.osam.model.serviceInstantiation.VfModule;

+

+import java.util.List;

+import java.util.Map;

+

+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY;

+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;

+

+public class ServiceInstantiationRequestDetails {

+

+    @JsonProperty("modelInfo")

+    private ModelInfo modelInfo;

+

+    @JsonProperty("owningEntity")

+    private ServiceInstantiationOwningEntity owningEntity;

+

+    @JsonProperty("subscriberInfo")

+    private SubscriberInfo subscriberInfo;

+

+    @JsonProperty("project")

+    private Project project;

+

+    @JsonProperty("requestParameters")

+    private RequestParameters requestParameters;

+

+    @JsonProperty("requestInfo")

+    private RequestInfo requestInfo;

+

+    public ServiceInstantiationRequestDetails(@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,

+                                              @JsonProperty(value = "owningEntity", required = true) ServiceInstantiationOwningEntity owningEntity,

+                                              @JsonProperty(value = "subscriberInfo", required = true) SubscriberInfo subscriberInfo,

+                                              @JsonProperty(value = "project", required = true) Project project,

+                                              @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,

+                                              @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters) {

+        this.modelInfo = modelInfo;

+        this.owningEntity = owningEntity;

+        this.subscriberInfo = subscriberInfo;

+        this.project = project;

+        this.requestInfo = requestInfo;

+        this.requestParameters = requestParameters;

+    }

+

+    public static class  ServiceInstantiationOwningEntity{

+        public final String owningEntityId;

+        public final String owningEntityName;

+

+        public ServiceInstantiationOwningEntity(String owningEntityId, String owningEntityName) {

+            this.owningEntityId = owningEntityId;

+            this.owningEntityName = owningEntityName;

+        }

+    }

+

+    public static class RequestInfo {

+

+        @JsonInclude(NON_NULL) public final String instanceName;

+        public final String productFamilyId;

+        public final String source;

+        public final boolean suppressRollback;

+        public final String requestorId;

+

+        public RequestInfo(String instanceName, String productFamilyId, String source, boolean rollbackOnFailure, String requestorId) {

+            this.instanceName = instanceName;

+            this.productFamilyId = productFamilyId;

+            this.source = source;

+            this.requestorId = requestorId;

+            // in the FE we are asking for "RollbackOnFailure" but to MSO we are passing the negative value "suppressRollback"

+            this.suppressRollback = !rollbackOnFailure;

+        }

+    }

+

+    public static class Project{

+        public final String projectName;

+

+        public Project(String projectName) {

+            this.projectName = projectName;

+        }

+    }

+

+    public static class RequestParameters {

+

+        public final String subscriptionServiceType;

+        public final boolean aLaCarte;

+        public final List<ServiceInstantiationService> userParams;

+

+        public RequestParameters(String subscriptionServiceType, boolean aLaCarte, List<ServiceInstantiationService> userParams) {

+            this.subscriptionServiceType = subscriptionServiceType;

+            this.aLaCarte = aLaCarte;

+            this.userParams = userParams;

+        }

+    }

+

+    @JsonTypeName("service")

+    @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)

+    public static class ServiceInstantiationService{

+        public ModelInfo modelInfo = new ModelInfo();

+        @JsonInclude(NON_NULL) public String instanceName;

+        public List<Map<String,String>> instanceParams;

+        public ServiceInstantiationVnfList resources;

+

+        public ServiceInstantiationService (ModelInfo modelInfo, String instanceName, List<Map<String,String>> instanceParams, ServiceInstantiationVnfList vnfs){

+            this.modelInfo.setModelType(modelInfo.getModelType());

+            this.modelInfo.setModelName(modelInfo.getModelName());

+            this.modelInfo.setModelVersionId(modelInfo.getModelVersionId());

+            this.instanceName = instanceName;

+            this.instanceParams = instanceParams;

+            this.resources = vnfs;

+        }

+    }

+

+    public static class ServiceInstantiationVnfList{

+        public final List<ServiceInstantiationVnf> vnfs;

+

+        public ServiceInstantiationVnfList(List<ServiceInstantiationVnf> vnfList) {

+            this.vnfs = vnfList;

+        }

+    }

+

+    public static class ServiceInstantiationVnf{

+        public final ModelInfo modelInfo;

+        public final CloudConfiguration cloudConfiguration;

+        public final Platform platform;

+        public final LineOfBusiness lineOfBusiness;

+        public final String productFamilyId;

+        public final List<Map<String, String>>  instanceParams;

+        @JsonInclude(NON_EMPTY) public final List<VfModule> vfModules;

+        @JsonInclude(NON_NULL) public final String instanceName;

+

+        public ServiceInstantiationVnf(ModelInfo modelInfo, CloudConfiguration cloudConfiguration, String platform, String lineOfBusiness, String productFamilyId, List<Map<String, String>>  instanceParams, List<VfModule> vfModules, String instanceName) {

+            this.modelInfo = modelInfo;

+            this.cloudConfiguration = cloudConfiguration;

+            this.platform = new Platform(platform);

+            this.lineOfBusiness = new LineOfBusiness(lineOfBusiness);

+            this.productFamilyId = productFamilyId;

+            this.instanceParams = instanceParams;

+            this.vfModules = vfModules;

+            this.instanceName = instanceName;

+        }

+    }

+

+    public static class Platform{

+        public final String platformName;

+

+        public Platform(String platformName) {

+            this.platformName = platformName;

+        }

+    }

+

+    public static class LineOfBusiness{

+        public final String lineOfBusinessName;

+

+        public LineOfBusiness(String lineOfBusiness) {

+            this.lineOfBusinessName = lineOfBusiness;

+        }

+    }

+}

+

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/AsyncRequestStatus.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/AsyncRequestStatus.java
new file mode 100644
index 0000000..722e7dc
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/AsyncRequestStatus.java
@@ -0,0 +1,71 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+

+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

+import com.fasterxml.jackson.annotation.JsonInclude;

+import org.onap.osam.domain.mso.RequestStatus;

+

+@JsonInclude(JsonInclude.Include.NON_NULL)

+@JsonIgnoreProperties(ignoreUnknown = true)

+public class AsyncRequestStatus  {

+

+    public Request request;

+

+    public AsyncRequestStatus(Request request) {

+        this.request = request;

+    }

+

+    public AsyncRequestStatus() {

+

+    }

+

+    @JsonIgnoreProperties(ignoreUnknown = true)

+    public static class Request {

+

+        public Request(RequestStatus requestStatus) {

+            this.requestStatus = requestStatus;

+        }

+

+        public Request() {

+        }

+

+        public String requestId;

+

+        public InstanceReferences instanceReferences;

+

+        /**

+         * The request status.

+         */

+        public RequestStatus requestStatus;

+    }

+

+    @JsonIgnoreProperties(ignoreUnknown = true)

+    public static class InstanceReferences {

+

+        public String serviceInstanceId;

+    }

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/MsoRestClientNew.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/MsoRestClientNew.java
new file mode 100644
index 0000000..3964f3e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/MsoRestClientNew.java
@@ -0,0 +1,515 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+import com.google.common.collect.ImmutableMap;

+import io.joshworks.restclient.http.HttpResponse;

+import java.util.HashMap;

+import java.util.Map;

+import javax.ws.rs.core.HttpHeaders;

+import javax.ws.rs.core.MediaType;

+import org.apache.commons.codec.binary.Base64;

+import org.eclipse.jetty.util.security.Password;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.onap.osam.client.SyncRestClient;

+import org.onap.osam.model.RequestReferencesContainer;

+import org.onap.osam.mso.*;

+

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.Date;

+import org.onap.osam.utils.Logging;

+

+

+public class MsoRestClientNew implements MsoInterface {

+

+    public static final String X_FROM_APP_ID = "X-FromAppId";

+    final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+    private static final String START = " start";

+    private final SyncRestClient client;

+    private final String baseUrl;

+    private final Map<String, String> commonHeaders;

+    /**

+     * The logger.

+     */

+    EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestClientNew.class);

+

+    public MsoRestClientNew(SyncRestClient client, String baseUrl) {

+        this.client = client;

+        this.baseUrl = baseUrl;

+        this.commonHeaders = initCommonHeaders();

+    }

+

+    @Override

+    public MsoResponseWrapper createSvcInstance(RequestDetails requestDetails, String endpoint) {

+        String methodName = "createSvcInstance ";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        return createInstance(requestDetails, path);

+    }

+    

+    @Override

+    public MsoResponseWrapper createE2eSvcInstance(Object requestDetails, String endpoint) {

+        String methodName = "createE2eSvcInstance ";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        return createInstance(requestDetails, path);

+    }

+

+    @Override

+    public MsoResponseWrapper createVnf(RequestDetails requestDetails, String endpoint) {

+

+        String methodName = "createVnf";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        return createInstance(requestDetails, path);

+    }

+

+    @Override

+    public MsoResponseWrapper createNwInstance(RequestDetails requestDetails, String endpoint) {

+

+        String methodName = "createNwInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        return createInstance(requestDetails, path);

+    }

+

+    @Override

+    public MsoResponseWrapper createVolumeGroupInstance(RequestDetails requestDetails, String endpoint) {

+        String methodName = "createVolumeGroupInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        return createInstance(requestDetails, path);

+    }

+

+    @Override

+    public MsoResponseWrapper createVfModuleInstance(RequestDetails requestDetails, String endpoint) {

+        String methodName = "createVfModuleInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        return createInstance(requestDetails, path);

+    }

+

+    @Override

+    public MsoResponseWrapper scaleOutVFModuleInstance(RequestDetailsWrapper requestDetailsWrapper, String endpoint) {

+        String methodName = "scaleOutVFModuleInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+        return createInstance(requestDetailsWrapper, path);

+    }

+

+    @Override

+    public MsoResponseWrapper createConfigurationInstance(org.onap.osam.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String endpoint) {

+        String methodName = "createConfigurationInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        return createInstance(requestDetailsWrapper, path);

+    }

+

+    @Override

+    public MsoResponseWrapper deleteE2eSvcInstance(Object requestDetails, String endpoint) {

+        String methodName = "deleteE2eSvcInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+        return deleteInstance(requestDetails, path);

+    }

+

+    @Override

+    public MsoResponseWrapper deleteSvcInstance(RequestDetails requestDetails, String endpoint) {

+        String methodName = "deleteSvcInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+        return deleteInstance(requestDetails, path);

+    }

+

+    @Override

+    public MsoResponseWrapper unassignSvcInstance(RequestDetails requestDetails, String endpoint) {

+        String methodName = "unassignSvcInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        HttpResponse<String> response = client.post(endpoint, commonHeaders, requestDetails, String.class);

+        return MsoUtil.wrapResponse(response);

+    }

+

+    @Override

+    public MsoResponseWrapper deleteVnf(RequestDetails requestDetails, String endpoint) {

+        String methodName = "deleteVnf";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        return deleteInstance(requestDetails, path);

+    }

+

+    @Override

+    public MsoResponseWrapper deleteVfModule(RequestDetails requestDetails, String endpoint) {

+        String methodName = "deleteVfModule";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        return deleteInstance(requestDetails, path);

+    }

+

+    @Override

+    public MsoResponseWrapper deleteVolumeGroupInstance(RequestDetails requestDetails, String endpoint) {

+        String methodName = "deleteVolumeGroupInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        return deleteInstance(requestDetails, path);

+    }

+

+    @Override

+    public MsoResponseWrapper deleteNwInstance(RequestDetails requestDetails, String endpoint) {

+        String methodName = "deleteNwInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        return deleteInstance(requestDetails, path);

+    }

+

+    @Override

+    public MsoResponseWrapper getOrchestrationRequest(String endpoint) {

+        String path = baseUrl + endpoint;

+

+        HttpResponse<String> response = client.get(path, commonHeaders, new HashMap<>(), String.class);

+        return MsoUtil.wrapResponse(response);

+    }

+

+    public MsoResponseWrapper getManualTasks(String endpoint) {

+        String path = baseUrl + endpoint;

+

+        HttpResponse<String> response = client.get(path, commonHeaders, new HashMap<>(), String.class);

+        return MsoUtil.wrapResponse(response);

+    }

+

+    public MsoResponseWrapper getOrchestrationRequestsForDashboard(String t, String sourceId, String path, RestObject restObject) {

+        String methodName = "getOrchestrationRequestsForDashboard";

+        logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        try {

+            MsoResponseWrapper w = getOrchestrationRequest(path);

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());

+

+            return w;

+

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+    }

+

+    public MsoResponseWrapper getManualTasksByRequestId(String t, String sourceId, String endpoint, RestObject restObject) {

+        String methodName = "getManualTasksByRequestId";

+        logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        try {

+            String path = baseUrl + endpoint;

+

+            MsoResponseWrapper w =getManualTasks(path);

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());

+

+            return w;

+

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+    }

+

+    @Override

+    public MsoResponseWrapper completeManualTask(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject restObject) {

+        String methodName = "completeManualTask";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Complete ");

+        try {

+            String path = baseUrl + endpoint;

+

+            HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);

+            MsoResponseWrapper w = MsoUtil.wrapResponse(response);

+

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());

+            return w;

+

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+    }

+

+   /* @Override

+    public MsoResponseWrapper replaceVnf(RequestDetails requestDetails, String endpoint) {

+        String methodName = "replaceVnf";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+        return replaceInstance(requestDetails, path);

+    }*/

+

+    @Override

+    public MsoResponseWrapper deleteConfiguration(org.onap.osam.mso.rest.RequestDetailsWrapper requestDetailsWrapper, String pmc_endpoint) {

+        String methodName = "deleteConfiguration";

+        logger.debug(EELFLoggerDelegate.debugLogger,

+                dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + pmc_endpoint;

+

+        return deleteInstance(requestDetailsWrapper, path);

+    }

+

+    @Override

+    public MsoResponseWrapper setConfigurationActiveStatus(RequestDetails request, String endpoint) {

+        String methodName = "setConfigurationActiveStatus";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        try {

+            String path = baseUrl + endpoint;

+

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== "

+                  + methodName + " calling change configuration active status, path =[" + path + "]");

+            HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);

+            return MsoUtil.wrapResponse(response);

+        } 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());

+            throw e;

+        }

+    }

+

+    @Override

+    public MsoResponseWrapper setPortOnConfigurationStatus(RequestDetails request, String endpoint) {

+        String methodName = "setPortOnConfigurationStatus";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        try {

+            String path = baseUrl + endpoint;

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== "

+                + methodName + " calling change port configuration status, path =[" + path + "]");

+            HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);

+            return MsoUtil.wrapResponse(response);

+        } 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());

+            throw e;

+        }

+    }

+

+    @Override

+    public MsoResponseWrapperInterface changeManagementUpdate(RequestDetailsWrapper requestDetails, String endpoint) {

+        String path = baseUrl + endpoint;

+        HttpResponse<RequestReferencesContainer> response = client.post(path, commonHeaders, requestDetails, RequestReferencesContainer.class);

+        return MsoUtil.wrapResponse(response);

+    }

+

+    public MsoResponseWrapper replaceInstance(RequestDetails request, String path) {

+        String methodName = "replaceInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        try {

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Replace VNF, path =[" + path + "]");

+

+            HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);

+            MsoResponseWrapper msoResponseWrapperObject = MsoUtil.wrapResponse(response);

+            int status = msoResponseWrapperObject.getStatus();

+            if (status == 202) {

+                logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +

+                        ",post succeeded, msoResponseWrapperObject response:" + msoResponseWrapperObject.getResponse());

+            } else {

+                logger.error(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +

+                        ": post failed, msoResponseWrapperObject status" + status + ", response:" + msoResponseWrapperObject.getResponse());

+

+                // TODO

+            }

+            return msoResponseWrapperObject;

+

+        } 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());

+            throw e;

+        }

+

+    }

+

+    /*@Override

+    public MsoResponseWrapper updateVnf(RequestDetails requestDetails, String endpoint) {

+        String methodName = "updateVnf";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+        String path = baseUrl + endpoint;

+

+        RequestDetailsWrapper wrapper = new RequestDetailsWrapper();

+        wrapper.requestDetails = new MsoRequestDetails(requestDetails);

+        return updateInstance(requestDetails, path);

+    }*/

+

+    public MsoResponseWrapper updateInstance(RequestDetails request, String path) {

+        String methodName = "updateInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        try {

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]");

+

+            HttpResponse<String> response = client.post(path, commonHeaders, request, String.class);

+            MsoResponseWrapper w = MsoUtil.wrapResponse(response);

+

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());

+            return w;

+

+        } 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());

+            throw e;

+        }

+

+    }

+

+    public void setServiceInstanceStatus(RequestDetails requestDetails, String t, String sourceId, String endpoint, RestObject<String> restObject) {

+        String methodName = "activateServiceInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start ");

+        try {

+            String path = baseUrl + endpoint;

+            HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);

+            MsoResponseWrapper w = MsoUtil.wrapResponse(response);

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w =" + w.getResponse());

+

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+    }

+

+    @Override

+    public MsoResponseWrapper removeRelationshipFromServiceInstance(RequestDetails requestDetails, String endpoint) {

+        String methodName = "removeRelationshipFromServiceInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        try {

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Remove relationship from service instance, path =[" + endpoint + "]");

+            String path = baseUrl + endpoint;

+            HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);

+            return MsoUtil.wrapResponse(response);

+        } 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());

+            throw e;

+        }

+    }

+

+    @Override

+    public MsoResponseWrapper addRelationshipToServiceInstance(RequestDetails requestDetails, String addRelationshipsPath) {

+        String methodName = "addRelationshipToServiceInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        try {

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Add relationship to service instance, path =[" + addRelationshipsPath + "]");

+            String path = baseUrl + addRelationshipsPath;

+

+            HttpResponse<String> response = client.post(path, commonHeaders, requestDetails, String.class);

+            return MsoUtil.wrapResponse(response);

+        } 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());

+            throw e;

+        }

+    }

+

+    @Override

+    public <T> HttpResponse<T> get(String path, Class<T> responseClass) {

+        return client.get(path, commonHeaders, new HashMap<>(), responseClass);

+    }

+

+    @Override

+    public <T> HttpResponse<T> post(String path, RequestDetailsWrapper requestDetailsWrapper,

+        Class<T> responseClass) {

+        return client.post(path, commonHeaders, requestDetailsWrapper, responseClass);

+    }

+

+

+    private MsoResponseWrapper createInstance(Object request, String endpoint) {

+        String methodName = "createInstance";

+        logger.debug(dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        try {

+            HttpResponse<String> response = client.post(endpoint, commonHeaders, request, String.class);

+            return MsoUtil.wrapResponse(response);

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+    }

+

+    /**

+     * Delete instance.

+     *

+     * @param request the request

+     * @param path    the path

+     * @return the mso response wrapper

+     * @throws Exception the exception

+     */

+    private MsoResponseWrapper deleteInstance(Object request, String path) {

+        String methodName = "deleteInstance";

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + START);

+

+        try {

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]");

+

+            HttpResponse<String> response = client.delete(path, commonHeaders, String.class);

+            MsoResponseWrapper w = MsoUtil.wrapResponse(response);

+

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());

+            return w;

+

+        } catch (Exception e) {

+            logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());

+            throw e;

+        }

+

+    }

+

+    private Map<String, String> initCommonHeaders() {

+        String username = SystemProperties.getProperty(MsoProperties.MSO_USER_NAME);

+        String password = SystemProperties.getProperty(MsoProperties.MSO_PASSWORD);

+        String decrypted_password = Password.deobfuscate(password);

+

+        String authString = username + ":" + decrypted_password;

+

+        byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());

+        String authStringEnc = new String(authEncBytes);

+

+        Map<String, String> map = new HashMap<>();

+        map.put(HttpHeaders.AUTHORIZATION,  "Basic " + authStringEnc);

+        map.put(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);

+        map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);

+        map.put(X_FROM_APP_ID, SystemProperties.getProperty(SystemProperties.APP_DISPLAY_NAME));

+        map.put(SystemProperties.ECOMP_REQUEST_ID, Logging.extractOrGenerateRequestId());

+        return ImmutableMap.copyOf(map);

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/OperationalEnvironment/OperationEnvironmentRequestDetails.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/OperationalEnvironment/OperationEnvironmentRequestDetails.java
new file mode 100644
index 0000000..0a26b3b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/OperationalEnvironment/OperationEnvironmentRequestDetails.java
@@ -0,0 +1,142 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest.OperationalEnvironment;

+

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonTypeInfo;

+import com.fasterxml.jackson.annotation.JsonTypeName;

+

+import java.util.List;

+

+public class OperationEnvironmentRequestDetails {

+    private final RequestInfo requestInfo;

+    private final List<RelatedInstance> relatedInstanceList;

+    private final RequestParameters requestParameters;

+

+    public OperationEnvironmentRequestDetails(@JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,

+                                              @JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList,

+                                              @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters) {

+        this.requestInfo = requestInfo;

+        this.relatedInstanceList = relatedInstanceList;

+        this.requestParameters = requestParameters;

+    }

+

+    public RequestInfo getRequestInfo() {

+        return requestInfo;

+    }

+

+    public List<RelatedInstance> getRelatedInstanceList() {

+        return relatedInstanceList;

+    }

+

+    public RequestParameters getRequestParameters() {

+        return requestParameters;

+    }

+

+    public static class RequestInfo {

+        private final String resourceType;

+        private final String instanceName;

+        private final String source;

+        private final String requestorId;

+

+        public RequestInfo(@JsonProperty(value = "resourceType", required = true) String resourceType,

+                           @JsonProperty(value = "instanceName", required = true) String instanceName,

+                           @JsonProperty(value = "source", required = true) String source,

+                           @JsonProperty(value = "requestorId", required = true) String requestorId) {

+            this.resourceType = resourceType;

+            this.instanceName = instanceName;

+            this.source = source;

+            this.requestorId = requestorId;

+        }

+

+        public String getResourceType() {

+            return resourceType;

+        }

+

+        public String getInstanceName() {

+            return instanceName;

+        }

+

+        public String getSource() {

+            return source;

+        }

+

+        public String getRequestorId() {

+            return requestorId;

+        }

+    }

+

+    public static class RequestParameters {

+        private final String operationalEnvironmentType;

+        private final String tenantContext;

+        private final String workloadContext;

+

+        public RequestParameters(@JsonProperty(value = "operationalEnvironmentType", required = true) String operationalEnvironmentType,

+                                 @JsonProperty(value = "tenantContext", required = true) String tenantContext,

+                                 @JsonProperty(value = "workloadContext", required = true) String workloadContext) {

+            this.operationalEnvironmentType = operationalEnvironmentType;

+            this.tenantContext = tenantContext;

+            this.workloadContext = workloadContext;

+        }

+        public String getOperationalEnvironmentType() {

+            return operationalEnvironmentType;

+        }

+

+        public String getTenantContext() {

+            return tenantContext;

+        }

+

+        public String getWorkloadContext() {

+            return workloadContext;

+        }

+    }

+

+    @JsonTypeName("relatedInstance")

+    @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME)

+    public static class RelatedInstance {

+        private final String resourceType;

+        private final String instanceId;

+        private final String instanceName;

+

+        public String getResourceType() {

+            return resourceType;

+        }

+

+        public String getInstanceId() {

+            return instanceId;

+        }

+

+        public String getInstanceName() {

+            return instanceName;

+        }

+

+        public RelatedInstance(@JsonProperty(value = "instanceName", required = true) String resourceType,

+                               @JsonProperty(value = "instanceId", required = true) String instanceId,

+                               @JsonProperty(value = "instanceName", required = true) String instanceName) {

+            this.resourceType = resourceType;

+            this.instanceId = instanceId;

+            this.instanceName = instanceName;

+        }

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RelatedInstance.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RelatedInstance.java
new file mode 100644
index 0000000..4bcacc9
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RelatedInstance.java
@@ -0,0 +1,123 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+import java.util.HashMap;

+import java.util.Map;

+import javax.annotation.Generated;

+import com.fasterxml.jackson.annotation.JsonAnyGetter;

+import com.fasterxml.jackson.annotation.JsonAnySetter;

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+import org.apache.commons.lang.builder.EqualsBuilder;

+import org.apache.commons.lang.builder.HashCodeBuilder;

+import org.apache.commons.lang.builder.ToStringBuilder;

+

+

+@JsonInclude(JsonInclude.Include.NON_NULL)

+@Generated("org.jsonschema2pojo")

+@JsonPropertyOrder({

+    "instanceName",

+    "instanceId",

+    "modelInfo"

+})

+public class RelatedInstance extends org.onap.osam.domain.mso.RelatedInstance{

+

+

+    @JsonProperty("modelInfo")

+    private org.onap.osam.domain.mso.ModelInfo modelInfo;

+    

+    /** The additional properties. */

+    @JsonIgnore

+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

+

+    /**

+     * (Required).

+     *

+     * @return     The modelInfo

+     */

+    @JsonProperty("modelInfo")

+    public org.onap.osam.domain.mso.ModelInfo getModelInfo() {

+        return modelInfo;

+    }

+

+    /**

+     * (Required).

+     *

+     * @param modelInfo     The modelInfo

+     */

+    @JsonProperty("modelInfo")

+    public void setModelInfo(org.onap.osam.domain.mso.ModelInfo modelInfo) {

+        this.modelInfo = modelInfo;

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RelatedInstance#toString()

+     */

+    @Override

+    public String toString() {

+        return ToStringBuilder.reflectionToString(this);

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RelatedInstance#getAdditionalProperties()

+     */

+    @JsonAnyGetter

+    public Map<String, Object> getAdditionalProperties() {

+        return this.additionalProperties;

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RelatedInstance#setAdditionalProperty(java.lang.String, java.lang.Object)

+     */

+    @JsonAnySetter

+    public void setAdditionalProperty(String name, Object value) {

+        this.additionalProperties.put(name, value);

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RelatedInstance#hashCode()

+     */

+    @Override

+    public int hashCode() {

+        return new HashCodeBuilder().append(getInstanceName()).append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode();

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RelatedInstance#equals(java.lang.Object)

+     */

+    @Override

+    public boolean equals(Object other) {

+        if (other == this) {

+            return true;

+        }

+        if ((other instanceof RelatedInstance) == false) {

+            return false;

+        }

+        RelatedInstance rhs = ((RelatedInstance) other);

+        return new EqualsBuilder().append(getInstanceName(), rhs.getInstanceName()).append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.getModelInfo()).append(additionalProperties, rhs.additionalProperties).isEquals();

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RelatedInstanceWrapper.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RelatedInstanceWrapper.java
new file mode 100644
index 0000000..d32b8a5
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RelatedInstanceWrapper.java
@@ -0,0 +1,27 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+public class RelatedInstanceWrapper {

+    public RelatedInstance relatedInstance;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RelatedModel.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RelatedModel.java
new file mode 100644
index 0000000..4a400bb
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RelatedModel.java
@@ -0,0 +1,123 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+import java.util.HashMap;

+import java.util.Map;

+import com.fasterxml.jackson.annotation.JsonAnyGetter;

+import com.fasterxml.jackson.annotation.JsonAnySetter;

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+import org.apache.commons.lang.builder.EqualsBuilder;

+import org.apache.commons.lang.builder.HashCodeBuilder;

+import org.apache.commons.lang.builder.ToStringBuilder;

+

+

+@JsonInclude(JsonInclude.Include.NON_NULL)

+@JsonPropertyOrder({

+    "instanceId",

+    "modelInfo"

+})

+public class RelatedModel extends org.onap.osam.domain.mso.RelatedModel {

+    

+    @JsonProperty("modelInfo")

+    private org.onap.osam.domain.mso.ModelInfo modelInfo;

+

+//    /** The related model object instance list. */

+//    @JsonProperty("instanceId")

+//    private org.onap.vid.domain.mso.InstanceIds instanceId;

+    

+    /** The additional properties. */

+    @JsonIgnore

+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

+

+    /**

+     * (Required).

+     *

+     * @return     The modelInfo

+     */

+    @JsonProperty("modelInfo")

+    public org.onap.osam.domain.mso.ModelInfo getModelInfo() {

+        return modelInfo;

+    }

+

+    /**

+     * (Required).

+     *

+     * @param modelInfo     The modelInfo

+     */

+    @JsonProperty("modelInfo")

+    public void setModelInfo(org.onap.osam.domain.mso.ModelInfo modelInfo) {

+        this.modelInfo = modelInfo;

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RelatedModel#toString()

+     */

+    @Override

+    public String toString() {

+        return ToStringBuilder.reflectionToString(this);

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RelatedModel#getAdditionalProperties()

+     */

+    @JsonAnyGetter

+    public Map<String, Object> getAdditionalProperties() {

+        return this.additionalProperties;

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RelatedModel#setAdditionalProperty(java.lang.String, java.lang.Object)

+     */

+    @JsonAnySetter

+    public void setAdditionalProperty(String name, Object value) {

+        this.additionalProperties.put(name, value);

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RelatedModel#hashCode()

+     */

+    @Override

+    public int hashCode() {

+        return new HashCodeBuilder().append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode();

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RelatedModel#equals(java.lang.Object)

+     */

+    @Override

+    public boolean equals(Object other) {

+        if (other == this) {

+            return true;

+        }

+        if ((other instanceof RelatedModel) == false) {

+            return false;

+        }

+        RelatedModel rhs = ((RelatedModel) other);

+        return new EqualsBuilder().append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.modelInfo).append(additionalProperties, rhs.additionalProperties).isEquals();

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/Request.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/Request.java
new file mode 100644
index 0000000..831f0c5
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/Request.java
@@ -0,0 +1,144 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+//import java.util.HashMap;

+//import java.util.Map;

+//import javax.annotation.Generated;

+

+import org.apache.commons.lang3.builder.HashCodeBuilder;

+import org.onap.osam.domain.mso.InstanceIds;

+import org.onap.osam.domain.mso.RequestStatus;

+//import com.fasterxml.jackson.annotation.JsonAnyGetter;

+//import com.fasterxml.jackson.annotation.JsonAnySetter;

+//import com.fasterxml.jackson.annotation.JsonCreator;

+//import com.fasterxml.jackson.annotation.JsonIgnore;

+//import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+//import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+//import com.fasterxml.jackson.annotation.JsonValue;

+import org.apache.commons.lang.builder.EqualsBuilder;

+//import org.apache.commons.lang.builder.HashCodeBuilder;

+import org.apache.commons.lang.builder.ToStringBuilder;

+

+

+public class Request extends org.onap.osam.domain.mso.Request {

+

+ 

+    private InstanceIds instanceIds;

+    

+    /** The request details. */

+    private RequestDetails requestDetails;

+    

+    /** The request status. */

+    private RequestStatus requestStatus;

+ 

+    

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.Request#getInstanceIds()

+     */

+    @JsonProperty("instanceIds")

+    public InstanceIds getInstanceIds() {

+        return instanceIds;

+    }

+

+    /**

+     * Sets the instance ids.

+     *

+     * @param instanceIds     The instanceIds

+     */

+    @JsonProperty("instanceIds")

+    public void setInstanceIds(InstanceIds instanceIds) {

+        this.instanceIds = instanceIds;

+    }

+

+    /**

+     * (Required).

+     *

+     * @return     The requestDetails

+     */

+    @JsonProperty("requestDetails")

+    public RequestDetails getRequestDetails() {

+        return requestDetails;

+    }

+

+    /**

+     * (Required).

+     *

+     * @param requestDetails     The requestDetails

+     */

+    @JsonProperty("requestDetails")

+    public void setRequestDetails(RequestDetails requestDetails) {

+        this.requestDetails = requestDetails;

+    }

+

+    

+    /**

+     * Gets the request status.

+     *

+     * @return     The requestStatus

+     */

+    @JsonProperty("requestStatus")

+    public RequestStatus getRequestStatus() {

+        return requestStatus;

+    }

+

+    /**

+     * Sets the request status.

+     *

+     * @param requestStatus     The requestStatus

+     */

+    @JsonProperty("requestStatus")

+    public void setRequestStatus(RequestStatus requestStatus) {

+        this.requestStatus = requestStatus;

+    }

+

+  

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.Request#toString()

+     */

+    @Override

+    public String toString() {

+        return ToStringBuilder.reflectionToString(this);

+    }

+    

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.Request#equals(java.lang.Object)

+     */

+    @Override

+    public boolean equals(Object other) {

+        if (other == this) {

+            return true;

+        }

+        if ((other instanceof Request) == false) {

+            return false;

+        }

+        Request rhs = ((Request) other);

+        return new EqualsBuilder().append(getFinishTime(), rhs.getFinishTime()).append(getInstanceIds(), rhs.getInstanceIds()).append(getRequestDetails(), rhs.getRequestDetails()).append(getRequestId(), rhs.getRequestId()).append(getRequestScope(), rhs.getRequestScope()).append(getRequestStatus(), rhs.getRequestStatus()).append(getRequestType(), rhs.getRequestType()).append(getStartTime(), rhs.getStartTime()).append(getAdditionalProperties(), rhs.getAdditionalProperties()).isEquals();

+    }

+

+    @Override

+    public int hashCode() {

+        return new HashCodeBuilder(17, 37).append(getFinishTime()).append(getInstanceIds()).append(getRequestDetails()).append(getRequestId()).append(getRequestScope()).append(getRequestStatus()).append(getRequestType()).append(getStartTime()).append(getAdditionalProperties()).toHashCode();

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestDetails.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestDetails.java
new file mode 100644
index 0000000..35496cb
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestDetails.java
@@ -0,0 +1,270 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+import com.fasterxml.jackson.annotation.JsonAnyGetter;

+import com.fasterxml.jackson.annotation.JsonAnySetter;

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+import org.apache.commons.lang3.builder.EqualsBuilder;

+import org.apache.commons.lang3.builder.HashCodeBuilder;

+import org.apache.commons.lang3.builder.ToStringBuilder;

+import org.onap.osam.domain.mso.CloudConfiguration;

+import org.onap.osam.domain.mso.ModelInfo;

+import org.onap.osam.domain.mso.RequestInfo;

+import org.onap.osam.domain.mso.RequestParameters;

+import org.onap.osam.domain.mso.SubscriberInfo;

+

+import java.util.HashMap;

+import java.util.List;

+import java.util.Map;

+

+

+@JsonInclude(JsonInclude.Include.NON_NULL)

+@JsonPropertyOrder({

+        "cloudConfiguration",

+        "modelInfo",

+        "relatedModelList",

+        "requestInfo",

+        "subscriberInfo",

+        "requestParameters",

+        "configurationParameters"

+})

+public class RequestDetails{

+

+

+

+    @JsonProperty("cloudConfiguration")

+    private CloudConfiguration cloudConfiguration;

+

+    /** The model info. */

+    @JsonProperty("modelInfo")

+    private ModelInfo modelInfo;

+

+    /** The related model list. */

+    @JsonProperty("relatedInstanceList")

+    private List<RelatedInstanceWrapper> relatedInstanceList;

+

+    /** The request info. */

+    @JsonProperty("requestInfo")

+    private RequestInfo requestInfo;

+

+    /** The subscriber info. */

+    @JsonProperty("subscriberInfo")

+    private SubscriberInfo subscriberInfo;

+

+    /** The request parameters. */

+    @JsonProperty("requestParameters")

+    private RequestParameters requestParameters;

+

+    @JsonProperty("configurationParameters")

+    protected List<Map<String, String>> configurationParameters;

+

+    /** The additional properties. */

+    @JsonIgnore

+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

+

+    /**

+     * Gets the cloud configuration.

+     *

+     * @return     The cloudConfiguration

+     */

+    @JsonProperty("cloudConfiguration")

+    public CloudConfiguration getCloudConfiguration() {

+        return cloudConfiguration;

+    }

+

+    /**

+     * Sets the cloud configuration.

+     *

+     * @param cloudConfiguration     The cloudConfiguration

+     */

+    @JsonProperty("cloudConfiguration")

+    public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {

+        this.cloudConfiguration = cloudConfiguration;

+    }

+

+    /**

+     * Gets the model info.

+     *

+     * @return     The modelInfo

+     */

+    @JsonProperty("modelInfo")

+    public ModelInfo getModelInfo() {

+        return modelInfo;

+    }

+

+    /**

+     * Sets the model info.

+     *

+     * @param modelInfo     The modelInfo

+     */

+    @JsonProperty("modelInfo")

+    public void setModelInfo(ModelInfo modelInfo) {

+        this.modelInfo = modelInfo;

+    }

+    /**

+     * Gets the related instance list.

+     *

+     * @return     The relatedInstanceList

+     */

+    @JsonProperty("relatedInstanceList")

+    public List<RelatedInstanceWrapper> getRelatedInstanceList() {

+        return relatedInstanceList;

+    }

+

+    /**

+     * Sets the related model list.

+     *

+     * @param relatedInstanceList     The relatedInstanceList

+     */

+    @JsonProperty("relatedInstanceList")

+    public void setRelatedInstanceList(List<RelatedInstanceWrapper> relatedInstanceList) {

+        this.relatedInstanceList = relatedInstanceList;

+    }

+

+    /**

+     * Gets the request info.

+     *

+     * @return     The requestInfo

+     */

+    @JsonProperty("requestInfo")

+    public RequestInfo getRequestInfo() {

+        return requestInfo;

+    }

+

+    /**

+     * Sets the request info.

+     *

+     * @param requestInfo     The requestInfo

+     */

+    @JsonProperty("requestInfo")

+    public void setRequestInfo(RequestInfo requestInfo) {

+        this.requestInfo = requestInfo;

+    }

+

+    /**

+     * Gets the subscriber info.

+     *

+     * @return     The subscriberInfo

+     */

+    @JsonProperty("subscriberInfo")

+    public SubscriberInfo getSubscriberInfo() {

+        return subscriberInfo;

+    }

+

+    /**

+     * Sets the subscriber info.

+     *

+     * @param subscriberInfo     The subscriberInfo

+     */

+    @JsonProperty("subscriberInfo")

+    public void setSubscriberInfo(SubscriberInfo subscriberInfo) {

+        this.subscriberInfo = subscriberInfo;

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RequestDetails#toString()

+     */

+    @Override

+    public String toString() {

+        return ToStringBuilder.reflectionToString(this);

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RequestDetails#getAdditionalProperties()

+     */

+    @JsonAnyGetter

+    public Map<String, Object> getAdditionalProperties() {

+        return this.additionalProperties;

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RequestDetails#setAdditionalProperty(java.lang.String, java.lang.Object)

+     */

+    @JsonAnySetter

+    public void setAdditionalProperty(String name, Object value) {

+        this.additionalProperties.put(name, value);

+    }

+

+    @JsonProperty("configurationParameters")

+    public List<Map<String, String>> getConfigurationParameters() {

+        return configurationParameters;

+    }

+

+    @JsonProperty("configurationParameters")

+    public void setConfigurationParameters(List<Map<String, String>> configurationParameters) {

+        this.configurationParameters = configurationParameters;

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RequestDetails#hashCode()

+     */

+    @Override

+    public int hashCode() {

+        return new HashCodeBuilder()

+                .append(cloudConfiguration)

+                .append(modelInfo)

+                .append(relatedInstanceList)

+                .append(requestInfo)

+                .append(getRequestParameters())

+                .append(subscriberInfo)

+                .append(additionalProperties)

+                .append(configurationParameters)

+                .toHashCode();

+    }

+

+    /* (non-Javadoc)

+     * @see org.onap.vid.domain.mso.RequestDetails#equals(java.lang.Object)

+     */

+    @Override

+    public boolean equals(Object other) {

+        if (other == this) {

+            return true;

+        }

+        if (!(other instanceof RequestDetails)) {

+            return false;

+        }

+        RequestDetails rhs = ((RequestDetails) other);

+        return new EqualsBuilder()

+                .append(cloudConfiguration, rhs.cloudConfiguration)

+                .append(modelInfo, rhs.modelInfo)

+                .append(relatedInstanceList, rhs.relatedInstanceList)

+                .append(requestInfo, rhs.requestInfo)

+                .append(getRequestParameters(), rhs.getRequestParameters())

+                .append(subscriberInfo, rhs.subscriberInfo)

+                .append(additionalProperties, rhs.additionalProperties)

+                .append(configurationParameters, rhs.configurationParameters)

+                .isEquals();

+    }

+

+    public RequestParameters getRequestParameters() {

+        return requestParameters;

+    }

+

+    public void setRequestParameters(RequestParameters requestParameters) {

+        this.requestParameters = requestParameters;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestDetailsWrapper.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestDetailsWrapper.java
new file mode 100644
index 0000000..d5a36a4
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestDetailsWrapper.java
@@ -0,0 +1,27 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+public class RequestDetailsWrapper {

+    public RequestDetails requestDetails;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestList.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestList.java
new file mode 100644
index 0000000..79f7055
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestList.java
@@ -0,0 +1,135 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+import java.util.HashMap;

+import java.util.Map;

+

+import javax.annotation.Generated;

+

+import com.fasterxml.jackson.annotation.JsonAnyGetter;

+import com.fasterxml.jackson.annotation.JsonAnySetter;

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+

+//import com.fasterxml.jackson.annotation.JsonInclude;

+//import com.fasterxml.jackson.annotation.JsonProperty;

+//import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+import org.apache.commons.lang.builder.EqualsBuilder;

+import org.apache.commons.lang.builder.HashCodeBuilder;

+import org.apache.commons.lang.builder.ToStringBuilder;

+import java.util.List;

+

+@JsonInclude(JsonInclude.Include.NON_NULL)

+@Generated("org.jsonschema2pojo")

+@JsonPropertyOrder({

+    "finishTime",

+    "instanceIds",

+    "requestDetails",

+    "requestId",

+    "requestScope",

+    "requestStatus",

+    "requestType",

+    "startTime"

+})

+

+public class RequestList {

+    

+    private List<RequestWrapper> requestList;

+    

+    /** The additional properties. */

+    @JsonIgnore

+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

+

+    /**

+     * (Required).

+     *

+     * @return     The RelatedModel List

+     */

+    public List<RequestWrapper> getRequestList() {

+        return requestList;

+    }

+

+    /**

+     * Sets the request list.

+     *

+     * @param l the new request list

+     */

+    public void setRequestList(List<RequestWrapper> l) {

+        this.requestList = l;

+    }

+

+    /* (non-Javadoc)

+     * @see java.lang.Object#toString()

+     */

+    @Override

+    public String toString() {

+        return ToStringBuilder.reflectionToString(this);

+    }

+

+    /**

+     * Gets the additional properties.

+     *

+     * @return the additional properties

+     */

+    @JsonAnyGetter

+    public Map<String, Object> getAdditionalProperties() {

+        return this.additionalProperties;

+    }

+

+    /**

+     * Sets the additional property.

+     *

+     * @param name the name

+     * @param value the value

+     */

+    @JsonAnySetter

+    public void setAdditionalProperty(String name, Object value) {

+        this.additionalProperties.put(name, value);

+    }

+

+    /* (non-Javadoc)

+     * @see java.lang.Object#hashCode()

+     */

+    @Override

+    public int hashCode() {

+        return new HashCodeBuilder().append(getRequestList()).append(additionalProperties).toHashCode();

+    }

+

+    /* (non-Javadoc)

+     * @see java.lang.Object#equals(java.lang.Object)

+     */

+    @Override

+    public boolean equals(Object other) {

+        if (other == this) {

+            return true;

+        }

+        if ((other instanceof RequestList) == false) {

+            return false;

+        }

+        RequestList rhs = ((RequestList) other);

+        return new EqualsBuilder().append(getRequestList(), rhs.getRequestList()).append(additionalProperties, rhs.additionalProperties).isEquals();

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestParameters.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestParameters.java
new file mode 100644
index 0000000..4d1b402
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestParameters.java
@@ -0,0 +1,117 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+import com.fasterxml.jackson.annotation.JsonAnyGetter;

+import com.fasterxml.jackson.annotation.JsonAnySetter;

+import com.fasterxml.jackson.annotation.JsonIgnore;

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+import org.apache.commons.lang.builder.EqualsBuilder;

+import org.apache.commons.lang.builder.HashCodeBuilder;

+import org.apache.commons.lang.builder.ToStringBuilder;

+import org.onap.osam.domain.mso.UserParam;

+

+import java.util.ArrayList;

+import java.util.HashMap;

+import java.util.List;

+import java.util.Map;

+

+@JsonInclude(JsonInclude.Include.NON_NULL)

+@JsonPropertyOrder({

+    "subscriptionServiceType",

+    "userParams"

+})

+public class RequestParameters {

+

+    @JsonProperty("subscriptionServiceType")

+    private String subscriptionServiceType;

+    @JsonProperty("userParams")

+    private List<UserParam> userParams = new ArrayList<UserParam>();

+    @JsonIgnore

+    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

+

+    @JsonProperty("subscriptionServiceType")

+    public String getSubscriptionServiceType() {

+        return subscriptionServiceType;

+    }

+

+    @JsonProperty("subscriptionServiceType")

+    public void setSubscriptionServiceType(String subscriptionServiceType) {

+        this.subscriptionServiceType = subscriptionServiceType;

+    }

+

+    /**

+     * 

+     * @return

+     *     The userParams

+     */

+    @JsonProperty("userParams")

+    public List<UserParam> getUserParams() {

+        return userParams;

+    }

+

+    /**

+     * 

+     * @param userParams

+     *     The userParams

+     */

+    @JsonProperty("userParams")

+    public void setUserParams(List<UserParam> userParams) {

+        this.userParams = userParams;

+    }

+

+    @Override

+    public String toString() {

+        return ToStringBuilder.reflectionToString(this);

+    }

+

+    @JsonAnyGetter

+    public Map<String, Object> getAdditionalProperties() {

+        return this.additionalProperties;

+    }

+

+    @JsonAnySetter

+    public void setAdditionalProperty(String name, Object value) {

+        this.additionalProperties.put(name, value);

+    }

+

+    @Override

+    public int hashCode() {

+        return new HashCodeBuilder().append(subscriptionServiceType).append(userParams).append(additionalProperties).toHashCode();

+    }

+

+    @Override

+    public boolean equals(Object other) {

+        if (other == this) {

+            return true;

+        }

+        if ((other instanceof RequestParameters) == false) {

+            return false;

+        }

+        RequestParameters rhs = ((RequestParameters) other);

+        return new EqualsBuilder().append(subscriptionServiceType, rhs.subscriptionServiceType).append(userParams, rhs.userParams).append(additionalProperties, rhs.additionalProperties).isEquals();

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestWrapper.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestWrapper.java
new file mode 100644
index 0000000..d8e9eaa
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RequestWrapper.java
@@ -0,0 +1,53 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+public class RequestWrapper {

+

+

+    private Request request;

+

+

+    /**

+     * Gets the request.

+     *

+     * @return     The requestDetails

+     */

+    @JsonProperty("request")

+    public Request getRequest() {

+        return request;

+    }

+

+    /**

+     * Sets the request.

+     *

+     * @param request     The request

+     */

+    @JsonProperty

+    public void setRequest(Request request) {

+        this.request = request;

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/Response.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/Response.java
new file mode 100644
index 0000000..ba20228
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/Response.java
@@ -0,0 +1,74 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+import com.fasterxml.jackson.annotation.JsonProperty;

+

+public class Response {

+

+    private int status;

+

+    private RequestList entity;

+

+    /**

+     * Gets the status.

+     *

+     * @return     The status

+     */

+    @JsonProperty("status")

+    public int getStatus() {

+        return status;

+    }

+

+    /**

+     * Sets the status.

+     *

+     * @param status     The status

+     */

+    @JsonProperty("status")

+    public void setStatus(int status) {

+        this.status = status;

+    }

+

+    /**

+     * Gets the entity.

+     *

+     * @return     The entity

+     */

+    @JsonProperty("entity")

+    public RequestList getEntity() {

+        return entity;

+    }

+

+    /**

+     * Sets the entity.

+     *

+     * @param entity     The entity

+     */

+    @JsonProperty("entity")

+    public void setEntity(RequestList entity) {

+        this.entity = entity;

+    }

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RestInterface.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RestInterface.java
new file mode 100644
index 0000000..c3fe880
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/RestInterface.java
@@ -0,0 +1,84 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+import org.onap.osam.mso.RestObject;

+

+import javax.ws.rs.core.MultivaluedHashMap;

+

+public interface RestInterface {

+

+    MultivaluedHashMap<String, Object> initMsoClient();

+

+    /**

+     * Gets the.

+     *

+     * @param <T> the generic type

+     * @param t the t

+     * @param sourceId the source id

+     * @param path the path

+     * @param restObject the rest object

+     * @throws Exception the exception

+     */

+    <T> void Get (T t, String sourceId, String path, RestObject<T> restObject );

+

+    /**

+     * Delete.

+     *

+     * @param <T> the generic type

+     * @param t the t

+     * @param r the r

+     * @param sourceID the source ID

+     * @param path the path

+     * @param restObject the rest object

+     * @throws Exception the exception

+     */

+    <T> void Delete(T t, Object r, String sourceID, String path, RestObject<T> restObject);

+

+    /**

+     * Post.

+     *

+     * @param <T> the generic type

+     * @param t the t

+     * @param r the r

+     * @param sourceID the source ID

+     * @param path the path

+     * @param restObject the rest object

+     * @throws Exception the exception

+     */

+    <T> void Post(T t, Object r, String sourceID, String path, RestObject<T> restObject);

+

+    /**

+     * Put.

+     *

+     * @param <T> the generic type

+     * @param t the t

+     * @param r the r

+     * @param sourceID the source ID

+     * @param path the path

+     * @param restObject the rest object

+     * @throws Exception the exception

+     */

+    <T> void Put(T t, RequestDetailsWrapper r, String sourceID, String path, RestObject<T> restObject);

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/Task.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/Task.java
new file mode 100644
index 0000000..1848b08
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/Task.java
@@ -0,0 +1,141 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+import java.util.List;

+

+public class Task {

+

+    private String taskId;

+    private String type;

+    private String nfRole;

+    private String subscriptionServiceType;

+    private String originalRequestId;

+    private String originalRequestorId;

+    private String errorSource;

+    private String errorCode;

+    private String errorMessage;

+    private String buildingBlockName;

+    private String buildingBlockStep;

+    private List<String> validResponses;

+

+

+    public String getTaskId() {

+        return taskId;

+    }

+

+    public void setTaskId(String taskId) {

+        this.taskId = taskId;

+    }

+

+    public String getType() {

+        return type;

+    }

+

+    public void setType(String type) {

+        this.type = type;

+    }

+

+    public String getNfRole() {

+        return nfRole;

+    }

+

+    public void setNfRole(String nfRole) {

+        this.nfRole = nfRole;

+    }

+

+    public String getSubscriptionServiceType() {

+        return subscriptionServiceType;

+    }

+

+    public void setSubscriptionServiceType(String subscriptionServiceType) {

+        this.subscriptionServiceType = subscriptionServiceType;

+    }

+

+    public String getOriginalRequestId() {

+        return originalRequestId;

+    }

+

+    public void setOriginalRequestId(String originalRequestId) {

+        this.originalRequestId = originalRequestId;

+    }

+

+    public String getOriginalRequestorId() {

+        return originalRequestorId;

+    }

+

+    public void setOriginalRequestorId(String originalRequestorId) {

+        this.originalRequestorId = originalRequestorId;

+    }

+

+    public String getErrorSource() {

+        return errorSource;

+    }

+

+    public void setErrorSource(String errorSource) {

+        this.errorSource = errorSource;

+    }

+

+    public String getErrorCode() {

+        return errorCode;

+    }

+

+    public void setErrorCode(String errorCode) {

+        this.errorCode = errorCode;

+    }

+

+    public String getErrorMessage() {

+        return errorMessage;

+    }

+

+    public void setErrorMessage(String errorMessage) {

+        this.errorMessage = errorMessage;

+    }

+

+    public String getBuildingBlockName() {

+        return buildingBlockName;

+    }

+

+    public void setBuildingBlockName(String buildingBlockName) {

+        this.buildingBlockName = buildingBlockName;

+    }

+

+    public String getBuildingBlockStep() {

+        return buildingBlockStep;

+    }

+

+    public void setBuildingBlockStep(String buildingBlockStep) {

+        this.buildingBlockStep = buildingBlockStep;

+    }

+

+    public List<String> getValidResponses() {

+        return validResponses;

+    }

+

+    public void setValidResponses(List<String> validResponses) {

+        this.validResponses = validResponses;

+    }

+

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/TaskList.java b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/TaskList.java
new file mode 100644
index 0000000..3e49238
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/mso/rest/TaskList.java
@@ -0,0 +1,38 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.mso.rest;

+

+import java.util.List;

+

+public class TaskList {

+

+    public List<Task> getTaskList() {

+        return taskList;

+    }

+

+    public void setTaskList(List<Task> taskList) {

+        this.taskList = taskList;

+    }

+

+    private List<Task> taskList;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyProperties.java b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyProperties.java
new file mode 100644
index 0000000..f509051
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyProperties.java
@@ -0,0 +1,48 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.policy;

+

+import org.onap.portalsdk.core.util.SystemProperties;

+

+

+public class PolicyProperties extends SystemProperties {

+	

+	public static final String POLICY_CLIENTAUTH_VAL =  "policy.ClientAuth";

+	

+	public static final String POLICY_CLIENT_MECHID_VAL =  "policy.client.mechId";

+	

+	public static final String POLICY_CLIENT_PASSWORD_VAL =  "policy.client.password";

+	

+	public static final String POLICY_USERNAME_VAL =  "policy.username";

+	

+	public static final String POLICY_PASSWORD_VAL =  "policy.password";

+	

+	public static final String POLICY_AUTHORIZATION_VAL = "policy.Authorization";

+	

+	public static final String POLICY_SERVER_URL_VAL = "policy.server.url";

+	

+	public static final String POLICY_ENVIRONMENT_VAL = "policy.environment";

+	

+	public static final String POLICY_GET_CONFIG_VAL = "policy.get.config"; 

+	

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyResponseWrapper.java b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyResponseWrapper.java
new file mode 100644
index 0000000..0569e97
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyResponseWrapper.java
@@ -0,0 +1,75 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.policy;

+

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+import org.apache.commons.lang.builder.ToStringBuilder;

+

+@JsonInclude(JsonInclude.Include.NON_NULL)

+@JsonPropertyOrder({

+	    "status",

+	    "entity"

+})

+

+public class PolicyResponseWrapper {

+	

+	@JsonProperty("status")

+	private int status;

+

+	@JsonProperty("entity")

+	private String entity;

+

+	@JsonProperty("entity")

+    public String getEntity() {

+        return entity;

+    }

+	

+	@JsonProperty("status")

+    public int getStatus() {

+        return status;

+    }	

+	

+	@JsonProperty("status")

+    public void setStatus(int v) {

+        this.status = v;

+    }

+

+	@JsonProperty("entity")

+    public void setEntity(String v) {

+        this.entity = v;

+    }

+

+    @Override

+    public String toString() {

+        return ToStringBuilder.reflectionToString(this);

+    }

+

+    public String getResponse () {

+    	

+    	StringBuilder b = new StringBuilder ("{ \"status\": ");

+        b.append(getStatus()).append(", \"entity\": " ).append(this.getEntity()).append("}");

+        return (b.toString());

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInt.java b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInt.java
new file mode 100644
index 0000000..29fd109
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInt.java
@@ -0,0 +1,66 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.policy;

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.osam.policy.rest.RequestDetails;

+

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.Date;

+

+public class PolicyRestInt {

+	

+	private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyRestInt.class);

+	

+	final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+	

+	/** The request date format. */

+	public DateFormat requestDateFormat = new SimpleDateFormat("EEE, dd MMM YYYY HH:mm:ss z");

+	

+	public PolicyRestInt() {

+		requestDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));

+	}

+

+	/**

+	 * Log request.

+	 *

+	 * @param r the r

+	 */

+	public void logRequest ( RequestDetails r ) {

+    	String methodName = "logRequest";

+	    ObjectMapper mapper = new ObjectMapper();

+	    String r_json_str = "";

+	    if ( r != null ) {

+	    	r_json_str = r.toString();

+		    try {

+		    	r_json_str = mapper.writeValueAsString(r);

+		    }

+		    catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {

+		    	logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " +  methodName + " Unable to parse request as json");

+		    }

+	    }

+	    logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " +  methodName + " Request=(" + r_json_str + ")");  

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInterface.java b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInterface.java
new file mode 100644
index 0000000..7773cc1
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInterface.java
@@ -0,0 +1,250 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.policy;

+

+import org.apache.commons.codec.binary.Base64;

+import org.eclipse.jetty.util.security.Password;

+import org.json.simple.JSONObject;

+import org.onap.osam.client.HttpBasicClient;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.osam.policy.rest.RequestDetails;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+

+import javax.ws.rs.client.Client;

+import javax.ws.rs.client.Entity;

+import javax.ws.rs.core.MediaType;

+import javax.ws.rs.core.MultivaluedHashMap;

+import javax.ws.rs.core.Response;

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.Collections;

+import java.util.Date;

+

+public class PolicyRestInterface extends PolicyRestInt implements PolicyRestInterfaceIfc {

+

+	private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyRestInterface.class);

+	

+	public static final String APPLICATION_JSON = "application/json";

+

+	private static Client client = null;

+

+	/** The common headers. */

+	private MultivaluedHashMap<String, Object> commonHeaders;

+	public PolicyRestInterface() {

+		super();

+	}

+

+	/** The Constant dateFormat. */

+	static final DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+

+	public void initRestClient()

+	{

+		final String methodname = "initRestClient()";

+		

+		final String mechId = SystemProperties.getProperty(PolicyProperties.POLICY_CLIENT_MECHID_VAL);

+		final String clientPassword = SystemProperties.getProperty(PolicyProperties.POLICY_CLIENT_PASSWORD_VAL);

+		final String username = SystemProperties.getProperty(PolicyProperties.POLICY_USERNAME_VAL);

+		final String password = SystemProperties.getProperty(PolicyProperties.POLICY_PASSWORD_VAL);

+		final String environment = SystemProperties.getProperty(PolicyProperties.POLICY_ENVIRONMENT_VAL);

+				

+		final String decrypted_client_password = Password.deobfuscate(clientPassword);		

+		String mechAuthString = mechId + ":" + decrypted_client_password;		

+		byte[] mechAuthEncBytes = Base64.encodeBase64(mechAuthString.getBytes());

+		String clientAuth = new String(mechAuthEncBytes);

+		

+		final String decrypted_password = Password.deobfuscate(password);		

+		String authString = username + ":" + decrypted_password;		

+		byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());

+		String authorization = new String(authEncBytes);

+		

+		commonHeaders = new MultivaluedHashMap<> ();

+		commonHeaders.put("ClientAuth",  Collections.singletonList((Object) ("Basic " + clientAuth)));

+		commonHeaders.put("Authorization",  Collections.singletonList((Object) ("Basic " + authorization)));

+		commonHeaders.put("Environment",  Collections.singletonList((Object) (environment)));

+		

+		if (client == null) {

+			

+			try {

+				client = HttpBasicClient.getClient();

+			} catch (Exception e) {

+				System.out.println(  methodname + " Unable to get the SSL client");

+			}

+		}

+	}

+	

+	@SuppressWarnings("unchecked")

+	public <T> void  Get (T t, String sourceId, String path, RestObject<T> restObject ) {

+		String methodName = "Get";

+		

+		logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start");

+		

+		String url="";

+		restObject.set(t);

+		

+		url = SystemProperties.getProperty(PolicyProperties.POLICY_SERVER_URL_VAL) + path;

+        logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " +  methodName + " sending request to url= " + url);

+		

+        initRestClient();

+		

+		final Response cres = client.target(url)

+			 .request()

+	         .accept(APPLICATION_JSON)

+	         .headers(commonHeaders)

+	         .get();

+		

+		int status = cres.getStatus();

+		restObject.setStatusCode (status);

+		

+		if (status == 200) {

+			 t = (T) cres.readEntity(t.getClass());

+			 restObject.set(t);

+			 logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " REST api was successfull!");

+		    

+		 } else {

+		     throw new GenericUncheckedException(methodName + " with status="+ status + ", url= " + url );

+		 }

+

+		logger.debug(EELFLoggerDelegate.debugLogger,methodName + " received status=" + status );

+		

+		return;

+	}

+   

+   @SuppressWarnings("unchecked")

+   	public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) {

+	 

+		String methodName = "Delete";

+		String url="";

+		Response cres = null;

+		

+		logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " +  methodName + " start");

+		logRequest (r);

+

+		try {

+			initRestClient();

+			

+			url = SystemProperties.getProperty(PolicyProperties.POLICY_SERVER_URL_VAL) + path;

+			logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + " methodName sending request to: " + url);

+	

+			cres = client.target(url)

+					 .request()

+			         .accept(APPLICATION_JSON)

+	        		 .headers(commonHeaders)

+			         //.entity(r)

+			         .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)).invoke();

+

+			int status = cres.getStatus();

+	    	restObject.setStatusCode (status);

+	    	

+			if (status == 404) { // resource not found

+				String msg = "Resource does not exist...: " + cres.getStatus();

+				logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);

+			} else if (status == 200  || status == 204){

+				logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted");

+			} else if (status == 202) {

+				String msg = "Delete in progress: " + status;

+				logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);

+			}

+			else {

+				String msg = "Deleting Resource failed: " + status;

+					logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);

+			}

+			

+			try {

+	   			t = (T) cres.readEntity(t.getClass());

+	   			restObject.set(t);

+            }

+            catch ( Exception e ) {

+            	logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e="

+            			+ e.getMessage());

+            }

+   

+        } 

+		catch (Exception e)

+        {

+        	 logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());

+        	 throw e;

+        

+        }

+	}

+	

+	@SuppressWarnings("unchecked")

+	public <T> void Post(T t, JSONObject requestDetails, String uuid, String path, RestObject<T> restObject) {

+		

+        String methodName = "Post";

+        String url="";

+

+        System.out.println( "POST policy rest interface");

+       

+        try {

+            

+            initRestClient();    

+    

+            url = SystemProperties.getProperty(PolicyProperties.POLICY_SERVER_URL_VAL) + path;

+            System.out.println( "<== " +  methodName + " sending request to url= " + url);

+            // Change the content length

+            final Response cres = client.target(url)

+            	 .request()

+                 .accept(APPLICATION_JSON)

+	        	 .headers(commonHeaders)

+                 //.header("content-length", 201)

+                 //.header("X-FromAppId",  sourceID)

+                 .post(Entity.entity(requestDetails, MediaType.APPLICATION_JSON));

+            

+            try {

+	   			t = (T) cres.readEntity(t.getClass());

+	   			restObject.set(t);

+            }

+            catch ( Exception e ) {

+            	

+            	System.out.println("<== " + methodName + " No response entity, this is probably ok, e=" + e.getMessage());

+            }

+

+            int status = cres.getStatus();

+    		restObject.setStatusCode (status);

+    		

+    		if ( status >= 200 && status <= 299 ) {

+    			System.out.println( "<== " + methodName + " REST api POST was successful!");

+    		

+             } else {

+            	 System.out.println( "<== " + methodName + " with status="+status+", url="+url);

+             }    

+   

+        } catch (Exception e)

+        {

+        	System.out.println( "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());

+        	 throw e;

+        

+        }

+    }

+	

+	public <T> T getInstance(Class<T> clazz) throws IllegalAccessException, InstantiationException

+	{

+		return clazz.newInstance();

+	}

+

+	@Override

+	public void logRequest(RequestDetails r) {

+		// TODO Auto-generated method stub

+	} 	

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInterfaceFactory.java b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInterfaceFactory.java
new file mode 100644
index 0000000..104a573
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInterfaceFactory.java
@@ -0,0 +1,35 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.policy;

+

+public class PolicyRestInterfaceFactory {

+

+	

+	public static PolicyRestInterfaceIfc getInstance () {

+		PolicyRestInterfaceIfc obj = null;

+

+		obj = new PolicyRestInterface();

+		

+		return ( obj );

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInterfaceIfc.java b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInterfaceIfc.java
new file mode 100644
index 0000000..cd39351
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyRestInterfaceIfc.java
@@ -0,0 +1,66 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.policy;

+

+import org.json.simple.JSONObject;

+import org.onap.osam.policy.rest.RequestDetails;

+

+public interface PolicyRestInterfaceIfc {	

+	public void initRestClient();

+	

+	public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject );

+	

+	/**

+	 * Delete.

+	 *

+	 * @param <T> the generic type

+	 * @param t the t

+	 * @param r the r

+	 * @param sourceID the source ID

+	 * @param path the path

+	 * @param restObject the rest object

+	 * @throws Exception the exception

+	 */

+	public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject);

+	

+	/**

+	 * Post.

+	 *

+	 * @param <T> the generic type

+	 * @param t the t

+	 * @param r the r

+	 * @param sourceID the source ID

+	 * @param path the path

+	 * @param restObject the rest object

+	 * @throws Exception the exception

+	 */

+	public <T> void Post(T t, JSONObject r, String sourceID, String path, RestObject<T> restObject);

+	

+	/***

+	 * Log request.

+	 *

+	 * @param r the r

+	 */

+	public void logRequest ( RequestDetails r  );

+	

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyUtil.java b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyUtil.java
new file mode 100644
index 0000000..c73d529
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/policy/PolicyUtil.java
@@ -0,0 +1,90 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.policy;

+

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.Date;

+

+import org.glassfish.jersey.client.ClientResponse;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+

+import com.fasterxml.jackson.databind.ObjectMapper;

+

+public class PolicyUtil {

+	

+	private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PolicyUtil.class);

+	

+	final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+	

+	public static PolicyResponseWrapper wrapResponse ( String body, int statusCode ) {

+		

+		PolicyResponseWrapper w = new PolicyResponseWrapper();

+		w.setStatus (statusCode);

+		w.setEntity(body);

+		

+		return w;

+	}

+	

+	public static PolicyResponseWrapper wrapResponse (ClientResponse cres) {	

+		String resp_str = "";

+		if ( cres != null ) {

+			resp_str = cres.readEntity(String.class);

+		}

+		int statuscode = cres.getStatus();

+		PolicyResponseWrapper w = PolicyUtil.wrapResponse ( resp_str, statuscode );

+		return (w);

+	}

+	

+	public static PolicyResponseWrapper wrapResponse (RestObject<String> rs) {	

+		String resp_str = "";

+		int status = 0;

+		if ( rs != null ) {

+			resp_str = rs.get();

+			status = rs.getStatusCode();

+		}

+		PolicyResponseWrapper w = PolicyUtil.wrapResponse ( resp_str, status );

+		return (w);

+	}

+	

+	public static <T> String convertPojoToString ( T t ) throws com.fasterxml.jackson.core.JsonProcessingException {

+		

+		String methodName = "convertPojoToString";

+		ObjectMapper mapper = new ObjectMapper();

+		String r_json_str = "";

+	    if ( t != null ) {

+		    try {

+		    	r_json_str = mapper.writeValueAsString(t);

+		    }

+		    catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {

+		    	logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " +  methodName + " Unable to parse object as json");

+		    }

+	    }

+	    return (r_json_str);

+	}

+	

+	

+	public static void main(String[] args) {

+		// TODO Auto-generated method stub		

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/policy/RestObject.java b/onap-enabler-be/src/main/java/org/onap/osam/policy/RestObject.java
new file mode 100644
index 0000000..d098fe0
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/policy/RestObject.java
@@ -0,0 +1,61 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.policy;

+

+public class RestObject<T> {

+

+    // T stands for "Type"

+    private T t;

+    

+    /** The status code. */

+    private int statusCode= 0;

+    

+    /**

+     * Sets the.

+     *

+     * @param t the t

+     */

+    public void set(T t) { this.t = t; }

+    

+    /**

+     * Gets the.

+     *

+     * @return the t

+     */

+    public T get() { return t; }

+	

+    /**

+     * Sets the status code.

+     *

+     * @param v the new status code

+     */

+    public void setStatusCode(int v) { this.statusCode = v; }

+    

+    /**

+     * Gets the status code.

+     *

+     * @return the status code

+     */

+    public int getStatusCode() { return this.statusCode; }

+    

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/policy/rest/RequestDetails.java b/onap-enabler-be/src/main/java/org/onap/osam/policy/rest/RequestDetails.java
new file mode 100644
index 0000000..9c2997a
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/policy/rest/RequestDetails.java
@@ -0,0 +1,109 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.policy.rest;

+

+import com.fasterxml.jackson.annotation.JsonInclude;

+import com.fasterxml.jackson.annotation.JsonProperty;

+import com.fasterxml.jackson.annotation.JsonPropertyOrder;

+

+/*

+	[

+	  {

+	    "policyConfigMessage": "Config Retrieved! ",

+	    "policyConfigStatus": "CONFIG_RETRIEVED",

+	    "type": "JSON",

+	    "config": "{\"service\":\"TimeLimitAndVerticalTopology\",\"policyName\":\"SNIRO_CM_1707.Demo_TimeLimitAndVerticalTopology_zone_localTime\",\"description\":\"dev instance\",\"templateVersion\":\"1702.03\",\"version\":\"1707\",\"priority\":\"4\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"serviceType\":\"networkOnDemand\",\"identity\":\"vnf_upgrade_policy\",\"policyScope\":{\"serviceType\":[\"networkOnDemand\"],\"aicZone\":[\" \"],\"entityType\":[\"vnf\"]},\"timeSchedule\":{\"allowedPeriodicTime\":[{\"day\":\"weekday\",\"timeRange\":[{\"start_time\":\"04:00:00\",\"end_time\":\"13:00:00\"}]}]},\"nodeType\":[\"vnf\"],\"type\":\"timeLimitAndVerticalTopology\",\"conflictScope\":\"vnf_zone\"}}",

+	    "policyName": "SNIRO_CM_1707.Config_MS_Demo_TimeLimitAndVerticalTopology_zone_localTime.1.xml",

+	    "policyVersion": "1",

+	    "matchingConditions": {

+	      "ECOMPName": "SNIRO-Placement",

+	      "ConfigName": "",

+	      "service": "TimeLimitAndVerticalTopology",

+	      "uuid": "",

+	      "Location": ""

+	    },

+	    "responseAttributes": {},

+	    "property": null

+	  },

+	  {

+	    "policyConfigMessage": "Config Retrieved! ",

+	    "policyConfigStatus": "CONFIG_RETRIEVED",

+	    "type": "JSON",

+	    "config": "{\"service\":\"TimeLimitAndVerticalTopology\",\"policyName\":\"SNIRO_CM_1707.Demo_TimeLimitAndVerticalTopology_pserver_localTime\",\"description\":\"dev instance\",\"templateVersion\":\"1702.03\",\"version\":\"1707\",\"priority\":\"4\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"serviceType\":\"networkOnDemand\",\"identity\":\"vnf_upgrade_policy\",\"policyScope\":{\"serviceType\":[\"networkOnDemand\"],\"aicZone\":[\" \"],\"entityType\":[\"vnf\"]},\"timeSchedule\":{\"allowedPeriodicTime\":[{\"day\":\"weekday\",\"timeRange\":[{\"start_time\":\"04:00:00\",\"end_time\":\"13:00:00\"}]}]},\"nodeType\":[\"vnf\"],\"type\":\"timeLimitAndVerticalTopology\",\"conflictScope\":\"vnf_pserver\"}}",

+	    "policyName": "SNIRO_CM_1707.Config_MS_Demo_TimeLimitAndVerticalTopology_pserver_localTime.1.xml",

+	    "policyVersion": "1",

+	    "matchingConditions": {

+	      "ECOMPName": "SNIRO-Placement",

+	      "ConfigName": "",

+	      "service": "TimeLimitAndVerticalTopology",

+	      "uuid": "",

+	      "Location": ""

+	    },

+	    "responseAttributes": {},

+	    "property": null

+	  },

+	  {

+	    "policyConfigMessage": "Config Retrieved! ",

+	    "policyConfigStatus": "CONFIG_RETRIEVED",

+	    "type": "JSON",

+	    "config": "{\"service\":\"TimeLimitAndVerticalTopology\",\"policyName\":\"SNIRO_CM_1707.Demo_TimeLimitAndVerticalTopology_vnf_localTime\",\"description\":\"dev instance\",\"templateVersion\":\"1702.03\",\"version\":\"1707\",\"priority\":\"4\",\"riskType\":\"test\",\"riskLevel\":\"3\",\"guard\":\"False\",\"content\":{\"serviceType\":\"networkOnDemand\",\"identity\":\"vnf_upgrade_policy\",\"policyScope\":{\"serviceType\":[\"networkOnDemand\"],\"aicZone\":[\" \"],\"entityType\":[\"vnf\"]},\"timeSchedule\":{\"allowedPeriodicTime\":[{\"day\":\"weekday\",\"timeRange\":[{\"start_time\":\"04:00:00\",\"end_time\":\"13:00:00\"}]}]},\"nodeType\":[\"vnf\"],\"type\":\"timeLimitAndVerticalTopology\",\"conflictScope\":\"vnf\"}}",

+	    "policyName": "SNIRO_CM_1707.Config_MS_Demo_TimeLimitAndVerticalTopology_vnf_localTime.1.xml",

+	    "policyVersion": "1",

+	    "matchingConditions": {

+	      "ECOMPName": "SNIRO-Placement",

+	      "ConfigName": "",

+	      "service": "TimeLimitAndVerticalTopology",

+	      "uuid": "",

+	      "Location": ""

+	    },

+	    "responseAttributes": {},

+	    "property": null

+	  }

+	]

+*/

+@JsonInclude(JsonInclude.Include.NON_NULL)

+@JsonPropertyOrder({

+    "policyConfigMessage",

+    "policyConfigStatus",

+    "type",

+    "config",

+    "policyName",

+    "policyVersion",

+    "matchingConditions"

+})

+public class RequestDetails {

+	

+	@JsonProperty("policyName")

+    private String policyName;	 

+    

+	@JsonProperty("policyName")

+    public String getPolicyName() {

+        return policyName;

+    }

+

+    @JsonProperty("policyName")

+    public void setPolicyName(String policyName) {

+        this.policyName = policyName;

+    }

+    

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/properties/AsdcClientConfiguration.java b/onap-enabler-be/src/main/java/org/onap/osam/properties/AsdcClientConfiguration.java
new file mode 100644
index 0000000..625587a
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/properties/AsdcClientConfiguration.java
@@ -0,0 +1,122 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.properties;

+

+import org.springframework.beans.factory.annotation.Value;

+import org.springframework.context.annotation.Bean;

+import org.springframework.context.annotation.Configuration;

+import org.springframework.context.annotation.PropertySource;

+import org.springframework.context.annotation.PropertySources;

+import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

+

+@Configuration

+

+@PropertySources({

+		@PropertySource(value="asdc.properties",  ignoreResourceNotFound = true),

+		@PropertySource(value="${container.classpath:}/WEB-INF/conf/asdc.properties", ignoreResourceNotFound = true)

+})

+public class AsdcClientConfiguration {

+

+    @Bean

+    public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {

+        return new PropertySourcesPlaceholderConfigurer();

+    }

+

+	@Value("${asdc.client.type}")

+	private AsdcClientType asdcClientType;

+

+	@Value("${asdc.client.rest.host}")

+	private String asdcClientHost;

+

+	/** The asdc client port. */

+	@Value("${asdc.client.rest.port}")

+	private int asdcClientPort;

+

+	/** The asdc client auth. */

+	@Value("${asdc.client.rest.auth}")

+	public String asdcClientAuth;

+

+	/** The asdc client protocol. */

+	@Value("${asdc.client.rest.protocol}")

+	public String asdcClientProtocol;

+

+	/**

+	 * Gets the asdc client type.

+	 *

+	 * @return the asdc client type

+	 */

+	public AsdcClientType getAsdcClientType() {

+		return asdcClientType;

+	}

+

+	/**

+	 * Gets the asdc client host.

+	 *

+	 * @return the asdc client host

+	 */

+	public String getAsdcClientHost() {

+		return asdcClientHost;

+	}

+

+	/**

+	 * Gets the asdc client port.

+	 *

+	 * @return the asdc client port

+	 */

+	public int getAsdcClientPort() {

+		return asdcClientPort;

+	}

+

+	/**

+	 * Gets the asdc client auth.

+	 *

+	 * @return the asdc client auth

+	 */

+	public String getAsdcClientAuth() {

+		return asdcClientAuth;

+	}

+

+	/**

+	 * Gets the asdc client protocol.

+	 *

+	 * @return the asdc client protocol

+	 */

+	public String getAsdcClientProtocol() {

+		return asdcClientProtocol;

+	}

+

+	/**

+	 * The Enum AsdcClientType.

+	 */

+	public enum AsdcClientType {

+

+		/** The in memory. */

+		IN_MEMORY,

+

+		/** The rest. */

+		REST,

+

+		/** The local. */

+		LOCAL

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/properties/Features.java b/onap-enabler-be/src/main/java/org/onap/osam/properties/Features.java
new file mode 100644
index 0000000..995e608
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/properties/Features.java
@@ -0,0 +1,51 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.properties;

+

+import org.togglz.core.Feature;

+import org.togglz.core.context.FeatureContext;

+

+public enum Features implements Feature {

+

+

+    FLAG_ASYNC_JOBS,

+    FLAG_REGION_ID_FROM_REMOTE,

+    CREATE_INSTANCE_TEST,

+    EMPTY_DRAWING_BOARD_TEST,

+    FLAG_ADVANCED_PORTS_FILTER,

+    FLAG_ADD_MSO_TESTAPI_FIELD,

+    FLAG_ASYNC_INSTANTIATION,

+    FLAG_SERVICE_MODEL_CACHE,

+    FLAG_UNASSIGN_SERVICE,

+    FLAG_NETWORK_TO_ASYNC_INSTANTIATION,

+    FLAG_COLLECTION_RESOURCE_SUPPORT,

+    FLAG_SHOW_ASSIGNMENTS,

+    FLAG_SHOW_VERIFY_SERVICE,

+    FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD,

+    FLAG_PNP_INSTANTIATION;

+

+    public boolean isActive() {

+        return FeatureContext.getFeatureManager().isActive(this);

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/properties/FeaturesTogglingConfiguration.java b/onap-enabler-be/src/main/java/org/onap/osam/properties/FeaturesTogglingConfiguration.java
new file mode 100644
index 0000000..86761a8
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/properties/FeaturesTogglingConfiguration.java
@@ -0,0 +1,62 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.properties;

+

+import org.apache.commons.lang3.StringUtils;

+import org.springframework.context.ApplicationListener;

+import org.springframework.context.annotation.Bean;

+import org.springframework.context.annotation.Configuration;

+import org.springframework.core.env.Environment;

+import org.togglz.core.manager.FeatureManager;

+import org.togglz.core.manager.FeatureManagerBuilder;

+import org.togglz.core.repository.file.FileBasedStateRepository;

+import org.togglz.spring.listener.TogglzApplicationContextBinderApplicationListener;

+

+import javax.servlet.ServletContext;

+import java.io.File;

+

+@Configuration

+public class FeaturesTogglingConfiguration {

+    @Bean

+    public ApplicationListener getApplicationListener() {

+        return new TogglzApplicationContextBinderApplicationListener();

+    }

+

+    @Bean

+    public FeatureManager featureManager(ServletContext servletContext, Environment environment) {

+        final String defaultFilename = "features.properties";

+

+        String filename = environment.getProperty("featureFlags.filename");

+

+        if (StringUtils.isBlank(filename)) {

+            filename = defaultFilename;

+        }

+

+        return new FeatureManagerBuilder()

+                .featureEnum(Features.class)

+                .stateRepository(new FileBasedStateRepository(

+                        new File(servletContext.getRealPath("/WEB-INF/conf/" + filename))

+                ))

+                .build();

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/properties/VidProperties.java b/onap-enabler-be/src/main/java/org/onap/osam/properties/VidProperties.java
new file mode 100644
index 0000000..1dedd29
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/properties/VidProperties.java
@@ -0,0 +1,95 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.properties;

+

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.onap.osam.model.ModelConstants;

+

+import java.text.DateFormat;

+import java.text.SimpleDateFormat;

+import java.util.Date;

+public class VidProperties extends SystemProperties {

+

+	//VID General Properties

+	public static final String MSO_DISPLAY_TEST_API_ON_SCREEN="mso.displayTestAPIOnScreen";

+	public static final String MSO_DEFAULT_TEST_API="mso.defaultTestAPI";

+	public static final String MSO_MAX_OPENED_INSTANTIATION_REQUESTS="mso.maxOpenedInstantiationRequests";

+	public static final String MSO_ASYNC_POLLING_INTERVAL_SECONDS="mso.asyncPollingIntervalSeconds";

+

+	public static final String VID_TRUSTSTORE_FILENAME = "vid.truststore.filename";

+	

+	/** The Constant VID_TRUSTSTORE_PASSWD_X. */

+	public static final String VID_TRUSTSTORE_PASSWD_X = "vid.truststore.passwd.x";

+	

+	/** The Constant FILESEPARATOR. */

+	public static final String FILESEPARATOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");

+	

+	/** The Constant LOG. */

+	private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VidProperties.class);

+	

+	/** The Constant dateFormat. */

+	final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");

+	/**

+	 * Gets the asdc model namespace prefix property

+	 * 

+	 * @return the property value or a default value

+	 */

+	public static String getAsdcModelNamespace() {

+		String methodName = "getAsdcModelNamespace ";

+		String asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;

+	    try {

+	        asdcModelNamespace = SystemProperties.getProperty(ModelConstants.ASDC_MODEL_NAMESPACE);

+	        if ( asdcModelNamespace == null || asdcModelNamespace.isEmpty()) {

+		    	asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;

+		    }

+	    }

+	    catch ( Exception e ) {

+	    	LOG.error (EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + "unable to find the value, using the default "

+	    			+ ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE);

+	    	asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;

+	    }

+	    return (asdcModelNamespace);

+	}

+	/**

+	 * Gets the specified property value. If the property is not defined, returns a default value.

+	 * 

+	 * @return the property value or a default value

+	 */

+	public static String getPropertyWithDefault ( String propName, String defaultValue ) {

+		String methodName = "getPropertyWithDefault ";

+		String propValue = defaultValue;

+	    try {

+	        propValue = SystemProperties.getProperty(propName);

+	        if ( propValue == null || propValue.isEmpty()) {

+		    	propValue = defaultValue;

+		    }

+	    }

+	    catch ( Exception e ) {

+	    	LOG.error (EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + "unable to find the value, using the default "

+	    			+ defaultValue);

+	    	propValue = defaultValue;

+	    }

+	    return (propValue);

+	}

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/roles/EcompRole.java b/onap-enabler-be/src/main/java/org/onap/osam/roles/EcompRole.java
new file mode 100644
index 0000000..5a6ec35
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/roles/EcompRole.java
@@ -0,0 +1,27 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.roles;

+

+public enum EcompRole {

+	READ;

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/roles/Role.java b/onap-enabler-be/src/main/java/org/onap/osam/roles/Role.java
new file mode 100644
index 0000000..e24eb6e
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/roles/Role.java
@@ -0,0 +1,67 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.roles;

+

+

+public class Role {

+

+    private EcompRole ecompRole;

+

+    private String subscribeName;

+

+    private String serviceType;

+

+    private String tenant;

+

+    public Role(EcompRole ecompRole, String subscribeName, String serviceType, String tenant) {

+        this.ecompRole = ecompRole;

+        this.subscribeName = subscribeName;

+        this.serviceType = serviceType;

+        this.tenant = tenant;

+    }

+

+    public EcompRole getEcompRole() {

+        return ecompRole;

+    }

+

+

+    public String getSubscribeName() {

+        return subscribeName;

+    }

+

+    public void setSubscribeName(String subscribeName) {

+        this.subscribeName = subscribeName;

+    }

+

+    public String getServiceType() {

+        return serviceType;

+    }

+

+

+    public String getTenant() {

+        return tenant;

+    }

+

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/roles/RoleProvider.java b/onap-enabler-be/src/main/java/org/onap/osam/roles/RoleProvider.java
new file mode 100644
index 0000000..e6b503a
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/roles/RoleProvider.java
@@ -0,0 +1,156 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.roles;

+

+import com.fasterxml.jackson.core.JsonProcessingException;

+import com.fasterxml.jackson.databind.ObjectMapper;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.web.support.UserUtils;

+import org.onap.osam.aai.AaiResponse;

+import org.onap.osam.aai.exceptions.RoleParsingException;

+import org.onap.osam.model.ModelConstants;

+import org.onap.osam.model.Subscriber;

+import org.onap.osam.model.SubscriberList;

+import org.onap.osam.services.IAaiService;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Component;

+

+import javax.servlet.http.HttpServletRequest;

+import java.util.*;

+

+//import org.codehaus.jackson.map.ObjectMapper;

+

+

+@Component

+public class RoleProvider {

+

+    private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(RoleProvider.class);

+    final String readPermissionString = "read";

+    SubscriberList subscribers;

+    ObjectMapper om = new ObjectMapper();

+    @Autowired

+    private IAaiService aaiService;

+

+    public static List<String> extractRoleFromSession(HttpServletRequest request) {

+

+        return new ArrayList<String>();

+

+    }

+

+    public void init() {

+        LOG.debug(EELFLoggerDelegate.debugLogger, "Role provider => init method started");

+        AaiResponse<SubscriberList> subscribersResponse = aaiService.getFullSubscriberList();

+        subscribers = subscribersResponse.getT();

+        LOG.debug(EELFLoggerDelegate.debugLogger, "Role provider => init method finished");

+    }

+

+    public List<Role> getUserRoles(HttpServletRequest request) throws JsonProcessingException {

+        String logPrefix = "Role Provider (" + UserUtils.getUserId(request) + ") ==>";

+

+        LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + "Entering to get user role for user " + UserUtils.getUserId(request));

+

+        List<Role> roleList = new ArrayList<>();

+        //Disable roles until AAF integration finishes

+        /*HashMap roles = UserUtils.getRoles(request);

+        for (Object role : roles.keySet()) {

+            org.openecomp.portalsdk.core.domain.Role sdkRol = (org.openecomp.portalsdk.core.domain.Role) roles.get(role);

+

+            LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + "Role " + sdkRol.getName() + " is being proccessed");

+            try {

+                if (sdkRol.getName().contains(readPermissionString)) {

+                    LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + " Role " + sdkRol.getName() + " contain " + readPermissionString);

+

+                    continue;

+                }

+                String[] roleParts = splitRole((sdkRol.getName()), logPrefix);

+                roleList.add(createRoleFromStringArr(roleParts, logPrefix));

+                String msg = String.format(logPrefix + " User %s got permissions %s", UserUtils.getUserId(request), Arrays.toString(roleParts));

+                LOG.debug(EELFLoggerDelegate.debugLogger, msg);

+            } catch (RoleParsingException e) {

+                LOG.error(logPrefix + " Failed to parse permission");

+

+            }

+        }*/

+

+        return roleList;

+    }

+

+    public String[] splitRole(String roleAsString, String logPrefix) {

+        LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + "Spliting role = " + roleAsString + "With delimeter = " + ModelConstants.ROLE_DELIMITER);

+        return roleAsString.split(ModelConstants.ROLE_DELIMITER);

+    }

+

+    public boolean userPermissionIsReadOnly(List<Role> roles) {

+

+        return (!(roles.size() > 0));

+    }

+

+    public boolean userPermissionIsReadLogs(List<Role> roles){

+        for(Role role: roles){

+            if(role.getServiceType().equals("LOGS")){

+                if(role.getTenant().equals("PERMITTED")){

+                    return true;

+                }

+            }

+        }

+        return false;

+    }

+

+    private String replaceSubscriberNameToGlobalCustomerID(String subscriberName, String logPrefix) throws JsonProcessingException {

+        if (subscribers == null) {

+            LOG.debug(EELFLoggerDelegate.debugLogger, "replaceSubscriberNameToGlobalCustomerID calling init method");

+            init();

+        }

+        LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + "subscribers list size is  " + subscribers.customer.size() + " with the values " + om.writeValueAsString(subscribers.customer));

+        LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + "subscribers list size is  " + subscribers.customer.size() + " with the values " + om.writeValueAsString(subscribers.customer));

+

+

+        Optional<Subscriber> s = subscribers.customer.stream().filter(x -> x.subscriberName.equals(subscriberName)).findFirst();

+        //Fixing bug of logging "optional get" before isPresent

+        String replacement = s.isPresent() ? s.get().globalCustomerId : "";

+        LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + "Subscribername " + subscriberName + " changed to  " + replacement);

+        return replacement;

+    }

+

+    public Role createRoleFromStringArr(String[] roleParts, String rolePrefix) throws JsonProcessingException, RoleParsingException {

+        String globalCustomerID = replaceSubscriberNameToGlobalCustomerID(roleParts[0], rolePrefix);

+        try {

+            if (roleParts.length > 2) {

+                return new Role(EcompRole.READ, globalCustomerID, roleParts[1], roleParts[2]);

+            } else {

+                return new Role(EcompRole.READ, globalCustomerID, roleParts[1], null);

+            }

+        } catch (ArrayIndexOutOfBoundsException e) {

+            if (roleParts.length > 0)

+                LOG.debug(EELFLoggerDelegate.debugLogger, "Could not parse role ", roleParts[0]);

+            else {

+                LOG.debug(EELFLoggerDelegate.debugLogger, "Got empty role, Could not parse it ");

+

+            }

+            throw new RoleParsingException();

+        }

+

+    }

+

+}

+

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/roles/RoleValidator.java b/onap-enabler-be/src/main/java/org/onap/osam/roles/RoleValidator.java
new file mode 100644
index 0000000..deddcee
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/roles/RoleValidator.java
@@ -0,0 +1,85 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.roles;

+

+import org.onap.osam.mso.rest.RequestDetails;

+

+import java.util.List;

+import java.util.Map;

+

+public class RoleValidator {

+

+    private boolean disableRoles = true;

+    private List<Role> userRoles;

+

+    public RoleValidator(List<Role> roles) {

+        this.userRoles = roles;

+    }

+

+    public boolean isSubscriberPermitted(String subscriberName) {

+        if(this.disableRoles) return true;

+        

+        for (Role role : userRoles) {

+            if (role.getSubscribeName().equals(subscriberName))

+                return true;

+        }

+        return false;

+    }

+

+    public boolean isServicePermitted(String subscriberName, String serviceType) {

+        if(this.disableRoles) return true;

+        

+        for (Role role : userRoles) {

+            if (role.getSubscribeName().equals(subscriberName) && role.getServiceType().equals(serviceType))

+                return true;

+        }

+        return false;

+    }

+

+    public boolean isMsoRequestValid(RequestDetails mso_request) {

+        if(this.disableRoles) return true;

+        

+        try {

+            String globalSubscriberIdRequested = (String) ((Map) ((Map) mso_request.getAdditionalProperties().get("requestDetails")).get("subscriberInfo")).get("globalSubscriberId");

+            String serviceType = (String) ((Map) ((Map) mso_request.getAdditionalProperties().get("requestDetails")).get("requestParameters")).get("subscriptionServiceType");

+            return isServicePermitted(globalSubscriberIdRequested, serviceType);

+        } catch (Exception e) {

+            //Until we'll get the exact information regarding the tenants and the global customer id, we'll return true on unknown requests to mso

+            return true;

+        }

+//        return false;

+    }

+

+    public boolean isTenantPermitted(String globalCustomerId, String serviceType, String tenantName) {

+        if(this.disableRoles) return true;

+        

+        for (Role role : userRoles) {

+            if (role.getSubscribeName().equals(globalCustomerId)

+                    && role.getServiceType().equals(serviceType)

+                    && (role.getTenant() == null || role.getTenant().equalsIgnoreCase(tenantName))) {

+                return true;

+            }

+        }

+        return false;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/scheduler/RestObject.java b/onap-enabler-be/src/main/java/org/onap/osam/scheduler/RestObject.java
new file mode 100644
index 0000000..6bee4e4
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/scheduler/RestObject.java
@@ -0,0 +1,46 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.scheduler;

+

+

+public class RestObject<T> {

+	

+    private T t;

+   

+    private int statusCode= 0;

+    

+    public String uuid;

+    

+    public void set(T t) { this.t = t; }

+    

+    public T get() { return t; }

+	   

+    public void setStatusCode(int v) { this.statusCode = v; }

+       

+    public int getStatusCode() { return this.statusCode; }

+        

+    public void setUUID(String uuid) { this.uuid = uuid; }

+    

+    public String getUUID() { return this.uuid; }

+}

+

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/scheduler/RestObjects/RestObject.java b/onap-enabler-be/src/main/java/org/onap/osam/scheduler/RestObjects/RestObject.java
new file mode 100644
index 0000000..fd01133
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/scheduler/RestObjects/RestObject.java
@@ -0,0 +1,41 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.scheduler.RestObjects;

+

+

+public class RestObject<T> {

+	

+    private T t;

+   

+    private int statusCode= 0;

+        

+    public void set(T t) { this.t = t; }

+    

+    public T get() { return t; }

+	   

+    public void setStatusCode(int v) { this.statusCode = v; }

+       

+    public int getStatusCode() { return this.statusCode; }

+        

+}

+

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/scheduler/SchedulerProperties.java b/onap-enabler-be/src/main/java/org/onap/osam/scheduler/SchedulerProperties.java
new file mode 100644
index 0000000..e313d93
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/scheduler/SchedulerProperties.java
@@ -0,0 +1,43 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.scheduler;

+

+import org.onap.portalsdk.core.util.SystemProperties;

+

+

+public class SchedulerProperties extends SystemProperties { 

+	

+	public static final String SCHEDULER_USER_NAME_VAL =  "scheduler.user.name";

+		

+	public static final String SCHEDULER_PASSWORD_VAL = "scheduler.password";

+	

+	public static final String SCHEDULER_SERVER_URL_VAL = "scheduler.server.url";

+

+	public static final String SCHEDULER_GET_SCHEDULES = "scheduler.get.schedules";

+

+	public static final String SCHEDULER_DELETE_SCHEDULE = "scheduler.delete.schedule";

+

+	public static final String SCHEDULER_BASIC_AUTH =  "scheduler.basic.auth";

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/scheduler/SchedulerRestInterface.java b/onap-enabler-be/src/main/java/org/onap/osam/scheduler/SchedulerRestInterface.java
new file mode 100644
index 0000000..c764108
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/scheduler/SchedulerRestInterface.java
@@ -0,0 +1,133 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.scheduler;

+

+import com.att.eelf.configuration.EELFLogger;

+import com.google.common.collect.ImmutableMap;

+import com.google.common.collect.Maps;

+import io.joshworks.restclient.http.HttpResponse;

+import org.eclipse.jetty.util.security.Password;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.onap.osam.client.SyncRestClient;

+import org.onap.osam.client.SyncRestClientInterface;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.osam.utils.Logging;

+import org.springframework.http.HttpMethod;

+import org.springframework.stereotype.Service;

+

+import java.util.Base64;

+import java.util.Collections;

+import java.util.Map;

+import java.util.function.Function;

+

+import static org.onap.osam.utils.Logging.REQUEST_ID_HEADER_KEY;

+

+@Service

+public class SchedulerRestInterface implements SchedulerRestInterfaceIfc {

+

+    final private static EELFLogger outgoingRequestsLogger = Logging.getRequestsLogger("scheduler");

+    private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerRestInterface.class);

+    private SyncRestClientInterface syncRestClient;

+    private Function<String, String> propertyGetter;

+    private Map<String, String> commonHeaders;

+

+    public SchedulerRestInterface() {

+        this.propertyGetter = SystemProperties::getProperty;

+    }

+

+    public SchedulerRestInterface(Function<String, String> propertyGetter) {

+        this.propertyGetter = propertyGetter;

+    }

+

+    public void initRestClient() {

+        logger.info("Starting to initialize rest client ");

+        String authStringEnc = calcEncodedAuthString();

+

+        commonHeaders = Maps.newHashMap();

+        commonHeaders.put("Authorization", "Basic " + authStringEnc);

+

+        syncRestClient = new SyncRestClient();

+

+        logger.info("\t<== Client Initialized \n");

+    }

+

+    public <T> void Get(T t, String sourceId, String path, org.onap.osam.scheduler.RestObject<T> restObject) {

+        initRestClient();

+        String methodName = "Get";

+        String url = String.format("%s%s", propertyGetter.apply(SchedulerProperties.SCHEDULER_SERVER_URL_VAL), path);

+        Logging.logRequest(outgoingRequestsLogger, HttpMethod.GET, url);

+        Map<String, String> requestHeaders = ImmutableMap.<String, String>builder()

+                .putAll(commonHeaders)

+                .put(REQUEST_ID_HEADER_KEY, Logging.extractOrGenerateRequestId()).build();

+        final HttpResponse<T> response = ((HttpResponse<T>) syncRestClient.get(url, requestHeaders,

+                Collections.emptyMap(), t.getClass()));

+        Logging.logResponse(outgoingRequestsLogger, HttpMethod.GET, url, response);

+        int status = response.getStatus();

+        restObject.setStatusCode(status);

+

+        if (status == 200) {

+            t = response.getBody();

+            restObject.set(t);

+

+        } else {

+            throw new GenericUncheckedException(String.format("%s with status=%d, url=%s", methodName, status, url));

+        }

+    }

+

+    public <T> void Delete(T t, String sourceID, String path, org.onap.osam.scheduler.RestObject<T> restObject) {

+        initRestClient();

+        String url = String.format("%s%s", propertyGetter.apply(SchedulerProperties.SCHEDULER_SERVER_URL_VAL), path);

+        Logging.logRequest(outgoingRequestsLogger, HttpMethod.DELETE, url);

+        Map<String, String> requestHeaders = ImmutableMap.<String, String>builder()

+                .putAll(commonHeaders)

+                .put(REQUEST_ID_HEADER_KEY, Logging.extractOrGenerateRequestId()).build();

+        final HttpResponse<T> response = (HttpResponse<T>) syncRestClient.delete(url, requestHeaders, t.getClass());

+

+        Logging.logResponse(outgoingRequestsLogger, HttpMethod.DELETE, url, response);

+

+        int status = response.getStatus();

+        restObject.setStatusCode(status);

+

+        t = response.getBody();

+        restObject.set(t);

+    }

+

+    public <T> T getInstance(Class<T> clazz) throws IllegalAccessException, InstantiationException {

+        return clazz.newInstance();

+    }

+

+    private String calcEncodedAuthString() {

+        String retrievedUsername = propertyGetter.apply(SchedulerProperties.SCHEDULER_USER_NAME_VAL);

+        final String username = retrievedUsername.isEmpty() ? "" : retrievedUsername;

+

+        String retrievedPassword = propertyGetter.apply(SchedulerProperties.SCHEDULER_PASSWORD_VAL);

+        final String password = retrievedPassword.isEmpty() ? "" : getDeobfuscatedPassword(retrievedPassword);

+

+        return Base64.getEncoder().encodeToString((username + ":" + password).getBytes());

+    }

+

+    private static String getDeobfuscatedPassword(String password) {

+        return password.contains("OBF:") ? Password.deobfuscate(password) : password;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/scheduler/SchedulerRestInterfaceIfc.java b/onap-enabler-be/src/main/java/org/onap/osam/scheduler/SchedulerRestInterfaceIfc.java
new file mode 100644
index 0000000..dbb5f67
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/scheduler/SchedulerRestInterfaceIfc.java
@@ -0,0 +1,39 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.scheduler;

+

+import org.springframework.stereotype.Service;

+

+@Service

+public interface SchedulerRestInterfaceIfc {

+

+	void initRestClient();

+

+	<T> void Get(T t, String sourceId, String path, org.onap.osam.scheduler.RestObject<T> restObject);

+

+	<T> void Delete(T t, String sourceID, String path, org.onap.osam.scheduler.RestObject<T> restObject)

+			throws Exception;

+

+}

+

+

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/AaiServiceImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/services/AaiServiceImpl.java
new file mode 100644
index 0000000..01de375
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/AaiServiceImpl.java
@@ -0,0 +1,480 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import org.apache.http.HttpStatus;

+import org.onap.osam.aai.AaiClientInterface;

+import org.onap.osam.aai.AaiResponse;

+import org.onap.osam.aai.ServiceInstance;

+import org.onap.osam.aai.ServiceInstancesSearchResults;

+import org.onap.osam.aai.ServiceSubscription;

+import org.onap.osam.aai.ServiceSubscriptions;

+import org.onap.osam.aai.Services;

+import org.onap.osam.aai.SubscriberFilteredResults;

+import org.onap.osam.aai.model.AaiGetAicZone.AicZones;

+import org.onap.osam.aai.model.AaiGetInstanceGroupsByCloudRegion;

+import org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.AaiGetNetworkCollectionDetails;

+import org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.AaiGetRelatedInstanceGroupsByVnfId;

+import org.onap.osam.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;

+import org.onap.osam.aai.model.AaiGetPnfs.Pnf;

+import org.onap.osam.aai.model.AaiGetServicesRequestModel.GetServicesAAIRespone;

+import org.onap.osam.aai.model.AaiGetTenatns.GetTenantsResponse;

+import org.onap.osam.aai.model.AaiRelationResponse;

+import org.onap.osam.aai.model.InstanceGroupInfo;

+import org.onap.osam.aai.model.LogicalLinkResponse;

+import org.onap.osam.aai.model.Model;

+import org.onap.osam.aai.model.OwningEntity;

+import org.onap.osam.aai.model.OwningEntityResponse;

+import org.onap.osam.aai.model.PortDetailsTranslator;

+import org.onap.osam.aai.model.Project;

+import org.onap.osam.aai.model.ProjectResponse;

+import org.onap.osam.aai.model.RelatedToProperty;

+import org.onap.osam.aai.model.Relationship;

+import org.onap.osam.aai.model.RelationshipData;

+import org.onap.osam.aai.model.RelationshipList;

+import org.onap.osam.aai.model.ServiceRelationships;

+import org.onap.osam.model.ServiceInstanceSearchResult;

+import org.onap.osam.model.SubscriberList;

+import org.onap.osam.roles.RoleValidator;

+import org.onap.osam.utils.Intersection;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.springframework.beans.factory.annotation.Autowired;

+

+import javax.ws.rs.core.Response;

+import java.io.UnsupportedEncodingException;

+import java.net.URLEncoder;

+import java.util.ArrayList;

+import java.util.List;

+import java.util.stream.Collectors;

+

+public class AaiServiceImpl implements IAaiService {

+    private static final String SERVICE_INSTANCE_ID = "service-instance.service-instance-id";

+    private static final String SERVICE_TYPE = "service-subscription.service-type";

+    private static final String CUSTOMER_ID = "customer.global-customer-id";

+    private static final String SERVICE_INSTANCE_NAME = "service-instance.service-instance-name";

+    private int indexOfSubscriberName = 6;

+

+    @Autowired

+    private AaiClientInterface aaiClient;

+

+    private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(AaiServiceImpl.class);

+

+    private boolean validateModel(Model model){

+        if (model == null) {

+            return false;

+        } else {

+            return model.getModelVers() != null && model.getModelVers().getModelVer() != null && model.getModelVers().getModelVer().get(0).getModelVersionId() != null;

+        }

+    }

+

+    private List<ServiceInstanceSearchResult> getServicesByOwningEntityId(List<String> owningEntities, RoleValidator roleValidator) {

+        AaiResponse<OwningEntityResponse> owningEntityResponse = aaiClient.getServicesByOwningEntityId(owningEntities);

+        List<ServiceInstanceSearchResult> serviceInstanceSearchResultList = new ArrayList<>();

+        if (owningEntityResponse.getT() != null) {

+            for (OwningEntity owningEntity : owningEntityResponse.getT().getOwningEntity()) {

+                if (owningEntity.getRelationshipList() != null) {

+                    serviceInstanceSearchResultList = convertRelationshipToSearchResult(owningEntity, serviceInstanceSearchResultList, roleValidator);

+                }

+            }

+        }

+        return serviceInstanceSearchResultList;

+    }

+

+    private List<ServiceInstanceSearchResult> getServicesByProjectNames(List<String> projectNames, RoleValidator roleValidator) {

+        AaiResponse<ProjectResponse> projectByIdResponse = aaiClient.getServicesByProjectNames(projectNames);

+        List<ServiceInstanceSearchResult> serviceInstanceSearchResultList = new ArrayList<>();

+        if (projectByIdResponse.getT() != null) {

+            for (Project project : projectByIdResponse.getT().getProject()) {

+                if (project.getRelationshipList() != null) {

+                    serviceInstanceSearchResultList = convertRelationshipToSearchResult(project, serviceInstanceSearchResultList, roleValidator);

+                }

+            }

+        }

+        return serviceInstanceSearchResultList;

+    }

+

+    private List<ServiceInstanceSearchResult> convertRelationshipToSearchResult(AaiRelationResponse owningEntityResponse, List<ServiceInstanceSearchResult> serviceInstanceSearchResultList, RoleValidator roleValidator) {

+        if (owningEntityResponse.getRelationshipList().getRelationship() != null) {

+            List<Relationship> relationshipList = owningEntityResponse.getRelationshipList().getRelationship();

+            for (Relationship relationship : relationshipList) {

+                ServiceInstanceSearchResult serviceInstanceSearchResult = new ServiceInstanceSearchResult();

+                extractRelationshipData(relationship, serviceInstanceSearchResult, roleValidator);

+                extractRelatedToProperty(relationship, serviceInstanceSearchResult);

+                serviceInstanceSearchResultList.add(serviceInstanceSearchResult);

+            }

+        }

+        return serviceInstanceSearchResultList;

+    }

+

+    private void extractRelationshipData(Relationship relationship, ServiceInstanceSearchResult serviceInstanceSearchResult, RoleValidator roleValidator) {

+        List<RelationshipData> relationshipDataList = relationship.getRelationDataList();

+        if (relationshipDataList != null) {

+            setSubscriberName(relationship, serviceInstanceSearchResult);

+            for (RelationshipData relationshipData : relationshipDataList) {

+                String key = relationshipData.getRelationshipKey();

+                if (key.equals(SERVICE_INSTANCE_ID)) {

+                    serviceInstanceSearchResult.setServiceInstanceId(relationshipData.getRelationshipValue());

+                } else if (key.equals(SERVICE_TYPE)) {

+                    serviceInstanceSearchResult.setServiceType(relationshipData.getRelationshipValue());

+                } else if (key.equals(CUSTOMER_ID)) {

+                    serviceInstanceSearchResult.setGlobalCustomerId(relationshipData.getRelationshipValue());

+                }

+            }

+

+            boolean isPermitted = roleValidator.isServicePermitted(serviceInstanceSearchResult.getSubscriberName(), serviceInstanceSearchResult.getServiceType());

+            serviceInstanceSearchResult.setIsPermitted(isPermitted);

+        }

+    }

+

+    private void setSubscriberName(Relationship relationship, ServiceInstanceSearchResult serviceInstanceSearchResult) {

+        String relatedLink = relationship.getRelatedLink();

+        String[] subsciber = relatedLink.split("/");

+        serviceInstanceSearchResult.setSubscriberName(subsciber[indexOfSubscriberName]);

+    }

+

+    private void extractRelatedToProperty(Relationship relationship, ServiceInstanceSearchResult serviceInstanceSearchResult) {

+        List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToPropertyList();

+        if (relatedToPropertyList != null) {

+            for (RelatedToProperty relatedToProperty : relatedToPropertyList) {

+                if (relatedToProperty.getPropertyKey().equals(SERVICE_INSTANCE_NAME)) {

+                    serviceInstanceSearchResult.setServiceInstanceName(relatedToProperty.getPropertyValue());

+                }

+            }

+        }

+    }

+

+    @Override

+    public SubscriberFilteredResults getFullSubscriberList(RoleValidator roleValidator) {

+        AaiResponse<SubscriberList> subscriberResponse = aaiClient.getAllSubscribers();

+

+        return new SubscriberFilteredResults(roleValidator, subscriberResponse.getT(),

+                subscriberResponse.getErrorMessage(),

+                subscriberResponse.getHttpCode());

+    }

+

+    @Override

+    public AaiResponse<OperationalEnvironmentList> getOperationalEnvironments(String operationalEnvironmentType, String operationalEnvironmentStatus) {

+        return aaiClient.getOperationalEnvironments(operationalEnvironmentType, operationalEnvironmentStatus);

+    }

+

+    @Override

+    public AaiResponse<SubscriberList> getFullSubscriberList() {

+        return aaiClient.getAllSubscribers();

+    }

+

+    @Override

+    public AaiResponse getSubscriberData(String subscriberId, RoleValidator roleValidator) {

+        AaiResponse<Services> subscriberResponse = aaiClient.getSubscriberData(subscriberId);

+        String subscriberGlobalId = subscriberResponse.getT().globalCustomerId;

+        for (ServiceSubscription serviceSubscription : subscriberResponse.getT().serviceSubscriptions.serviceSubscription) {

+            String serviceType = serviceSubscription.serviceType;

+            serviceSubscription.isPermitted = roleValidator.isServicePermitted(subscriberGlobalId, serviceType);

+        }

+        return subscriberResponse;

+

+    }

+

+    @Override

+    public AaiResponse getServiceInstanceSearchResults(String subscriberId, String instanceIdentifier, RoleValidator roleValidator, List<String> owningEntities, List<String> projects) {

+        List<List<ServiceInstanceSearchResult>> resultList = new ArrayList<>();

+        ServiceInstancesSearchResults serviceInstancesSearchResults = new ServiceInstancesSearchResults();

+

+        if (subscriberId != null || instanceIdentifier != null) {

+            resultList.add(getServicesBySubscriber(subscriberId, instanceIdentifier, roleValidator));

+        }

+        if (owningEntities != null) {

+            resultList.add(getServicesByOwningEntityId(owningEntities, roleValidator));

+        }

+        if (projects != null) {

+            resultList.add(getServicesByProjectNames(projects, roleValidator));

+        }

+        if (!resultList.isEmpty()) {

+            Intersection<ServiceInstanceSearchResult> intersection = new Intersection<>();

+            serviceInstancesSearchResults.serviceInstances = intersection.intersectMultipileArray(resultList);

+        }

+

+        return new AaiResponse<>(serviceInstancesSearchResults, null, HttpStatus.SC_OK);

+    }

+

+

+    private List<ServiceInstanceSearchResult> getServicesBySubscriber(String subscriberId, String instanceIdentifier, RoleValidator roleValidator) {

+        AaiResponse<Services> subscriberResponse = aaiClient.getSubscriberData(subscriberId);

+        String subscriberGlobalId = subscriberResponse.getT().globalCustomerId;

+        String subscriberName = subscriberResponse.getT().subscriberName;

+        ServiceSubscriptions serviceSubscriptions = subscriberResponse.getT().serviceSubscriptions;

+

+        return getSearchResultsForSubscriptions(serviceSubscriptions, subscriberId, instanceIdentifier, roleValidator, subscriberGlobalId, subscriberName);

+

+    }

+

+

+    private ArrayList<ServiceInstanceSearchResult> getSearchResultsForSubscriptions(ServiceSubscriptions serviceSubscriptions, String subscriberId, String instanceIdentifier, RoleValidator roleValidator, String subscriberGlobalId, String subscriberName) {

+        ArrayList<ServiceInstanceSearchResult> results = new ArrayList<>();

+

+        if (serviceSubscriptions != null) {

+            for (ServiceSubscription serviceSubscription : serviceSubscriptions.serviceSubscription) {

+                String serviceType = serviceSubscription.serviceType;

+                serviceSubscription.isPermitted = roleValidator.isServicePermitted(subscriberGlobalId, serviceType);

+                ArrayList<ServiceInstanceSearchResult> resultsForSubscription = getSearchResultsForSingleSubscription(serviceSubscription, subscriberId, instanceIdentifier, subscriberName, serviceType);

+                results.addAll(resultsForSubscription);

+            }

+        }

+

+        return results;

+    }

+

+    private ArrayList<ServiceInstanceSearchResult> getSearchResultsForSingleSubscription(ServiceSubscription serviceSubscription, String subscriberId, String instanceIdentifier, String subscriberName, String serviceType) {

+        ArrayList<ServiceInstanceSearchResult> results = new ArrayList<>();

+

+        if (serviceSubscription.serviceInstances != null) {

+            for (ServiceInstance serviceInstance : serviceSubscription.serviceInstances.serviceInstance) {

+                ServiceInstanceSearchResult serviceInstanceSearchResult =

+                        new ServiceInstanceSearchResult(serviceInstance.serviceInstanceId, subscriberId, serviceType, serviceInstance.serviceInstanceName,

+                                subscriberName, serviceInstance.modelInvariantId, serviceInstance.modelVersionId, serviceSubscription.isPermitted);

+

+                if (instanceIdentifier == null) {

+                    results.add(serviceInstanceSearchResult);

+                } else if (serviceInstanceMatchesIdentifier(instanceIdentifier, serviceInstance)) {

+                    results.add(serviceInstanceSearchResult);

+                }

+            }

+        }

+

+        return results;

+    }

+

+    private boolean serviceInstanceMatchesIdentifier(String instanceIdentifier, ServiceInstance serviceInstance) {

+        return instanceIdentifier.equals(serviceInstance.serviceInstanceId) || instanceIdentifier.equals(serviceInstance.serviceInstanceName);

+    }

+

+    @Override

+    public Response getVersionByInvariantId(List<String> modelInvariantId) {

+        try {

+            return aaiClient.getVersionByInvariantId(modelInvariantId);

+        } catch (Exception e) {

+            LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to getVersionByInvariantId from A&AI", e);

+        }

+        return null;

+    }

+

+    @Override

+    public AaiResponse<Pnf> getSpecificPnf(String pnfId) {

+        return aaiClient.getSpecificPnf(pnfId);

+    }

+

+    @Override

+    public AaiResponse getPNFData(String globalCustomerId, String serviceType, String modelVersionId, String modelInvariantId, String cloudRegion, String equipVendor, String equipModel) {

+        return aaiClient.getPNFData(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion, equipVendor, equipModel);

+    }

+

+

+

+    @Override

+    public AaiResponse getServices(RoleValidator roleValidator) {

+        AaiResponse<GetServicesAAIRespone> subscriberResponse = aaiClient.getServices();

+        if (subscriberResponse.getT() != null) {

+            for (org.onap.osam.aai.model.AaiGetServicesRequestModel.Service service : subscriberResponse.getT().service) {

+                service.isPermitted = true;

+            }

+        }

+        return subscriberResponse;

+    }

+

+    @Override

+    public AaiResponse<GetTenantsResponse[]> getTenants(String globalCustomerId, String serviceType, RoleValidator roleValidator) {

+        AaiResponse<GetTenantsResponse[]> aaiGetTenantsResponse = aaiClient.getTenants(globalCustomerId, serviceType);

+        GetTenantsResponse[] tenants = aaiGetTenantsResponse.getT();

+        if (tenants != null) {

+            for (int i = 0; i < tenants.length; i++) {

+                tenants[i].isPermitted = roleValidator.isTenantPermitted(globalCustomerId, serviceType, tenants[i].tenantName);

+            }

+        }

+        return aaiGetTenantsResponse;

+

+

+    }

+

+    @Override

+    public AaiResponse getVNFData(String globalSubscriberId, String serviceType, String serviceInstanceId) {

+        return aaiClient.getVNFData(globalSubscriberId, serviceType, serviceInstanceId);

+    }

+

+    @Override

+    public Response getVNFData(String globalSubscriberId, String serviceType) {

+        return aaiClient.getVNFData(globalSubscriberId, serviceType);

+    }

+

+    @Override

+    public AaiResponse getAaiZones() {

+        return (AaiResponse<AicZones>) aaiClient.getAllAicZones();

+    }

+

+    @Override

+    public AaiResponse getAicZoneForPnf(String globalCustomerId, String serviceType, String serviceId) {

+        String aicZone = "";

+

+        AaiResponse<ServiceRelationships> serviceInstanceResp = aaiClient.getServiceInstance(globalCustomerId, serviceType, serviceId);

+        if (serviceInstanceResp.getT() != null) {

+            List<String> aicZoneList = getRelationshipDataByType(serviceInstanceResp.getT().getRelationshipList(), "zone", "zone.zone-id");

+            if (!aicZoneList.isEmpty()) {

+                aicZone = aicZoneList.get(0);

+            } else {

+                LOGGER.warn("aic zone not found for service instance " + serviceId);

+            }

+        } else {

+            if (serviceInstanceResp.getErrorMessage() != null) {

+                LOGGER.error("get service instance {} return error {}", serviceId, serviceInstanceResp.getErrorMessage());

+                return new AaiResponse(aicZone , serviceInstanceResp.getErrorMessage() ,serviceInstanceResp.getHttpCode());

+            } else {

+                LOGGER.warn("get service instance {} return empty body", serviceId);

+                return new AaiResponse(aicZone , "get service instance " + serviceId + " return empty body" ,serviceInstanceResp.getHttpCode());

+            }

+        }

+

+        return new AaiResponse(aicZone , null ,HttpStatus.SC_OK);

+    }

+

+    @Override

+    public AaiResponse getNodeTemplateInstances(String globalCustomerId, String serviceType, String modelVersionId, String modelInvariantId, String cloudRegion) {

+        return aaiClient.getNodeTemplateInstances(globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegion);

+    }

+

+    @Override

+    public AaiResponse getNetworkCollectionDetails(String serviceInstanceId){

+        AaiResponse<AaiGetNetworkCollectionDetails> getNetworkCollectionDetailsAaiResponse = aaiClient.getNetworkCollectionDetails(serviceInstanceId);

+        return getNetworkCollectionDetailsAaiResponse;

+    }

+

+    @Override

+    public AaiResponse<AaiGetInstanceGroupsByCloudRegion> getInstanceGroupsByCloudRegion(String cloudOwner, String cloudRegionId, String networkFunction){

+        AaiResponse<AaiGetInstanceGroupsByCloudRegion> getInstanceGroupsByCloudRegionResponse = aaiClient.getInstanceGroupsByCloudRegion(cloudOwner, cloudRegionId, networkFunction);

+        return getInstanceGroupsByCloudRegionResponse;

+    }

+

+     @Override

+    public List<String> getServiceInstanceAssociatedPnfs(String globalCustomerId, String serviceType, String serviceInstanceId) {

+        List<String> pnfs = new ArrayList<>();

+

+        AaiResponse<ServiceRelationships> serviceInstanceResp = aaiClient.getServiceInstance(globalCustomerId, serviceType, serviceInstanceId);

+        if (serviceInstanceResp.getT() != null) {

+

+            addPnfsToListViaLogicalLinks(pnfs, serviceInstanceResp);

+            addPnfsToListViaDirectRelations(pnfs, serviceInstanceResp);

+

+            if (pnfs.isEmpty()) {

+                LOGGER.warn("no pnf direct relation found for service id:" + serviceInstanceId+

+                        " name: "+serviceInstanceResp.getT().getServiceInstanceName());

+            }

+        } else {

+            if (serviceInstanceResp.getErrorMessage() != null) {

+                LOGGER.error("get service instance {} return error {}", serviceInstanceId, serviceInstanceResp.getErrorMessage());

+            } else {

+                LOGGER.warn("get service instance {} return empty body", serviceInstanceId);

+            }

+        }

+

+        return pnfs.stream().distinct().collect(Collectors.toList());

+    }

+

+    @Override

+    public AaiResponse getInstanceGroupsByVnfInstanceId(String vnfInstanceId){

+        AaiResponse<AaiGetRelatedInstanceGroupsByVnfId> aaiResponse = aaiClient.getInstanceGroupsByVnfInstanceId(vnfInstanceId);

+        if(aaiResponse.getHttpCode() == HttpStatus.SC_OK){

+            return new AaiResponse(convertGetInstanceGroupsResponseToSimpleResponse(aaiResponse.getT()), aaiResponse.getErrorMessage(), aaiResponse.getHttpCode());

+        }

+        return aaiClient.getInstanceGroupsByVnfInstanceId(vnfInstanceId);

+    }

+

+    private List<InstanceGroupInfo> convertGetInstanceGroupsResponseToSimpleResponse(AaiGetRelatedInstanceGroupsByVnfId response) {

+        List<InstanceGroupInfo> instanceGroupInfoList = new ArrayList<>();

+        for(org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.Relationship relationship: response.getRelationshipList().getRelationship()){

+            getInstanceGroupInfoFromRelationship(relationship, instanceGroupInfoList);

+        }

+        return instanceGroupInfoList;

+    }

+

+    private void getInstanceGroupInfoFromRelationship(org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.Relationship relationship, List<InstanceGroupInfo> instanceGroupInfoList) {

+        if(relationship.getRelatedTo().equals("instance-group")){

+            for(org.onap.osam.aai.model.AaiGetNetworkCollectionDetails.RelatedToProperty relatedToProperty: relationship.getRelatedToPropertyList()){

+                if(relatedToProperty.getPropertyKey().equals("instance-group.instance-group-name")){

+                    instanceGroupInfoList.add(new InstanceGroupInfo(relatedToProperty.getPropertyValue()));

+                }

+            }

+        }

+    }

+

+    @Override

+    public  List<PortDetailsTranslator.PortDetails> getPortMirroringSourcePorts(String configurationId){

+        return aaiClient.getPortMirroringSourcePorts(configurationId);

+    }

+

+    private void addPnfsToListViaDirectRelations(List<String> pnfs, AaiResponse<ServiceRelationships> serviceInstanceResp) {

+        pnfs.addAll(getRelationshipDataByType(serviceInstanceResp.getT().getRelationshipList(), "pnf", "pnf.pnf-name"));

+    }

+

+    private void addPnfsToListViaLogicalLinks(List<String> pnfs, AaiResponse<ServiceRelationships> serviceInstanceResp) {

+        List<String> logicalLinks = getRelationshipDataByType(serviceInstanceResp.getT().getRelationshipList(), "logical-link", "logical-link.link-name");

+        for (String logicalLink : logicalLinks) {

+            String link;

+            try {

+                link = URLEncoder.encode(logicalLink, "UTF-8");

+            } catch (UnsupportedEncodingException e) {

+                LOGGER.error("Failed to encode logical link: " + logicalLink, e);

+                continue;

+            }

+

+            AaiResponse<LogicalLinkResponse> logicalLinkResp = aaiClient.getLogicalLink(link);

+            if (logicalLinkResp.getT() != null) {

+                //lag-interface is the key for pnf - approved by Bracha

+                List<String> linkPnfs = getRelationshipDataByType(logicalLinkResp.getT().getRelationshipList(), "lag-interface", "pnf.pnf-name");

+                if (!linkPnfs.isEmpty()) {

+                    pnfs.addAll(linkPnfs);

+                } else {

+                    LOGGER.warn("no pnf found for logical link " + logicalLink);

+                }

+            } else {

+                if (logicalLinkResp.getErrorMessage() != null) {

+                    LOGGER.error("get logical link " + logicalLink + " return error", logicalLinkResp.getErrorMessage());

+                } else {

+                    LOGGER.warn("get logical link " + logicalLink + " return empty body");

+                }

+            }

+        }

+    }

+

+    private List<String> getRelationshipDataByType(RelationshipList relationshipList, String relationshipType, String relationshipDataKey) {

+        List<String> relationshipValues = new ArrayList<>();

+        for (Relationship relationship : relationshipList.getRelationship()) {

+            if (relationship.getRelatedTo().equals(relationshipType)) {

+                relationshipValues.addAll( relationship.getRelationDataList().stream()

+                        .filter(rel -> rel.getRelationshipKey().equals(relationshipDataKey))

+                        .map(RelationshipData::getRelationshipValue)

+                        .collect(Collectors.toList())

+                );

+            }

+        }

+

+

+        return relationshipValues;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/AsyncInstantiationBusinessLogicImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/services/AsyncInstantiationBusinessLogicImpl.java
new file mode 100644
index 0000000..71be06a
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/AsyncInstantiationBusinessLogicImpl.java
@@ -0,0 +1,506 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import com.google.common.collect.ImmutableMap;

+import org.apache.commons.collections.CollectionUtils;

+import org.apache.commons.lang3.StringUtils;

+import org.hibernate.SessionFactory;

+import org.onap.osam.aai.AaiClientInterface;

+import org.onap.osam.aai.AaiResponse;

+import org.onap.osam.aai.exceptions.InvalidAAIResponseException;

+import org.onap.osam.aai.model.AaiNodeQueryResponse;

+import org.onap.osam.aai.model.ResourceType;

+import org.onap.osam.domain.mso.CloudConfiguration;

+import org.onap.osam.exceptions.DbFailureUncheckedException;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.osam.exceptions.MaxRetriesException;

+import org.onap.osam.exceptions.OperationNotAllowedException;

+import org.onap.osam.job.Job;

+import org.onap.osam.job.Job.JobStatus;

+import org.onap.osam.job.JobAdapter;

+import org.onap.osam.job.JobType;

+import org.onap.osam.job.JobsBrokerService;

+import org.onap.osam.model.JobAuditStatus;

+import org.onap.osam.model.NameCounter;

+import org.onap.osam.model.ServiceInfo;

+import org.onap.osam.model.serviceInstantiation.ServiceInstantiation;

+import org.onap.osam.model.serviceInstantiation.VfModule;

+import org.onap.osam.model.serviceInstantiation.Vnf;

+import org.onap.osam.mso.MsoBusinessLogicImpl;

+import org.onap.osam.mso.MsoProperties;

+import org.onap.osam.mso.model.ServiceInstantiationRequestDetails;

+import org.onap.osam.mso.rest.AsyncRequestStatus;

+import org.onap.osam.utils.DaoUtils;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.service.DataAccessService;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Service;

+

+import java.sql.Timestamp;

+import java.time.LocalDateTime;

+import java.util.*;

+import java.util.function.Consumer;

+import java.util.stream.Collectors;

+

+@Service

+public class AsyncInstantiationBusinessLogicImpl implements IAsyncInstantiationBusinessLogic {

+

+    private static final int MAX_RETRIES_GETTING_COUNTER = 100;

+    private static final int MAX_RETRIES_GETTING_FREE_NAME_FROM_AAI = 10000;

+    public static final String NAME_FOR_CHECK_AAI_STATUS = "NAME_FOR_CHECK_AAI_STATUS";

+

+    private final DataAccessService dataAccessService;

+

+    private final JobAdapter jobAdapter;

+

+    private final JobsBrokerService jobService;

+

+    private SessionFactory sessionFactory;

+

+    private AaiClientInterface aaiClient;

+

+    private int maxRetriesGettingFreeNameFromAai = MAX_RETRIES_GETTING_FREE_NAME_FROM_AAI;

+

+    private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AsyncInstantiationBusinessLogicImpl.class);

+    private Map<String, JobStatus> msoStateToJobStatusMap = ImmutableMap.<String, JobStatus>builder()

+            .put("inprogress", JobStatus.IN_PROGRESS)

+            .put("failed", JobStatus.FAILED)

+            .put("pause", JobStatus.PAUSE)

+            .put("paused", JobStatus.PAUSE)

+            .put("complete", JobStatus.COMPLETED)

+            .put("pending", JobStatus.IN_PROGRESS)

+            .put("pendingmanualtask", JobStatus.PAUSE)

+            .put("unlocked", JobStatus.IN_PROGRESS)

+            .build();

+

+

+    @Autowired

+    public AsyncInstantiationBusinessLogicImpl(DataAccessService dataAccessService,

+                                               JobAdapter jobAdapter,

+                                               JobsBrokerService jobService,

+                                               SessionFactory sessionFactory,

+                                               AaiClientInterface aaiClient) {

+        this.dataAccessService = dataAccessService;

+        this.jobAdapter = jobAdapter;

+        this.jobService = jobService;

+        this.sessionFactory = sessionFactory;

+        this.aaiClient = aaiClient;

+    }

+

+    @Override

+    public List<ServiceInfo> getAllServicesInfo() {

+        return dataAccessService.getList(ServiceInfo.class, filterByCreationDateAndNotDeleted(), orderByCreatedDateAndStatus(), null);

+    }

+

+    private String filterByCreationDateAndNotDeleted() {

+        LocalDateTime minus3Months = LocalDateTime.now().minusMonths(3);

+        Timestamp filterDate = Timestamp.valueOf(minus3Months);

+        return " where" +

+                "   hidden = false" +

+                "   and deleted_at is null" +  // don't fetch deleted

+                "   and created >= '" + filterDate + "' ";

+    }

+

+    private String orderByCreatedDateAndStatus() {

+        return " createdBulkDate DESC ,\n" +

+                "  (CASE jobStatus\n" +

+                "   WHEN 'COMPLETED' THEN 0\n" +

+                "   WHEN 'FAILED' THEN 0\n" +

+                "   WHEN 'IN_PROGRESS' THEN 1\n" +

+                "   WHEN 'PAUSE' THEN 2\n" +

+                "   WHEN 'PENDING' THEN 3\n" +

+                "   WHEN 'STOPPED' THEN 3 END),\n" +

+                "  statusModifiedDate ";

+    }

+

+    @Override

+    public List<UUID> pushBulkJob(ServiceInstantiation request, String userId) {

+        List<UUID> uuids = new ArrayList<>();

+        Date createdBulkDate = Calendar.getInstance().getTime();

+        int bulkSize = request.getBulkSize();

+        UUID templateId = UUID.randomUUID();

+        for (int i = 0; i < bulkSize; i++) {

+            //Job job = jobAdapter.createJob(JobType.ServiceInstantiation, request, templateId, userId, i);

+            Job job = jobAdapter.createJob(JobType.NoOp, request, templateId, userId, i);//should be some instatiation, this was changed as part of code cleaning

+

+            UUID jobId = jobService.add(job);

+            auditVidStatus(jobId,job.getStatus());

+            uuids.add(jobId);

+            dataAccessService.saveDomainObject(createServiceInfo(userId, request, jobId, templateId, createdBulkDate), DaoUtils.getPropsMap());

+        }

+        return uuids;

+    }

+

+    private ServiceInfo createServiceInfo(String userId, ServiceInstantiation serviceInstantiation, UUID jobId, UUID templateId, Date createdBulkDate) {

+        return new ServiceInfo(

+                userId, Job.JobStatus.PENDING, serviceInstantiation.isPause(), jobId, templateId,

+                serviceInstantiation.getOwningEntityId(),

+                serviceInstantiation.getOwningEntityName(),

+                serviceInstantiation.getProjectName(),

+                serviceInstantiation.getAicZoneId(),

+                serviceInstantiation.getAicZoneName(),

+                serviceInstantiation.getTenantId(),

+                serviceInstantiation.getTenantName(),

+                serviceInstantiation.getLcpCloudRegionId(),

+                null,

+                serviceInstantiation.getSubscriptionServiceType(),

+                serviceInstantiation.getSubscriberName(),

+                null,

+                serviceInstantiation.getInstanceName(),

+                serviceInstantiation.getModelInfo().getModelInvariantId(),

+                serviceInstantiation.getModelInfo().getModelName(),

+                serviceInstantiation.getModelInfo().getModelVersion(),

+                createdBulkDate

+        );

+    }

+

+

+    /*//@Override

+    public RequestDetailsWrapper<ServiceInstantiationRequestDetails> generateServiceInstantiationRequest(UUID jobId, ServiceInstantiation payload, String userId) {

+

+           ServiceInstantiationRequestDetails.ServiceInstantiationOwningEntity owningEntity = new ServiceInstantiationRequestDetails.ServiceInstantiationOwningEntity(payload.getOwningEntityId(), payload.getOwningEntityName());

+

+        SubscriberInfo subscriberInfo = new SubscriberInfo();

+        subscriberInfo.setGlobalSubscriberId(payload.getGlobalSubscriberId());

+

+        String serviceInstanceName = null;

+        if(payload.isUserProvidedNaming()) {

+            serviceInstanceName = getUniqueName(payload.getInstanceName(), ResourceType.SERVICE_INSTANCE);

+            String finalServiceInstanceName = serviceInstanceName;

+            updateServiceInfo(jobId, x -> x.setServiceInstanceName(finalServiceInstanceName));

+        }

+        ServiceInstantiationRequestDetails.RequestInfo requestInfo = new ServiceInstantiationRequestDetails.RequestInfo(

+                serviceInstanceName,

+                payload.getProductFamilyId(),

+                "VID",

+                payload.isRollbackOnFailure(),

+                userId);

+

+        List<ServiceInstantiationRequestDetails.ServiceInstantiationService> serviceInstantiationService = new LinkedList<>();

+        List<Map<String, String>> unFilteredInstanceParams = payload.getInstanceParams() != null ? payload.getInstanceParams() : new LinkedList<>();

+        List<Map<String, String>> filteredInstanceParams = removeUnNeededParams(unFilteredInstanceParams);

+        ServiceInstantiationRequestDetails.ServiceInstantiationService serviceInstantiationService1 = new ServiceInstantiationRequestDetails.ServiceInstantiationService(

+                payload.getModelInfo(),

+                serviceInstanceName,

+                filteredInstanceParams,

+                createServiceInstantiationVnfList(payload)

+        );

+        serviceInstantiationService.add(serviceInstantiationService1);

+

+        ServiceInstantiationRequestDetails.RequestParameters requestParameters = new ServiceInstantiationRequestDetails.RequestParameters(payload.getSubscriptionServiceType(), false, serviceInstantiationService);

+

+        ServiceInstantiationRequestDetails.Project project = payload.getProjectName() != null ?  new ServiceInstantiationRequestDetails.Project(payload.getProjectName()) : null;

+

+        ServiceInstantiationRequestDetails requestDetails = new ServiceInstantiationRequestDetails(payload.getModelInfo(), owningEntity, subscriberInfo,

+                project, requestInfo, requestParameters);

+

+        RequestDetailsWrapper<ServiceInstantiationRequestDetails> requestDetailsWrapper = new RequestDetailsWrapper(requestDetails);

+        debugRequestDetails(requestDetailsWrapper, logger);

+        return requestDetailsWrapper;

+    }*/

+

+    private List<Map<String, String>> removeUnNeededParams(List<Map<String, String>> instanceParams) {

+        List<String> keysToRemove = new ArrayList<>();

+        if (instanceParams != null && !instanceParams.isEmpty()) {

+            for (String key : instanceParams.get(0).keySet()) {

+                for (String paramToIgnore : PARAMS_TO_IGNORE)

+                    if ((key.equalsIgnoreCase(paramToIgnore))) {

+                        keysToRemove.add(key);

+                    }

+            }

+            for (String key : keysToRemove) {

+                instanceParams.get(0).remove(key);

+            }

+            //TODO will be removed on once we stop using List<Map<String, String>>

+            if (instanceParams.get(0).isEmpty()) {

+                return Collections.emptyList();

+            }

+        }

+        return instanceParams;

+    }

+

+    private ServiceInstantiationRequestDetails.ServiceInstantiationVnfList createServiceInstantiationVnfList(ServiceInstantiation payload) {

+        CloudConfiguration cloudConfiguration = new CloudConfiguration();

+        cloudConfiguration.setTenantId(payload.getTenantId());

+        cloudConfiguration.setLcpCloudRegionId(payload.getLcpCloudRegionId());

+

+        Map<String, Vnf> vnfs = payload.getVnfs();

+        List<ServiceInstantiationRequestDetails.ServiceInstantiationVnf> vnfList = new ArrayList<>();

+        for (Vnf vnf : vnfs.values()) {

+            Map<String, Map<String, VfModule>> vfModules = vnf.getVfModules();

+            List<VfModule> convertedUnFilteredVfModules = convertVfModuleMapToList(vfModules);

+            List<VfModule> filteredVfModules = filterInstanceParamsFromVfModuleAndUniqueNames(convertedUnFilteredVfModules, vnf.isUserProvidedNaming());

+            ServiceInstantiationRequestDetails.ServiceInstantiationVnf serviceInstantiationVnf = new ServiceInstantiationRequestDetails.ServiceInstantiationVnf(

+                    vnf.getModelInfo(),

+                    cloudConfiguration,

+                    vnf.getPlatformName(),

+                    vnf.getLineOfBusiness(),

+                    payload.getProductFamilyId(),

+                    removeUnNeededParams(vnf.getInstanceParams()),

+                    filteredVfModules,

+                    vnf.isUserProvidedNaming() ? getUniqueName(vnf.getInstanceName(), ResourceType.GENERIC_VNF) : null

+            );

+            vnfList.add(serviceInstantiationVnf);

+        }

+

+        return new ServiceInstantiationRequestDetails.ServiceInstantiationVnfList(vnfList);

+    }

+

+    private List<VfModule> convertVfModuleMapToList(Map<String, Map<String, VfModule>> vfModules) {

+        return vfModules.values().stream().flatMap(vfModule -> vfModule.values().stream()).collect(Collectors.toList());

+    }

+

+    private List<VfModule> filterInstanceParamsFromVfModuleAndUniqueNames(List<VfModule> unFilteredVfModules, boolean isUserProvidedNaming) {

+        return unFilteredVfModules.stream().map(vfModule ->

+                new VfModule(

+                        vfModule.getModelInfo(),

+                        getUniqueNameIfNeeded(isUserProvidedNaming, vfModule.getInstanceName(), ResourceType.VF_MODULE),

+                        getUniqueNameIfNeeded(isUserProvidedNaming, vfModule.getVolumeGroupInstanceName(), ResourceType.VOLUME_GROUP),

+                        removeUnNeededParams(vfModule.getInstanceParams())))

+                .collect(Collectors.toList());

+    }

+

+    private String getUniqueNameIfNeeded(boolean isUserProvidedNaming, String name, ResourceType resourceType) {

+        return isUserProvidedNaming && !StringUtils.isEmpty(name) ?

+                getUniqueName(name, resourceType) : null;

+    }

+

+    @Override

+    public String getServiceInstantiationPath(ServiceInstantiation serviceInstantiationRequest) {

+        //in case pause flag is true - use assign , else - use create.

+        return MsoBusinessLogicImpl.validateEndpointPath(

+                serviceInstantiationRequest.isPause() ?

+                        "mso.restapi.serviceInstanceAssign" : "mso.restapi.serviceInstanceCreate"

+        );

+    }

+

+    @Override

+    public String getOrchestrationRequestsPath() {

+        return MsoBusinessLogicImpl.validateEndpointPath(MsoProperties.MSO_REST_API_GET_ORC_REQ);

+    }

+

+    @Override

+    public ServiceInfo updateServiceInfo(UUID jobUUID, Consumer<ServiceInfo> serviceUpdater) {

+        ServiceInfo serviceInfo = getServiceInfoByJobId(jobUUID);

+        serviceUpdater.accept(serviceInfo);

+        dataAccessService.saveDomainObject(serviceInfo, DaoUtils.getPropsMap());

+        return serviceInfo;

+    }

+

+    @Override

+    public ServiceInfo updateServiceInfoAndAuditStatus(UUID jobUuid, JobStatus jobStatus) {

+        auditVidStatus(jobUuid,jobStatus);

+        return updateServiceInfo(jobUuid, x -> setServiceInfoStatus(x, jobStatus));

+    }

+

+    private void setServiceInfoStatus(ServiceInfo serviceInfo, JobStatus jobStatus) {

+        serviceInfo.setJobStatus(jobStatus);

+        serviceInfo.setStatusModifiedDate(new Date());

+    }

+

+    public ServiceInfo getServiceInfoByJobId(UUID jobUUID) {

+        List<ServiceInfo> serviceInfoList = dataAccessService.getList(ServiceInfo.class, String.format(" where jobId = '%s' ", jobUUID), null, null);

+        if (serviceInfoList.size() != 1) {

+            throw new GenericUncheckedException("Failed to retrieve job with uuid " + jobUUID + " from ServiceInfo table. Instances found: " + serviceInfoList.size());

+        }

+        return serviceInfoList.get(0);

+    }

+

+    public List<JobAuditStatus> getAuditStatuses(UUID jobUUID, JobAuditStatus.SourceStatus source) {

+        return dataAccessService.getList(

+            JobAuditStatus.class,

+            String.format(" where SOURCE = '%s' and JOB_ID = '%s'",source, jobUUID),

+            " CREATED_DATE ", null);

+    }

+

+    private JobAuditStatus getLatestAuditStatus(UUID jobUUID, JobAuditStatus.SourceStatus source){

+        List<JobAuditStatus> list = getAuditStatuses(jobUUID,source);

+        return !list.isEmpty() ? list.get(list.size()-1) : null;

+    }

+

+    @Override

+    public void auditVidStatus(UUID jobUUID, JobStatus jobStatus){

+        JobAuditStatus vidStatus = new JobAuditStatus(jobUUID, jobStatus.toString(), JobAuditStatus.SourceStatus.VID);

+        auditStatus(vidStatus);

+    }

+

+    @Override

+    public void auditMsoStatus(UUID jobUUID, AsyncRequestStatus.Request msoRequestStatus){

+        auditMsoStatus(jobUUID, msoRequestStatus.requestStatus.getRequestState(), msoRequestStatus.requestId, msoRequestStatus.requestStatus.getStatusMessage());

+    }

+

+    @Override

+    public void auditMsoStatus(UUID jobUUID, String jobStatus, String requestId, String additionalInfo){

+        JobAuditStatus msoStatus = new JobAuditStatus(jobUUID, jobStatus, JobAuditStatus.SourceStatus.MSO,

+                requestId != null ? UUID.fromString(requestId) : null,

+                additionalInfo);

+        auditStatus(msoStatus);

+    }

+

+    private void auditStatus(JobAuditStatus jobAuditStatus){

+        JobAuditStatus latestStatus = getLatestAuditStatus(jobAuditStatus.getJobId(),jobAuditStatus.getSource());

+        if (latestStatus == null || !latestStatus.equals(jobAuditStatus))

+            dataAccessService.saveDomainObject(jobAuditStatus, DaoUtils.getPropsMap());

+

+    }

+

+    public Job.JobStatus calcStatus(AsyncRequestStatus asyncRequestStatus) {

+        String msoRequestState = asyncRequestStatus.request.requestStatus.getRequestState().toLowerCase().replaceAll("[^a-z]+", "");

+        JobStatus jobStatus = msoStateToJobStatusMap.get(msoRequestState);

+        return (jobStatus != null ? jobStatus : JobStatus.IN_PROGRESS);

+    }

+

+    @Override

+    public void handleFailedInstantiation(UUID jobUUID) {

+        ServiceInfo serviceInfo = updateServiceInfoAndAuditStatus(jobUUID, JobStatus.FAILED);

+        List<ServiceInfo> serviceInfoList = dataAccessService.getList(

+                ServiceInfo.class,

+                String.format(" where templateId = '%s' and jobStatus = '%s'",

+                        serviceInfo.getTemplateId(),

+                        JobStatus.PENDING),

+                null, null);

+        serviceInfoList.forEach(si -> updateServiceInfoAndAuditStatus(si.getJobId(), JobStatus.STOPPED));

+    }

+

+    @Override

+    public void deleteJob(UUID jobId) {

+        jobService.delete(jobId);

+        Date now = new Date();

+        updateServiceInfo(jobId, x -> x.setDeletedAt(now));

+    }

+

+    @Override

+    public void hideServiceInfo(UUID jobUUID) {

+        ServiceInfo serviceInfo = getServiceInfoByJobId(jobUUID);

+        if (!serviceInfo.getJobStatus().isFinal()) {

+            String message = String.format( "jobId %s: Service status does not allow hide service, status = %s",

+                    serviceInfo.getJobId(),

+                    serviceInfo.getJobStatus());

+            logger.error(EELFLoggerDelegate.errorLogger, message);

+            throw new OperationNotAllowedException(message);

+        }

+        serviceInfo.setHidden(true);

+        dataAccessService.saveDomainObject(serviceInfo, DaoUtils.getPropsMap());

+    }

+

+    @Override

+    public int

+

+

+    getCounterForName(String name) {

+

+        String hqlSelectNC = "from NameCounter where name = :name";

+        String hqlUpdateCounter = "update NameCounter set counter = :newCounter " +

+                "where name= :name " +

+                "and counter= :prevCounter";

+

+        Integer counter = null;

+        GenericUncheckedException lastException = null;

+        for (int i = 0; i< MAX_RETRIES_GETTING_COUNTER && counter==null; i++) {

+            try {

+                counter = calcCounter(name, hqlSelectNC, hqlUpdateCounter);

+            }

+            catch (GenericUncheckedException exception) {

+                lastException = exception; //do nothing, we will try again in the loop

+            }

+        }

+

+        if (counter!=null) {

+            return counter;

+        }

+

+        throw lastException!=null ? new DbFailureUncheckedException(lastException) :

+                new DbFailureUncheckedException("Failed to get counter for "+name+" due to unknown error");

+

+    }

+

+    private Integer calcCounter(String name, String hqlSelectNC, String hqlUpdateCounter) {

+        Integer counter;

+        counter = DaoUtils.tryWithSessionAndTransaction(sessionFactory, session -> {

+            NameCounter nameCounter = (NameCounter) session.createQuery(hqlSelectNC)

+                    .setText("name", name)

+                    .uniqueResult();

+            if (nameCounter != null) {

+                int updatedRows = session.createQuery(hqlUpdateCounter)

+                        .setText("name", nameCounter.getName())

+                        .setInteger("prevCounter", nameCounter.getCounter())

+                        .setInteger("newCounter", nameCounter.getCounter() + 1)

+                        .executeUpdate();

+                if (updatedRows == 1) {

+                    return nameCounter.getCounter() + 1;

+                }

+            } else {

+                Object nameAsId = session.save(new NameCounter(name));

+                //if save success

+                if (nameAsId != null) {

+                    return 1;

+                }

+            }

+            //in case of failure return null, in order to continue the loop

+            return null;

+        });

+        return counter;

+    }

+

+    @Override

+    public int getMaxRetriesGettingFreeNameFromAai() {

+        return maxRetriesGettingFreeNameFromAai;

+    }

+

+    @Override

+    public void setMaxRetriesGettingFreeNameFromAai(int maxRetriesGettingFreeNameFromAai) {

+        this.maxRetriesGettingFreeNameFromAai = maxRetriesGettingFreeNameFromAai;

+    }

+

+    @Override

+    public String getUniqueName(String name, ResourceType resourceType) {

+        //check that name aai response well before increasing counter from DB

+        //Prevents unnecessary increasing of the counter while AAI doesn't response

+        isNameFreeInAai(NAME_FOR_CHECK_AAI_STATUS, resourceType);

+

+        for (int i=0; i<getMaxRetriesGettingFreeNameFromAai(); i++) {

+            int counter = getCounterForName(name);

+            String newName = formatNameAndCounter(name, counter);

+            if (isNameFreeInAai(newName, resourceType)) {

+                return newName;

+            }

+        }

+

+        throw new MaxRetriesException("find unused name for "+name, getMaxRetriesGettingFreeNameFromAai());

+    }

+

+    //the method is protected so we can call it in the UT

+    protected String formatNameAndCounter(String name, int counter) {

+        return name + "_" + String.format("%03d", counter);

+    }

+

+    private boolean isNameFreeInAai(String name, ResourceType resourceType) throws InvalidAAIResponseException {

+        AaiResponse<AaiNodeQueryResponse> aaiResponse = aaiClient.searchNodeTypeByName(name, resourceType);

+        if (aaiResponse.getHttpCode() > 399 || aaiResponse.getT() == null) {

+            throw new InvalidAAIResponseException(aaiResponse);

+        }

+        return CollectionUtils.isEmpty(aaiResponse.getT().resultData);

+    }

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/AuditServiceImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/services/AuditServiceImpl.java
new file mode 100644
index 0000000..b4c5a10
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/AuditServiceImpl.java
@@ -0,0 +1,69 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import com.fasterxml.jackson.core.JsonParseException;

+import com.fasterxml.jackson.databind.ObjectMapper;

+import org.apache.commons.lang3.StringUtils;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.springframework.stereotype.Service;

+

+import javax.inject.Inject;

+import java.io.IOException;

+import java.util.UUID;

+

+

+@Service

+public class AuditServiceImpl implements IAuditService {

+

+    @Inject

+    private IAsyncInstantiationBusinessLogic asyncInstantiationBL;

+

+    @Override

+    public void setFailedAuditStatusFromMso(UUID jobUuid, String requestId, int statusCode, String msoResponse){

+        final String failedMsoRequestStatus = "FAILED";

+        String additionalInfo = formatExceptionAdditionalInfo(statusCode, msoResponse);

+        asyncInstantiationBL.auditMsoStatus(jobUuid, failedMsoRequestStatus, requestId, additionalInfo);

+    }

+

+    private String formatExceptionAdditionalInfo(int statusCode, String msoResponse) {

+        String errorMsg = "Http Code:" + statusCode;

+        if (!StringUtils.isEmpty(msoResponse)) {

+            String filteredJson;

+            try {

+                ObjectMapper objectMapper = new ObjectMapper();

+                filteredJson = StringUtils.defaultIfEmpty(

+                        objectMapper.readTree(msoResponse).path("serviceException").toString().replaceAll("[\\{\\}]","") ,

+                        msoResponse

+                );

+            } catch (JsonParseException e) {

+                filteredJson = msoResponse;

+            } catch (IOException e) {

+                throw new GenericUncheckedException(e);

+            }

+

+            errorMsg = errorMsg + ", " + filteredJson;

+        }

+        return errorMsg;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/BulkInstantiationServiceImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/services/BulkInstantiationServiceImpl.java
new file mode 100644
index 0000000..8e4ae76
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/BulkInstantiationServiceImpl.java
@@ -0,0 +1,68 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import org.onap.osam.job.Job;

+import org.onap.osam.job.JobAdapter;

+import org.onap.osam.job.JobsBrokerService;

+import org.onap.osam.model.JobBulk;

+import org.onap.osam.model.JobModel;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Service;

+

+import javax.ws.rs.NotFoundException;

+import java.util.List;

+import java.util.Map;

+import java.util.UUID;

+

+@Service

+public class BulkInstantiationServiceImpl implements IBulkInstantiationService {

+

+    private JobsBrokerService jobsBrokerService;

+    private JobAdapter jobAdapter;

+

+    @Autowired

+    public BulkInstantiationServiceImpl(JobsBrokerService jobsBrokerService, JobAdapter jobAdapter) {

+        this.jobsBrokerService = jobsBrokerService;

+        this.jobAdapter = jobAdapter;

+    }

+

+    @Override

+    public JobBulk saveBulk(Map<String, Object> bulkRequest) {

+        List<Job> jobList = jobAdapter.createBulkOfJobs(bulkRequest);

+        jobList.forEach(jobsBrokerService::add);

+        return jobAdapter.toModelBulk(jobList);

+    }

+

+    @Override

+    public JobModel getJob(UUID uuid) {

+        Job job = jobsBrokerService.peek(uuid);

+

+        if (job == null || job.getUuid() == null) {

+            throw new NotFoundException("Job with uuid " + uuid + " not found");

+        }

+        return jobAdapter.toModel(job);

+    }

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/CsvServiceImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/services/CsvServiceImpl.java
new file mode 100644
index 0000000..e95ab28
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/CsvServiceImpl.java
@@ -0,0 +1,272 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import com.opencsv.CSVReader;

+import org.json.JSONArray;

+import org.json.JSONObject;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.springframework.stereotype.Service;

+import org.springframework.web.multipart.MultipartFile;

+

+import javax.ws.rs.BadRequestException;

+import java.io.FileReader;

+import java.io.IOException;

+import java.io.InputStreamReader;

+import java.util.ArrayList;

+import java.util.Arrays;

+import java.util.List;

+

+import static org.onap.osam.utils.Logging.getMethodName;

+

+@Service

+public class CsvServiceImpl implements ICsvService {

+

+

+    static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(CsvServiceImpl.class);

+

+    private static final String ARRAY_REGEX = "\\[(.*?)\\]";

+

+

+    private String [] removeBOMFromCsv(String [] line){

+        if (line.length>0)

+            line[0] = line[0].replaceFirst("\uFEFF","").replaceFirst("","");

+        return line;

+    }

+

+    /**

+     * read a csv file and puts its content in list of string arrays (without the empty lines)

+     * @param filePath - the path of file to read

+     * @return the content of file

+     * @throws IOException

+     */

+    @Override

+    public List<String[]> readCsv(String filePath) throws IOException {

+        CSVReader reader = new CSVReader(new FileReader(filePath));

+        return readCsv(reader);

+    }

+

+    @Override

+    public List<String[]> readCsv(MultipartFile file) throws IOException {

+        CSVReader reader = new CSVReader(new InputStreamReader(file.getInputStream()));

+        return readCsv(reader);

+    }

+

+    private List<String[]> addLineWithoutSpaces(List<String[]> myEntries, String [] line){

+        line = Arrays.stream(line).filter(x -> !"".equals(x)).toArray(String[]::new);

+        if(line.length > 0)

+            myEntries.add(line);

+        return myEntries;

+    }

+

+

+    private  List<String[]> readCsv(CSVReader reader) throws IOException {

+        try {

+            List<String[]> myEntries = new ArrayList<>() ;

+            String [] line;

+            Boolean firstLine = true;

+            while ((line = reader.readNext())!= null) {

+                if (firstLine) {

+                    line = removeBOMFromCsv(line);

+                    firstLine = false;

+                }

+                myEntries = addLineWithoutSpaces(myEntries, line);

+            }

+            return myEntries;

+        }

+        catch (Exception e){

+            logger.error("error during reading CSV file. exception:" + e.getMessage());

+            throw e;

+        }

+

+    }

+

+    /**

+     * main function that call to the recursive function with initial parameters

+     * @param myEntries - the matrix with file content

+     * @return the json

+     * @throws IOException

+     * @throws InstantiationException

+     * @throws IllegalAccessException

+     */

+    @Override

+    public JSONObject convertCsvToJson (List<String[]> myEntries) throws InstantiationException, IllegalAccessException {

+        try {

+            return buildJSON(myEntries, 0, 0, myEntries.size(), JSONObject.class);

+        }

+        catch (Exception e){

+            logger.error("error during parsing CSV file. exception:" + e.getMessage());

+            throw e;

+        }

+

+    }

+

+    /**

+     * it goes over the matrix column while the values are the same and returns the index of changed value

+     * @param myEntries the matrix

+     * @param i row index refer to the whole matrix

+     * @param j column index

+     * @param numLines the length of the current inner matrix

+     * @param startLine row index of inner matrix

+     * @return the index of changed line

+     */

+    private int findIndexOfChangedLine(List<String[]> myEntries, final int i, final int j, final int numLines, final int startLine) {

+        int k;

+        for(k = 0; k + i - startLine < numLines && myEntries.get(i)[j].equals(myEntries.get(k + i)[j]) ; k++);

+        return k;

+    }

+

+    /**

+     *  check in array if its first element or if the key already exist in the previous item

+     * @param jsonArray - the array to search in

+     * @param key - the key to check

+     * @return if exists or first element return true, otherwise- false

+     */

+    private Boolean keyExistsOrFirstElement( JSONArray jsonArray,String key){

+        Boolean exists = false;

+        Boolean first = false;

+        JSONObject lastItem = lastItemInArray(jsonArray);

+        if (lastItem == null) {

+            first = true;

+        }

+        else {

+            if (lastItem.has(key)) {

+                exists = true;

+            }

+        }

+        return exists||first;

+    }

+

+    /**

+     * return last json in json array

+     * @param jsonArray

+     * @return last item or null if the array is empty

+     */

+    private JSONObject lastItemInArray(JSONArray jsonArray){

+        JSONObject lastItem = null;

+        if(jsonArray.length()>0) {

+            lastItem = (JSONObject) jsonArray.get(jsonArray.length() - 1);

+        }

+        return lastItem;

+    }

+

+    /**

+     * append current json to the main json

+     * @param json - the main json to append to it

+     * @param key - key to append

+     * @param values - value(s) to append

+     * @param <T> can be JSONObject or JSONArray

+     * @param <E> string or jsonObject or jsonArray

+     * @return json after put

+     * @throws IllegalAccessException

+     * @throws InstantiationException

+     */

+    private <T, E> T putJson(T json, String key, E values) throws IllegalAccessException, InstantiationException {

+        if (json instanceof JSONArray){

+            JSONArray currentJson= ((JSONArray)json);

+            if (values == null) //array of strings (for last item)

+            {

+                currentJson.put(key);

+            }

+            else {

+                if (keyExistsOrFirstElement(currentJson, key)) {

+                    currentJson.put(new JSONObject().put(key, values));

+                } else {

+                    JSONObject lastItem = lastItemInArray(currentJson);

+                    if(lastItem != null){

+                        lastItem.put(key, values);

+                    }

+

+                }

+            }

+        }

+        if (json instanceof JSONObject){

+            if (values == null)

+                throw new BadRequestException("Invalid csv file");

+            ((JSONObject)json).put(key,values);

+        }

+        return json;

+    }

+

+

+    /**

+     *  recursive function to build JSON. Each time it counts the same values in left and send the smaller matrix

+     *  (until the changed value) to the next time.

+     *

+     * @param myEntries - the whole matrix

+     * @param i- row index of the whole matrix

+     * @param j - column index

+     * @param numLines - number of lines of inner matrix (num of same values in the left column)

+     * @param clazz JSONArray or JSONObject

+     * @param <T> JSONArray or JSONObject

+     * @return the json object

+     * @throws IllegalAccessException

+     * @throws InstantiationException

+     */

+    private <T> T buildJSON(List<String[]> myEntries, int i, final int j, final int numLines, Class<T> clazz) throws IllegalAccessException, InstantiationException {

+        logger.debug(EELFLoggerDelegate.debugLogger, "start {}({}, {}, {})", getMethodName(), i, j, numLines);

+        T json = clazz.newInstance();

+        int startLine = i;

+        while(i < numLines + startLine){

+            String[] currentRow = myEntries.get(i);

+            int length = currentRow.length;

+            int currentDuplicateRows = findIndexOfChangedLine(myEntries,i,j,numLines, startLine);

+            String key = currentRow[j];

+            if (j == length-1) {

+                json = putJson(json,currentRow[j],null);

+            }

+            else

+            {

+                json = buildJsonRow(myEntries, i, j, json, currentRow, length, currentDuplicateRows, key);

+            }

+            i += currentDuplicateRows;

+        }

+        logger.debug(EELFLoggerDelegate.debugLogger, "end {} json = {}", getMethodName(), json);

+        return json;

+    }

+

+    private <T> T buildJsonRow(List<String[]> myEntries, int i, int j, T json, String[] currentRow, int length, int currentDuplicateRows, String key) throws IllegalAccessException, InstantiationException {

+        if (key.matches(ARRAY_REGEX)){

+            JSONArray arrayObjects = buildJSON(myEntries, i, j + 1, currentDuplicateRows, JSONArray.class);

+            json = putJson(json,key.replaceAll("\\[","").replaceAll("]",""),arrayObjects);

+        }

+        else {

+            if (j < length - 2) {

+                json = putJson(json, currentRow[j], buildJSON(myEntries, i, j + 1, currentDuplicateRows, JSONObject.class));

+            }

+            else

+            {

+                if (j == length - 2)//last object

+                {

+                    if(currentDuplicateRows > 1) {

+                        throw new BadRequestException("Invalid csv file");

+                    }

+                    json = putJson(json, currentRow[j], currentRow[j + 1]);

+                }

+            }

+        }

+        return json;

+    }

+

+}

+

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/IAaiService.java b/onap-enabler-be/src/main/java/org/onap/osam/services/IAaiService.java
new file mode 100644
index 0000000..b30d957
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/IAaiService.java
@@ -0,0 +1,80 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import org.onap.osam.aai.AaiResponse;

+import org.onap.osam.aai.SubscriberFilteredResults;

+import org.onap.osam.aai.model.AaiGetInstanceGroupsByCloudRegion;

+import org.onap.osam.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList;

+import org.onap.osam.aai.model.AaiGetPnfs.Pnf;

+import org.onap.osam.aai.model.AaiGetTenatns.GetTenantsResponse;

+import org.onap.osam.aai.model.PortDetailsTranslator;

+import org.onap.osam.model.SubscriberList;

+import org.onap.osam.roles.RoleValidator;

+

+import javax.ws.rs.core.Response;

+import java.util.List;

+

+public interface IAaiService {

+

+

+    SubscriberFilteredResults getFullSubscriberList(RoleValidator roleValidator);

+

+    AaiResponse getSubscriberData(String subscriberId, RoleValidator roleValidator);

+

+    AaiResponse getServiceInstanceSearchResults(String subscriberId, String instanceIdentifier, RoleValidator roleProvider, List<String> owningEntities, List<String> projects);

+

+    AaiResponse<SubscriberList> getFullSubscriberList();

+

+    AaiResponse getServices(RoleValidator roleValidator);

+    

+    AaiResponse getAaiZones();

+

+    AaiResponse getNetworkCollectionDetails(String serviceInstanceId);

+

+    AaiResponse<AaiGetInstanceGroupsByCloudRegion> getInstanceGroupsByCloudRegion(String cloudOwner, String cloudRegionId, String networkFunction);

+

+    AaiResponse<OperationalEnvironmentList> getOperationalEnvironments(String operationalEnvironmentType, String operationalEnvironmentStatus);

+

+    AaiResponse getAicZoneForPnf(String globalCustomerId , String serviceType , String serviceId);

+

+    Response getVNFData(String globalSubscriberId, String serviceType);

+

+    AaiResponse<GetTenantsResponse[]> getTenants(String globalCustomerId, String serviceType, RoleValidator roleValidator);

+

+    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<Pnf> getSpecificPnf(String pnfId);

+

+    List<String> getServiceInstanceAssociatedPnfs(String globalCustomerId, String serviceType, String serviceInstanceId);

+

+    AaiResponse getPNFData(String globalCustomerId, String serviceType, String modelVersionId, String modelInvariantId, String cloudRegion, String equipVendor, String equipModel);

+

+    List<PortDetailsTranslator.PortDetails> getPortMirroringSourcePorts(String configurationId);

+

+    AaiResponse getInstanceGroupsByVnfInstanceId(String vnfInstanceId);

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/IAsyncInstantiationBusinessLogic.java b/onap-enabler-be/src/main/java/org/onap/osam/services/IAsyncInstantiationBusinessLogic.java
new file mode 100644
index 0000000..39e2b73
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/IAsyncInstantiationBusinessLogic.java
@@ -0,0 +1,78 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import org.onap.osam.aai.model.ResourceType;

+import org.onap.osam.job.Job;

+import org.onap.osam.model.JobAuditStatus;

+import org.onap.osam.model.ServiceInfo;

+import org.onap.osam.model.serviceInstantiation.ServiceInstantiation;

+import org.onap.osam.mso.rest.AsyncRequestStatus;

+

+import java.util.Arrays;

+import java.util.List;

+import java.util.UUID;

+import java.util.function.Consumer;

+

+public interface IAsyncInstantiationBusinessLogic {

+

+    List<String> PARAMS_TO_IGNORE = Arrays.asList("vnf_name", "vf_module_name");

+

+    List<ServiceInfo> getAllServicesInfo();

+

+    List<UUID> pushBulkJob(ServiceInstantiation request, String userId);

+

+    String getServiceInstantiationPath(ServiceInstantiation serviceInstantiationRequest);

+

+    String getOrchestrationRequestsPath();

+

+    ServiceInfo getServiceInfoByJobId(UUID jobUUID);

+

+    List<JobAuditStatus> getAuditStatuses(UUID jobUUID, JobAuditStatus.SourceStatus source);

+

+    ServiceInfo updateServiceInfo(UUID jobUUID, Consumer<ServiceInfo> serviceUpdater);

+

+    ServiceInfo updateServiceInfoAndAuditStatus(UUID jobUuid, Job.JobStatus jobStatus);

+

+    void auditVidStatus(UUID jobUUID, Job.JobStatus jobStatus);

+

+    void auditMsoStatus(UUID jobUUID, AsyncRequestStatus.Request msoRequestStatus);

+

+    void auditMsoStatus(UUID jobUUID, String jobStatus, String requestId, String additionalInfo);

+

+    Job.JobStatus calcStatus(AsyncRequestStatus asyncRequestStatus);

+

+    void handleFailedInstantiation(UUID jobUUID);

+

+    void deleteJob(UUID jobId);

+

+    void hideServiceInfo(UUID jobUUID);

+

+    int getCounterForName(String name);

+

+    int getMaxRetriesGettingFreeNameFromAai();

+

+    void setMaxRetriesGettingFreeNameFromAai(int maxRetriesGettingFreeNameFromAai);

+

+    String getUniqueName(String name, ResourceType resourceType);

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/IAuditService.java b/onap-enabler-be/src/main/java/org/onap/osam/services/IAuditService.java
new file mode 100644
index 0000000..c806d88
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/IAuditService.java
@@ -0,0 +1,30 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import java.util.UUID;

+

+public interface IAuditService {

+

+    void setFailedAuditStatusFromMso(UUID jobUuid, String requestId, int statusCode, String msoResponse);

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/IBulkInstantiationService.java b/onap-enabler-be/src/main/java/org/onap/osam/services/IBulkInstantiationService.java
new file mode 100644
index 0000000..ede1a5d
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/IBulkInstantiationService.java
@@ -0,0 +1,37 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import org.onap.osam.model.JobBulk;

+import org.onap.osam.model.JobModel;

+

+import java.util.Map;

+import java.util.UUID;

+

+public interface IBulkInstantiationService {

+

+    JobBulk saveBulk(Map<String, Object> bulkRequest);

+

+    JobModel getJob(UUID uuid);

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/ICsvService.java b/onap-enabler-be/src/main/java/org/onap/osam/services/ICsvService.java
new file mode 100644
index 0000000..dd6cdda
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/ICsvService.java
@@ -0,0 +1,36 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import org.json.JSONObject;

+import org.springframework.web.multipart.MultipartFile;

+

+import java.io.IOException;

+import java.util.List;

+

+public interface ICsvService {

+    List<String[]> readCsv(String filePath) throws IOException;

+    JSONObject convertCsvToJson (List<String[]> myEntries) throws InstantiationException, IllegalAccessException;

+    List<String[]> readCsv(MultipartFile file) throws IOException;

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/IPodService.java b/onap-enabler-be/src/main/java/org/onap/osam/services/IPodService.java
new file mode 100644
index 0000000..5e88f07
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/IPodService.java
@@ -0,0 +1,27 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+public interface IPodService {

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/IPombaService.java b/onap-enabler-be/src/main/java/org/onap/osam/services/IPombaService.java
new file mode 100644
index 0000000..ef2fe04
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/IPombaService.java
@@ -0,0 +1,29 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import org.onap.osam.model.PombaInstance.PombaRequest;

+

+public interface IPombaService {

+    void verify(PombaRequest request);

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/IRoleGeneratorService.java b/onap-enabler-be/src/main/java/org/onap/osam/services/IRoleGeneratorService.java
new file mode 100644
index 0000000..a7f69bd
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/IRoleGeneratorService.java
@@ -0,0 +1,27 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+public interface IRoleGeneratorService {

+    String generateRoleScript(Boolean firstRun);

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/IWorkflowService.java b/onap-enabler-be/src/main/java/org/onap/osam/services/IWorkflowService.java
new file mode 100644
index 0000000..e756c15
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/IWorkflowService.java
@@ -0,0 +1,30 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import java.util.Collection;

+

+public interface IWorkflowService {

+    Collection<String> getWorkflowsForVNFs(Collection<String> vnfNames);

+    Collection<String> getAllWorkflows();

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/PombaServiceImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/services/PombaServiceImpl.java
new file mode 100644
index 0000000..dea4d39
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/PombaServiceImpl.java
@@ -0,0 +1,39 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import org.onap.osam.aai.PombaClientInterface;

+import org.onap.osam.model.PombaInstance.PombaRequest;

+import org.springframework.beans.factory.annotation.Autowired;

+

+public class PombaServiceImpl implements IPombaService {

+

+    @Autowired

+    private PombaClientInterface pombaClientInterface;

+

+

+    @Override

+    public void verify(PombaRequest request) {

+        pombaClientInterface.verify(request);

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/RoleGenaratorServiceImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/services/RoleGenaratorServiceImpl.java
new file mode 100644
index 0000000..c2a18eb
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/RoleGenaratorServiceImpl.java
@@ -0,0 +1,189 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import jline.internal.Log;

+import org.onap.osam.aai.AaiClientInterface;

+import org.onap.osam.aai.AaiResponse;

+import org.onap.osam.aai.ServiceSubscription;

+import org.onap.osam.aai.Services;

+import org.onap.osam.model.ModelConstants;

+import org.onap.osam.model.Subscriber;

+import org.onap.osam.model.SubscriberList;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.stereotype.Service;

+

+import java.util.HashMap;

+

+@Service

+public class RoleGenaratorServiceImpl implements IRoleGeneratorService {

+

+    public static final String ROLE_ID_COLUMN = "ROLE_ID";

+    @Autowired

+    AaiClientInterface client;

+

+    public static final String DB_NAME =  "vid_portal";

+    public static final String TBL_NAME = "fn_role";

+    public static final String TEMP_DELIMITER ="***";

+    public static final String OLD_DELIMITER = "_";

+

+    @Override

+    public String generateRoleScript(Boolean firstRun) {

+        String query =  "USE " + DB_NAME + ";\r\n" +

+                "SET SQL_SAFE_UPDATES = 0;\r\n";

+        try {

+            AaiResponse<SubscriberList> subscribers = client.getAllSubscribers();

+            if (firstRun) {

+                query += replaceRolesToTempDelimiter("subscriber",buildSubscribersValuesForMappingsTable(subscribers.getT()));

+            }

+            query += addAvailableRolesCombination(firstRun, subscribers);

+

+        }

+        catch (Exception e) {

+            Log.error("There was an error in updating roles "+e.getMessage());

+        }

+        return query;

+    }

+

+    private String addAvailableRolesCombination(Boolean firstRun, AaiResponse<SubscriberList> subscribers) {

+        String query, availableRoles="";

+        HashMap<String,String> servicesNames = new HashMap<String,String>();

+        for (Subscriber subscriber: subscribers.getT().customer) {

+            AaiResponse<Services> subscriberResponse = client.getSubscriberData(subscriber.globalCustomerId);

+            for(ServiceSubscription service: subscriberResponse.getT().serviceSubscriptions.serviceSubscription) {

+                servicesNames.put(service.serviceType,"");

+                String roleName = "'" + subscriber.subscriberName + ModelConstants.ROLE_DELIMITER + service.serviceType + "'";

+                availableRoles += "("+roleName+"),";

+

+

+            }

+        }

+        availableRoles = availableRoles.substring(0,availableRoles.length()-1);

+        query = createTemporaryTableAvailableRoles(availableRoles);

+        if (firstRun){

+            query += replaceRolesToTempDelimiter("service",buildServicesValuesForMappingsTable(servicesNames));

+            query += replaceToNewDelimiter();

+            query += deleteWrongRecords();

+

+        }

+        query += insertAvailableRolesToFnRole();

+        query += dropTemporaryTable("available_roles");

+        return query;

+    }

+

+    private String buildSubscribersValuesForMappingsTable(SubscriberList subscribers){

+        String query="";

+        for (Subscriber subscriber : subscribers.customer) {

+            String subscriberName = subscriber.subscriberName.contains(OLD_DELIMITER) ? subscriber.subscriberName.replace(OLD_DELIMITER, TEMP_DELIMITER) : subscriber.subscriberName;

+            query = query + "('" + subscriber.globalCustomerId + "','" + subscriberName + "') ,";

+        }

+        if(query.length() > 0)

+            query = query.substring(0, query.length()-1) + ";\r\n";

+        return query;

+    }

+

+    private String buildServicesValuesForMappingsTable(HashMap<String,String> servicesNames){

+        final String[] query = {""};

+        servicesNames.forEach((k,v)->{

+            if (k.contains(OLD_DELIMITER)) {

+                query[0] += "('" + k + "' ,'" + k.replace(OLD_DELIMITER, TEMP_DELIMITER) +"'),";

+            }

+        });

+        if(query[0].length() > 0)

+            query[0] = query[0].substring(0, query[0].length()-1) + ";\r\n";

+        return query[0];

+    }

+

+    private String replaceRolesToTempDelimiter(String entityName, String valuesForMappingsTable ) {

+

+        AaiResponse<Services> services = client.getServices();

+        String query = "";

+        if (valuesForMappingsTable.length() > 0) {

+            query = "CREATE TEMPORARY TABLE IF NOT EXISTS " + entityName + "Mappings(mapKey VARCHAR(255),mapValue VARCHAR(255));\r\n" +

+                    "INSERT INTO " + entityName + "Mappings VALUES ";

+            query += valuesForMappingsTable;

+            query += "UPDATE " + TBL_NAME + "\r\n" +

+                    "INNER JOIN " + entityName + "Mappings ON role_name LIKE concat('%',mapKey, '%')\r\n" +

+                    "SET ROLE_NAME = REPLACE(ROLE_NAME, mapKey, mapValue) ;  \r\n" +

+                    dropTemporaryTable(entityName + "Mappings");

+        }

+        return query;

+    }

+

+    private String replaceToNewDelimiter(){

+        String query =  "UPDATE " + TBL_NAME + "\r\n" +

+                "SET ROLE_NAME = REPLACE(ROLE_NAME, '" + OLD_DELIMITER + "', '" + ModelConstants.ROLE_DELIMITER + "');\r\n" ;

+        query += "UPDATE fn_role\r\n" +

+                "SET ROLE_NAME = REPLACE(ROLE_NAME, '" + TEMP_DELIMITER + "', '" + OLD_DELIMITER + "');\r\n" ;

+        return query;

+    }

+

+    private String insertAvailableRolesToFnRole(){

+        String query="INSERT INTO fn_role (ROLE_NAME, ACTIVE_YN, PRIORITY)\r\n" +

+                "SELECT RNAME, 'Y', 5\r\n" +

+                "FROM available_roles\r\n" +

+                "WHERE NOT EXISTS (SELECT ROLE_NAME\r\n" +

+                "FROM fn_role \r\n" +

+                "where RNAME = ROLE_NAME);\r\n";

+        return query;

+    }

+

+

+

+    private String createTemporaryTableAvailableRoles(String availableRoles) {

+        String query = "CREATE TEMPORARY TABLE IF NOT EXISTS available_roles(rname VARCHAR(255));\r\n";

+        query += "INSERT INTO available_roles VALUES "+availableRoles+";\r\n";

+                return query;

+    }

+

+    private String deleteWrongRecords(){

+        String query ="CREATE TEMPORARY TABLE IF NOT EXISTS wrong_roles(roleID INT);\r\n" +

+                "INSERT INTO wrong_roles (roleID)\r\n" +

+                "SELECT ROLE_ID FROM fn_role LEFT JOIN available_roles ON role_name LIKE concat(rname, '%')\r\n" +

+                "WHERE available_roles.rname IS NULL AND ROLE_ID NOT IN (1,16);\r\n";

+        query += deleteCascade();

+        query += dropTemporaryTable("wrong_roles");

+        return query;

+    }

+

+    private String deleteCascade() {

+        String query = deleteFromTableByRoles("fn_role_composite", "PARENT_ROLE_ID");

+        query = query.substring(0, query.length()-1);

+        query += " OR wrong_roles.ROLEID = fn_role_composite.CHILD_ROLE_ID;\r\n";

+        query += deleteFromTableByRoles("fn_role_function", ROLE_ID_COLUMN)+ "\r\n";

+        query += deleteFromTableByRoles("fn_user_role", ROLE_ID_COLUMN)+ "\r\n";

+        query += deleteFromTableByRoles(TBL_NAME, ROLE_ID_COLUMN)+ "\r\n";

+        return query;

+    }

+

+    private String deleteFromTableByRoles(String table, String column) {

+        String query = "DELETE FROM " + table + "\r\n";

+        query += "using  " + table + " inner join wrong_roles\r\n" +

+                "where wrong_roles.ROLEID = " + table + "." + column + ";";

+        return query;

+    }

+

+    private String dropTemporaryTable(String table) {

+        return "DROP TEMPORARY TABLE IF EXISTS " + table + ";\r\n";

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/services/WorkflowServiceImpl.java b/onap-enabler-be/src/main/java/org/onap/osam/services/WorkflowServiceImpl.java
new file mode 100644
index 0000000..b84de5b
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/services/WorkflowServiceImpl.java
@@ -0,0 +1,62 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.services;

+

+import org.onap.osam.model.Workflow;

+import org.springframework.stereotype.Service;

+

+import java.util.ArrayList;

+import java.util.Arrays;

+import java.util.Collection;

+import java.util.stream.Collectors;

+

+@Service

+public class WorkflowServiceImpl implements IWorkflowService {

+    //TODO: Add the list of workflows hard coded or from DB.

+    private ArrayList<Workflow> workflows = new ArrayList<>(Arrays.asList(

+            new Workflow(0, "Upgrade", new ArrayList<>(Arrays.asList("VNF1", "VNF2", "VNF3", "VNF4"))),

+            new Workflow(1, "Clean", new ArrayList<>(Arrays.asList("VNF1", "VNF2", "VNF3"))),

+            new Workflow(2, "Reinstall", new ArrayList<>(Arrays.asList("VNF1", "VNF2", "VNF4"))),

+            new Workflow(3, "Dump", new ArrayList<>(Arrays.asList("VNF1", "VNF3", "VNF4"))),

+            new Workflow(4, "Flush", new ArrayList<>(Arrays.asList("VNF2", "VNF3", "VNF4")))

+    ));

+

+    @Override

+    public Collection<String> getWorkflowsForVNFs(Collection<String> vnfNames) {

+        Collection<String> result = workflows.stream()

+                .filter(workflow -> workflow.getVnfNames().containsAll(vnfNames))

+                .map(workflow -> workflow.getWorkflowName())

+                .distinct()

+                .collect(Collectors.toList());

+

+        return result;

+    }

+

+    @Override

+    public Collection<String> getAllWorkflows() {

+        return workflows.stream()

+                .map(workflow -> workflow.getWorkflowName())

+                .distinct()

+                .collect(Collectors.toList());

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/utils/DaoUtils.java b/onap-enabler-be/src/main/java/org/onap/osam/utils/DaoUtils.java
new file mode 100644
index 0000000..c5612dd
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/utils/DaoUtils.java
@@ -0,0 +1,75 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.utils;

+

+import org.hibernate.Session;

+import org.hibernate.SessionFactory;

+import org.hibernate.Transaction;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.portalsdk.core.domain.FusionObject;

+

+import java.util.HashMap;

+import java.util.function.Function;

+

+public class DaoUtils {

+

+    //all credit for this wonderful method go to is9613

+    public static<T> T tryWithSessionAndTransaction(SessionFactory sessionFactory, Function<Session, T> update) {

+        // opens a session and transactions, executes the input query.

+        // gracefully close session and transaction once error occurres.

+        Session session = null;

+        Transaction tx = null;

+        try {

+            session = sessionFactory.openSession();

+            tx = session.beginTransaction();

+

+            T res = update.apply(session);

+

+            tx.commit();

+

+            return res;

+        } catch (RuntimeException e) {

+            try {

+                if (tx != null) {

+                    tx.rollback();

+                }

+            } catch (RuntimeException e2) {

+                // e2 is ingnored; we would like to know the

+                // original failure reason, not only the reason

+                // for rollback's failure

+                throw new GenericUncheckedException("Failed rolling back transaction", e);

+            }

+            throw new GenericUncheckedException("Rolled back transaction", e);

+        } finally {

+            if (session != null) {

+                session.close();

+            }

+        }

+    }

+

+    public static HashMap<String, Object> getPropsMap() {

+        HashMap<String, Object> props = new HashMap<>();

+        props.put(FusionObject.Parameters.PARAM_USERID, 0);

+        return props;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/utils/Intersection.java b/onap-enabler-be/src/main/java/org/onap/osam/utils/Intersection.java
new file mode 100644
index 0000000..6fd9ff9
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/utils/Intersection.java
@@ -0,0 +1,50 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.utils;

+

+import java.util.List;

+import java.util.stream.Collectors;

+

+public class Intersection<T> {

+    public List<T> intersectMultipileArray(List<List<T>> lists) {

+        if (lists.size() == 1) {

+            return lists.get(0);

+        } else {

+            List<T> intersectResult = intersectTwoArrays(lists.get(0),lists.get(1));

+

+            lists.remove(0);

+            lists.remove(0);

+            lists.add(0,intersectResult);

+            return intersectMultipileArray(lists);

+        }

+

+    }

+

+    public List<T> intersectTwoArrays(List<T> list1, List<T> list2) {

+

+        List<T> intersect = list1.stream()

+                .filter(list2::contains)

+                .collect(Collectors.toList());

+        return intersect;

+    }

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/utils/Logging.java b/onap-enabler-be/src/main/java/org/onap/osam/utils/Logging.java
new file mode 100644
index 0000000..ed30322
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/utils/Logging.java
@@ -0,0 +1,200 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.utils;

+

+import com.att.eelf.configuration.EELFLogger;

+import com.fasterxml.jackson.core.JsonProcessingException;

+import com.fasterxml.jackson.databind.ObjectMapper;

+import com.fasterxml.jackson.databind.SerializationFeature;

+import com.google.common.collect.ImmutableList;

+import io.joshworks.restclient.http.HttpResponse;

+import org.apache.commons.lang3.StringUtils;

+import org.onap.osam.exceptions.GenericUncheckedException;

+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;

+import org.onap.portalsdk.core.util.SystemProperties;

+import org.springframework.http.HttpMethod;

+import org.springframework.web.context.request.RequestContextHolder;

+import org.springframework.web.context.request.ServletRequestAttributes;

+

+import javax.servlet.http.HttpServletRequest;

+import javax.ws.rs.ProcessingException;

+import javax.ws.rs.core.Response;

+import java.util.Arrays;

+import java.util.Optional;

+import java.util.UUID;

+

+import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;

+import static org.apache.commons.lang3.exception.ExceptionUtils.getRootCause;

+import static org.apache.commons.lang3.exception.ExceptionUtils.getThrowableList;

+import static org.onap.osam.utils.Streams.not;

+

+public class Logging {

+

+    Logging() {

+    }

+

+    public static final String HTTP_REQUESTS_OUTGOING = "http.requests.outgoing.";

+

+    public static final String REQUEST_ID_HEADER_KEY = SystemProperties.ECOMP_REQUEST_ID;

+

+    private static ObjectMapper objectMapper = new ObjectMapper();

+

+    public static String getMethodName() {

+        return getMethodName(0);

+    }

+

+    public static String getMethodCallerName() {

+        return getMethodName(1);

+    }

+

+    private static String getMethodName(int depth) {

+        final StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();

+        String thisClassName = stackTrace[1].getClassName();

+        final Optional<String> caller =

+                Arrays.stream(stackTrace)

+                        .skip(1)

+                        .filter(not(frame -> frame.getClassName().equals(thisClassName)))

+                        .skip(depth)

+                        .map(StackTraceElement::getMethodName)

+                        .findFirst();

+        return caller.orElse("<unknonwn method name>");

+    }

+

+    public static EELFLogger getRequestsLogger(String serverName) {

+        return EELFLoggerDelegate.getLogger(HTTP_REQUESTS_OUTGOING +serverName);

+    }

+

+    public static void logRequest(final EELFLogger logger, final HttpMethod method, final String url, final Object body) {

+        if (!logger.isDebugEnabled()) {

+            return;

+        }

+

+        if (body == null) {

+            logRequest(logger, method, url);

+            return;

+        }

+

+        try {

+            String bodyAsJson = objectMapper.writeValueAsString(body);

+            logger.debug("Sending  {} {} Body: {}", method.name(), url, bodyAsJson);

+        } catch (JsonProcessingException e) {

+            logRequest(logger, method, url);

+            logger.debug("Failed to parse object in logRequest. {}", body);

+        }

+    }

+

+    public static void logRequest(final EELFLogger logger, final HttpMethod method, final String url) {

+        logger.debug("Sending  {} {}", method.name(), url);

+    }

+

+    public static <T> void logResponse(final EELFLogger logger, final HttpMethod method, final String url, final Response response, final Class<T> entityClass) {

+        if (!logger.isDebugEnabled()) {

+            return;

+        }

+        if (response == null) {

+            logger.debug("Received {} {} response: null", method.name(), url);

+            return;

+        }

+        try {

+            response.bufferEntity();

+            logger.debug("Received {} {} Status: {} . Body: {}", method.name(), url, response.getStatus(), response.readEntity(entityClass));

+        }

+        catch (ProcessingException | IllegalStateException e) {

+            logger.debug("Received {} {} Status: {} . Failed to read response as {}", method.name(), url, response.getStatus(), entityClass.getName());

+        }

+    }

+

+    public static <T> void logResponse(final EELFLogger logger, final HttpMethod method, final String url, final HttpResponse<T> response) {

+        try {

+            logger.debug("Received {} {} Status: {} . Body: {}", method.name(), url, response.getStatus(), response.getBody());

+        }

+        catch (ProcessingException | IllegalStateException e) {

+            logger.debug("Received {} {} Status: {} . Failed to read response", method.name(), url, response.getStatus());

+        }

+    }

+

+    public static void logResponse(final EELFLogger logger, final HttpMethod method, final String url, final Response response) {

+        logResponse(logger, method, url, response, String.class);

+    }

+

+    public static HttpServletRequest getHttpServletRequest(){

+        return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();

+    }

+

+    public static String extractOrGenerateRequestId() {

+        try {

+            return getHttpServletRequest().getHeader(REQUEST_ID_HEADER_KEY);

+        }

+        catch (IllegalStateException e) {

+            //in async jobs we don't have any HttpServletRequest

+            return UUID.randomUUID().toString();

+        }

+    }

+

+    public static void debugRequestDetails(Object requestDetails, final EELFLogger logger) {

+        if (logger.isDebugEnabled()) {

+            String requestDetailsAsString;

+            try {

+                requestDetailsAsString = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(requestDetails);

+            } catch (JsonProcessingException e) {

+                requestDetailsAsString = "error: cannot stringify RequestDetails";

+            }

+            logger.debug("requestDetailsAsString: {}", requestDetailsAsString);

+        }

+    }

+

+    public static String exceptionToDescription(Throwable exceptionToDescribe) {

+        // Ignore top-most GenericUnchecked or Runtime exceptions that has no added message

+        final Throwable top = getThrowableList(exceptionToDescribe).stream()

+                .filter(not(e -> ImmutableList.of(GenericUncheckedException.class, RuntimeException.class).contains(e.getClass())

+                        && StringUtils.equals(e.getMessage(), e.getCause() == null ? null : e.getCause().toString())))

+                .findFirst().orElse(exceptionToDescribe);

+

+        final Throwable root = defaultIfNull(getRootCause(top), top);

+

+        String rootToString = root.toString();

+

+        // nullPointer description will include some context

+        if (root.getClass().equals(NullPointerException.class) && root.getStackTrace().length > 0) {

+            rootToString = String.format("NullPointerException at %s:%d",

+                    root.getStackTrace()[0].getFileName(),

+                    root.getStackTrace()[0].getLineNumber());

+        }

+

+        // if input is a single exception, without cause: top.toString

+        // else: return top.toString + root.toString

+        //       but not if root is already described in top.toString

+        if (top.equals(root)) {

+            return rootToString;

+        } else {

+            final String topToString = top.toString();

+            if (topToString.contains(root.getClass().getName()) && topToString.contains(root.getLocalizedMessage())) {

+                return topToString;

+            } else {

+                return topToString + ": " + rootToString;

+            }

+        }

+    }

+

+

+}

diff --git a/onap-enabler-be/src/main/java/org/onap/osam/utils/Streams.java b/onap-enabler-be/src/main/java/org/onap/osam/utils/Streams.java
new file mode 100644
index 0000000..b9ee683
--- /dev/null
+++ b/onap-enabler-be/src/main/java/org/onap/osam/utils/Streams.java
@@ -0,0 +1,69 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * OSAM

+ * ================================================================================

+ * Copyright (C) 2018 AT&T

+ * ================================================================================

+ * 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.osam.utils;

+

+import java.util.Iterator;

+import java.util.Spliterator;

+import java.util.Spliterators;

+import java.util.function.Consumer;

+import java.util.function.Predicate;

+import java.util.stream.Stream;

+import java.util.stream.StreamSupport;

+

+public class Streams {

+    public static <R> Predicate<R> not(Predicate<R> predicate) {

+        return predicate.negate();

+    }

+

+    public static <T> Stream<T> fromIterator(final Iterator<T> iterator) {

+        Iterable<T> iterable = () -> iterator;

+        return StreamSupport.<T>stream(iterable.spliterator(), false);

+    }

+

+

+    // https://stackoverflow.com/questions/20746429/limit-a-stream-by-a-predicate

+    private static <T> Spliterator<T> takeWhile(

+            Spliterator<T> splitr, Predicate<? super T> predicate) {

+        return new Spliterators.AbstractSpliterator<T>(splitr.estimateSize(), 0) {

+            boolean stillGoing = true;

+            @Override public boolean tryAdvance(Consumer<? super T> consumer) {

+                if (stillGoing) {

+                    boolean hadNext = splitr.tryAdvance(elem -> {

+                        if (predicate.test(elem)) {

+                            consumer.accept(elem);

+                        } else {

+                            stillGoing = false;

+                        }

+                    });

+                    return hadNext && stillGoing;

+                }

+                return false;

+            }

+        };

+    }

+

+    public static <T> Stream<T> takeWhile(Stream<T> stream, Predicate<? super T> predicate) {

+        return StreamSupport.stream(takeWhile(stream.spliterator(), predicate), false);

+    }

+

+}

diff --git a/onap-enabler-be/src/main/resources/aai_config_instance_view_edit.json b/onap-enabler-be/src/main/resources/aai_config_instance_view_edit.json
new file mode 100644
index 0000000..3cd4506
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/aai_config_instance_view_edit.json
@@ -0,0 +1,81 @@
+{

+  "model-name":"Proxy-Config-Instance",

+  "configuration":{

+    "configuration-id": "9533-config-LB1113",

+    "configuration-name": "configuration-name-9533",

+    "configuration-type": "configuration-type-9533",

+    "configuration-sub-type": "configuration-sub-type-9533",

+    "model-invariant-id": "model-invariant-id-9533",

+    "model-version-id": "model-version-id-9533",

+    "orchestration-status": "Active",

+    "operational-status": "",

+    "configuration-selflink": "",

+    "model-customization-id": "model-customization-id-9533",

+    "resource-version": "1504038855716"

+  },

+  "extra-properties": {

+  },

+  "inventory-response-items":{

+    "inventory-response-item":[

+      {

+        "model-name":"VidPcrf051517..pcrf_nimbus_pcm..module-4",

+        "l-interface": {

+          "interface-name": "9533lInterface-LB1113",

+          "interface-role": "8ni",

+          "v6-wan-link-ip": "Pnr",

+          "selflink": "Un56B",

+          "interface-id": "o74n",

+          "macaddr": "8an6",

+          "network-name": "kjOn",

+          "management-option": "0Rn7",

+          "interface-description": "XPnLr",

+          "is-port-mirrored": true,

+          "resource-version": "1504038598348",

+          "in-maint": false,

+          "is-ip-unnumbered": false,

+          "relationship-list": {

+            "relationship": [

+              {

+                "related-to": "logical-link",

+                "related-link": "/aai/v11/network/logical-links/logical-link/logicallink-987654321-21-LB1113",

+                "relationship-data": [

+                  {

+                    "relationship-key": "logical-link.link-name",

+                    "relationship-value": "logicallink-987654321-21-LB1113"

+                  }

+                ]

+              }

+            ]

+          },

+          "l3-interface-ipv4-address-list": [

+            {

+              "l3-interface-ipv4-address": "112.121.144.16",

+              "l3-interface-ipv4-prefix-length": 59,

+              "vlan-id-inner": 917,

+              "vlan-id-outer": 519,

+              "is-floating": true,

+              "resource-version": "1504038598353",

+              "neutron-network-id": "HX6m54p1akX",

+              "neutron-subnet-id": "nbmX5okGg"

+            }

+          ],

+          "l3-interface-ipv6-address-list": [

+            {

+              "l3-interface-ipv6-address": "2001:232E:2333:2322:122C:CDD:2AE3:3E4",

+              "l3-interface-ipv6-prefix-length": 76,

+              "vlan-id-inner": 27,

+              "vlan-id-outer": 710,

+              "is-floating": true,

+              "resource-version": "1504038598364",

+              "neutron-network-id": "xBR0OOToQ",

+              "neutron-subnet-id": "4E0gZLH"

+            }

+          ]

+        },

+        "extra-properties":{

+

+        }

+      }

+    ]

+  }

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/aai_get_node_template_instances.json b/onap-enabler-be/src/main/resources/aai_get_node_template_instances.json
new file mode 100644
index 0000000..f6e3d52
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/aai_get_node_template_instances.json
@@ -0,0 +1,101 @@
+{"results": [

+  {

+    "id": "1976357096",

+    "node-type": "generic-vnf",

+    "url": "/aai/v11/network/generic-vnfs/generic-vnf/VNF-1-9887-jc689q",

+    "properties":       {

+      "vnf-id": "0846287b-65bf-45a6-88f6-6a1af4149fac",

+      "vnf-name": "vnf9887-1jc689q",

+      "vnf-name2": "notused",

+      "vnf-type": "VRR",

+      "service-id": "VRRaaS",

+      "regional-resource-zone": "notusedforMobility",

+      "prov-status": "PREPROV",

+      "operational-status": "",

+      "license-key": "novalue",

+      "equipment-role": "VRR",

+      "orchestration-status": "Created",

+      "heat-stack-id": "1234",

+      "mso-catalog-key": "msokey",

+      "ipv4-oam-address": "135.60.77.25",

+      "ipv4-loopback0-address": "12.60.77.25",

+      "nm-lan-v6-address": "2001:1890:1F8:2075::1:4",

+      "management-v6-address": "2001:1890:1F8:2075::1:5",

+      "in-maint": false,

+      "is-closed-loop-disabled": false,

+      "resource-version": "1505337418309",

+      "model-invariant-id": "96129eb9-f0de-4e05-8af2-73146473f766",

+      "model-version-id": "5761e0a7-c6df-4d8a-9ebd-b8f445054dec",

+      "widget-model-id": "78789",

+      "widget-model-version": "7",

+      "nf-function": "nf-function in ASDC",

+      "nf-role": "nf-role in ASDC",

+      "nf-naming-code": "code in ASDC",

+      "selflink": "pathToController"

+    },

+    "related-to":       [

+      {

+        "id": "1689710648",

+        "node-type": "service-instance",

+        "url": "/aai/v11/business/customers/customer/customer-9887-jc689q/service-subscriptions/service-subscription/VRR/service-instances/service-instance/SI-9887-jc689q"

+      },

+      {

+        "id": "1362120784",

+        "node-type": "vserver",

+        "url": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner-id-9887-jc689q/cloudRegion-id-9887-jc689q/tenants/tenant/tenant-id-9887-jc689q/vservers/vserver/vserver-id-2-9887-jc689q"

+      },

+      {

+        "id": "2017317104",

+        "node-type": "vserver",

+        "url": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner-id-9887-jc689q/cloudRegion-id-9887-jc689q/tenants/tenant/tenant-id-9887-jc689q/vservers/vserver/vserver-id-1-9887-jc689q"

+      }

+    ]

+  },

+  {

+    "id": "2362269792",

+    "node-type": "generic-vnf",

+    "url": "/aai/v11/network/generic-vnfs/generic-vnf/VNF-2-9887-jc689q",

+    "properties":       {

+      "vnf-id": "c187e9fe-40c3-4862-b73e-84ff056205f6",

+      "vnf-name": "vnf9887-2jc689q",

+      "vnf-name2": "notused",

+      "vnf-type": "VRR",

+      "service-id": "VRRaaS",

+      "regional-resource-zone": "notusedforMobility",

+      "prov-status": "PREPROV",

+      "operational-status": "",

+      "license-key": "novalue",

+      "equipment-role": "VRR",

+      "orchestration-status": "Created",

+      "heat-stack-id": "1234",

+      "mso-catalog-key": "msokey",

+      "ipv4-oam-address": "135.60.77.25",

+      "ipv4-loopback0-address": "12.60.77.25",

+      "nm-lan-v6-address": "2001:1890:1F8:2075::1:4",

+      "management-v6-address": "2001:1890:1F8:2075::1:5",

+      "in-maint": false,

+      "is-closed-loop-disabled": false,

+      "resource-version": "1505337418754",

+      "model-invariant-id": "96129eb9-f0de-4e05-8af2-73146473f766",

+      "model-version-id": "5761e0a7-c6df-4d8a-9ebd-b8f445054dec",

+      "widget-model-id": "78789",

+      "widget-model-version": "7",

+      "nf-function": "nf-function in ASDC",

+      "nf-role": "nf-role in ASDC",

+      "nf-naming-code": "code in ASDC",

+      "selflink": "pathToController"

+    },

+    "related-to":       [

+      {

+        "id": "1689710648",

+        "node-type": "service-instance",

+        "url": "/aai/v11/business/customers/customer/customer-9887-jc689q/service-subscriptions/service-subscription/VRR/service-instances/service-instance/SI-9887-jc689q"

+      },

+      {

+        "id": "1689706552",

+        "node-type": "vserver",

+        "url": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner-id-9887-jc689q/cloudRegion-id-9887-jc689q/tenants/tenant/tenant-id-9887-jc689q/vservers/vserver/vserver-id-3-9887-jc689q"

+      }

+    ]

+  }

+]}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/catalog.json b/onap-enabler-be/src/main/resources/catalog.json
new file mode 100644
index 0000000..ae4d684
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/catalog.json
@@ -0,0 +1,174 @@
+{

+	"services": {

+		"0346aa9f-57b7-458a-9681-daf5b19d52b0": {

+			"uuid": "0346aa9f-57b7-458a-9681-daf5b19d52b0",

+			"name": "The Worst Service",

+			"version": "1.0",

+			"toscaModelURL": "sampleTosca.csar",

+			"category": "Bad Services",

+			"lifecycleState": "NOT_CERTIFIED_CHECKOUT",

+			"lastUpdaterUserId": "example@example.org",

+			"lastUpdaterFullName": "Example User",

+			"distributionStatus": "DISTRIBUTION_REJECTED",

+			"artifacts": [],

+			"resources": []

+		},

+		"1346aa9f-57b7-458a-9681-daf5b19d52b1": {

+			"uuid": "1346aa9f-57b7-458a-9681-daf5b19d52b1",

+			"name": "The Worst Service",

+			"version": "1.1",

+			"toscaModelURL": "sampleTosca.csar",

+			"category": "Bad Services",

+			"lifecycleState": "CERTIFIED",

+			"lastUpdaterUserId": "example@example.org",

+			"lastUpdaterFullName": "Example User",

+			"distributionStatus": "DISTRIBUTED",

+			"artifacts": [],

+			"resources": []

+		},

+		"3346aa9f-57b7-458a-9681-daf5b19d52b3": {

+			"uuid": "3346aa9f-57b7-458a-9681-daf5b19d52b3",

+			"name": "Bland Service",

+			"version": "1.9",

+			"toscaModelURL": "sampleTosca.csar",

+			"category": "Neutral Services",

+			"lifecycleState": "CERTIFIED",

+			"lastUpdaterUserId": "example@example.org",

+			"lastUpdaterFullName": "Example User",

+			"distributionStatus": "DISTRIBUTION_NOT_APPROVED",

+			"artifacts": [],

+			"resources": []

+		},

+		"2346aa9f-57b7-458a-9681-daf5b19d52b2": {

+			"uuid": "2346aa9f-57b7-458a-9681-daf5b19d52b2",

+			"name": "The Best Service",

+			"version": "1.3",

+			"toscaModelURL": "sampleTosca.csar",

+			"category": "Good Services",

+			"lifecycleState": "CERTIFIED",

+			"lastUpdaterUserId": "example@example.org",

+			"lastUpdaterFullName": "Example User",

+			"distributionStatus": "DISTRIBUTION_APPROVED",

+			"artifacts": [

+					{

+						"artifactUUID": "0cf78c81-1246-45e7-a190-eaa309ee5680",

+						"generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",

+						"artifactName": "The Worst Artifact",

+						"artifactType": "HEAT",

+						"artifactDescription": "This is the worst artifact",

+						"artifactURL": "http://www.openecomp.org/",

+						"artifactTimeout": "60",

+						"artifactChecksum": "A worthy checksum",

+						"artifactVersion": "0.1"

+					},

+					{

+						"artifactUUID": "1cf78c81-1246-45e7-a190-eaa309ee5681",

+						"generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",

+						"artifactName": "The Worst Artifact",

+						"artifactType": "HEAT",

+						"artifactDescription": "This is the worst artifact",

+						"artifactURL": "http://www.openecomp.org/",

+						"artifactTimeout": "60",

+						"artifactChecksum": "A worthy checksum",

+						"artifactVersion": "0.1"

+					},

+					{

+						"artifactUUID": "2cf78c81-1246-45e7-a190-eaa309ee5682",

+						"generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",

+						"artifactName": "The Worst Artifact",

+						"artifactType": "HEAT",

+						"artifactDescription": "This is the worst artifact",

+						"artifactURL": "http://www.openecomp.org/",

+						"artifactTimeout": "60",

+						"artifactChecksum": "A worthy checksum",

+						"artifactVersion": "0.1"

+					}

+			],

+			"resources": []

+		}

+	},

+	"resources": {

+		"2f92b5b0-10ff-4cf4-9531-88546fe88a42": {

+			"uuid": "2f92b5b0-10ff-4cf4-9531-88546fe88a42",

+			"invariantUUID": "df92b5b0-10ff-4cf4-9531-88546fe88a4d",

+			"name": "The Worst Resource",

+			"version": "0.1",

+			"toscaModelURL": "sampleTosca.csar",

+			"toscaModel": "http://www.openecomp.org/",

+			"toscaResourceName": "The Worst Resource (TOSCA)",

+			"category": "Bad Resources",

+			"subCategory": "Really Bad Resources",

+			"resourceType": "VF",

+			"lifecycleState": "CERTIFIED",

+			"lastUpdaterUserId": "example@example.org",

+			"lastUpdaterFullName": "Example User",

+			"artifacts": [

+					{

+						"artifactUUID": "0cf78c81-1246-45e7-a190-eaa309ee5680",

+						"generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",

+						"artifactName": "The Worst Artifact",

+						"artifactType": "HEAT",

+						"artifactDescription": "This is the worst artifact",

+						"artifactURL": "http://www.openecomp.org/",

+						"artifactTimeout": "60",

+						"artifactChecksum": "A worthy checksum",

+						"artifactVersion": "0.1"

+					},

+					{

+						"artifactUUID": "1cf78c81-1246-45e7-a190-eaa309ee5681",

+						"generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",

+						"artifactName": "The Worst Artifact",

+						"artifactType": "HEAT",

+						"artifactDescription": "This is the worst artifact",

+						"artifactURL": "http://www.openecomp.org/",

+						"artifactTimeout": "60",

+						"artifactChecksum": "A worthy checksum",

+						"artifactVersion": "0.1"

+					},

+					{

+						"artifactUUID": "2cf78c81-1246-45e7-a190-eaa309ee5682",

+						"generatedFromUUID": "3cf78c81-1246-45e7-a190-eaa309ee5680",

+						"artifactName": "The Worst Artifact",

+						"artifactType": "HEAT",

+						"artifactDescription": "This is the worst artifact",

+						"artifactURL": "http://www.openecomp.org/",

+						"artifactTimeout": "60",

+						"artifactChecksum": "A worthy checksum",

+						"artifactVersion": "0.1"

+					}

+			]

+		},

+		"0f92b5b0-10ff-4cf4-9531-88546fe88a40": {

+			"uuid": "0f92b5b0-10ff-4cf4-9531-88546fe88a40",

+			"invariantUUID": "df92b5b0-10ff-4cf4-9531-88546fe88a4d",

+			"name": "The Worst Resource",

+			"version": "0.1",

+			"toscaModelURL": "sampleTosca.csar",

+			"toscaModel": "http://www.openecomp.org/",

+			"toscaResourceName": "The Worst Resource (TOSCA)",

+			"category": "Bad Resources",

+			"subCategory": "Really Bad Resources",

+			"resourceType": "VF",

+			"lifecycleState": "CERTIFIED",

+			"lastUpdaterUserId": "example@example.org",

+			"lastUpdaterFullName": "Example User",

+			"artifacts": []

+		},

+		"1f92b5b0-10ff-4cf4-9531-88546fe88a41": {

+			"uuid": "1f92b5b0-10ff-4cf4-9531-88546fe88a41",

+			"invariantUUID": "df92b5b0-10ff-4cf4-9531-88546fe88a4d",

+			"name": "The Worst Resource",

+			"version": "0.1",

+			"toscaModelURL": "sampleTosca.csar",

+			"toscaModel": "http://www.openecomp.org/",

+			"toscaResourceName": "The Worst Resource (TOSCA)",

+			"category": "Bad Resources",

+			"subCategory": "Really Bad Resources",

+			"resourceType": "VF",

+			"lifecycleState": "CERTIFIED",

+			"lastUpdaterUserId": "example@example.org",

+			"lastUpdaterFullName": "Example User",

+			"artifacts": []

+		}

+	}

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/json/mso/cloudConfiguration b/onap-enabler-be/src/main/resources/json/mso/cloudConfiguration
new file mode 100644
index 0000000..eb62779
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/cloudConfiguration
@@ -0,0 +1,19 @@
+{

+    "$schema": "http://json-schema.org/draft-04/schema#",

+	"description": "fields communicating the cloud configuration in a standard way",

+	"type": "object",

+	"properties": {  

+		"nodeLocation": {

+			"description": "Location identifier for the node",

+			"type": "string"

+		},  

+		"lcpCloudRegionId": {

+			"description": "LCP Node Location identifier",

+			"type": "string"

+		},  

+		"tenantId": {

+			"description": "Openstack tenant id",

+			"type": "string"

+		}  

+	}

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/json/mso/instanceIds b/onap-enabler-be/src/main/resources/json/mso/instanceIds
new file mode 100644
index 0000000..c20ea9a
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/instanceIds
@@ -0,0 +1,29 @@
+{

+    "$schema": "http://json-schema.org/draft-04/schema#",

+			"description": "instanceIds that may be associated with a particular request",

+			"type": "object",

+			"properties": {  

+				"networkInstanceId": {

+					"description": "UUID for the network instance (if any)",

+					"type": "string"

+				},  

+				"serviceInstanceId": {

+					"description": "UUID for the service instance",

+					"type": "string"

+				},  

+				"vfModuleInstanceId": {

+					"description": "UUID for the vfModule instance (if any)",

+					"type": "string"

+				},  

+				"vnfInstanceId": {

+					"description": "UUID for the vnf instance (if any)",

+					"type": "string"

+				},  

+				"volumeGroupInstanceId": {

+					"description": "UUID for the volume group instance (if any)",

+					"type": "string"

+				}  

+		}

+}

+

+			
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/json/mso/modelInfo b/onap-enabler-be/src/main/resources/json/mso/modelInfo
new file mode 100644
index 0000000..56d268c
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/modelInfo
@@ -0,0 +1,42 @@
+{

+	"$schema": "http://json-schema.org/draft-04/schema#",

+	"description": "fields describing the SDC entity being operated on by the request",

+	"type": "object",

+	"properties": {

+		"modelCustomizationName": {

+			"description": "reference to the customized set of parameters associated with a model in a given service context",

+			"type": "string"

+		},

+		"modelCustomizationId": {

+			"description": "reference to the customized set of parameters associated with a model in a given service context",

+			"type": "string"

+		},

+		"modelInvariantId": {

+			"description": "Invariant UUID for the model name, irrespective of the version, as defined in SDC--authoritative",

+			"type": "string",

+			"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"

+		},

+        "modelVersionId": {

+                "description": "Version id for version",

+                "type": "string"

+            },

+		"modelName": {

+			"description": "name of the model as defined in SDC--not authoritative",

+			"type": "string"

+		},

+		"modelNameVersionId": {

+			"description": "UUID for the model name and version combination as defined in SDC--authoritative",

+			"type": "string",

+			"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"

+		},

+		"modelType": {

+			"description": "short description of the entity being operated on",

+			"type": "string"

+		},

+		"modelVersion": {

+			"description": "the version of the model as defined in SDC--not authoritative",

+			"type": "string"

+		}

+	},

+	"required": ["modelType"]

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/json/mso/relatedInstance b/onap-enabler-be/src/main/resources/json/mso/relatedInstance
new file mode 100644
index 0000000..89554a5
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/relatedInstance
@@ -0,0 +1,16 @@
+{

+	"description": "modelInfo and optional instanceId and instanceName for a model related to the modelInfo being operated on",

+	"type": "object",

+	"properties": {

+		"instanceName": {

+			"description": "optional name for the instance Id of the related model",

+			"type": "string"

+		},

+		"instanceId": {

+			"description": "instance Id for the related model",

+			"type": "string"

+		},

+		"modelInfo": {}

+	},

+	"required": ["modelInfo"]

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/json/mso/relatedModel b/onap-enabler-be/src/main/resources/json/mso/relatedModel
new file mode 100644
index 0000000..a70a171
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/relatedModel
@@ -0,0 +1,15 @@
+{

+	"$schema": "http://json-schema.org/draft-04/schema#",

+	"description": "modelInfo and optional instance id for a model related to the modelInfo being operated on",

+	"type": "object",

+	"properties": {			

+		"instanceId": {

+			"description": "instance Id for the related model",

+			"type": "string"

+		},

+		"modelInfo": {}

+	},

+	"required": [ "modelInfo" ]

+}

+

+

diff --git a/onap-enabler-be/src/main/resources/json/mso/request b/onap-enabler-be/src/main/resources/json/mso/request
new file mode 100644
index 0000000..61f1040
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/request
@@ -0,0 +1,32 @@
+{

+	"$schema": "http://json-schema.org/draft-04/schema#",

+	"description": "request structure",

+	"type": "object",

+	"properties": {

+		"finishTime": {

+			"description": "Date and time the request was finished in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT",

+			"type": "string"

+		},

+		"instanceIds": {},

+		"requestDetails": {},

+		"requestId": {

+			"description": "UUID for the request generated by the instantiation service",

+			"type": "string",

+			"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"

+		},

+		"requestScope": {

+			"description": "short description of the entity being operated on",

+			"type": "string"

+		},

+		"requestStatus": {},

+		"requestType": {

+			"description": "short description of the action being performed on the requestScope",

+			"type": "string"

+		},

+		"startTime": {

+			"description": "Date and time the request was created in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT",

+			"type": "string"

+		}

+	},

+	"required": ["requestDetails", "requestId", "requestScope", "requestType", "startTime"]

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/json/mso/requestDetails b/onap-enabler-be/src/main/resources/json/mso/requestDetails
new file mode 100644
index 0000000..c0ef530
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/requestDetails
@@ -0,0 +1,13 @@
+{

+    "description": "aggregates the context, configuraiton and detailed parameters associated with the request into a single structure",

+    "properties": {

+        "cloudConfiguration": {},

+        "modelInfo": {},

+        "relatedModelList": {},

+        "requestInfo": {},

+        "requestParameters": {},

+        "subscriberInfo": {}

+    },

+    "type": "object"

+}

+

diff --git a/onap-enabler-be/src/main/resources/json/mso/requestError b/onap-enabler-be/src/main/resources/json/mso/requestError
new file mode 100644
index 0000000..497f671
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/requestError
@@ -0,0 +1,27 @@
+{

+    "$schema": "http://json-schema.org/draft-04/schema#",

+    "description": "standard request error data structure",

+    "properties": {

+        "messageId": {

+            "description": "Unique message identifier of the format ABCnnnn where ABC is either SVC for Service Exceptions or POL for Policy Exception",

+            "type": "string"

+        },

+        "text": {

+            "description": "Message text, with replacement variables marked with %n, where n is an index into the list of <variables> elements, starting at 1",

+            "type": "string"

+        },

+        "url": {

+            "description": "Hyperlink to a detailed error resource e.g., an HTML page for browser user agents",

+            "type": "string"

+        },

+        "variables": {

+            "description": "List of zero or more strings that represent the contents of the variables used by the message text",

+            "type": "string"

+        }

+    },

+    "required": [

+        "messageId",

+        "text"

+    ],

+    "type": "object"

+}

diff --git a/onap-enabler-be/src/main/resources/json/mso/requestInfo b/onap-enabler-be/src/main/resources/json/mso/requestInfo
new file mode 100644
index 0000000..5fcf74c
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/requestInfo
@@ -0,0 +1,52 @@
+{

+	"$schema": "http://json-schema.org/draft-04/schema#",

+	"description": "fields providing general context information for the request",

+	"properties": {

+		"billingAccountNumber": {

+			"description": "billing account associated with the model being operated on",

+			"type": "string"

+		},

+		"callbackUrl": {

+			"description": "client URL to use for asynchronous responses",

+			"type": "string"

+		},

+		"correlator": {

+			"description": "Optional correlationId for async callback requests",

+			"type": "string"

+		},

+		"instanceName": {

+			"description": "Client provided name for the instance being operated on by the operation (note: not guaranteed to be unique)",

+			"type": "string"

+		},

+		"orderNumber": {

+			"description": "reference to an order",

+			"type": "string"

+		},

+		"orderVersion": {

+			"description": "order version number",

+			"type": "number"

+		},

+		"productFamilyId": {

+			"description": "UUID for the product family associated with the model being operated on",

+			"type": "string"

+		},

+		"source": {

+			"description": "source of the request--not authoritative--actual source revealed via authentication",

+			"type": "string"

+		},

+		"suppressRollback": {

+			"description": "true or false boolean indicating whether rollbacks should be suppressed on failures",

+			"type": "boolean"

+		},

+		"responseValue": {

+			"description": "Is the user selected value based on the validResponses list provided to complete the manual task",

+			"type": "string"

+		},

+		"requestorId": {

+			"description": "The id of the person who initiated the completion request",

+			"type": "string"

+		}

+	},

+

+	"type": "object"

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/json/mso/requestParameters b/onap-enabler-be/src/main/resources/json/mso/requestParameters
new file mode 100644
index 0000000..010d787
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/requestParameters
@@ -0,0 +1,23 @@
+{

+  "$schema": "http://json-schema.org/draft-04/schema#",

+  "type": "object",

+  "properties": {

+        "subscriptionServiceType": {

+          "type": "string"

+        },

+        "userParams": {

+          "type": "array",

+          "items": {

+            "type": "object",

+            "properties": {

+              "name": {

+                "type": "string"

+              },

+              "value": {

+                "type": "string"

+              }

+            }

+          }

+        }

+      }

+    }
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/json/mso/requestReferences b/onap-enabler-be/src/main/resources/json/mso/requestReferences
new file mode 100644
index 0000000..30f6411
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/requestReferences
@@ -0,0 +1,18 @@
+{

+    "$schema": "http://json-schema.org/draft-04/schema#",

+    "description": "provides the instanceId and requestId associated with the request",

+			"type": "object",

+			"properties": { 

+		        "instanceId": {

+			        "description": "UUID for the service instance",

+			        "type": "string",

+					"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"

+				},

+		        "requestId": {

+			        "description": "UUID for the request",

+			        "type": "string",

+					"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"

+				}

+			},

+			"required": [ "instanceId", "requestId" ]

+}

diff --git a/onap-enabler-be/src/main/resources/json/mso/requestStatus b/onap-enabler-be/src/main/resources/json/mso/requestStatus
new file mode 100644
index 0000000..75b7215
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/requestStatus
@@ -0,0 +1,32 @@
+{

+    "$schema": "http://json-schema.org/draft-04/schema#",

+    "description": "fields describing the status of a request",

+    "properties": {

+        "percentProgress": {

+            "description": "percentage complete estimate from 0 to 100",

+            "type": "number"

+        },

+        "requestState": {

+            "description": "short description of the instantiation state",

+            "type": "string"

+        },

+        "statusMessage": {

+            "description": "additional descriptive information about the status",

+            "type": "string"

+        },

+        "timestamp": {

+            "description": "GMT Datetime the requestStatus was created e.g.: Wed, 15 Oct 2014 13:01:52 GMT",

+            "type": "string"

+        },

+        "wasRolledBack": {

+			"description": "true or false boolean indicating whether the request was rolled back",

+			"type": "boolean"

+		}

+        

+    },

+    "required": [

+        "requestState",

+        "timestamp"

+    ],

+    "type": "object"

+}

diff --git a/onap-enabler-be/src/main/resources/json/mso/response b/onap-enabler-be/src/main/resources/json/mso/response
new file mode 100644
index 0000000..fa37d2d
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/response
@@ -0,0 +1,13 @@
+{

+	"$schema": "http://json-schema.org/draft-04/schema#",

+	"description": "response structure",

+	"type": "object",

+	"code": {

+			"description": "Return code",

+			"type": "string"

+	},

+	"message": {

+		"description": "Result message",

+			"type": "string"

+	}

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/json/mso/subscriberInfo b/onap-enabler-be/src/main/resources/json/mso/subscriberInfo
new file mode 100644
index 0000000..df78737
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/json/mso/subscriberInfo
@@ -0,0 +1,19 @@
+{

+	"$schema": "http://json-schema.org/draft-04/schema#",

+	"description": "fields providing information about the subscriber associated with the request",

+	"type": "object",

+	"properties": {

+		"globalSubscriberId": {

+			"description": "global Customer Id understood by A&AI",

+			"type": "string"

+		},

+		"subscriberCommonSiteId": {

+			"description": "id representing the location of the subscriber",

+			"type": "string"

+		},

+		"subscriberName": {

+			"description": "name of the customer or subscriber",

+			"type": "string"

+		}

+	}

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/mso_complete_manual_task.json b/onap-enabler-be/src/main/resources/mso_complete_manual_task.json
new file mode 100644
index 0000000..af6c1e1
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/mso_complete_manual_task.json
@@ -0,0 +1,5 @@
+{

+  "taskRequestReference": {

+     "taskId": "daf4dd84-b77a-42da-a051-3239b7a9392c"

+      }

+}

diff --git a/onap-enabler-be/src/main/resources/mso_create_instance_response.json b/onap-enabler-be/src/main/resources/mso_create_instance_response.json
new file mode 100644
index 0000000..8b0341f
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/mso_create_instance_response.json
@@ -0,0 +1,6 @@
+{

+  "requestReferences": {

+    "instanceId": "ba00de9b-3c3e-4b0a-a1ad-0c5489e711fb",

+    "requestId": "311cc766-b673-4a50-b9c5-471f68914586"

+  }

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/mso_get_manual_task_by_request_id.json b/onap-enabler-be/src/main/resources/mso_get_manual_task_by_request_id.json
new file mode 100644
index 0000000..ae8d511
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/mso_get_manual_task_by_request_id.json
@@ -0,0 +1,23 @@
+{  

+   "taskList":[  

+      {  

+         "taskId":"daf4dd84-b77a-42da-a051-3239b7a9392c",

+         "type":"fallout",

+         "nfRole":"vSCP",

+         "subscriptionServiceType":"Mobility",

+         "originalRequestId":"za1234d1-5a33-55df-13ab-12abad84e335",

+         "originalRequestorId":"ss835w",

+         "errorSource":"A&AI",

+         "errorCode":"404",

+         "errorMessage":"Failed in A&AI 404",

+         "buildingBlockName":"DoCreateVfModule",

+         "buildingBlockStep":"invokeA&AI:getTenant",

+         "validResponses":[  

+            "rollback",

+            "abort",

+            "skip",

+            "retry"

+         ]

+      }

+   ]

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/mso_get_orchestration_requests.json b/onap-enabler-be/src/main/resources/mso_get_orchestration_requests.json
new file mode 100644
index 0000000..318945b
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/mso_get_orchestration_requests.json
@@ -0,0 +1,88 @@
+{  

+   "requestList":[  

+      {  

+         "request":{  

+            "requestId":"25272f7e-74c6-4afc-966a-4587f2c30bae",

+            "startTime":"Mon, 31 Jul 2017 23:25:30 GMT",

+            "requestScope":"vnf",

+            "requestType":"updateInstance",

+            "requestDetails":null,

+            "instanceReferences":{  

+               "serviceInstanceId":null,

+               "serviceInstanceName":null,

+               "vnfInstanceId":null,

+               "vnfInstanceName":null,

+               "vfModuleInstanceId":null,

+               "vfModuleInstanceName":null,

+               "volumeGroupInstanceId":null,

+               "volumeGroupInstanceName":null,

+               "networkInstanceId":null,

+               "networkInstanceName":null,

+               "requestorId":"md5621"

+            },

+            "requestStatus":{  

+               "requestState":"IN_PROGRESS",

+               "statusMessage":null,

+               "percentProgress":20,

+               "finishTime":null

+            }

+         }

+      },

+      {  

+         "request":{  

+            "requestId":"25272f7e-74c6-4afc-966a-4587f2c30bae",

+            "startTime":"Mon, 31 Jul 2017 23:25:30 GMT",

+            "requestScope":"service",

+            "requestType":"createInstance",

+            "requestDetails":null,

+            "instanceReferences":{  

+               "serviceInstanceId":null,

+               "serviceInstanceName":null,

+               "vnfInstanceId":null,

+               "vnfInstanceName":null,

+               "vfModuleInstanceId":null,

+               "vfModuleInstanceName":null,

+               "volumeGroupInstanceId":null,

+               "volumeGroupInstanceName":null,

+               "networkInstanceId":null,

+               "networkInstanceName":null,

+               "requestorId":"md5621"

+            },

+            "requestStatus":{  

+               "requestState":"IN_PROGRESS",

+               "statusMessage":null,

+               "percentProgress":20,

+               "finishTime":null

+            }

+         }

+      },

+      {  

+         "request":{  

+            "requestId":"9d6819e1-76e6-4e28-ad08-367632f41c7e",

+            "startTime":"Fri, 20 May 2016 19:07:57 GMT",

+            "requestScope":"vnf",

+            "requestType":"replaceInstance",

+            "requestDetails":null,

+            "instanceReferences":{  

+               "serviceInstanceId":null,

+               "serviceInstanceName":null,

+               "vnfInstanceId":null,

+               "vnfInstanceName":null,

+               "vfModuleInstanceId":null,

+               "vfModuleInstanceName":null,

+               "volumeGroupInstanceId":null,

+               "volumeGroupInstanceName":null,

+               "networkInstanceId":null,

+               "networkInstanceName":null,

+               "requestorId":null

+            },

+            "requestStatus":{  

+               "requestState":"FAILED",

+               "statusMessage":"Service request FAILED schema validation. No valid format for volume request is specified",

+               "percentProgress":100,

+               "finishTime":"Fri, 20 May 2016 19:07:57 GMT"

+            }

+         }

+      }

+   ]

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/owning-entity-properties.JSON b/onap-enabler-be/src/main/resources/owning-entity-properties.JSON
new file mode 100644
index 0000000..12ee4cf
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/owning-entity-properties.JSON
@@ -0,0 +1,17 @@
+{

+	"owningEntityProperties" : {

+		"platform": {

+			"Platform-name": "Platform-name"

+		},

+		"project": {

+			"Project-name": "Project-name"

+		},

+		"lineOfBusiness": {

+			"Line-of-business-name": "Line-of-business-name"

+		},		

+		"owningEntity": {

+			"Owning-entity-id": "Owning-entity-name"

+		}	

+	}			

+}

+	

diff --git a/onap-enabler-be/src/main/resources/roles.json b/onap-enabler-be/src/main/resources/roles.json
new file mode 100644
index 0000000..db32392
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/roles.json
@@ -0,0 +1,8 @@
+{

+  "roles": [

+    "VID_Subscriber_serviceType1_Tenant1",

+    "VID_Subscriber_serviceType1_Tenant2",

+    "read_motorola_epost_tow",

+    "read_motorola_epost"

+  ]

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/sdcservices.json b/onap-enabler-be/src/main/resources/sdcservices.json
new file mode 100644
index 0000000..91c2cc2
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/sdcservices.json
@@ -0,0 +1,172 @@
+{

+  "services": [

+    {

+      "uuid": "6bce7302-70bd-4057-b48e-8d5b99e686ca",

+      "invariantUUID": "9aa04749-c02c-432d-a90c-18caa361c833",

+      "name": "vDBE_srv",

+      "version": "1.0",

+      "toscaModelURL": "./service-VdbeSrv-csar.zip",

+      "category": "Mobility",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    },

+    {

+      "uuid": "76f27dfe-33e5-472f-8e0b-acf524adc4f0",

+      "invariantUUID": "c3618e16-bb5b-433a-a6e0-565ca79d8b65",

+      "name": "4-27_vMME_Service",

+      "version": "1.0",

+      "toscaModelURL": "./service-MsoExampleService-csar.zip",

+      "category": "Mobility",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    },

+    {

+      "uuid": "f4d84bb4-a416-4b4e-997e-0059973630b9",

+      "invariantUUID": "598e3f9e-3244-4d8f-a8e0-0e5d7a29eda9",

+      "name": "ADIOD vMX vPE_BV Service 488",

+      "version": "1.0",

+      "toscaModelURL": "./service-vf-with-annotations.zip",

+      "category": "Mobility",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    },

+    {

+      "uuid": "48a52540-8772-4368-9cdb-1f124ea5c931",

+      "invariantUUID": "f430728a-4530-42be-a577-1206b9484cef",

+      "name": "4-27_vMME_Service",

+      "version": "1.0",

+      "toscaModelURL": "./service-vf-csar.zip",

+      "category": "Mobility",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    },

+    {

+      "uuid": "cb49608f-5a24-4789-b0f7-2595473cb997",

+      "invariantUUID": "0311f998-9268-4fd6-bbba-afff15087b72",

+      "name": "4-27_vMME_Service",

+      "version": "1.0",

+      "toscaModelURL": "./service-vl-csar.zip",

+      "category": "Mobility",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    },

+    {

+      "uuid": "73e1322a-8a9a-49dc-9558-b0c5c5770e4a",

+      "invariantUUID": "f430728a-4530-42be-a577-1206b9484cef",

+      "name": "4-27_vMME_Service",

+      "version": "1.0",

+      "toscaModelURL": "./pnf.zip",

+      "category": "Mobility",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    },

+    {

+      "uuid": "240376de-870e-48df-915a-31f140eedd2c",

+      "invariantUUID": "709d1be4-9a3f-4a29-8c4d-a20465e808a3",

+      "name": "Demo Service",

+      "version": "1.0",

+      "toscaModelURL": "./service-DemoService1-csar.csar",

+      "category": "Mobility",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    },

+    {

+      "uuid": "32671332-a7ee-4df6-9609-db50ce5eaee7",

+      "invariantUUID": "598e3f9e-3244-4d8f-a8e0-0e5d7a29eda9",

+      "name": "ADIOD vMX vPE_BV Service 488",

+      "version": "1.0",

+      "toscaModelURL": "./adiod.zip",

+      "category": "Mobility",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    },

+    {

+      "uuid": "55a48870-d99e-41a8-a3b4-a8d748333139",

+      "invariantUUID": "3d89efc0-19ca-4df7-9818-028e1fc6f708",

+      "name": "AMP PH SVC",

+      "version": "1.0",

+      "toscaModelURL": "./service-AmpPhSvc-csar.zip",

+      "category": "Mobility",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    },

+    {

+      "uuid": "2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd",

+      "invariantUUID": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",

+      "name": "action-data",

+      "version": "1.0",

+      "toscaModelURL": "./2f80c596.zip",

+      "category": "Mobility",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    },

+    {

+      "uuid": "ee6d61be-4841-4f98-8f23-5de9da846ca7",

+      "invariantUUID": "b7d923c9-6175-41f1-91ba-4565c4953408",

+      "name": "Multiple pProbes",

+      "version": "1.0",

+      "toscaModelURL": "./service-Servicecontainermultiplepprobes-csar.zip",

+      "category": "Mobility",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    },

+    {

+      "uuid": "ee6d61be-4841-4f98-8f23-5de9da845544",

+      "invariantUUID": "b7d923c9-6175-41f1-91ba-4565c4955555",

+      "name": "ServiceContainerMultiplepProbes2",

+      "version": "2.0",

+      "toscaModelURL": "./service-ServicecontainerContainsPprobe.zip",

+      "category": "Network L1-3",

+      "lifecycleState": "CERTIFIED",

+      "lastUpdaterUserId": "rg276b",

+      "lastUpdaterFullName": null,

+      "distributionStatus": "DISTRIBUTED",

+      "artifacts": null,

+      "resources": null

+    }

+  ]

+}
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/resources/test.csv b/onap-enabler-be/src/main/resources/test.csv
new file mode 100644
index 0000000..e402c1e
--- /dev/null
+++ b/onap-enabler-be/src/main/resources/test.csv
@@ -0,0 +1,5 @@
+ee6d61be-4841-4f98-8f23-5de9da846ca7,95c75a48-6f86-498f-b1a6-e9179a83d9c7,Update

+ee6d61be-4841-4f98-8f23-5de9da846ca7,95c75a48-6f86-498f-b1a6-e9179a83d9c7,  VNF In Place Software Update

+418f32e5-484a-4073-8fa9-fab7d497459f,709d1be4-9a3f-4a29-8c4d-a20465e808a3,  VNF In Place Software Update

+fa06db34-f8e3-42d9-8e51-a76816eb0f0d,0ebfb706-a846-4715-b0d0-fe0be09458d7,  VNF In Place Software Update  

+fa06db34-f8e3-42d9-8e51-a76816eb0f0d, 87447b67-29e3-4244-8038-990a8c70259a,Replace
\ No newline at end of file
diff --git a/onap-enabler-be/src/main/webapp/META-INF/MANIFEST.MF b/onap-enabler-be/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..5e94951
--- /dev/null
+++ b/onap-enabler-be/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0

+Class-Path: 

+

diff --git a/onap-enabler-be/src/main/webapp/WEB-INF/conf/dev.features.properties b/onap-enabler-be/src/main/webapp/WEB-INF/conf/dev.features.properties
new file mode 100644
index 0000000..d1f8ffa
--- /dev/null
+++ b/onap-enabler-be/src/main/webapp/WEB-INF/conf/dev.features.properties
@@ -0,0 +1,14 @@
+FLAG_ASYNC_INSTANTIATION = true

+FLAG_ASYNC_JOBS = true

+FLAG_REGION_ID_FROM_REMOTE = true

+CREATE_INSTANCE_TEST = false

+EMPTY_DRAWING_BOARD_TEST = false

+FLAG_ADVANCED_PORTS_FILTER = true

+FLAG_ADD_MSO_TESTAPI_FIELD = true

+FLAG_UNASSIGN_SERVICE = true

+FLAG_COLLECTION_RESOURCE_SUPPORT = true

+FLAG_NETWORK_TO_ASYNC_INSTANTIATION = true

+FLAG_SERVICE_MODEL_CACHE = true

+FLAG_SHOW_ASSIGNMENTS = true

+FLAG_SHOW_VERIFY_SERVICE=false

+FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD = false

diff --git a/onap-enabler-be/src/main/webapp/WEB-INF/conf/features.properties b/onap-enabler-be/src/main/webapp/WEB-INF/conf/features.properties
new file mode 100644
index 0000000..b9a640d
--- /dev/null
+++ b/onap-enabler-be/src/main/webapp/WEB-INF/conf/features.properties
@@ -0,0 +1,27 @@
+#    features.properties

+#    -------------------

+

+#    This file is, generally, empty.

+

+#    Configure `featureFlags.filename` in system.properties to use

+#    one of the ready-made sets:

+

+#    -  featureFlags.filename = ci.features.properties

+#    -  featureFlags.filename = ist.features.properties

+#    -  featureFlags.filename = e2e.features.properties

+

+FLAG_ASYNC_INSTANTIATION = true

+FLAG_ASYNC_JOBS = false

+FLAG_REGION_ID_FROM_REMOTE = true

+CREATE_INSTANCE_TEST = false

+EMPTY_DRAWING_BOARD_TEST = false

+FLAG_ADVANCED_PORTS_FILTER = true

+FLAG_ADD_MSO_TESTAPI_FIELD = true

+FLAG_UNASSIGN_SERVICE = true

+FLAG_COLLECTION_RESOURCE_SUPPORT = true

+FLAG_NETWORK_TO_ASYNC_INSTANTIATION = true

+FLAG_SERVICE_MODEL_CACHE = true

+FLAG_SHOW_ASSIGNMENTS = true

+FLAG_SHOW_VERIFY_SERVICE=false

+FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD = false

+FLAG_PNP_INSTANTIATION = true
\ No newline at end of file