diff options
author | Hengye <yehui.wang@est.tech> | 2019-03-25 14:32:21 +0000 |
---|---|---|
committer | Hengye <yehui.wang@est.tech> | 2019-03-25 14:32:21 +0000 |
commit | b150aa8197e8a21ab7ad4cf1d91cfa30f56fa3df (patch) | |
tree | 60c296267f496f3b40d838294e8f80b04ceb2607 /models-interactions/model-impl/sdnc/src/main | |
parent | 2a245ef80e39a101015efb164de53f1753fa5d47 (diff) |
migrate model-impl from drools-applications
migrate controlloop/common/model-impl from drools-applicaitons to
policy/models
Issue-ID: POLICY-1264
Change-Id: Ibe0bb5c49a7b1344f4104b30455f52834041e187
Signed-off-by: Hengye <yehui.wang@est.tech>
Diffstat (limited to 'models-interactions/model-impl/sdnc/src/main')
12 files changed, 752 insertions, 0 deletions
diff --git a/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealNetworkInfo.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealNetworkInfo.java new file mode 100644 index 000000000..be26f8775 --- /dev/null +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealNetworkInfo.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java new file mode 100644 index 000000000..88645d517 --- /dev/null +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequest.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestHeaderInfo.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestHeaderInfo.java new file mode 100644 index 000000000..0cdbb294e --- /dev/null +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestHeaderInfo.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestInfo.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestInfo.java new file mode 100644 index 000000000..fa449a013 --- /dev/null +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealRequestInfo.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealServiceInfo.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealServiceInfo.java new file mode 100644 index 000000000..5b03db3ca --- /dev/null +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncHealServiceInfo.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java new file mode 100644 index 000000000..5770a23c5 --- /dev/null +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java @@ -0,0 +1,168 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. All rights reserved. + * ================================================================================ + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved + * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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.common.endpoints.event.comm.Topic.CommInfrastructure; +import org.onap.policy.common.endpoints.utils.NetLoggerUtil; +import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +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 String sdncUrlBase; + private String username; + private String password; + private SdncRequest sdncRequest; + private WorkingMemory workingMem; + private static final Logger logger = LoggerFactory.getLogger(SdncManager.class); + + // 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<String, String> headers = new HashMap<>(); + Pair<Integer, String> 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); + NetLoggerUtil.log(EventType.OUT, CommInfrastructure.REST, sdncUrl, sdncRequestJson); + logger.info("[OUT|{}|{}|]{}{}", CommInfrastructure.REST, sdncUrl, NetLoggerUtil.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); + NetLoggerUtil.log(EventType.IN, CommInfrastructure.REST, sdncUrl, httpDetails.second); + logger.info("[IN|{}|{}|]{}{}", "Sdnc", sdncUrl, NetLoggerUtil.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/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncRequest.java new file mode 100644 index 000000000..4aaa844cd --- /dev/null +++ b/models-interactions/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. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponse.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponse.java new file mode 100644 index 000000000..496bf10a7 --- /dev/null +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponse.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseNetworkInfo.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseNetworkInfo.java new file mode 100644 index 000000000..094b2641b --- /dev/null +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseNetworkInfo.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java new file mode 100644 index 000000000..fc3335a61 --- /dev/null +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseOutput.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseServiceInfo.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseServiceInfo.java new file mode 100644 index 000000000..05b854418 --- /dev/null +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncResponseServiceInfo.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java new file mode 100644 index 000000000..428f357aa --- /dev/null +++ b/models-interactions/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/util/Serialization.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 Huawei. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY 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(); + +} |