From 4498fc2617e0003b7d2f53a6b09051fd216c840e Mon Sep 17 00:00:00 2001 From: Xin Miao Date: Mon, 1 Oct 2018 18:09:24 -0500 Subject: Add new actor SDNC to support CCVPN Closed Loop Issue-ID: POLICY-1183 Change-Id: I1b77b5b9cefca104382d9d84dd00bbd63b20e0f2 Signed-off-by: Xin Miao Signed-off-by: Pamela Dragosh --- .../org/onap/policy/sdnc/SdncHealNetworkInfo.java | 43 ++++++ .../java/org/onap/policy/sdnc/SdncHealRequest.java | 77 ++++++++++ .../policy/sdnc/SdncHealRequestHeaderInfo.java | 54 +++++++ .../org/onap/policy/sdnc/SdncHealRequestInfo.java | 43 ++++++ .../org/onap/policy/sdnc/SdncHealServiceInfo.java | 43 ++++++ .../java/org/onap/policy/sdnc/SdncManager.java | 164 +++++++++++++++++++++ .../java/org/onap/policy/sdnc/SdncRequest.java | 63 ++++++++ .../java/org/onap/policy/sdnc/SdncResponse.java | 54 +++++++ .../onap/policy/sdnc/SdncResponseNetworkInfo.java | 54 +++++++ .../org/onap/policy/sdnc/SdncResponseOutput.java | 67 +++++++++ .../onap/policy/sdnc/SdncResponseServiceInfo.java | 44 ++++++ .../org/onap/policy/sdnc/util/Serialization.java | 32 ++++ 12 files changed, 738 insertions(+) create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealNetworkInfo.java create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestHeaderInfo.java create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestInfo.java create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealServiceInfo.java create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponse.java create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseNetworkInfo.java create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseServiceInfo.java create mode 100644 controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java (limited to 'controlloop/common/model-impl/sdnc/src/main') diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealNetworkInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealNetworkInfo.java new file mode 100644 index 000000000..4039d9441 --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealNetworkInfo.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. 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.sdnc; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SdncHealNetworkInfo implements Serializable { + + private static final long serialVersionUID = 3208673205100673119L; + + @SerializedName("network-id") + private String networkId; + + public SdncHealNetworkInfo() { + // Default constructor for SdncHealActionVmInfo + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } +} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java new file mode 100644 index 000000000..74122b845 --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. 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.sdnc; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SdncHealRequest implements Serializable { + + private static final long serialVersionUID = -7341931593089709247L; + + @SerializedName("sdnc-request-header") + private SdncHealRequestHeaderInfo requestHeaderInfo; + + @SerializedName("request-information") + private SdncHealRequestInfo requestInfo; + + @SerializedName("service-information") + private SdncHealServiceInfo serviceInfo; + + @SerializedName("network-information") + private SdncHealNetworkInfo networkInfo; + + public SdncHealRequest() { + // Default constructor for SdncHealRequest + } + + public SdncHealRequestHeaderInfo getRequestHeaderInfo() { + return requestHeaderInfo; + } + + public void setRequestHeaderInfo(SdncHealRequestHeaderInfo requestHeaderInfo) { + this.requestHeaderInfo = requestHeaderInfo; + } + + public SdncHealRequestInfo getRequestInfo() { + return requestInfo; + } + + public void setRequestInfo(SdncHealRequestInfo requestInfo) { + this.requestInfo = requestInfo; + } + + public SdncHealServiceInfo getServiceInfo() { + return serviceInfo; + } + + public void setServiceInfo(SdncHealServiceInfo serviceInfo) { + this.serviceInfo = serviceInfo; + } + + public SdncHealNetworkInfo getNetworkInfo() { + return networkInfo; + } + + public void setNetworkInfo(SdncHealNetworkInfo networkInfo) { + this.networkInfo = networkInfo; + } + +} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestHeaderInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestHeaderInfo.java new file mode 100644 index 000000000..97426b40e --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestHeaderInfo.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. 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.sdnc; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SdncHealRequestHeaderInfo implements Serializable { + + private static final long serialVersionUID = 3208673205100673119L; + + @SerializedName("svc-request-id") + private String svcRequestId; + + @SerializedName("svc-action") + private String svcAction; + + public SdncHealRequestHeaderInfo() { + // Default constructor for SdncHealActionVmInfo + } + + public String getSvcRequestId() { + return svcRequestId; + } + + public void setSvcRequestId(String svcRequestId) { + this.svcRequestId = svcRequestId; + } + + public String getSvcAction() { + return svcAction; + } + + public void setSvcAction(String svcAction) { + this.svcAction = svcAction; + } +} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestInfo.java new file mode 100644 index 000000000..91de4b2d2 --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestInfo.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. 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.sdnc; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SdncHealRequestInfo implements Serializable { + + private static final long serialVersionUID = 3208673205100673119L; + + @SerializedName("request-action") + private String requestAction; + + public SdncHealRequestInfo() { + // Default constructor for SdncHealActionVmInfo + } + + public String getRequestAction() { + return requestAction; + } + + public void setRequestAction(String requestAction) { + this.requestAction = requestAction; + } +} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealServiceInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealServiceInfo.java new file mode 100644 index 000000000..d86d32fea --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealServiceInfo.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. 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.sdnc; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SdncHealServiceInfo implements Serializable { + + private static final long serialVersionUID = 3208673205100673119L; + + @SerializedName("service-instance-id") + private String serviceInstanceId; + + public SdncHealServiceInfo() { + // Default constructor for SdncHealActionVmInfo + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } +} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java new file mode 100644 index 000000000..61665f684 --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java @@ -0,0 +1,164 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. 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.sdnc; + + +import com.google.gson.JsonSyntaxException; + +import java.util.HashMap; +import java.util.Map; + +import org.drools.core.WorkingMemory; +import org.onap.policy.drools.system.PolicyEngine; +import org.onap.policy.rest.RESTManager; +import org.onap.policy.rest.RESTManager.Pair; +import org.onap.policy.sdnc.util.Serialization; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public final class SdncManager implements Runnable { + private static final String SYSTEM_LS = System.lineSeparator(); + + private String sdncUrlBase; + private String username; + private String password; + private SdncRequest sdncRequest; + private WorkingMemory workingMem; + private static final Logger logger = LoggerFactory.getLogger(SdncManager.class); + private static final Logger netLogger = + LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER); + + // The REST manager used for processing REST calls for this Sdnc manager + private RESTManager restManager; + + /** + * Constructor. + * + * @param wm Drools working memory + * @param request request + */ + public SdncManager(WorkingMemory wm, SdncRequest request) { + if (wm == null || request == null) { + throw new IllegalArgumentException( + "the parameters \"wm\" and \"request\" on the SdncManager constructor may not be null" + ); + } + workingMem = wm; + sdncRequest = request; + + restManager = new RESTManager(); + + setSdncParams(getPeManagerEnvProperty("sdnc.url"), getPeManagerEnvProperty("sdnc.username"), + getPeManagerEnvProperty("sdnc.password")); + } + + /** + * Set the parameters. + * + * @param baseUrl base URL + * @param name username + * @param pwd password + */ + public void setSdncParams(String baseUrl, String name, String pwd) { + sdncUrlBase = baseUrl; + username = name; + password = pwd; + } + + @Override + public void run() { + Map headers = new HashMap<>(); + Pair httpDetails; + + SdncResponse responseError = new SdncResponse(); + SdncResponseOutput responseOutput = new SdncResponseOutput(); + responseOutput.setResponseCode("404"); + responseError.setResponseOutput(responseOutput); + + headers.put("Accept", "application/json"); + String sdncUrl = sdncUrlBase + "/GENERIC-RESOURCE-API:network-topology-operation"; + + try { + String sdncRequestJson = Serialization.gsonPretty.toJson(sdncRequest); + netLogger.info("[OUT|{}|{}|]{}{}", "Sdnc", sdncUrl, SYSTEM_LS, sdncRequestJson); + logger.info("[OUT|{}|{}|]{}{}", "Sdnc", sdncUrl, SYSTEM_LS, sdncRequestJson); + + httpDetails = restManager.post(sdncUrl, username, password, headers, "application/json", + sdncRequestJson); + } catch (Exception e) { + logger.info(e.getMessage(), e); + workingMem.insert(responseError); + return; + } + + if (httpDetails == null) { + workingMem.insert(responseError); + return; + } + + try { + SdncResponse response = Serialization.gsonPretty.fromJson(httpDetails.second, SdncResponse.class); + netLogger.info("[IN|{}|{}|]{}{}", "Sdnc", sdncUrl, SYSTEM_LS, httpDetails.second); + logger.info("[IN|{}|{}|]{}{}", "Sdnc", sdncUrl, SYSTEM_LS, httpDetails.second); + String body = Serialization.gsonPretty.toJson(response); + logger.info("Response to Sdnc Heal post:"); + logger.info(body); + response.setRequestId(sdncRequest.getRequestId().toString()); + + if (!response.getResponseOutput().getResponseCode().equals("200")) { + logger.info( + "Sdnc Heal Restcall failed with http error code {} {}", httpDetails.first, httpDetails.second + ); + } + + workingMem.insert(response); + } catch (JsonSyntaxException e) { + logger.info("Failed to deserialize into SdncResponse {}", e.getLocalizedMessage(), e); + } catch (Exception e) { + logger.info("Unknown error deserializing into SdncResponse {}", e.getLocalizedMessage(), e); + } + } + + /** + * Protected setter for rest manager to allow mocked rest manager to be used for testing. + * @param restManager the test REST manager + */ + protected void setRestManager(final RESTManager restManager) { + this.restManager = restManager; + } + + /** + * This method reads and validates environmental properties coming from the policy engine. Null properties cause + * an {@link IllegalArgumentException} runtime exception to be thrown + * @param enginePropertyName name of the parameter to retrieve + * @return the property value + */ + + private String getPeManagerEnvProperty(String enginePropertyName) { + String enginePropertyValue = PolicyEngine.manager.getEnvironmentProperty(enginePropertyName); + if (enginePropertyValue == null) { + throw new IllegalArgumentException( + "The value of policy engine manager environment property \"" + + enginePropertyName + "\" may not be null" + ); + } + return enginePropertyValue; + } +} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java new file mode 100644 index 000000000..ad824f6c9 --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. 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.sdnc; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; +import java.util.UUID; + +public class SdncRequest implements Serializable { + + private static final long serialVersionUID = 3736300970326332512L; + // These fields are not serialized and not part of JSON + private transient String nsInstanceId; + private transient UUID requestId; + + @SerializedName("input") + private SdncHealRequest healRequest; + + public SdncRequest() { + // Default constructor for SdncRequest + } + + public String getNsInstanceId() { + return nsInstanceId; + } + + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + + public UUID getRequestId() { + return requestId; + } + + public void setRequestId(UUID requestId) { + this.requestId = requestId; + } + + public SdncHealRequest getHealRequest() { + return healRequest; + } + + public void setHealRequest(SdncHealRequest healRequest) { + this.healRequest = healRequest; + } +} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponse.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponse.java new file mode 100644 index 000000000..c0f244413 --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponse.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. 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.sdnc; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SdncResponse implements Serializable { + + private static final long serialVersionUID = 9151443891238218455L; + + @SerializedName("output") + private SdncResponseOutput responseOutput; + + private transient String requestId; + + public SdncResponse() { + // Default constructor for SdncResponse + } + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public SdncResponseOutput getResponseOutput() { + return responseOutput; + } + + public void setResponseOutput(SdncResponseOutput responseOutput) { + this.responseOutput = responseOutput; + } + +} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseNetworkInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseNetworkInfo.java new file mode 100644 index 000000000..75582ff45 --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseNetworkInfo.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. 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.sdnc; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SdncResponseNetworkInfo implements Serializable { + + private static final long serialVersionUID = 6827782899144150158L; + + @SerializedName("instance-id") + private String instanceId; + + @SerializedName("object-path") + private String objectPath; + + public SdncResponseNetworkInfo() { + // Default constructor for SdncResponseNetworkInfo + } + + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public String getObjectPath() { + return objectPath; + } + + public void setObjectPath(String objectPath) { + this.objectPath = objectPath; + } +} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java new file mode 100644 index 000000000..48acc5e9a --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. 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.sdnc; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; +import java.util.List; + +public class SdncResponseOutput implements Serializable { + + private static final long serialVersionUID = 6827782899144150158L; + + @SerializedName("svc-request-id") + private String svcRequestId; + + @SerializedName("response-code") + private String responseCode; + + @SerializedName("ack-final-indicator") + private String ackFinalIndicator; + + public SdncResponseOutput() { + // Default constructor for SdncResponseDescriptor + } + + public String getSvcRequestId() { + return svcRequestId; + } + + public void setSvcRequestId(String svcRequestId) { + this.svcRequestId = svcRequestId; + } + + public String getResponseCode() { + return responseCode; + } + + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + } + + public String getAckFinalIndicator() { + return ackFinalIndicator; + } + + public void setAckFinalIndicator(String ackFinalIndicator) { + this.ackFinalIndicator = ackFinalIndicator; + } + +} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseServiceInfo.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseServiceInfo.java new file mode 100644 index 000000000..745ba2475 --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseServiceInfo.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. 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.sdnc; + +import com.google.gson.annotations.SerializedName; + +import java.io.Serializable; + +public class SdncResponseServiceInfo implements Serializable { + + private static final long serialVersionUID = 6827782899144150158L; + + @SerializedName("instance-id") + private String instanceId; + + public SdncResponseServiceInfo() { + // Default constructor for SdncResponseServiceInfo + } + + public String getInstanceId() { + return instanceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + +} diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java new file mode 100644 index 000000000..260407af2 --- /dev/null +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei Corp. 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.sdnc.util; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public final class Serialization { + private Serialization() { + } + + public static final Gson gsonPretty = new GsonBuilder().disableHtmlEscaping() + .setPrettyPrinting() + .create(); + +} -- cgit 1.2.3-korg