From c5f38f5de2f49d3f2fa7f03808f9f063f1cb2ed9 Mon Sep 17 00:00:00 2001 From: "Hockla, Ali (ah999m)" Date: Wed, 13 Sep 2017 09:24:43 -0500 Subject: Added changes for vDNS Use Case -Renamed remaining MSO classes and packages to SO and modified drl accordingly -Connected SO Interface to SO Simulator -Added vDNS Control Loop junit -Modified SOActorServiceProvider to reflect AAI class changes (POLICY-103) Issue-ID: POLICY-102 Change-Id: Iea5d3f096c4ccfedde68e79d7593d66331127aaf Signed-off-by: Hockla, Ali (ah999m) --- controlloop/common/model-impl/mso/pom.xml | 57 ------- .../org/onap/policy/mso/SOAsyncRequestStatus.java | 63 -------- .../org/onap/policy/mso/SOCloudConfiguration.java | 44 ------ .../org/onap/policy/mso/SOInstanceReferences.java | 44 ------ .../main/java/org/onap/policy/mso/SOManager.java | 168 --------------------- .../main/java/org/onap/policy/mso/SOModelInfo.java | 59 -------- .../org/onap/policy/mso/SOPolicyException.java | 43 ------ .../org/onap/policy/mso/SORelatedInstance.java | 49 ------ .../policy/mso/SORelatedInstanceListElement.java | 42 ------ .../main/java/org/onap/policy/mso/SORequest.java | 60 -------- .../java/org/onap/policy/mso/SORequestDetails.java | 124 --------------- .../java/org/onap/policy/mso/SORequestError.java | 59 -------- .../java/org/onap/policy/mso/SORequestInfo.java | 66 -------- .../org/onap/policy/mso/SORequestParameters.java | 47 ------ .../org/onap/policy/mso/SORequestReferences.java | 38 ----- .../java/org/onap/policy/mso/SORequestStatus.java | 51 ------- .../main/java/org/onap/policy/mso/SOResponse.java | 49 ------ .../org/onap/policy/mso/SOServiceException.java | 48 ------ .../java/org/onap/policy/mso/SOSubscriberInfo.java | 47 ------ .../org/onap/policy/mso/util/Serialization.java | 32 ---- .../test/java/org/onap/policy/mso/TestDemo.java | 167 -------------------- controlloop/common/model-impl/pom.xml | 2 +- controlloop/common/model-impl/so/pom.xml | 57 +++++++ .../org/onap/policy/so/SOAsyncRequestStatus.java | 63 ++++++++ .../org/onap/policy/so/SOCloudConfiguration.java | 44 ++++++ .../org/onap/policy/so/SOInstanceReferences.java | 44 ++++++ .../main/java/org/onap/policy/so/SOManager.java | 168 +++++++++++++++++++++ .../main/java/org/onap/policy/so/SOModelInfo.java | 59 ++++++++ .../java/org/onap/policy/so/SOPolicyException.java | 43 ++++++ .../java/org/onap/policy/so/SORelatedInstance.java | 49 ++++++ .../policy/so/SORelatedInstanceListElement.java | 42 ++++++ .../main/java/org/onap/policy/so/SORequest.java | 61 ++++++++ .../java/org/onap/policy/so/SORequestDetails.java | 124 +++++++++++++++ .../java/org/onap/policy/so/SORequestError.java | 59 ++++++++ .../java/org/onap/policy/so/SORequestInfo.java | 66 ++++++++ .../org/onap/policy/so/SORequestParameters.java | 47 ++++++ .../org/onap/policy/so/SORequestReferences.java | 38 +++++ .../java/org/onap/policy/so/SORequestStatus.java | 51 +++++++ .../main/java/org/onap/policy/so/SOResponse.java | 49 ++++++ .../org/onap/policy/so/SOServiceException.java | 48 ++++++ .../java/org/onap/policy/so/SOSubscriberInfo.java | 47 ++++++ .../org/onap/policy/so/util/Serialization.java | 32 ++++ .../src/test/java/org/onap/policy/so/TestDemo.java | 167 ++++++++++++++++++++ 43 files changed, 1359 insertions(+), 1358 deletions(-) delete mode 100644 controlloop/common/model-impl/mso/pom.xml delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOAsyncRequestStatus.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOCloudConfiguration.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOInstanceReferences.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOManager.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOModelInfo.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOPolicyException.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstance.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstanceListElement.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequest.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestDetails.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestError.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestInfo.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestParameters.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestReferences.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestStatus.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOResponse.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOServiceException.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOSubscriberInfo.java delete mode 100644 controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/util/Serialization.java delete mode 100644 controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java create mode 100644 controlloop/common/model-impl/so/pom.xml create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyException.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceException.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java create mode 100644 controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java create mode 100644 controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestDemo.java (limited to 'controlloop/common/model-impl') diff --git a/controlloop/common/model-impl/mso/pom.xml b/controlloop/common/model-impl/mso/pom.xml deleted file mode 100644 index 5d386688d..000000000 --- a/controlloop/common/model-impl/mso/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - 4.0.0 - - mso - - - org.onap.policy.drools-applications - model-impl - 1.1.0-SNAPSHOT - - - - - junit - junit - 4.12 - provided - - - com.google.code.gson - gson - 2.5 - provided - - - org.drools - drools-core - 6.5.0.Final - provided - - - org.onap.policy.drools-applications - rest - ${project.version} - - - diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOAsyncRequestStatus.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOAsyncRequestStatus.java deleted file mode 100644 index 600816304..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOAsyncRequestStatus.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; -import java.time.LocalDateTime; - -import com.google.gson.annotations.SerializedName; - -public class SOAsyncRequestStatus implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("correlator") - public String correlator; - - @SerializedName("requestId") - public String requestId; - - @SerializedName("instanceReferences") - public SOInstanceReferences instanceReferences; - - @SerializedName("startTime") - public LocalDateTime startTime; - - @SerializedName("finishTime") - public LocalDateTime finishTime; - - @SerializedName("requestScope") - public String requestScope; - - @SerializedName("requestType") - public String requestType; - - @SerializedName("requestStatus") - public SORequestStatus requestStatus; - - - public SOAsyncRequestStatus() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOCloudConfiguration.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOCloudConfiguration.java deleted file mode 100644 index 7e4951166..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOCloudConfiguration.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - - -import com.google.gson.annotations.SerializedName; - -public class SOCloudConfiguration implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("lcpCloudRegionId") - public String lcpCloudRegionId; - - @SerializedName("tenantId") - public String tenantId; - - public SOCloudConfiguration() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOInstanceReferences.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOInstanceReferences.java deleted file mode 100644 index 894b17ade..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOInstanceReferences.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - - -import com.google.gson.annotations.SerializedName; - -public class SOInstanceReferences implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("requestId") - public String requestId; - - @SerializedName("instanceId") - public String instanceId; - - public SOInstanceReferences() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOManager.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOManager.java deleted file mode 100644 index ea9146d24..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOManager.java +++ /dev/null @@ -1,168 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.util.Base64; -import java.util.HashMap; -import java.util.Map; - -import org.onap.policy.mso.util.Serialization; -import org.onap.policy.rest.RESTManager; -import org.onap.policy.rest.RESTManager.Pair; -import org.drools.core.WorkingMemory; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonSyntaxException; - -public final class SOManager { - - private static final Logger logger = LoggerFactory.getLogger(SOManager.class); - private static ExecutorService executors = Executors.newCachedThreadPool(); - - public static SOResponse createModuleInstance(String url, String urlBase, String username, String password, SORequest request) { - - // - // Call REST - // - Map headers = new HashMap(); - //headers.put("X-FromAppId", "POLICY"); - //headers.put("X-TransactionId", requestID.toString()); - headers.put("Accept", "application/json"); - - // - // 201 - CREATED - you are done just return - // - - Pair httpDetails = RESTManager.post(url, username, password, headers, "application/json", Serialization.gsonPretty.toJson(request)); - - if (httpDetails == null) { - return null; - } - - if (httpDetails.a == 202) { - try { - SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class); - - String body = Serialization.gsonPretty.toJson(response); - logger.debug("***** Response to post:"); - logger.debug(body); - - String requestId = response.requestReferences.requestId; - int attemptsLeft = 20; - - //String getUrl = "/orchestrationRequests/v2/"+requestId; - String urlGet = urlBase + "/orchestrationRequests/v2/"+requestId; - SOResponse responseGet = null; - - while(attemptsLeft-- > 0){ - - Pair httpDetailsGet = RESTManager.get(urlGet, username, password, headers); - responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, SOResponse.class); - body = Serialization.gsonPretty.toJson(responseGet); - logger.debug("***** Response to get:"); - logger.debug(body); - - if(httpDetailsGet.a == 200){ - if(responseGet.request.requestStatus.requestState.equalsIgnoreCase("COMPLETE") || - responseGet.request.requestStatus.requestState.equalsIgnoreCase("FAILED")){ - logger.debug("***** ######## VF Module Creation "+responseGet.request.requestStatus.requestState); - return responseGet; - } - } - Thread.sleep(20000); - } - - if (responseGet != null - && responseGet.request != null - && responseGet.request.requestStatus != null - && responseGet.request.requestStatus.requestState != null) { - logger.warn("***** ######## VF Module Creation timeout. Status: ( {})", responseGet.request.requestStatus.requestState); - } - - return responseGet; - } catch (JsonSyntaxException e) { - logger.error("Failed to deserialize into SOResponse: ", e); - } catch (InterruptedException e) { - logger.error("Interrupted exception: ", e); - } - } - - - - - return null; - } - - /** - * - * @param wm - * @param url - * @param urlBase - * @param username - * @param password - * @param request - * - * This method makes an asynchronous Rest call to MSO and inserts the response into the Drools working memory - */ - public void asyncMSORestCall(WorkingMemory wm, String serviceInstanceId, String vnfInstanceId, SORequest request) { - executors.submit(new Runnable() - { - @Override - public void run() - { - String serverRoot = ""; // TODO - String username = ""; // TODO - String password = ""; // TODO - String url = serverRoot + "/serviceInstances/v5/" + serviceInstanceId + "/vnfs/" + vnfInstanceId + "/vfModules"; - - String auth = username + ":" + password; - - Map headers = new HashMap(); - byte[] encodedBytes = Base64.getEncoder().encode(auth.getBytes()); - headers.put("Accept", "application/json"); - headers.put("Authorization", "Basic " + new String(encodedBytes)); - - Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() - .setPrettyPrinting() - .create(); - - String msoJson = gsonPretty.toJson(request); - - SOResponse mso = new SOResponse(); - Pair httpResponse = RESTManager.post(url, "policy", "policy", headers, "application/json", msoJson); - if (httpResponse != null) { - Gson gson = new Gson(); - mso = gson.fromJson(httpResponse.b, SOResponse.class); - mso.httpResponseCode = httpResponse.a; - } - -// logger.info("MSOResponse inserted " + mso.toString()); - wm.insert(mso); - } - }); - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOModelInfo.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOModelInfo.java deleted file mode 100644 index cba763daf..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOModelInfo.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - - -import com.google.gson.annotations.SerializedName; - -public class SOModelInfo implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("modelType") - public String modelType; - - @SerializedName("modelInvariantId") - public String modelInvariantId; - - @SerializedName("modelNameVersionId") - public String modelNameVersionId; - - @SerializedName("modelName") - public String modelName; - - @SerializedName("modelVersion") - public String modelVersion; - - @SerializedName("modelCustomizationName") - public String modelCustomizationName; - - @SerializedName("modelCustomizationId") - public String modelCustomizationId; - - public SOModelInfo() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOPolicyException.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOPolicyException.java deleted file mode 100644 index a2c9f81aa..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOPolicyException.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - -import com.google.gson.annotations.SerializedName; - -public class SOPolicyException implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("messageId") - public String messageId; - - @SerializedName("text") - public String text; - - public SOPolicyException() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstance.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstance.java deleted file mode 100644 index d9d634a57..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstance.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - - - -import com.google.gson.annotations.SerializedName; - -public class SORelatedInstance implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("instanceId") - public String instanceId; - - @SerializedName("instanceName") - public String instanceName; - - @SerializedName("modelInfo") - public SOModelInfo modelInfo; - - - public SORelatedInstance() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstanceListElement.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstanceListElement.java deleted file mode 100644 index f32f7ccb1..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstanceListElement.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - - -import com.google.gson.annotations.SerializedName; - -public class SORelatedInstanceListElement implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("relatedInstance") - public SORelatedInstance relatedInstance; - - - public SORelatedInstanceListElement() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequest.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequest.java deleted file mode 100644 index 83a761377..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequest.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; -import java.time.LocalDateTime; - -import com.google.gson.annotations.SerializedName; - -public class SORequest implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("requestId") - public String requestId; - - @SerializedName("startTime") - //public LocalDateTime startTime; - public String startTime; - - @SerializedName("finishTime") - public LocalDateTime finishTime; - - @SerializedName("requestScope") - public String requestScope; - - @SerializedName("requestType") - public String requestType; - - @SerializedName("requestDetails") - public SORequestDetails requestDetails; - - @SerializedName("requestStatus") - public SORequestStatus requestStatus; - - public SORequest() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestDetails.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestDetails.java deleted file mode 100644 index 4b4b8217e..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestDetails.java +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; - -public class SORequestDetails implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("modelInfo") - public SOModelInfo modelInfo; - - @SerializedName("cloudConfiguration") - public SOCloudConfiguration cloudConfiguration; - - @SerializedName("requestInfo") - public SORequestInfo requestInfo; - - @SerializedName("subscriberInfo") - public SOSubscriberInfo subscriberInfo; - - @SerializedName("relatedInstanceList") - public List relatedInstanceList= new LinkedList(); - - @SerializedName("requestParameters") - public SORequestParameters requestParameters; - - public SORequestDetails() { - - } - - public SORequestDetails(SORequestDetails soRequestDetails) { - this.modelInfo = soRequestDetails.modelInfo; - this.cloudConfiguration = soRequestDetails.cloudConfiguration; - this.requestInfo = soRequestDetails.requestInfo; - this.relatedInstanceList = soRequestDetails.relatedInstanceList; - this.requestParameters = soRequestDetails.requestParameters; - } - - @Override - public String toString() { - return "SORequestDetails [modelInfo=" + modelInfo - + ", cloudConfiguration=" + cloudConfiguration - + ", requestInfo=" + requestInfo + ", relatedInstanceList=" - + relatedInstanceList + ", requestParameters=" - + requestParameters + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((cloudConfiguration == null) ? 0 : cloudConfiguration.hashCode()); - result = prime * result + ((modelInfo == null) ? 0 : modelInfo.hashCode()); - result = prime * result + ((relatedInstanceList == null) ? 0 : relatedInstanceList.hashCode()); - result = prime * result + ((requestInfo == null) ? 0 : requestInfo.hashCode()); - result = prime * result + ((requestParameters == null) ? 0 : requestParameters.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - SORequestDetails other = (SORequestDetails) obj; - if (cloudConfiguration == null) { - if (other.cloudConfiguration != null) - return false; - } else if (!cloudConfiguration.equals(other.cloudConfiguration)) - return false; - if (modelInfo == null) { - if (other.modelInfo != null) - return false; - } else if (!modelInfo.equals(other.modelInfo)) - return false; - if (relatedInstanceList == null) { - if (other.relatedInstanceList != null) - return false; - } else if (!relatedInstanceList.equals(other.relatedInstanceList)) - return false; - if (requestInfo == null) { - if (other.requestInfo != null) - return false; - } else if (!requestInfo.equals(other.requestInfo)) - return false; - if (requestParameters == null) { - if (other.requestParameters != null) - return false; - } else if (!requestParameters.equals(other.requestParameters)) - return false; - return true; - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestError.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestError.java deleted file mode 100644 index 76b62bfa0..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestError.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - -import com.google.gson.annotations.SerializedName; - -public class SORequestError implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - - @SerializedName("policyException") - public SOPolicyException policyException; - - - @SerializedName("serviceException") - public SOServiceException serviceException; - - /* - @SerializedName("messageId") - public String messageId; - - @SerializedName("text") - public String text; - - @SerializedName("url") - public String url; - - @SerializedName("variables") - public String variables; - */ - - public SORequestError() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestInfo.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestInfo.java deleted file mode 100644 index 9e5b93ccb..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestInfo.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - - -import com.google.gson.annotations.SerializedName; - -public class SORequestInfo implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("instanceName") - public String instanceName; - - @SerializedName("source") - public String source; - - @SerializedName("productFamilyId") - public String productFamilyId; - - @SerializedName("suppressRollback") - public boolean suppressRollback; - - @SerializedName("billingAccountNumber") - public String billingAccountNumber; - - @SerializedName("callbackUrl") - public String callbackUrl; - - @SerializedName("correlator") - public String correlator; - - @SerializedName("orderNumber") - public String orderNumber; - - @SerializedName("orderVersion") - public Integer orderVersion; - - - public SORequestInfo() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestParameters.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestParameters.java deleted file mode 100644 index 6e45afe83..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestParameters.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - - -import com.google.gson.annotations.SerializedName; - -public class SORequestParameters implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("subscriptionServiceType") - public String subscriptionServiceType; - - @SerializedName("userParams") - public List> userParams = new LinkedList>(); - - public SORequestParameters() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestReferences.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestReferences.java deleted file mode 100644 index ea8ebc64a..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestReferences.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - - -import com.google.gson.annotations.SerializedName; - -public class SORequestReferences implements Serializable { - - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("instanceId") - public String instanceId; - - @SerializedName("requestId") - public String requestId; - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestStatus.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestStatus.java deleted file mode 100644 index d5174328e..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestStatus.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - -import com.google.gson.annotations.SerializedName; - -public class SORequestStatus implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("percentProgress") - public int percentProgress; - - @SerializedName("requestState") - public String requestState; - - @SerializedName("timestamp") - //public LocalDateTime timestamp; - public String timestamp; - - @SerializedName("wasRolledBack") - public boolean wasRolledBack; - - - public SORequestStatus() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOResponse.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOResponse.java deleted file mode 100644 index ddf937593..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOResponse.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - -import com.google.gson.annotations.SerializedName; - -public class SOResponse implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("requestReferences") - public SORequestReferences requestReferences; - - @SerializedName("requestError") - public SORequestError requestError; - - @SerializedName("request") - public SORequest request; - - public int httpResponseCode; - - - public SOResponse() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOServiceException.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOServiceException.java deleted file mode 100644 index 4a806ced4..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOServiceException.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; -import java.util.LinkedList; -import java.util.List; - -import com.google.gson.annotations.SerializedName; - -public class SOServiceException implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("messageId") - public String messageId; - - @SerializedName("text") - public String text; - - @SerializedName("variables") - public List variables = new LinkedList(); - - public SOServiceException() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOSubscriberInfo.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOSubscriberInfo.java deleted file mode 100644 index 97d620f5c..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOSubscriberInfo.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.io.Serializable; - - -import com.google.gson.annotations.SerializedName; - -public class SOSubscriberInfo implements Serializable { - - /** - * - */ - private static final long serialVersionUID = -3283942659786236032L; - - @SerializedName("globalSubscriberId") - public String globalSubscriberId; - - @SerializedName("subscriberCommonSiteId") - public String subscriberCommonSiteId; - - @SerializedName("subscriberName") - public String subscriberName; - - public SOSubscriberInfo() { - } - -} diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/util/Serialization.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/util/Serialization.java deleted file mode 100644 index 24eb2951a..000000000 --- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/util/Serialization.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -public final class Serialization { - - final static public Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() - .setPrettyPrinting() - .create(); - -} diff --git a/controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java b/controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java deleted file mode 100644 index bfbbf0b57..000000000 --- a/controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java +++ /dev/null @@ -1,167 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * mso - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.policy.mso; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.onap.policy.mso.SOCloudConfiguration; -import org.onap.policy.mso.SOModelInfo; -import org.onap.policy.mso.SORelatedInstance; -import org.onap.policy.mso.SORelatedInstanceListElement; -import org.onap.policy.mso.SORequest; -import org.onap.policy.mso.SORequestDetails; -import org.onap.policy.mso.SORequestInfo; -import org.onap.policy.mso.SORequestParameters; -import org.onap.policy.mso.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TestDemo { - private static final Logger logger = LoggerFactory.getLogger(TestDemo.class); - @Test - public void test() { - - SORequest request = new SORequest(); - request.requestDetails = new SORequestDetails(); - request.requestDetails.modelInfo = new SOModelInfo(); - request.requestDetails.cloudConfiguration = new SOCloudConfiguration(); - request.requestDetails.requestInfo = new SORequestInfo(); - request.requestDetails.requestParameters = new SORequestParameters(); - - request.requestDetails.modelInfo.modelType = "vfModule"; - request.requestDetails.modelInfo.modelInvariantId = "ff5256d2-5a33-55df-13ab-12abad84e7ff"; - request.requestDetails.modelInfo.modelNameVersionId = "fe6478e5-ea33-3346-ac12-ab121484a3fe"; - request.requestDetails.modelInfo.modelName = "vSAMP12..base..module-0"; - request.requestDetails.modelInfo.modelVersion = "1"; - - request.requestDetails.cloudConfiguration.lcpCloudRegionId = "mdt1"; - request.requestDetails.cloudConfiguration.tenantId = "88a6ca3ee0394ade9403f075db23167e"; - - request.requestDetails.requestInfo.instanceName = "SOTEST103a-vSAMP12_base_module-0"; - request.requestDetails.requestInfo.source = "VID"; - request.requestDetails.requestInfo.suppressRollback = true; - - SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement(); - SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement(); - SORelatedInstanceListElement relatedInstanceListElement3 = new SORelatedInstanceListElement(); - relatedInstanceListElement1.relatedInstance = new SORelatedInstance(); - relatedInstanceListElement2.relatedInstance = new SORelatedInstance(); - relatedInstanceListElement3.relatedInstance = new SORelatedInstance(); - - relatedInstanceListElement1.relatedInstance.instanceId = "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c"; - relatedInstanceListElement1.relatedInstance.instanceName = "SOTESTVOL103a-vSAMP12_base_module-0_vol"; - relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo(); - relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "volumeGroup"; - - relatedInstanceListElement2.relatedInstance.instanceId = "serviceInstanceId"; - relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo(); - relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "service"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = "ff3514e3-5a33-55df-13ab-12abad84e7ff"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = "fe6985cd-ea33-3346-ac12-ab121484a3fe"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelName = "parent service model name"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = "1.0"; - - relatedInstanceListElement3.relatedInstance.instanceId = "vnfInstanceId"; - relatedInstanceListElement3.relatedInstance.modelInfo = new SOModelInfo(); - relatedInstanceListElement3.relatedInstance.modelInfo.modelType = "vnf"; - relatedInstanceListElement3.relatedInstance.modelInfo.modelInvariantId = "ff5256d1-5a33-55df-13ab-12abad84e7ff"; - relatedInstanceListElement3.relatedInstance.modelInfo.modelNameVersionId = "fe6478e4-ea33-3346-ac12-ab121484a3fe"; - relatedInstanceListElement3.relatedInstance.modelInfo.modelName = "vSAMP12"; - relatedInstanceListElement3.relatedInstance.modelInfo.modelVersion = "1.0"; - relatedInstanceListElement3.relatedInstance.modelInfo.modelCustomizationName = "vSAMP12 1"; - - request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1); - request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2); - request.requestDetails.relatedInstanceList.add(relatedInstanceListElement3); - - Map userParam1 = new HashMap<>(); - userParam1.put("name1", "value1"); - - Map userParam2 = new HashMap<>(); - userParam2.put("name2", "value2"); - - request.requestDetails.requestParameters.userParams.add(userParam1); - request.requestDetails.requestParameters.userParams.add(userParam2); - - logger.debug(Serialization.gsonPretty.toJson(request)); - - } - - @Test - public void testHack() { - - logger.debug("** HACK **"); - - SORequest request = new SORequest(); - // - request.requestDetails = new SORequestDetails(); - request.requestDetails.modelInfo = new SOModelInfo(); - request.requestDetails.cloudConfiguration = new SOCloudConfiguration(); - request.requestDetails.requestInfo = new SORequestInfo(); - request.requestDetails.requestParameters = new SORequestParameters(); - request.requestDetails.requestParameters.userParams = null; - - request.requestDetails.modelInfo.modelType = "vfModule"; - request.requestDetails.modelInfo.modelInvariantId = "a9c4a35a-de48-451a-9e4e-343f2ac52928"; - request.requestDetails.modelInfo.modelNameVersionId = "e0d98ad1-238d-4555-b439-023d3f9079f6"; - request.requestDetails.modelInfo.modelName = "0d9e0d9d352749f4B3cb..dnsscaling..module-0"; - request.requestDetails.modelInfo.modelVersion = "2.0"; - - request.requestDetails.cloudConfiguration.lcpCloudRegionId = "DFW"; - request.requestDetails.cloudConfiguration.tenantId = "1015548"; - - request.requestDetails.requestInfo.instanceName = "Vfmodule_Ete_Name1eScaling63928f-ccdc-4b34-bdef-9bf64109026e"; - request.requestDetails.requestInfo.source = "POLICY"; - request.requestDetails.requestInfo.suppressRollback = false; - - SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement(); - SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement(); - relatedInstanceListElement1.relatedInstance = new SORelatedInstance(); - relatedInstanceListElement2.relatedInstance = new SORelatedInstance(); - - String serviceInstanceId = "98af39ce-6408-466b-921f-c2c7a8f59ed6"; - relatedInstanceListElement1.relatedInstance.instanceId = serviceInstanceId; - relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo(); - relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service"; - relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = "24329a0c-1d57-4210-b1af-a65df64e9d59"; - relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = "ac642881-8e7e-4217-bd64-16ad41c42e30"; - relatedInstanceListElement1.relatedInstance.modelInfo.modelName = "5116d67e-0b4f-46bf-a46f"; - relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = "2.0"; - - String vnfInstanceId = "8eb411b8-a936-412f-b01f-9a9a435c0e93"; - relatedInstanceListElement2.relatedInstance.instanceId = vnfInstanceId; - relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo(); - relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "vnf"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = "09fd971e-db5f-475d-997c-cf6704b6b8fe"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = "152ed917-6dcc-46ee-bf8a-a775c5aa5a74"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelName = "9e4c31d2-4b25-4d9e-9fb4"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = "2.0"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = "0d9e0d9d-3527-49f4-b3cb 2"; - - request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1); - request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2); - - logger.debug(Serialization.gsonPretty.toJson(request)); - } - -} diff --git a/controlloop/common/model-impl/pom.xml b/controlloop/common/model-impl/pom.xml index e96befbf7..3f0c004e6 100644 --- a/controlloop/common/model-impl/pom.xml +++ b/controlloop/common/model-impl/pom.xml @@ -37,7 +37,7 @@ appc appclcm events - mso + so rest sdc trafficgenerator diff --git a/controlloop/common/model-impl/so/pom.xml b/controlloop/common/model-impl/so/pom.xml new file mode 100644 index 000000000..faeb12130 --- /dev/null +++ b/controlloop/common/model-impl/so/pom.xml @@ -0,0 +1,57 @@ + + + + 4.0.0 + + so + + + org.onap.policy.drools-applications + model-impl + 1.1.0-SNAPSHOT + + + + + junit + junit + 4.12 + provided + + + com.google.code.gson + gson + 2.5 + provided + + + org.drools + drools-core + 6.5.0.Final + provided + + + org.onap.policy.drools-applications + rest + ${project.version} + + + diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java new file mode 100644 index 000000000..97978c73f --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOAsyncRequestStatus.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; +import java.time.LocalDateTime; + +import com.google.gson.annotations.SerializedName; + +public class SOAsyncRequestStatus implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("correlator") + public String correlator; + + @SerializedName("requestId") + public String requestId; + + @SerializedName("instanceReferences") + public SOInstanceReferences instanceReferences; + + @SerializedName("startTime") + public LocalDateTime startTime; + + @SerializedName("finishTime") + public LocalDateTime finishTime; + + @SerializedName("requestScope") + public String requestScope; + + @SerializedName("requestType") + public String requestType; + + @SerializedName("requestStatus") + public SORequestStatus requestStatus; + + + public SOAsyncRequestStatus() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java new file mode 100644 index 000000000..6b817075f --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOCloudConfiguration.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + + +import com.google.gson.annotations.SerializedName; + +public class SOCloudConfiguration implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("lcpCloudRegionId") + public String lcpCloudRegionId; + + @SerializedName("tenantId") + public String tenantId; + + public SOCloudConfiguration() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java new file mode 100644 index 000000000..97abd3950 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOInstanceReferences.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + + +import com.google.gson.annotations.SerializedName; + +public class SOInstanceReferences implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("requestId") + public String requestId; + + @SerializedName("instanceId") + public String instanceId; + + public SOInstanceReferences() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java new file mode 100644 index 000000000..86ade6db7 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOManager.java @@ -0,0 +1,168 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; + +import org.onap.policy.so.util.Serialization; +import org.onap.policy.rest.RESTManager; +import org.onap.policy.rest.RESTManager.Pair; +import org.drools.core.WorkingMemory; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonSyntaxException; + +public final class SOManager { + + private static final Logger logger = LoggerFactory.getLogger(SOManager.class); + private static ExecutorService executors = Executors.newCachedThreadPool(); + + public static SOResponse createModuleInstance(String url, String urlBase, String username, String password, SORequest request) { + + // + // Call REST + // + Map headers = new HashMap(); + //headers.put("X-FromAppId", "POLICY"); + //headers.put("X-TransactionId", requestID.toString()); + headers.put("Accept", "application/json"); + + // + // 201 - CREATED - you are done just return + // + + Pair httpDetails = RESTManager.post(url, username, password, headers, "application/json", Serialization.gsonPretty.toJson(request)); + + if (httpDetails == null) { + return null; + } + + if (httpDetails.a == 202) { + try { + SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class); + + String body = Serialization.gsonPretty.toJson(response); + logger.debug("***** Response to post:"); + logger.debug(body); + + String requestId = response.requestReferences.requestId; + int attemptsLeft = 20; + + //String getUrl = "/orchestrationRequests/v2/"+requestId; + String urlGet = urlBase + "/orchestrationRequests/v2/"+requestId; + SOResponse responseGet = null; + + while(attemptsLeft-- > 0){ + + Pair httpDetailsGet = RESTManager.get(urlGet, username, password, headers); + responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, SOResponse.class); + body = Serialization.gsonPretty.toJson(responseGet); + logger.debug("***** Response to get:"); + logger.debug(body); + + if(httpDetailsGet.a == 200){ + if(responseGet.request.requestStatus.requestState.equalsIgnoreCase("COMPLETE") || + responseGet.request.requestStatus.requestState.equalsIgnoreCase("FAILED")){ + logger.debug("***** ######## VF Module Creation "+responseGet.request.requestStatus.requestState); + return responseGet; + } + } + Thread.sleep(20000); + } + + if (responseGet != null + && responseGet.request != null + && responseGet.request.requestStatus != null + && responseGet.request.requestStatus.requestState != null) { + logger.warn("***** ######## VF Module Creation timeout. Status: ( {})", responseGet.request.requestStatus.requestState); + } + + return responseGet; + } catch (JsonSyntaxException e) { + logger.error("Failed to deserialize into SOResponse: ", e); + } catch (InterruptedException e) { + logger.error("Interrupted exception: ", e); + } + } + + + + + return null; + } + + /** + * + * @param wm + * @param url + * @param urlBase + * @param username + * @param password + * @param request + * + * This method makes an asynchronous Rest call to MSO and inserts the response into the Drools working memory + */ + public void asyncSORestCall(WorkingMemory wm, String serviceInstanceId, String vnfInstanceId, SORequest request) { + executors.submit(new Runnable() + { + @Override + public void run() + { + String serverRoot = "http://localhost:6667"; // TODO + String username = "username"; // TODO + String password = "password"; // TODO + String url = serverRoot + "/serviceInstances/v2/" + serviceInstanceId + "/vnfs/" + vnfInstanceId + "/vfModulesHTTPS/1.1"; + + String auth = username + ":" + password; + + Map headers = new HashMap(); + byte[] encodedBytes = Base64.getEncoder().encode(auth.getBytes()); + headers.put("Accept", "application/json"); + headers.put("Authorization", "Basic " + new String(encodedBytes)); + + Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() + .setPrettyPrinting() + .create(); + + String msoJson = gsonPretty.toJson(request); + + SOResponse mso = new SOResponse(); + Pair httpResponse = RESTManager.post(url, "policy", "policy", headers, "application/json", msoJson); + if (httpResponse != null) { + Gson gson = new Gson(); + mso = gson.fromJson(httpResponse.b, SOResponse.class); + mso.httpResponseCode = httpResponse.a; + } + + wm.insert(mso); + logger.info("SOResponse inserted " + gsonPretty.toJson(mso)); + } + }); + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java new file mode 100644 index 000000000..94070ba9a --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOModelInfo.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + + +import com.google.gson.annotations.SerializedName; + +public class SOModelInfo implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("modelType") + public String modelType; + + @SerializedName("modelInvariantId") + public String modelInvariantId; + + @SerializedName("modelNameVersionId") + public String modelNameVersionId; + + @SerializedName("modelName") + public String modelName; + + @SerializedName("modelVersion") + public String modelVersion; + + @SerializedName("modelCustomizationName") + public String modelCustomizationName; + + @SerializedName("modelCustomizationId") + public String modelCustomizationId; + + public SOModelInfo() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyException.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyException.java new file mode 100644 index 000000000..150733963 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOPolicyException.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class SOPolicyException implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("messageId") + public String messageId; + + @SerializedName("text") + public String text; + + public SOPolicyException() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java new file mode 100644 index 000000000..ac737307c --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstance.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + + + +import com.google.gson.annotations.SerializedName; + +public class SORelatedInstance implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("instanceId") + public String instanceId; + + @SerializedName("instanceName") + public String instanceName; + + @SerializedName("modelInfo") + public SOModelInfo modelInfo; + + + public SORelatedInstance() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java new file mode 100644 index 000000000..c4b85ab52 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORelatedInstanceListElement.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + + +import com.google.gson.annotations.SerializedName; + +public class SORelatedInstanceListElement implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("relatedInstance") + public SORelatedInstance relatedInstance; + + + public SORelatedInstanceListElement() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java new file mode 100644 index 000000000..3e90ff345 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequest.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.UUID; + +import com.google.gson.annotations.SerializedName; + +public class SORequest implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("requestId") + public UUID requestId; + + @SerializedName("startTime") + //public LocalDateTime startTime; + public String startTime; + + @SerializedName("finishTime") + public LocalDateTime finishTime; + + @SerializedName("requestScope") + public String requestScope; + + @SerializedName("requestType") + public String requestType; + + @SerializedName("requestDetails") + public SORequestDetails requestDetails; + + @SerializedName("requestStatus") + public SORequestStatus requestStatus; + + public SORequest() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java new file mode 100644 index 000000000..ab4afc16c --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestDetails.java @@ -0,0 +1,124 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + +public class SORequestDetails implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("modelInfo") + public SOModelInfo modelInfo; + + @SerializedName("cloudConfiguration") + public SOCloudConfiguration cloudConfiguration; + + @SerializedName("requestInfo") + public SORequestInfo requestInfo; + + @SerializedName("subscriberInfo") + public SOSubscriberInfo subscriberInfo; + + @SerializedName("relatedInstanceList") + public List relatedInstanceList= new LinkedList(); + + @SerializedName("requestParameters") + public SORequestParameters requestParameters; + + public SORequestDetails() { + + } + + public SORequestDetails(SORequestDetails soRequestDetails) { + this.modelInfo = soRequestDetails.modelInfo; + this.cloudConfiguration = soRequestDetails.cloudConfiguration; + this.requestInfo = soRequestDetails.requestInfo; + this.relatedInstanceList = soRequestDetails.relatedInstanceList; + this.requestParameters = soRequestDetails.requestParameters; + } + + @Override + public String toString() { + return "SORequestDetails [modelInfo=" + modelInfo + + ", cloudConfiguration=" + cloudConfiguration + + ", requestInfo=" + requestInfo + ", relatedInstanceList=" + + relatedInstanceList + ", requestParameters=" + + requestParameters + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((cloudConfiguration == null) ? 0 : cloudConfiguration.hashCode()); + result = prime * result + ((modelInfo == null) ? 0 : modelInfo.hashCode()); + result = prime * result + ((relatedInstanceList == null) ? 0 : relatedInstanceList.hashCode()); + result = prime * result + ((requestInfo == null) ? 0 : requestInfo.hashCode()); + result = prime * result + ((requestParameters == null) ? 0 : requestParameters.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + SORequestDetails other = (SORequestDetails) obj; + if (cloudConfiguration == null) { + if (other.cloudConfiguration != null) + return false; + } else if (!cloudConfiguration.equals(other.cloudConfiguration)) + return false; + if (modelInfo == null) { + if (other.modelInfo != null) + return false; + } else if (!modelInfo.equals(other.modelInfo)) + return false; + if (relatedInstanceList == null) { + if (other.relatedInstanceList != null) + return false; + } else if (!relatedInstanceList.equals(other.relatedInstanceList)) + return false; + if (requestInfo == null) { + if (other.requestInfo != null) + return false; + } else if (!requestInfo.equals(other.requestInfo)) + return false; + if (requestParameters == null) { + if (other.requestParameters != null) + return false; + } else if (!requestParameters.equals(other.requestParameters)) + return false; + return true; + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java new file mode 100644 index 000000000..d49897c72 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestError.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class SORequestError implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + + @SerializedName("policyException") + public SOPolicyException policyException; + + + @SerializedName("serviceException") + public SOServiceException serviceException; + + /* + @SerializedName("messageId") + public String messageId; + + @SerializedName("text") + public String text; + + @SerializedName("url") + public String url; + + @SerializedName("variables") + public String variables; + */ + + public SORequestError() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java new file mode 100644 index 000000000..640649800 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestInfo.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + + +import com.google.gson.annotations.SerializedName; + +public class SORequestInfo implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("instanceName") + public String instanceName; + + @SerializedName("source") + public String source; + + @SerializedName("productFamilyId") + public String productFamilyId; + + @SerializedName("suppressRollback") + public boolean suppressRollback; + + @SerializedName("billingAccountNumber") + public String billingAccountNumber; + + @SerializedName("callbackUrl") + public String callbackUrl; + + @SerializedName("correlator") + public String correlator; + + @SerializedName("orderNumber") + public String orderNumber; + + @SerializedName("orderVersion") + public Integer orderVersion; + + + public SORequestInfo() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java new file mode 100644 index 000000000..c66f0979c --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestParameters.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + + +import com.google.gson.annotations.SerializedName; + +public class SORequestParameters implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("subscriptionServiceType") + public String subscriptionServiceType; + + @SerializedName("userParams") + public List> userParams = new LinkedList>(); + + public SORequestParameters() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java new file mode 100644 index 000000000..f3e15e1d7 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestReferences.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + + +import com.google.gson.annotations.SerializedName; + +public class SORequestReferences implements Serializable { + + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("instanceId") + public String instanceId; + + @SerializedName("requestId") + public String requestId; + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java new file mode 100644 index 000000000..4b57fc7ba --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SORequestStatus.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class SORequestStatus implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("percentProgress") + public int percentProgress; + + @SerializedName("requestState") + public String requestState; + + @SerializedName("timestamp") + //public LocalDateTime timestamp; + public String timestamp; + + @SerializedName("wasRolledBack") + public boolean wasRolledBack; + + + public SORequestStatus() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java new file mode 100644 index 000000000..c5c3737b2 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOResponse.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + +import com.google.gson.annotations.SerializedName; + +public class SOResponse implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("requestReferences") + public SORequestReferences requestReferences; + + @SerializedName("requestError") + public SORequestError requestError; + + @SerializedName("request") + public SORequest request; + + public int httpResponseCode; + + + public SOResponse() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceException.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceException.java new file mode 100644 index 000000000..58999fd30 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOServiceException.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; +import java.util.LinkedList; +import java.util.List; + +import com.google.gson.annotations.SerializedName; + +public class SOServiceException implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("messageId") + public String messageId; + + @SerializedName("text") + public String text; + + @SerializedName("variables") + public List variables = new LinkedList(); + + public SOServiceException() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java new file mode 100644 index 000000000..745e237fe --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SOSubscriberInfo.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.io.Serializable; + + +import com.google.gson.annotations.SerializedName; + +public class SOSubscriberInfo implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3283942659786236032L; + + @SerializedName("globalSubscriberId") + public String globalSubscriberId; + + @SerializedName("subscriberCommonSiteId") + public String subscriberCommonSiteId; + + @SerializedName("subscriberName") + public String subscriberName; + + public SOSubscriberInfo() { + } + +} diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java new file mode 100644 index 000000000..c9d013ea6 --- /dev/null +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/util/Serialization.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so.util; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public final class Serialization { + + final static public Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() + .setPrettyPrinting() + .create(); + +} diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestDemo.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestDemo.java new file mode 100644 index 000000000..af8f4be0e --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestDemo.java @@ -0,0 +1,167 @@ +/*- + * ============LICENSE_START======================================================= + * mso + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.so; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.policy.so.SOCloudConfiguration; +import org.onap.policy.so.SOModelInfo; +import org.onap.policy.so.SORelatedInstance; +import org.onap.policy.so.SORelatedInstanceListElement; +import org.onap.policy.so.SORequest; +import org.onap.policy.so.SORequestDetails; +import org.onap.policy.so.SORequestInfo; +import org.onap.policy.so.SORequestParameters; +import org.onap.policy.so.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TestDemo { + private static final Logger logger = LoggerFactory.getLogger(TestDemo.class); + @Test + public void test() { + + SORequest request = new SORequest(); + request.requestDetails = new SORequestDetails(); + request.requestDetails.modelInfo = new SOModelInfo(); + request.requestDetails.cloudConfiguration = new SOCloudConfiguration(); + request.requestDetails.requestInfo = new SORequestInfo(); + request.requestDetails.requestParameters = new SORequestParameters(); + + request.requestDetails.modelInfo.modelType = "vfModule"; + request.requestDetails.modelInfo.modelInvariantId = "ff5256d2-5a33-55df-13ab-12abad84e7ff"; + request.requestDetails.modelInfo.modelNameVersionId = "fe6478e5-ea33-3346-ac12-ab121484a3fe"; + request.requestDetails.modelInfo.modelName = "vSAMP12..base..module-0"; + request.requestDetails.modelInfo.modelVersion = "1"; + + request.requestDetails.cloudConfiguration.lcpCloudRegionId = "mdt1"; + request.requestDetails.cloudConfiguration.tenantId = "88a6ca3ee0394ade9403f075db23167e"; + + request.requestDetails.requestInfo.instanceName = "SOTEST103a-vSAMP12_base_module-0"; + request.requestDetails.requestInfo.source = "VID"; + request.requestDetails.requestInfo.suppressRollback = true; + + SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement(); + SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement(); + SORelatedInstanceListElement relatedInstanceListElement3 = new SORelatedInstanceListElement(); + relatedInstanceListElement1.relatedInstance = new SORelatedInstance(); + relatedInstanceListElement2.relatedInstance = new SORelatedInstance(); + relatedInstanceListElement3.relatedInstance = new SORelatedInstance(); + + relatedInstanceListElement1.relatedInstance.instanceId = "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c"; + relatedInstanceListElement1.relatedInstance.instanceName = "SOTESTVOL103a-vSAMP12_base_module-0_vol"; + relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo(); + relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "volumeGroup"; + + relatedInstanceListElement2.relatedInstance.instanceId = "serviceInstanceId"; + relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo(); + relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "service"; + relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = "ff3514e3-5a33-55df-13ab-12abad84e7ff"; + relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = "fe6985cd-ea33-3346-ac12-ab121484a3fe"; + relatedInstanceListElement2.relatedInstance.modelInfo.modelName = "parent service model name"; + relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = "1.0"; + + relatedInstanceListElement3.relatedInstance.instanceId = "vnfInstanceId"; + relatedInstanceListElement3.relatedInstance.modelInfo = new SOModelInfo(); + relatedInstanceListElement3.relatedInstance.modelInfo.modelType = "vnf"; + relatedInstanceListElement3.relatedInstance.modelInfo.modelInvariantId = "ff5256d1-5a33-55df-13ab-12abad84e7ff"; + relatedInstanceListElement3.relatedInstance.modelInfo.modelNameVersionId = "fe6478e4-ea33-3346-ac12-ab121484a3fe"; + relatedInstanceListElement3.relatedInstance.modelInfo.modelName = "vSAMP12"; + relatedInstanceListElement3.relatedInstance.modelInfo.modelVersion = "1.0"; + relatedInstanceListElement3.relatedInstance.modelInfo.modelCustomizationName = "vSAMP12 1"; + + request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1); + request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2); + request.requestDetails.relatedInstanceList.add(relatedInstanceListElement3); + + Map userParam1 = new HashMap<>(); + userParam1.put("name1", "value1"); + + Map userParam2 = new HashMap<>(); + userParam2.put("name2", "value2"); + + request.requestDetails.requestParameters.userParams.add(userParam1); + request.requestDetails.requestParameters.userParams.add(userParam2); + + logger.debug(Serialization.gsonPretty.toJson(request)); + + } + + @Test + public void testHack() { + + logger.debug("** HACK **"); + + SORequest request = new SORequest(); + // + request.requestDetails = new SORequestDetails(); + request.requestDetails.modelInfo = new SOModelInfo(); + request.requestDetails.cloudConfiguration = new SOCloudConfiguration(); + request.requestDetails.requestInfo = new SORequestInfo(); + request.requestDetails.requestParameters = new SORequestParameters(); + request.requestDetails.requestParameters.userParams = null; + + request.requestDetails.modelInfo.modelType = "vfModule"; + request.requestDetails.modelInfo.modelInvariantId = "a9c4a35a-de48-451a-9e4e-343f2ac52928"; + request.requestDetails.modelInfo.modelNameVersionId = "e0d98ad1-238d-4555-b439-023d3f9079f6"; + request.requestDetails.modelInfo.modelName = "0d9e0d9d352749f4B3cb..dnsscaling..module-0"; + request.requestDetails.modelInfo.modelVersion = "2.0"; + + request.requestDetails.cloudConfiguration.lcpCloudRegionId = "DFW"; + request.requestDetails.cloudConfiguration.tenantId = "1015548"; + + request.requestDetails.requestInfo.instanceName = "Vfmodule_Ete_Name1eScaling63928f-ccdc-4b34-bdef-9bf64109026e"; + request.requestDetails.requestInfo.source = "POLICY"; + request.requestDetails.requestInfo.suppressRollback = false; + + SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement(); + SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement(); + relatedInstanceListElement1.relatedInstance = new SORelatedInstance(); + relatedInstanceListElement2.relatedInstance = new SORelatedInstance(); + + String serviceInstanceId = "98af39ce-6408-466b-921f-c2c7a8f59ed6"; + relatedInstanceListElement1.relatedInstance.instanceId = serviceInstanceId; + relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo(); + relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service"; + relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = "24329a0c-1d57-4210-b1af-a65df64e9d59"; + relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = "ac642881-8e7e-4217-bd64-16ad41c42e30"; + relatedInstanceListElement1.relatedInstance.modelInfo.modelName = "5116d67e-0b4f-46bf-a46f"; + relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = "2.0"; + + String vnfInstanceId = "8eb411b8-a936-412f-b01f-9a9a435c0e93"; + relatedInstanceListElement2.relatedInstance.instanceId = vnfInstanceId; + relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo(); + relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "vnf"; + relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = "09fd971e-db5f-475d-997c-cf6704b6b8fe"; + relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = "152ed917-6dcc-46ee-bf8a-a775c5aa5a74"; + relatedInstanceListElement2.relatedInstance.modelInfo.modelName = "9e4c31d2-4b25-4d9e-9fb4"; + relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = "2.0"; + relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = "0d9e0d9d-3527-49f4-b3cb 2"; + + request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1); + request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2); + + logger.debug(Serialization.gsonPretty.toJson(request)); + } + +} -- cgit 1.2.3-korg